Commit Graph

17609 Commits

Author SHA1 Message Date
Bill Wendling 03eefb3a38 Add a couple of accessor methods to get the kind and values of an attribute.
llvm-svn: 173828
2013-01-29 20:45:34 +00:00
Bill Wendling f2955aa3f2 Convert getAttributes() to return an AttributeSetNode.
The AttributeSetNode contains all of the attributes. This removes one (hopefully
last) use of the Attribute class as a container of multiple attributes.

llvm-svn: 173761
2013-01-29 03:20:31 +00:00
Evan Cheng 0e88c7d897 Teach SDISel to combine fsin / fcos into a fsincos node if the following
conditions are met:
1. They share the same operand and are in the same BB.
2. Both outputs are used.
3. The target has a native instruction that maps to ISD::FSINCOS node or
   the target provides a sincos library call.

Implemented the generic optimization in sdisel and enabled it for
Mac OSX. Also added an additional optimization for x86_64 Mac OSX by
using an alternative entry point __sincos_stret which returns the two
results in xmm0 / xmm1.

rdar://13087969
PR13204

llvm-svn: 173755
2013-01-29 02:32:37 +00:00
Bill Wendling 60011b8e27 Use an AttrBuilder to generate the correct AttributeSet.
We no longer accept an encoded integer as representing all of the
attributes. Convert this via the AttrBuilder class into an AttributeSet with the
correct representation (an AttributeSetImpl that holds a list of Attribute
objects).

llvm-svn: 173750
2013-01-29 01:43:29 +00:00
Bill Wendling 7707c5a985 S'more small non-functional changes in comments and #includes.
llvm-svn: 173738
2013-01-29 00:48:16 +00:00
Bill Wendling d509a6653a Reorder some functions and add comments. No functionality change.
llvm-svn: 173733
2013-01-29 00:34:06 +00:00
Bill Wendling eeebb13fb2 Try to appease some broken compilers by using 'unsigned' instead of 'uint64_t'.
llvm-svn: 173725
2013-01-28 22:33:39 +00:00
Bill Wendling ec454546ec Remove the AttributeWithIndex class.
The AttributeWithIndex class exposed the interior structure of the AttributeSet
class. That was gross. Remove it and all of the code that relied upon it.

llvm-svn: 173722
2013-01-28 21:55:20 +00:00
Dan Gohman 00830962c6 Add a comment mentioning that InstructionSimplify routines do,
in fact, resolve undef uses.

llvm-svn: 173721
2013-01-28 21:45:32 +00:00
Bill Wendling 892711b0db Mid-air collision. reapply r173656.
llvm-svn: 173661
2013-01-28 05:51:40 +00:00
Bill Wendling 8e31efdbbf Rewrite the removeAttr() method.
This now uses the AttributeSet object instead of the Attribute /
AttributeWithIndex objects. It's fairly simple now. It goes through all of the
subsets before the one we're modifying, adds them to the new set. It then adds
the modified subset (with the requested attributes removed). And then adds the
rest of the subsets.

llvm-svn: 173660
2013-01-28 05:44:14 +00:00
Bill Wendling 1aa9d9e260 Rewrite the addAttr() method.
This now uses the AttributeSet object instead of the Attribute /
AttributeWithIndex objects. It's fairly simple now. It goes through all of the
subsets before the one we're modifying, adds them to the new set. It then adds
the modified subset. And then adds the rest of the subsets.

llvm-svn: 173659
2013-01-28 05:23:28 +00:00
NAKAMURA Takumi 55ec92004f Revert r173646, "Use proper type for the index."
Unfortunately, msvc miscompiles it. Investigating.

llvm-svn: 173656
2013-01-28 04:29:01 +00:00
Michael Gottesman 79d8d81226 Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation for refactoring the ARC Optimizer.
llvm-svn: 173647
2013-01-28 01:35:51 +00:00
Bill Wendling 63ab99829a Use proper type for the index.
llvm-svn: 173646
2013-01-28 01:30:29 +00:00
Bill Wendling 3217eb652b Use proper return type for attribute index.
llvm-svn: 173639
2013-01-27 23:50:44 +00:00
Bill Wendling 1f786a7371 Push the calculation of the 'Raw' attribute mask down into the implementation. It in turn uses the correct list for calculating the 'Raw' value.
llvm-svn: 173637
2013-01-27 23:41:29 +00:00
Bill Wendling 71ead26439 Don't erase these methods. They're used during testing.
llvm-svn: 173636
2013-01-27 22:46:17 +00:00
Bill Wendling 4bbe9db48f Add special 'get' methods to create an Attribute with an alignment. Also do some random cleanup. No functionality change.
llvm-svn: 173635
2013-01-27 22:43:04 +00:00
Bill Wendling 56b0b2a8e4 s/AttrList/pImpl/g in AttributeSet. No functionality change.
llvm-svn: 173628
2013-01-27 21:23:46 +00:00
Bill Wendling f5c1f555cb Fix miscompile. Add back the use of the ArrayRef version of the ::get method.
llvm-svn: 173613
2013-01-27 10:28:39 +00:00
Bill Wendling a05f97c6e5 Rearrange some deckchairs. Moving the class before it's use.
llvm-svn: 173612
2013-01-27 10:00:13 +00:00
Bill Wendling 993604c747 Remove dead methods.
llvm-svn: 173611
2013-01-27 09:55:44 +00:00
Bill Wendling 53e191b2bc Hide the method that creates an AttributeSet with AttributeWithIndexes.
This method will go away once AttributeWithIndex goes away. In the meantime,
hide it from general use.

llvm-svn: 173607
2013-01-27 03:35:32 +00:00
David Blaikie 9f4b70dde0 PR14566: Debug Info: Removing top level lexical blocks
This adds support for LLVM to accept metadata that doesn't include a top level
lexical block in a function. Specifically LLVM couldn't handle this when there
were file changes relating to these blocks. I've updated a few test cases to
ensure other functionality (such as inlining) isn't affected by this change, but
haven't pervasively updated all the test cases.

llvm-svn: 173592
2013-01-26 21:55:23 +00:00
David Blaikie 18a7776b93 IRBuilder: Remove redundant check around SetInstDebugLocation call.
llvm-svn: 173591
2013-01-26 21:55:19 +00:00
NAKAMURA Takumi a44b1c2486 Object/RelocVisitor: Add minimal support, R_MIPS_32, for mips.
It fixes llvm-dwarfdump for mips and mipsel.

llvm-svn: 173567
2013-01-26 08:27:36 +00:00
NAKAMURA Takumi 3ba23555de Object/RelocVisitor: Add minimal support, R_PPC64_ADDR32, for ppc64.
It fixes llvm-dwarfdump for ppc64-elf.

llvm-svn: 173566
2013-01-26 08:27:29 +00:00
NAKAMURA Takumi a5b09ff6b9 RelocVisitor::visit(): Set hasError in the default path.
llvm-svn: 173565
2013-01-26 08:27:23 +00:00
Andrew Kaylor 9a8ff813f3 Add DIContext::getLineInfoForAddressRange() function and test. This function allows a caller to obtain a table of line information for a function using the function's address and size.
llvm-svn: 173537
2013-01-26 00:28:05 +00:00
Bill Wendling 201d7b2545 Convert BuildLibCalls.cpp to using the AttributeSet methods instead of AttributeWithIndex.
llvm-svn: 173536
2013-01-26 00:03:11 +00:00
Bill Wendling 0170cc7523 Remove dead method.
llvm-svn: 173524
2013-01-25 23:14:36 +00:00
Bill Wendling 57625a4966 Remove some introspection functions.
The 'getSlot' function and its ilk allow introspection into the AttributeSet
class. However, that class should be opaque. Allow access through accessor
methods instead.

llvm-svn: 173522
2013-01-25 23:09:36 +00:00
Andrew Kaylor d55d7019fc Add support for applying in-memory relocations to the .debug_line section and, in the case of ELF files, using symbol addresses when available for relocations to the .debug_info section. Also extending the llvm-rtdyld tool to add the ability to dump line number information for testing purposes.
llvm-svn: 173517
2013-01-25 22:50:58 +00:00
Reid Kleckner 1bda56ce55 Add parens to suppress an MSVC 2012 << precedence warning
It doesn't seem to like instantiating the isUInt<unsigned N> template
with 6+3, and then doing <<N.

llvm-svn: 173507
2013-01-25 22:12:45 +00:00
Nick Lewycky 476a6dab9f Add an insert() method to MapVector. Adds the first MapVector unit test.
llvm-svn: 173505
2013-01-25 22:11:02 +00:00
Bill Wendling 25e65a61cc Add an accessor method to get the slot's index. This will limit the use of AttributeWithIndex.
llvm-svn: 173495
2013-01-25 21:30:53 +00:00
David Blaikie 3ea696d73f This is no trule.
llvm-svn: 173487
2013-01-25 20:47:58 +00:00
Eli Bendersky 7a94daa170 Add command-line flags for DWARF dumping.
Flags for dumping specific DWARF sections added in lib/DebugInfo and
llvm-dwarfdump.

llvm-svn: 173480
2013-01-25 20:26:43 +00:00
Hal Finkel c7d4dc13a4 Add an addition operator to TableGen
This adds an !add(a, b) operator to tablegen; this will be used
to cleanup the PPC register definitions.

llvm-svn: 173445
2013-01-25 14:49:08 +00:00
Andrew Trick ea9fd951a0 MachineScheduler support for viewGraph.
llvm-svn: 173432
2013-01-25 07:45:29 +00:00
Andrew Trick b36388a1cb ScheduleDAG: colorize the DOT graph and improve formatting.
llvm-svn: 173431
2013-01-25 07:45:25 +00:00
Andrew Trick 646eeb6675 ScheduleDAG: Added isBoundaryNode to conveniently detect a common corner case.
This fixes DAG subtree analysis at the boundary.

llvm-svn: 173427
2013-01-25 06:52:30 +00:00
Andrew Trick ffc8097c60 SchedDFS: Complete support for nested subtrees.
Maintain separate per-node and per-tree book-keeping.
Track all instructions above a DAG node including nested subtrees.
Seperately track instructions within a subtree.
Record subtree parents.

llvm-svn: 173426
2013-01-25 06:52:27 +00:00
Andrew Trick e2c3f5c982 MIsched: Improve the interface to SchedDFS analysis (subtrees).
Allow the strategy to select SchedDFS. Allow the results of SchedDFS
to affect initialization of the scheduler state.

llvm-svn: 173425
2013-01-25 06:33:57 +00:00
Andrew Trick f443f11589 ArrayRef reverse iterators.
llvm-svn: 173424
2013-01-25 06:33:52 +00:00
Andrew Trick 030119bc3e whitespace
llvm-svn: 173423
2013-01-25 06:33:50 +00:00
Andrew Trick 5b07eeb24a SchedDFS: Initial support for nested subtrees.
This is mostly refactoring, along with adding an instruction count
within the subtrees and ensuring we only look at data edges.

llvm-svn: 173420
2013-01-25 06:02:44 +00:00
Andrew Trick 44f750a3e5 MISched: Add SchedDFSResult to ScheduleDAGMI to formalize the
interface and allow other strategies to select it.

llvm-svn: 173413
2013-01-25 04:01:04 +00:00
Andrew Trick dca637ab36 SchedDFS: Constify interface.
llvm-svn: 173398
2013-01-25 00:12:55 +00:00
Renato Golin d4c392e6ff Moving Cost Tables up to share with other targets
llvm-svn: 173382
2013-01-24 23:01:00 +00:00
Richard Trieu 3ac907def8 Add asserts to SmallVector so that calls to front() and back() only succeed
if the vector is not empty.  This will ensure that calls to these functions
will reference elements in the vector.

llvm-svn: 173321
2013-01-24 04:29:24 +00:00
Andrew Trick d3b8629a53 MIsched: Added biasCriticalPath.
Allow schedulers to order DAG edges by critical path. This makes
DFS-based heuristics more stable and effective.

llvm-svn: 173317
2013-01-24 02:09:55 +00:00
Michael J. Spencer 0f515f898e [ELF] Add R_X86_64_IRELATIVE.
llvm-svn: 173316
2013-01-24 02:08:25 +00:00
Bill Wendling 39a4c80570 Add a profile for uniquifying the AttributeSet with the AttributeSetNodes.
llvm-svn: 173313
2013-01-24 01:01:34 +00:00
Bill Wendling d2e493bb65 Create a new class: AttributeSetNode.
This is a helper class for the AttributeSetImpl class. It holds a set of
attributes that apply to a single element: function, return type, or
parameter.

These are uniqued.

llvm-svn: 173310
2013-01-24 00:06:56 +00:00
Bill Wendling 9de4b973f1 Remove dead methods.
llvm-svn: 173302
2013-01-23 22:38:33 +00:00
Chad Rosier 49544b36f7 Initialize SSPBufferSize. PR14999. Patch by Vinson Lee.
llvm-svn: 173285
2013-01-23 19:32:37 +00:00
Bill Wendling e8fa95f628 Remove unused methods and ivars.
llvm-svn: 173284
2013-01-23 19:06:01 +00:00
Eli Bendersky 32aab2216d Clean up assignment of CalleeSaveStackSlotSize: get rid of the default and explicitly set this in every target that needs to change it from the default.
llvm-svn: 173270
2013-01-23 16:22:04 +00:00
Bill Wendling d154e283f2 Add the IR attribute 'sspstrong'.
SSPStrong applies a heuristic to insert stack protectors in these situations:

* A Protector is required for functions which contain an array, regardless of
  type or length.

* A Protector is required for functions which contain a structure/union which
  contains an array, regardless of type or length.  Note, there is no limit to
  the depth of nesting.

* A protector is required when the address of a local variable (i.e., stack
  based variable) is exposed. (E.g., such as through a local whose address is
  taken as part of the RHS of an assignment or a local whose address is taken as
  part of a function argument.)

This patch implements the SSPString attribute to be equivalent to
SSPRequired. This will change in a subsequent patch.

llvm-svn: 173230
2013-01-23 06:41:41 +00:00
Bill Wendling 49bc76cbb3 Remove the last of uses that use the Attribute object as a collection of attributes.
Collections of attributes are handled via the AttributeSet class now. This
finally frees us up to make significant changes to how attributes are structured.

llvm-svn: 173228
2013-01-23 06:14:59 +00:00
Bill Wendling 430fa9bfb3 Use the AttributeSet when removing multiple attributes. Use Attribute::AttrKind
when removing one attribute. This further encapsulates the use of the attributes.

llvm-svn: 173214
2013-01-23 00:45:55 +00:00
Michael J. Spencer 706eedb1b9 [Support][ErrorOr] Don't use nullptr :(
llvm-svn: 173212
2013-01-23 00:22:30 +00:00
Bill Wendling c0e2a1f457 Use the AttributeSet when adding multiple attributes and an Attribute::AttrKind
when adding a single attribute to the function.

llvm-svn: 173210
2013-01-23 00:20:53 +00:00
Michael J. Spencer f71baa84ea [Support][ErrorOr] Add optimized specialization of ErrorOr<void>.
ErrorOr<void> represents an operation that returns nothing, but can still fail.
It should be used in cases where you need the aditional user data that ErrorOr
provides over error_code.

llvm-svn: 173209
2013-01-23 00:18:31 +00:00
Michael J. Spencer 9566c1663c [Support][ErrorOr] Make old gcc happy.
Apparently this is how C++98 worked pre-DR. (Thanks Richard).

llvm-svn: 173203
2013-01-22 22:48:46 +00:00
Bill Wendling 09175b39f2 More encapsulation work.
Use the AttributeSet when we're talking about more than one attribute. Add a
function that adds a single attribute. No functionality change intended.

llvm-svn: 173196
2013-01-22 21:15:51 +00:00
Eli Bendersky 0893e1079d Initial patch for x32 ABI support.
Add the x32 environment kind to the triple, and separate the concept of
pointer size and callee save stack slot size, since they're not equal
on x32.

llvm-svn: 173175
2013-01-22 18:02:49 +00:00
Tim Northover 984b472161 Fix truncation of relocation types in Support/ELF.h
This is a follow-up to r171845, which fixes the same issue in the Support code.
Only targets with >256 relocations (principally AArch64) should be affected.

llvm-svn: 173151
2013-01-22 12:01:43 +00:00
Chandler Carruth 0ba8db45c6 Begin fleshing out an interface in TTI for modelling the costs of
generic function calls and intrinsics. This is somewhat overlapping with
an existing intrinsic cost method, but that one seems targetted at
vector intrinsics. I'll merge them or separate their names and use cases
in a separate commit.

This sinks the test of 'callIsSmall' down into TTI where targets can
control it. The whole thing feels very hack-ish to me though. I've left
a FIXME comment about the fundamental design problem this presents. It
isn't yet clear to me what the users of this function *really* care
about. I'll have to do more analysis to figure that out. Putting this
here at least provides it access to proper analysis pass tools and other
such. It also allows us to more cleanly implement the baseline cost
interfaces in TTI.

With this commit, it is now theoretically possible to simplify much of
the inline cost analysis's handling of calls by calling through to this
interface. That conversion will have to happen in subsequent commits as
it requires more extensive restructuring of the inline cost analysis.

The CodeMetrics class is now really only in the business of running over
a block of code and aggregating the metrics on that block of code, with
the actual cost evaluation done entirely in terms of TTI.

llvm-svn: 173148
2013-01-22 11:26:02 +00:00
Tim Northover 29178a348a Make APFloat constructor require explicit semantics.
Previously we tried to infer it from the bit width size, with an added
IsIEEE argument for the PPC/IEEE 128-bit case, which had a default
value. This default value allowed bugs to creep in, where it was
inappropriate.

llvm-svn: 173138
2013-01-22 09:46:31 +00:00
NAKAMURA Takumi be39b10ee1 SparseMultiSet.h: Add suggested parentheses.
llvm-svn: 173128
2013-01-22 05:41:57 +00:00
Bill Wendling eb9c0ec26e Add a new method that adds the AttributeSet at the given index. No functional change.
llvm-svn: 173109
2013-01-22 00:53:12 +00:00
Bill Wendling b679233a24 Remove unused method.
llvm-svn: 173106
2013-01-21 23:41:50 +00:00
Bill Wendling c90d9f89b7 Have AttributeSet::getRetAttributes() return an AttributeSet instead of Attribute.
This further restricts the use of the Attribute class to the Attribute family of
classes.

llvm-svn: 173098
2013-01-21 22:44:49 +00:00
Bill Wendling bd4ea16bf3 Make AttributeSet::getFnAttributes() return an AttributeSet instead of an Attribute.
This is more code to isolate the use of the Attribute class to that of just
holding one attribute instead of a collection of attributes.

llvm-svn: 173094
2013-01-21 21:57:28 +00:00
Chris Lattner 085c5450d9 r173072 is causing some regressions on big endian hosts, I don't have time to debug it
so revert it for now.

llvm-svn: 173074
2013-01-21 19:08:15 +00:00
Chris Lattner bba95c08e4 rework the Bitstream reader to actually work a machine word at a time, instead of 32-bits at a time.
This cuts in half the number of virtual methods called to refill that word when compiling on a 64-bit
host, and will make 64-bit read operations faster.

llvm-svn: 173072
2013-01-21 18:48:26 +00:00
Chris Lattner 1aeca1e806 Fix a heinous inefficiency introduced in r149918, wherein reading each byte of a
BLOB (i.e., large, performance intensive data) in a bitcode file was switched to
invoking one virtual method call per byte read.  Now we do one virtual call per
BLOB.

llvm-svn: 173065
2013-01-21 18:24:49 +00:00
Michael Ilseman 3e3194f4ec Introduce a new data structure, the SparseMultiSet, and changes to the MI scheduler to use it.
A SparseMultiSet adds multiset behavior to SparseSet, while retaining SparseSet's desirable properties. Essentially, SparseMultiSet provides multiset behavior by storing its dense data in doubly linked lists that are inlined into the dense vector. This allows it to provide good data locality as well as vector-like constant-time clear() and fast constant time find(), insert(), and erase(). It also allows SparseMultiSet to have a builtin recycler rather than keeping SparseSet's behavior of always swapping upon removal, which allows it to preserve more iterators. It's often a better alternative to a SparseSet of a growable container or vector-of-vector.

llvm-svn: 173064
2013-01-21 18:18:53 +00:00
Chris Lattner e1817aae5f rename "SkipToWord" to "SkipToFourByteBoundary" since a word is not always 4 bytes.
llvm-svn: 173062
2013-01-21 18:04:19 +00:00
Chandler Carruth bb9caa9241 Switch CodeMetrics itself over to use TTI to determine if an instruction
is free. The whole CodeMetrics API should probably be reworked more, but
this is enough to allow deleting the duplicate code there for computing
whether an instruction is free.

All of the passes using this have been updated to pull in TTI and hand
it to the CodeMetrics stuff. Further, a dead CodeMetrics API
(analyzeFunction) is nuked for lack of users.

llvm-svn: 173036
2013-01-21 13:04:33 +00:00
Chandler Carruth d11e9a8300 Fix indentation and formatting.
This change brought to by clang-format. =]

llvm-svn: 173034
2013-01-21 12:14:42 +00:00
Chandler Carruth 42f3dceb63 Now that the inline cost analysis is a pass, we can easily have it
depend on and use other analyses (as long as they're either immutable
passes or CGSCC passes of course -- nothing in the pass manager has been
fixed here). Leverage this to thread TargetTransformInfo down through
the inline cost analysis.

No functionality changed here, this just threads things through.

llvm-svn: 173031
2013-01-21 11:55:09 +00:00
Chandler Carruth 4319e2948d Make the inline cost a proper analysis pass. This remains essentially
a dynamic analysis done on each call to the routine. However, now it can
use the standard pass infrastructure to reference other analyses,
instead of a silly setter method. This will become more interesting as
I teach it about more analysis passes.

This updates the two inliner passes to use the inline cost analysis.
Doing so highlights how utterly redundant these two passes are. Either
we should find a cheaper way to do always inlining, or we should merge
the two and just fiddle with the thresholds to get the desired behavior.
I'm leaning increasingly toward the latter as it would also remove the
Inliner sub-class split.

llvm-svn: 173030
2013-01-21 11:39:18 +00:00
Chandler Carruth 664e570b59 Fix an old-style doxygen comment.
llvm-svn: 173027
2013-01-21 11:39:12 +00:00
Chandler Carruth c4352ec26a Cleanup the formatting of this header. This removes the namespace indent
and reformats a few constructors using clang-format. Only whitespace
changes here.

llvm-svn: 173018
2013-01-21 10:08:42 +00:00
Michael J. Spencer a4f9924c79 Revert "[Object] .bss sections have no content. PR15005."
This reverts commit r173007.

llvm-svn: 173012
2013-01-21 08:13:04 +00:00
Michael J. Spencer c47de41e02 [Object] .bss sections have no content. PR15005.
llvm-svn: 173007
2013-01-21 06:46:11 +00:00
Chandler Carruth 8717111bb1 Remove the comma from the last enumerator to fix -pedantic warnings.
llvm-svn: 172999
2013-01-21 02:17:36 +00:00
Chandler Carruth 511aa76048 Introduce a generic interface for querying an operation's expected
lowered cost.

Currently, this is a direct port of the logic implementing
isInstructionFree in CodeMetrics. The hope is that the interface can be
improved (f.ex. supporting un-formed instruction queries) and the
implementation abstracted so that as we have test cases and target
knowledge we can expose increasingly accurate heuristics to clients.

I'll start switching existing consumers over and kill off the routine in
CodeMetrics in subsequent commits.

llvm-svn: 172998
2013-01-21 01:27:39 +00:00
NAKAMURA Takumi 3c7982dfd9 Support/Compiler.h: MSC1600, aka VS2010, is not C++11-ready.
LLVM_HAS_CXX11_TYPETRAITS -- std::is_constructible
LLVM_HAS_CXX11_STDLIB -- std::unique_ptr

llvm-svn: 172997
2013-01-21 00:30:31 +00:00
Renato Golin e1fb059327 Revert CostTable algorithm, will re-write
llvm-svn: 172992
2013-01-20 20:57:20 +00:00
Michael J. Spencer 779c4247f7 [Support] Port ErrorOr<T> from lld to C++03.
llvm-svn: 172991
2013-01-20 20:32:30 +00:00
Michael Gottesman 87a736ca9f Changed IRBuilder::CreateZExtOrTrunc and IRBuilder::CreateSExtOrTrunc so they also work with vectors.
I also changed the name of a variable in IRBuilder::CreateFPExtOrFPTrunc to
match the names used in its two matching brethern as well.

llvm-svn: 172967
2013-01-20 07:33:26 +00:00
Michael Gottesman e41be48a59 More copy editing.
llvm-svn: 172962
2013-01-20 05:12:35 +00:00
Michael Gottesman 47c7bf0d26 Doxygenified and copy edited BasicBlock.h.
llvm-svn: 172961
2013-01-20 05:03:42 +00:00
Michael Gottesman 2013293d0a Doxygenified Argument.h and performed some copy editing of the documentation.
llvm-svn: 172960
2013-01-20 05:03:39 +00:00
Michael Gottesman 3478f51cb8 Converted all method comments in IRBuilder.h to use doxygen style comments.
This implies changing method documentation from the following style:

/// MethodName - Method description...

to

/// \brief Method description...

ala the LLVM Style Guide.

llvm-svn: 172959
2013-01-20 05:03:37 +00:00
Michael Gottesman ed514068cc Corrected assert messages for CreateZExtOrTrunc/CreateSExtOrTrunc.
llvm-svn: 172958
2013-01-20 04:19:39 +00:00
Michael Gottesman 1d200f6d40 Added IRBuilder::CreateFPExtOrFPTrunc.
This method serves an analogous purpose to CreateZExtOrTrunc/CreateSExtOrTrunc
but for floating point types.

In detail, it provides a manner when one is handling conversions of floating
point types of automatically selecting fpext, fptrunc, or identity depending on
the relative bitsize of the source and destination types.

llvm-svn: 172957
2013-01-20 03:56:31 +00:00
Chris Lattner 8d14053545 trivial micro-optimization: lazily call the virtual method instead of eagerly calling it.
llvm-svn: 172953
2013-01-20 02:54:05 +00:00
Chris Lattner 0271af8dc9 switch llvm-bcanalyzer onto the new cursor APIs, allowing deletion of
the old ReadRecord methods.

llvm-svn: 172952
2013-01-20 02:50:32 +00:00
Chris Lattner 9772de0315 add an option to not auto-process abbreviations in advance()
llvm-svn: 172946
2013-01-20 02:12:39 +00:00
Chris Lattner 3cf49cf265 stringref'ize readRecord and properly capitalize it. Add a compatibility method to easy
the transition.

llvm-svn: 172940
2013-01-20 01:06:48 +00:00
Chris Lattner 5ba7bcac6b move some private methods out of line, add a skipRecord() method.
llvm-svn: 172931
2013-01-20 00:00:00 +00:00
Chris Lattner 7fac504bf3 add some optional flags to affect the way advance works.
llvm-svn: 172928
2013-01-19 23:31:15 +00:00
Chris Lattner ab7701749c Add a new BitstreamEntry concept, and add two helper methods for walking
through a BitstreamCursor that produce it: advance() and 
advanceSkippingSubblocks(), representing the two most common ways clients
want to walk through bitcode.

llvm-svn: 172919
2013-01-19 21:35:24 +00:00
Jakub Staszak 645985288f Include Support/ELF.h instead of Object/ELF.h. It is much lighter and completely
sufficient.

llvm-svn: 172916
2013-01-19 19:56:11 +00:00
Chris Lattner 59c3abc6ef BitstreamReader hasn't aged well. It's been hacked on by various people and
has past the point of making sense.  Lets tidy things up: first step, moving
a ton of big functions out of line.

llvm-svn: 172904
2013-01-19 18:19:39 +00:00
Chandler Carruth 1fe21fc0b5 Sort all of the includes. Several files got checked in with mis-sorted
includes.

llvm-svn: 172891
2013-01-19 08:03:47 +00:00
Andrew Kaylor 162b22c155 Fixing behavior of ELFObjectFile::getSymbolFileOffset().
llvm-svn: 172872
2013-01-18 23:40:42 +00:00
Bill Wendling 658d24d211 Use AttributeSet accessor methods instead of Attribute accessor methods.
Further encapsulation of the Attribute object. Don't allow direct access to the
Attribute object as an aggregate.

llvm-svn: 172853
2013-01-18 21:53:16 +00:00
Bill Wendling 4f972ea2d8 Remove unused parameter. Also use the AttributeSet query methods instead of the Attribute query methods.
llvm-svn: 172852
2013-01-18 21:50:24 +00:00
Jordan Rose e1f76583dd Add llvm::hexDigitValue to convert single characters to hex.
This is duplicated in a couple places in the codebase. Adopt this in APFloat.

llvm-svn: 172851
2013-01-18 21:45:30 +00:00
Jack Carter c1b17ed2e1 This is a resubmittal. For some reason it broke the bots yesterday
but I cannot reproduce the problem and have scrubed my sources and
even tested with llvm-lit -v --vg.
Support for Mips register information sections.

Mips ELF object files have a section that is dedicated
to register use info. Some of this information such as
the assumed Global Pointer value is used by the linker
in relocation resolution.

The register info file is .reginfo in o32 and .MIPS.options
in 64 and n32 abi files.

This patch contains the changes needed to create the sections,
but leaves the actual register accounting for a future patch.


Contributer: Jack Carter
 
llvm-svn: 172847
2013-01-18 21:20:38 +00:00
Bill Wendling 7754389526 Push some more methods down to hide the use of the Attribute class.
Because the Attribute class is going to stop representing a collection of
attributes, limit the use of it as an aggregate in favor of using AttributeSet.
This replaces some of the uses for querying the function attributes.

llvm-svn: 172844
2013-01-18 21:11:39 +00:00
Daniel Dunbar 4f8e3f5b6a [Linker] Zap a dead typedef.
llvm-svn: 172841
2013-01-18 20:08:09 +00:00
Daniel Dunbar a32a546dcb [Linker] Kill Linker::LoadObject which is dead, and drop the BitReader dependency again.
llvm-svn: 172838
2013-01-18 19:37:11 +00:00
Will Dietz b9eb34e100 Move Blacklist.h to include/ to enable use from clang.
llvm-svn: 172806
2013-01-18 11:29:21 +00:00
Daniel Dunbar eec0f32eea [MC/Mach-O] Add support for linker options in Mach-O files.
llvm-svn: 172779
2013-01-18 01:26:07 +00:00
Daniel Dunbar 16004b8324 [MC/Mach-O] Add AsmParser support for .linker_option directive.
llvm-svn: 172778
2013-01-18 01:25:48 +00:00
Daniel Dunbar 4038fa3c82 [MC] Expose ParseEscapedString to target AsmParser implementations.
llvm-svn: 172777
2013-01-18 01:25:33 +00:00
Bill Wendling da29e00578 Reverting r171325 & r172363. This was causing a mis-compile on the self-hosted LTO build bots.
Okay, here's how to reproduce the problem:

1) Build a Release (or Release+Asserts) version of clang in the normal way.

2) Using the clang & clang++ binaries from (1), build a Release (or
   Release+Asserts) version of the same sources, but this time enable LTO ---
   specify the `-flto' flag on the command line.

3) Run the ARC migrator tests:

    $ arcmt-test --args -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ ./src/tools/clang/test/ARCMT/cxx-rewrite.mm

You'll see that the output isn't correct (the whitespace is off).

The mis-compile is in the function `RewriteBuffer::RemoveText' in the
clang/lib/Rewrite/Core/Rewriter.cpp file. When that function and RewriteRope.cpp
are compiled with LTO and the `arcmt-test' executable is regenerated, you'll see
the error. When those files are not LTO'ed, then the output of the `arcmt-test'
is fine.

It is *really* hard to get a testcase out of this. I'll file a PR with what I
have currently.

--- Reverse-merging r172363 into '.':
U    include/llvm/Analysis/MemoryBuiltins.h
U    lib/Analysis/MemoryBuiltins.cpp

--- Reverse-merging r171325 into '.':
U    test/Transforms/InstCombine/objsize.ll
G    include/llvm/Analysis/MemoryBuiltins.h
G    lib/Analysis/MemoryBuiltins.cpp

llvm-svn: 172756
2013-01-17 21:28:46 +00:00
Aaron Ballman bea6c8d36a Reverting back to the fallback instead of using the 64-bit popcnt instruction as it doesn't exist on all x64 CPU architectures.
llvm-svn: 172751
2013-01-17 20:04:28 +00:00
Daniel Dunbar 8a81c24312 [Linker] Drop support for IR-level extended linking support (archives, etc.).
- This code is dead, and the "right" way to get this support is to use the
   platform-specific linker-integrated LTO mechanisms, or the forthcoming LLVM
   linker.

llvm-svn: 172749
2013-01-17 19:52:25 +00:00
Chad Rosier d0ed73acb4 [ms-inline asm] Add support for the 'SIZE' and 'LENGTH' operators.
Part of rdar://12576868

llvm-svn: 172743
2013-01-17 19:21:48 +00:00
Aaron Ballman 892a8ebf32 Reverting back to the fallback instead of using popcnt; this instruction doesn't exist on all CPU architectures. Fixes PR14982
llvm-svn: 172734
2013-01-17 18:27:30 +00:00
Alexey Samsonov 347bcd3c5c ASan: add optional 'zero-based shadow' option to ASan passes. Always tell the values of shadow scale and offset to the runtime
llvm-svn: 172709
2013-01-17 11:12:32 +00:00
Jakob Stoklund Olesen 965665bb48 Move MachineTraceMetrics.h into include/llvm/CodeGen.
Let targets use it.

llvm-svn: 172688
2013-01-17 01:06:04 +00:00
Jakob Stoklund Olesen 213a2f8b3f Provide a place for targets to insert ILP optimization passes.
Move the early if-conversion pass into this group.

ILP optimizations usually need to find the right balance between
register pressure and ILP using the MachineTraceMetrics analysis to
identify critical paths and estimate other costs. Such passes should run
together so they can share dominator tree and loop info analyses.

Besides if-conversion, future passes to run here here could include
expression height reduction and ARM's MLxExpansion pass.

llvm-svn: 172687
2013-01-17 00:58:38 +00:00
Aaron Ballman 10027160cc Wrapping __popcnt64 for MSVC so that it's only used on 64-bit builds.
llvm-svn: 172670
2013-01-16 23:17:21 +00:00
Daniel Dunbar d77d9fb04d [IR] Add 'Append' and 'AppendUnique' module flag behaviors.
llvm-svn: 172659
2013-01-16 21:38:56 +00:00
Renato Golin f104c4c4ca Change CostTable model to be global to all targets
Moving the X86CostTable to a common place, so that other back-ends
can share the code. Also simplifying it a bit and commoning up
tables with one and two types on operations.

llvm-svn: 172658
2013-01-16 21:29:55 +00:00
Michael J. Spencer a6285243b2 [Support] Include the intrisics header and check for definition properly.
llvm-svn: 172655
2013-01-16 20:50:43 +00:00
Michael J. Spencer 90a1773397 [Support] Add MSVC intrinsic for CountPopulation.
Patch by Jakub Staszak.

llvm-svn: 172645
2013-01-16 19:52:12 +00:00
Michael J. Spencer ad228f4a72 [Support] Update MSVC compiler support in Compiler.h.
llvm-svn: 172644
2013-01-16 19:51:59 +00:00
Eli Bendersky 0fab22544f Clean up some unnecessary headers and forward declarations
llvm-svn: 172638
2013-01-16 19:00:21 +00:00
Eli Bendersky a313ae6cf9 Now that GenericAsmParser was folded into AsmParser, some methods and types can
return into the safe harbor of AsmParser's private areas.

llvm-svn: 172637
2013-01-16 18:56:50 +00:00
Kevin Enderby e82ada6983 We want the dwarf AT_producer for assembly source files to match clang's
AT_producer.  Which includes clang's version information so we can tell
which version of the compiler was used.

This is the first of two steps to allow us to do that.  This is the llvm-mc
change to provide a method to set the AT_producer string.  The second step,
coming soon to a clang near you, will have the clang driver pass the value
of getClangFullVersion() via an flag when invoking the integrated assembler
on assembly source files.

rdar://12955296

llvm-svn: 172630
2013-01-16 17:46:23 +00:00
Peter Collingbourne a51c6ed608 Introduce llvm::sys::getProcessTriple() function.
In r143502, we renamed getHostTriple() to getDefaultTargetTriple()
as part of work to allow the user to supply a different default
target triple at configure time.  This change also affected the JIT.
However, it is inappropriate to use the default target triple in the
JIT in most circumstances because this will not necessarily match
the current architecture used by the process, leading to illegal
instruction and other such errors at run time.

Introduce the getProcessTriple() function for use in the JIT and
its clients, and cause the JIT to use it.  On architectures with a
single bitness, the host and process triples are identical.  On other
architectures, the host triple represents the architecture of the
host CPU, while the process triple represents the architecture used
by the host CPU to interpret machine code within the current process.
For example, when executing 32-bit code on a 64-bit Linux machine,
the host triple may be 'x86_64-unknown-linux-gnu', while the process
triple may be 'i386-unknown-linux-gnu'.

This fixes JIT for the 32-on-64-bit (and vice versa) build on non-Apple
platforms.

Differential Revision: http://llvm-reviews.chandlerc.com/D254

llvm-svn: 172627
2013-01-16 17:27:22 +00:00
Eli Bendersky 395a7e5d35 Replace virtual hasFixups with explicit fragment type checks
llvm-svn: 172622
2013-01-16 16:52:08 +00:00
Benjamin Kramer 995873ccda Remove unused leftover header (it moved to llvm/IR).
llvm-svn: 172612
2013-01-16 13:43:56 +00:00
Eric Christopher 4d23a4ae1f Define metadata interfaces for describing a static data member
of a class. Emit static data member declarations and definitions
through correctly.

Part of PR14471.

Patch by Paul Robinson!

llvm-svn: 172590
2013-01-16 01:22:23 +00:00
Eli Bendersky 29b9f47796 Use the ExtensionDirectiveHandler type in other places where it makes sense.
Since we already have this type it's a shame to keep dragging a pair of object
and method around explicitly.

llvm-svn: 172584
2013-01-16 00:50:52 +00:00
Dmitri Gribenko a1f0557200 Improve r172577 by using the correct type when declaring constants
llvm-svn: 172580
2013-01-16 00:14:15 +00:00
Eric Christopher 962c9089d9 Split address information for DWARF5 split dwarf proposal. This involves
using the DW_FORM_GNU_addr_index and a separate .debug_addr section which
stays in the executable and is fully linked.

Sneak in two other small changes:

a) Print out the debug_str_offsets.dwo section.
b) Change form we're expecting the entries in the debug_str_offsets.dwo
   section to take from ULEB128 to U32.

Add tests for all of this in the fission-cu.ll test.

llvm-svn: 172578
2013-01-15 23:56:56 +00:00
David Greene 99e6c1157d Avoid Enum Compare Warnings
Avoid a compiler warning about comparing disjoint enums but casting
them to int first.

llvm-svn: 172577
2013-01-15 23:46:58 +00:00
Eli Bendersky cf6009b9c2 Optimize the memory usage of MC bundling, by creating a new type of fragment
into which we can emit single instructions without fixups (which is most
instructions). This is an optimization required because MCDataFragment
is prety large (240 bytes on x64), with no change in functionality.

For large programs, this reduces memory usage overhead required for bundling
by 40%.

To make the code as palatable as possible, the MCEncodedFragment interface was
further fragmented (no pun intended) and MCEncodedFragmentWithFixups is used
as the interface to work against when the user expects fixups. MCDataFragment
and MCRelaxableFragment implement this interface, while the new
MCCompactEncodedInstFragment implements MCEncodeFragment.

llvm-svn: 172572
2013-01-15 23:22:09 +00:00
Michael J. Spencer 47811e4bd8 [Object][ELF] Fix -Wenum-compare.
llvm-svn: 172556
2013-01-15 22:00:16 +00:00
Evgeniy Stepanov f71e7ad3cc Fix operand type conditions in one of ICmpInst constructors.
It was out of sync with the conditions in the other two constructors.

llvm-svn: 172535
2013-01-15 15:30:33 +00:00
Michael J. Spencer 1a79161fe3 [Object][ELF] Simplify ELFObjectFile by using ELFType.
This simplifies the usage and implementation of ELFObjectFile by using ELFType
to replace:

<endianness target_endianness, std::size_t max_alignment, bool is64Bits>

This does complicate the base ELF types as they must now use template template
parameters to partially specialize for the 32 and 64bit cases. However these
are only defined once.

llvm-svn: 172515
2013-01-15 07:44:25 +00:00
Michael J. Spencer daa46eb736 [Support] Add LLVM_CONSTEXPR.
Marks a decl as constexpr if the compiler supports it.

llvm-svn: 172508
2013-01-15 05:01:39 +00:00
Argyrios Kyrtzidis 5312f07a89 [ADT/StringMap] Follow-up to r172455, use the correct constructor for setting the InitialSize,
previously it was calling the "StringMapImpl(unsigned itemSize)" constructor.

llvm-svn: 172500
2013-01-15 01:58:45 +00:00
Eli Bendersky 382741283f Properly encapsulate additional methods and data from AsmParser.
This finally allows AsmParser to no longer list GenericAsmParser as a friend.
All member vars directly accessed by GenericAsmParser have been properly
encapsulated and exposed through the MCAsmParser interface. This reduces the
coupling between AsmParser and GenericAsmParser.

llvm-svn: 172490
2013-01-14 23:22:36 +00:00
Quentin Colombet 1a71168624 Complete the existing support of ARM v6m, v7m, and v7em, i.e., respectively cortex-m0, cortex-m3, and cortex-m4 on the backend side.
Adds new subtype values for the MachO format and use them when the related triple are set.

llvm-svn: 172472
2013-01-14 21:07:43 +00:00
Andrew Trick d4e1b5e291 SCEVExpander fix. RAUW needs to update the InsertedExpressions cache.
Note that this bug is only exposed because LTO fails to use TTI.

Fixes self-LTO of clang. rdar://13007381.

llvm-svn: 172462
2013-01-14 21:00:37 +00:00
Argyrios Kyrtzidis 49e022df8f [ADT/StringMap] Add a constructor in StringMap that accepts both an
initial size and an allocator.

llvm-svn: 172455
2013-01-14 19:41:09 +00:00
Joe Groff e14fb33a05 Fix DenseMap when LLVM_HAS_RVALUE_REFERENCES is defined but equals 0.
llvm-svn: 172454
2013-01-14 19:37:42 +00:00
Joe Groff d3fc142fdd Add DenseMap::insert(value_type&&) method.
Use the existing move implementation of the internal DenseMap::InsertIntoBucket
method to provide a user-facing move insert method.

llvm-svn: 172453
2013-01-14 19:24:15 +00:00
Eli Bendersky 0a8fbdd015 Move CheckForValidSection to the MCAsmParser interface.
Now that it behaves itself in terms of streamer independence (r172450), this
method can be moved to MCAsmParser to be available to all extensions,
overriding, etc.

-- -This line, and those below, will be ignored--

M    lib/MC/MCParser/AsmParser.cpp
M    include/llvm/MC/MCParser/MCAsmParser.h

llvm-svn: 172451
2013-01-14 19:15:01 +00:00
Eli Bendersky cbb2514d51 Expose an InitToTextSection through MCStreamer.
The aim of this patch is to fix the following piece of code in the
platform-independent AsmParser:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.SwitchSection(Ctx.getMachOSection(
                        "__TEXT", "__text",
                        MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
                        0, SectionKind::getText()));
  }
}

This was added for the "-n" option of llvm-mc.

The proposed fix adds another virtual method to MCStreamer, called
InitToTextSection. Conceptually, it's similar to the existing
InitSections which initializes all common sections and switches to
text. The new method is implemented by each platform streamer in a way
that it sees fit. So AsmParser can now do this:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.InitToTextSection();
  }
}

Which is much more reasonable.

llvm-svn: 172450
2013-01-14 19:04:57 +00:00
Eli Bendersky a7b905eeaa Move ParseMacroArgument to the MCAsmParser interfance.
Since it's used by extensions. One further step to fully decoupling
GenericAsmParser from an intimate knowledge of the internals of AsmParser,
pointing it to the MCASmParser interface instead (like all other parser
extensions do).

Since this change moves the MacroArgument type to the interface header, it's
renamed to be a bit more descriptive in a general context.

llvm-svn: 172449
2013-01-14 19:00:26 +00:00
Eli Bendersky c2f6f920b9 Encapsulate the MacroEnabled flag in AsmParser behind accessor methods.
The methods are also exposed via the MCAsmParser interface, which allows more
than one client to control them. Previously, GenericAsmParser was playing with
a member var in AsmParser directly (by virtue of being its friend).

llvm-svn: 172440
2013-01-14 18:08:41 +00:00
Nuno Lopes f4ddc9c002 fix compile-time regression report by Joerg Sonnenberger:
cache result of Size/OffsetVisitor to speedup analysis of PHI nodes

llvm-svn: 172363
2013-01-13 18:02:57 +00:00
Dmitri Gribenko 226fea5bd6 Remove redundant 'llvm::' qualifications
llvm-svn: 172358
2013-01-13 16:01:15 +00:00
Jakob Stoklund Olesen 8f644449af Precompute some information about register costs.
Remember the minimum cost of the registers in an allocation order and
the number of registers at the end of the allocation order that have the
same cost per use.

This information can be used to limit the search space for
RAGreedy::tryEvict() when looking for a cheaper register.

llvm-svn: 172280
2013-01-12 00:54:59 +00:00
Benjamin Kramer 56b31bd9d7 Split TargetLowering into a CodeGen and a SelectionDAG part.
This fixes some of the cycles between libCodeGen and libSelectionDAG. It's still
a complete mess but as long as the edges consist of virtual call it doesn't
cause breakage. BasicTTI did static calls and thus broke some build
configurations.

llvm-svn: 172246
2013-01-11 20:05:37 +00:00
Andrew Trick 962318f6b4 Added -view-callgraph module pass.
-dot-callgraph similarly follows a standard module pass pattern.

Patch by Speziale Ettore!

llvm-svn: 172220
2013-01-11 17:28:14 +00:00
Michael Ilseman 6c6d715c15 Support for half intrinsics. Pushes MMX into slower encoding path.
llvm-svn: 172159
2013-01-11 01:45:05 +00:00
Dmitri Gribenko 12e2f2a573 Add a new portability macro LLVM_FUNCTION_NAME, that expands to __func__, if
supported.

llvm-svn: 172156
2013-01-11 01:13:51 +00:00
Jakub Staszak 01fa2d8f13 LoopPass.h doesn't require Function.h. Remove unneeded #include.
llvm-svn: 172155
2013-01-11 01:03:32 +00:00
Jakub Staszak acd9ab67dc Remove trailing spaces.
llvm-svn: 172125
2013-01-10 22:14:33 +00:00
Jakub Staszak a9286e931c Remove unneeded includes from FunctionLoweringInfo.h.
llvm-svn: 172123
2013-01-10 22:13:13 +00:00
Chad Rosier a4bc9437a2 [ms-inline asm] Add support for calling functions from inline assembly.
Part of rdar://12991541

llvm-svn: 172121
2013-01-10 22:10:27 +00:00
Jakub Staszak 56df644323 Remove unneeded #includes.
llvm-svn: 172118
2013-01-10 22:07:29 +00:00
Jakub Staszak 929cf5615f Fix indent and remove unneeded #includes in MDBuilder.h.
llvm-svn: 172115
2013-01-10 22:00:36 +00:00
Jakub Staszak 32738212f4 Rename LinkAllVMCore.h to LinkAllIR.h since VMCore directory was renamed to IR.
llvm-svn: 172112
2013-01-10 21:55:02 +00:00
Jordan Rose efd8f80ed5 Add basic fix-its to SMDiagnostic.
Like Clang's FixItHint, SMFixIt represents an insertion, replacement, or
removal of source text. One or more fix-its can be emitted as part of
a diagnostic, and will be printed below the source range line to show the
user how they can fix their code.

Currently, the only client of SMFixIt is clang-tblgen; thus, the tests for
this behavior live in clang/test/TableGen/tg-fixits.td. If/when SMFixIt is
adopted within LLVM itself, those tests should be moved to the LLVM suite.

llvm-svn: 172086
2013-01-10 18:50:15 +00:00
Jordan Rose f12e8a93ee TableGen: Keep track of superclass reference ranges.
def foo : bar;
          ~~~

This allows us to produce more precise diagnostics about a certain
superclass, and even provide fixits.

llvm-svn: 172085
2013-01-10 18:50:11 +00:00
Jordan Rose abdd99b5aa TableGen: record anonymous instantiations of classes.
llvm-svn: 172084
2013-01-10 18:50:05 +00:00
Jakob Stoklund Olesen f0615c71fa Allow hasProperty() to be called on bundle-internal instructions.
When calling hasProperty() on an instruction inside a bundle, it should
always behave as if IgnoreBundle was passed, and just return properties
for the current instruction.

Only attempt to aggregate bundle properties whan asked about the bundle
header.

The assertion fires on existing ARM test cases without this fix.

llvm-svn: 172082
2013-01-10 18:42:44 +00:00
NAKAMURA Takumi acfc1f21d4 Signal.h: Add <cstdio> for FILE*, since r171989.
llvm-svn: 172044
2013-01-10 05:23:59 +00:00
Douglas Gregor 056eafd420 Fix a race condition in the lock-file manager: once the lock file is
gone, check for the actual file we care about.

llvm-svn: 172033
2013-01-10 02:01:35 +00:00
Jakob Stoklund Olesen 55a7be237e Support headerless bundles in MachineInstr::hasProperty().
This function can still work without a BUNDLE header instruction.

llvm-svn: 172029
2013-01-10 01:29:42 +00:00
Manman Ren 207bcbacca Stack Alignment: throw error if we can't satisfy the minimal alignment
requirement when creating stack objects in MachineFrameInfo.

Add CreateStackObjectWithMinAlign to throw error when the minimal alignment
can't be achieved and to clamp the alignment when the preferred alignment
can't be achieved. Same is true for CreateVariableSizedObject.
Will not emit error in CreateSpillStackObject or CreateStackObject.

As long as callers of CreateStackObject do not assume the object will be
aligned at the requested alignment, we should not have miscompile since
later optimizations which look at the object's alignment will have the correct
information.

rdar://12713765

llvm-svn: 172027
2013-01-10 01:10:10 +00:00
Jakub Staszak 02a3c9b959 Fix include guards so they exactly match file names.
llvm-svn: 172025
2013-01-10 00:45:19 +00:00
Bill Wendling 3b65187d2f Revert s/Raw/getBitMask/g name change. This is possibly causing LTO test hangings.
llvm-svn: 172020
2013-01-09 23:36:50 +00:00
Nadav Rotem b1791a75cd ARM Cost model: Use the size of vector registers and widest vectorizable instruction to determine the max vectorization factor.
llvm-svn: 172010
2013-01-09 22:29:00 +00:00
Argyrios Kyrtzidis eb9ae76864 Move the internal PrintStackTrace function that is used for llvm::sys::PrintStackTraceOnErrorSignal(),
into a new function llvm::sys::PrintStackTrace, so that it's available to clients for logging purposes.

llvm-svn: 171989
2013-01-09 19:42:40 +00:00
Jakob Stoklund Olesen 68d752bf6b Don't require BUNDLE headers in MachineInstr::getBundleSize().
It is possible to build MI bundles that don't begin with a BUNDLE
header. Add support for such bundles, counting all instructions inside
the bundle.

llvm-svn: 171985
2013-01-09 18:28:16 +00:00
Adhemerval Zanella 1ae2248e14 PowerPC: EH adjustments
This patch adjust the r171506 to make all DWARF enconding pc-relative
for PPC64. It also adds the R_PPC64_REL32 relocation handling in MCJIT
(since the eh_frame will not generate PIC-relative relocation) and also
adds the emission of stubs created by the TTypeEncoding.

llvm-svn: 171979
2013-01-09 17:08:15 +00:00
Shankar Easwaran 9f64604e74 add hexagon flags in ELF.h
llvm-svn: 171977
2013-01-09 16:34:46 +00:00
David Tweed f42bdf7c77 For some LLVM-as-library uses it is convenient to create a
subclass of TargetMachine which "forwards" all operations to an
existing internal TargetMachine member variable. In the usage context the
specific-machine class derived from TargetMachine is not visible,
only a reference to the generic base class TargetMachine. Although
getSubtargetImpl() is public in specific-machine classes derived from
TargetMachine, the TargetMachine class unfortunately has
getSubtargetImpl() protected (and accessing non-const members makes
abusing getSubtarget() unsuitable). Making it public in the base class
allows this forwarding pattern.

llvm-svn: 171976
2013-01-09 16:21:47 +00:00
Tim Northover f1450d8d7c Refactor to expose RTLIB calls to targets.
fp128 is almost but not quite completely illegal as a type on AArch64. As a
result it needs to have a register class (for argument passing mainly), but all
operations need to be lowered to runtime calls. Currently there's no way for
targets to do this (without duplicating code), as the relevant functions are
hidden in SelectionDAG. This patch changes that.

llvm-svn: 171971
2013-01-09 13:18:15 +00:00
Manuel Klimek 652b9ab7df Incrase the number of parameters for AlignedCharArrayUnion.
We need this to correctly fix ASTMatchers/ASTTypeTraits.h in clang.

llvm-svn: 171965
2013-01-09 10:39:16 +00:00
Eric Christopher bf7bc4966c Last in the series of removing unnecessary '0' arguments for
address space. Reordered the EmitULEB128IntValue arguments to
make this easier.

llvm-svn: 171949
2013-01-09 03:52:05 +00:00
Andrew Trick 9f0b95f260 MIsched: add an ILP window property to machine model.
This was an experimental option, but needs to be defined
per-target. e.g. PPC A2 needs to aggressively hide latency.

I converted some in-order scheduling tests to A2. Hal is working on
more test cases.

llvm-svn: 171946
2013-01-09 03:36:49 +00:00
NAKAMURA Takumi d7678c6af5 [Object, DebugInfo] Make DWARFContext BE-aware.
test/DebugInfo/member-pointers.ll would not fail in targetting BE any more.

llvm-svn: 171943
2013-01-09 02:45:05 +00:00
Eric Christopher ce0cfce775 These functions have default arguments of 0 for the last arg. Use
them and add one where it seemed obvious that we wanted one.

llvm-svn: 171932
2013-01-09 01:35:34 +00:00
Nadav Rotem b696c36fcd Cost Model: Move the 'max unroll factor' variable to the TTI and add initial Cost Model support on ARM.
llvm-svn: 171928
2013-01-09 01:15:42 +00:00
Jakob Stoklund Olesen 5e111fe533 Add a getBundleEnd() function to go with the existing getBundleStart().
This is easier implemented now that bundle flags are symmetric.

llvm-svn: 171927
2013-01-09 01:02:19 +00:00
Bill Wendling 69fa5c0d99 Add the integer value of the ConstantInt instead of the Constant* value.
This is causing some problems. The root cause is unknown at this time.

llvm-svn: 171923
2013-01-09 00:32:08 +00:00
Shuxin Yang f0537ab681 Consider expression "0.0 - X" as the negation of X if
- this expression is explicitly marked no-signed-zero, or
  - no-signed-zero of this expression can be derived from some context.

llvm-svn: 171922
2013-01-09 00:13:41 +00:00
Eli Bendersky 5277120dd0 Simplify the code a bit: MCRelaxableFragment doesn't need a separate getInstSize
method because getContents().size() already covers it. So computeFragmentSize
can use the generic MCEncodedFragment interface when querying both Data and
Relaxable fragments for contents sizes.

No change in functionality

llvm-svn: 171903
2013-01-08 22:05:10 +00:00
Nick Kledzik 0dcef84b13 Fix memory leak in YAML I/O.
Stop using BumpPtrAllocator for HNodes because
they have fields (vector, map) which require HNode 
destructors to be run.

llvm-svn: 171896
2013-01-08 21:04:44 +00:00
Tim Northover 4bf47bc9d7 Add fp128 rtlib function names to LLVM
llvm-svn: 171867
2013-01-08 17:09:59 +00:00
Tim Northover a269c29e7f Allow ELF64 relocation type to be more than 8 bits.
Current targets don't have more than 256 relocations so they don't hit this
limit, but ELF64 actually allows more than 8 bits for a relocation type. These
were being truncated on AArch64.

llvm-svn: 171845
2013-01-08 10:12:09 +00:00
Chandler Carruth a7c44e6ec6 Sink a function that refers to the SelectionDAG into that library in the
one file where it is called as a static function. Nuke the declaration
and the definition in lib/CodeGen, along with the include of
SelectionDAG.h from this file.

There is no dependency edge from lib/CodeGen to
lib/CodeGen/SelectionDAG, so it isn't valid for a routine in lib/CodeGen
to reference the DAG. There is a dependency from
lib/CodeGen/SelectionDAG on lib/CodeGen. This breaks one violation of
this layering.

llvm-svn: 171842
2013-01-08 05:11:57 +00:00
Eric Christopher 72a529566c Remove the llvm-local DW_TAG_vector_type tag and add a test to
make sure that vector types do work.

llvm-svn: 171833
2013-01-08 01:53:52 +00:00
Eli Bendersky 4d9ada036c Renamed MCInstFragment to MCRelaxableFragment and added some comments.
No change in functionality.

llvm-svn: 171822
2013-01-08 00:22:56 +00:00
Eric Christopher 9948d5eb6f Remove what appears to be a dead llvm-specific debug tag.
llvm-svn: 171821
2013-01-08 00:16:33 +00:00
Jakob Stoklund Olesen a1b246df57 Pack MachineOperand bitfields better.
Previously, 4 bits were unused.

llvm-svn: 171814
2013-01-07 23:21:44 +00:00
Jakob Stoklund Olesen 5adc4a12fb Pack MachineInstr fields better.
This shrinks MachineInstr to 64 bytes (from 72).

llvm-svn: 171813
2013-01-07 23:21:41 +00:00
Eli Bendersky 802b62871e Add the align_to_end option to .bundle_lock in the MC implementation of aligned
bundling. The document describing this feature and the implementation has also
been updated:

https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm

llvm-svn: 171797
2013-01-07 21:51:08 +00:00
Jordan Rose e8f1eaea8a Change SMRange to be half-open (exclusive end) instead of closed (inclusive)
This is necessary not only for representing empty ranges, but for handling
multibyte characters in the input. (If the end pointer in a range refers to
a multibyte character, should it point to the beginning or the end of the
character in a char array?) Some of the code in the asm parsers was already
assuming this anyway.

llvm-svn: 171765
2013-01-07 19:00:49 +00:00
Shuxin Yang 4fb504fec1 Implement APFloat::isDenormal()
llvm-svn: 171764
2013-01-07 18:59:35 +00:00
Quentin Colombet 3b2db0bcd3 When code size is the priority (Oz, MinSize attribute), help llvm
turning a code like this:

if (foo)
   free(foo)

into that:
free(foo)

Move a call to free from basic block FB into FB's predecessor, P,
when the path from P to FB is taken only if the argument of free is
not equal to NULL.

Some restrictions apply on P and FB to be sure that this code motion
is profitable. Namely:
1. FB must have only one predecessor P.
2. FB must contain only the call to free plus an unconditional
   branch to S.
3. P's successors are FB and S.

Because of 1., we will not increase the code size when moving the call
to free from FB to P.
Because of 2., FB will be empty after the move.
Because of 2. and 3., P's branch instruction becomes useless, so as FB
(simplifycfg will do the job).

llvm-svn: 171762
2013-01-07 18:37:41 +00:00
Chandler Carruth dcb603feef Move TypeFinder.h into the IR tree, it clearly belongs with the IR library.
llvm-svn: 171749
2013-01-07 15:43:51 +00:00
Chandler Carruth 839a98e687 Move CallGraphSCCPass.h into the Analysis tree; that's where the
implementation lives already.

llvm-svn: 171746
2013-01-07 15:26:48 +00:00
Chandler Carruth 683ff2d7f9 Remove the long defunct 'DefaultPasses' header. We have a pass manager
builder these days, and this thing hasn't seen updates for a very long
time.

llvm-svn: 171741
2013-01-07 15:16:50 +00:00
Chandler Carruth 95f83e0155 Sink AddrMode back into TargetLowering, removing one of the most
peculiar headers under include/llvm.

This struct still doesn't make a lot of sense, but it makes more sense
down in TargetLowering than it did before.

llvm-svn: 171739
2013-01-07 15:14:13 +00:00
Chandler Carruth 26c59fa870 Switch the SCEV expander and LoopStrengthReduce to use
TargetTransformInfo rather than TargetLowering, removing one of the
primary instances of the layering violation of Transforms depending
directly on Target.

This is a really big deal because LSR used to be a "special" pass that
could only be tested fully using llc and by looking at the full output
of it. It also couldn't run with any other loop passes because it had to
be created by the backend. No longer is this true. LSR is now just
a normal pass and we should probably lift the creation of LSR out of
lib/CodeGen/Passes.cpp and into the PassManagerBuilder. =] I've not done
this, or updated all of the tests to use opt and a triple, because
I suspect someone more familiar with LSR would do a better job. This
change should be essentially without functional impact for normal
compilations, and only change behvaior of targetless compilations.

The conversion required changing all of the LSR code to refer to the TTI
interfaces, which fortunately are very similar to TargetLowering's
interfaces. However, it also allowed us to *always* expect to have some
implementation around. I've pushed that simplification through the pass,
and leveraged it to simplify code somewhat. It required some test
updates for one of two things: either we used to skip some checks
altogether but now we get the default "no" answer for them, or we used
to have no information about the target and now we do have some.

I've also started the process of removing AddrMode, as the TTI interface
doesn't use it any longer. In some cases this simplifies code, and in
others it adds some complexity, but I think it's not a bad tradeoff even
there. Subsequent patches will try to clean this up even further and use
other (more appropriate) abstractions.

Yet again, almost all of the formatting changes brought to you by
clang-format. =]

llvm-svn: 171735
2013-01-07 14:41:08 +00:00
NAKAMURA Takumi 2c79063731 CallingConvLower.h: Use bitfields like unsigned:1 instead of bool:1 .
Some compilers might be confused if bool were potentially signed integer. In my case, g++-4.7.0 miscompiled CodeGen/ARM.

llvm-svn: 171727
2013-01-07 11:13:51 +00:00
Bill Wendling 096f544edc Rough out a new c'tor for the AttrBuilder class.
This c'tor takes the AttributeSet class as the parameter. It will eventually
grab the attributes from the specified index and create a new attribute builder
with those attributes.

llvm-svn: 171712
2013-01-07 08:24:35 +00:00
David Blaikie 5d3249b554 PR14759: Debug info support for C++ member pointers.
This works fine with GDB for member variable pointers, but GDB's support for
member function pointers seems to be quite unrelated to
DW_TAG_ptr_to_member_type. (see GDB bug 14998 for details)

llvm-svn: 171698
2013-01-07 05:51:15 +00:00
Chandler Carruth 0b4ef9cedc Make SimplifyCFG simply depend upon TargetTransformInfo and pass it
through as a reference rather than a pointer. There is always *some*
implementation of this available, so this simplifies code by not having
to test for whether it is available or not.

Further, it turns out there were piles of places where SimplifyCFG was
recursing and not passing down either TD or TTI. These are fixed to be
more pedantically consistent even though I don't have any particular
cases where it would matter.

llvm-svn: 171691
2013-01-07 03:53:25 +00:00
Chandler Carruth 2109f47d97 Fix the enumerator names for ShuffleKind to match tho coding standards,
and make its comments doxygen comments.

llvm-svn: 171688
2013-01-07 03:20:02 +00:00
Chandler Carruth 50a36cd148 Make the popcnt support enums and methods have more clear names and
follow the conding conventions regarding enumerating a set of "kinds" of
things.

llvm-svn: 171687
2013-01-07 03:16:03 +00:00
Chandler Carruth d3e73556d6 Move TargetTransformInfo to live under the Analysis library. This no
longer would violate any dependency layering and it is in fact an
analysis. =]

llvm-svn: 171686
2013-01-07 03:08:10 +00:00
Sean Silva 93be7d59d2 Simplify TableGen type-compatibility checks.
Patch by Elior Malul!

llvm-svn: 171684
2013-01-07 02:30:19 +00:00
Chandler Carruth 664e354de7 Switch TargetTransformInfo from an immutable analysis pass that requires
a TargetMachine to construct (and thus isn't always available), to an
analysis group that supports layered implementations much like
AliasAnalysis does. This is a pretty massive change, with a few parts
that I was unable to easily separate (sorry), so I'll walk through it.

The first step of this conversion was to make TargetTransformInfo an
analysis group, and to sink the nonce implementations in
ScalarTargetTransformInfo and VectorTargetTranformInfo into
a NoTargetTransformInfo pass. This allows other passes to add a hard
requirement on TTI, and assume they will always get at least on
implementation.

The TargetTransformInfo analysis group leverages the delegation chaining
trick that AliasAnalysis uses, where the base class for the analysis
group delegates to the previous analysis *pass*, allowing all but tho
NoFoo analysis passes to only implement the parts of the interfaces they
support. It also introduces a new trick where each pass in the group
retains a pointer to the top-most pass that has been initialized. This
allows passes to implement one API in terms of another API and benefit
when some other pass above them in the stack has more precise results
for the second API.

The second step of this conversion is to create a pass that implements
the TargetTransformInfo analysis using the target-independent
abstractions in the code generator. This replaces the
ScalarTargetTransformImpl and VectorTargetTransformImpl classes in
lib/Target with a single pass in lib/CodeGen called
BasicTargetTransformInfo. This class actually provides most of the TTI
functionality, basing it upon the TargetLowering abstraction and other
information in the target independent code generator.

The third step of the conversion adds support to all TargetMachines to
register custom analysis passes. This allows building those passes with
access to TargetLowering or other target-specific classes, and it also
allows each target to customize the set of analysis passes desired in
the pass manager. The baseline LLVMTargetMachine implements this
interface to add the BasicTTI pass to the pass manager, and all of the
tools that want to support target-aware TTI passes call this routine on
whatever target machine they end up with to add the appropriate passes.

The fourth step of the conversion created target-specific TTI analysis
passes for the X86 and ARM backends. These passes contain the custom
logic that was previously in their extensions of the
ScalarTargetTransformInfo and VectorTargetTransformInfo interfaces.
I separated them into their own file, as now all of the interface bits
are private and they just expose a function to create the pass itself.
Then I extended these target machines to set up a custom set of analysis
passes, first adding BasicTTI as a fallback, and then adding their
customized TTI implementations.

The fourth step required logic that was shared between the target
independent layer and the specific targets to move to a different
interface, as they no longer derive from each other. As a consequence,
a helper functions were added to TargetLowering representing the common
logic needed both in the target implementation and the codegen
implementation of the TTI pass. While technically this is the only
change that could have been committed separately, it would have been
a nightmare to extract.

The final step of the conversion was just to delete all the old
boilerplate. This got rid of the ScalarTargetTransformInfo and
VectorTargetTransformInfo classes, all of the support in all of the
targets for producing instances of them, and all of the support in the
tools for manually constructing a pass based around them.

Now that TTI is a relatively normal analysis group, two things become
straightforward. First, we can sink it into lib/Analysis which is a more
natural layer for it to live. Second, clients of this interface can
depend on it *always* being available which will simplify their code and
behavior. These (and other) simplifications will follow in subsequent
commits, this one is clearly big enough.

Finally, I'm very aware that much of the comments and documentation
needs to be updated. As soon as I had this working, and plausibly well
commented, I wanted to get it committed and in front of the build bots.
I'll be doing a few passes over documentation later if it sticks.

Commits to update DragonEgg and Clang will be made presently.

llvm-svn: 171681
2013-01-07 01:37:14 +00:00
Michael J. Spencer c445408710 [Object][ELF] Fix incorrect size of members for the 64 version of Elf_Phdr_Impl.
llvm-svn: 171650
2013-01-06 03:57:11 +00:00
Michael J. Spencer 9ed47c76af [Object][ELF] Add program header iterator.
llvm-svn: 171648
2013-01-06 03:56:27 +00:00
Michael J. Spencer 960b5d2b75 [Object][ELF] Refactor ELFRelocationIterator into ELFEntityIterator. No functionality change.
llvm-svn: 171647
2013-01-06 03:56:14 +00:00
Chandler Carruth 42e9611f15 Funnel the actual TargetTransformInfo pass from the SelectionDAGISel
pass into the SelectionDAG itself rather than snooping on the
implementation of that pass as exposed by the TargetMachine. This
removes the last direct client of the ScalarTargetTransformInfo class
outside of the TTI pass implementation.

llvm-svn: 171625
2013-01-05 12:32:17 +00:00
Chandler Carruth 539edf4ee0 Convert the TargetTransformInfo from an immutable pass with dynamic
interfaces which could be extracted from it, and must be provided on
construction, to a chained analysis group.

The end goal here is that TTI works much like AA -- there is a baseline
"no-op" and target independent pass which is in the group, and each
target can expose a target-specific pass in the group. These passes will
naturally chain allowing each target-specific pass to delegate to the
generic pass as needed.

In particular, this will allow a much simpler interface for passes that
would like to use TTI -- they can have a hard dependency on TTI and it
will just be satisfied by the stub implementation when that is all that
is available.

This patch is a WIP however. In particular, the "stub" pass is actually
the one and only pass, and everything there is implemented by delegating
to the target-provided interfaces. As a consequence the tools still have
to explicitly construct the pass. Switching targets to provide custom
passes and sinking the stub behavior into the NoTTI pass is the next
step.

llvm-svn: 171621
2013-01-05 11:43:11 +00:00
Chandler Carruth 8f37342b38 Replicate the APIs of ScalarTargetTransformInfo and
VectorTargetTransformInfo into the TargetTransformInfo pass,
implementing them be delegating back out to the two subobjects.

This is the first step to folding the interfaces together and making
TargetTransformInfo a normal analysis pass (specifically an analysis
group which targets can provide target-specific analysis pass
implementations of).

No callers are migrated here, this just stubs out the interface. Next
step will be to migrate all the callers to directly operate on TTI
instead of STTI or VTTI respectively. That will allow replacing the
machinery for delivering TTI without changing every caller at once.

WIP, I promise all the duplicated interfaces will be removed in the end,
this just decouples the steps of the process.

llvm-svn: 171615
2013-01-05 09:56:20 +00:00
Chandler Carruth 5394e11a55 Switch the empty and tombstone key enumerators to not have explicit
values -- that's not required to fix the bug that was cropping up, and
the values selected made the enumeration's underlying type signed and
introduced some warnings. This fixes the -Werror build.

The underlying issue here was that the DenseMapInfo was casting values
completely outside the range of the underlying storage of the
enumeration to the enumeration's type. GCC went and "optimized" that
into infloops and other misbehavior. By providing designated special
values for these keys in the dense map, we ensure they are indeed
representable and that they won't be used for anything else.

It might be better to reuse None for the empty key and have the
tombstone share the value of the sentinel enumerator, but honestly
having 2 extra enumerators seemed not to matter and this seems a bit
simpler. I'll let Bill shuffle this around (or ask me to shuffle it
around) if he prefers it to look a different way.

I also made the switch a bit more clear (and produce a better assert)
that the enumerators are *never* going to show up and are errors if they
do.

llvm-svn: 171614
2013-01-05 08:47:26 +00:00
Chandler Carruth e0900ec533 While the struct being defined in the AddressingMode.h header was
unused, there were transitive includes needed.

llvm-svn: 171613
2013-01-05 08:19:20 +00:00
Chandler Carruth a56c3200aa Remove unnecessary include.
llvm-svn: 171612
2013-01-05 08:12:59 +00:00
NAKAMURA Takumi c91006f741 IR/Attributes: Provide EmptyKey and TombstoneKey in part of enum, as workaround for gcc-4.4 take #2.
I will investigate, later, what was wrong. I am too tired for now.

llvm-svn: 171611
2013-01-05 07:55:47 +00:00
NAKAMURA Takumi 6f3ef2d70e Whitespace.
llvm-svn: 171601
2013-01-05 05:16:53 +00:00
NAKAMURA Takumi 3b4d2c99ad DenseMap: Appease -fstrict-aliasing on g++-4.4.
With DenseMapInfo<Enum>, it is miscompiled on g++-4.4.

    static inline Enum getEmptyKey() { return Enum(<arbitrary int/unsigned value>); }

    isEauql(getEmptyKey(), ...)

The compiler mis-assumes the return value is not aliased to Enum.

llvm-svn: 171600
2013-01-05 05:14:23 +00:00
Jakob Stoklund Olesen dc5285f102 Don't call destructors on MachineInstr and MachineOperand.
The series of patches leading up to this one makes llc -O0 run 8% faster.

When deallocating a MachineFunction, there is no need to visit all
MachineInstr and MachineOperand objects to deallocate them. All their
memory come from a BumpPtrAllocator that is about to be purged, and they
have empty destructors anyway.

This only applies when deallocating the MachineFunction.
DeleteMachineInstr() should still be used to recycle MI memory during
the codegen passes.

Remove the LeakDetector support for MachineInstr. I've never seen it
used before, and now it definitely doesn't work. With this patch, leaked
MachineInstrs would be much less of a problem since all of their memory
will be reclaimed by ~MachineFunction().

llvm-svn: 171599
2013-01-05 05:05:51 +00:00
Jakob Stoklund Olesen 1bfeecb491 Use ArrayRecycler for MachineInstr operand lists.
Instead of an std::vector<MachineOperand>, use MachineOperand arrays
from an ArrayRecycler living in MachineFunction.

This has several advantages:

- MachineInstr now has a trivial destructor, making it possible to
  delete them in batches when destroying MachineFunction. This will be
  enabled in a later patch.

- Bypassing malloc() and free() can be faster, depending on the system
  library.

- MachineInstr objects and their operands are allocated from the same
  BumpPtrAllocator, so they will usually be next to each other in
  memory, providing better locality of reference.

- Reduce MachineInstr footprint. A std::vector is 24 bytes, the new
  operand array representation only uses 8+4+1 bytes in MachineInstr.

- Better control over operand array reallocations. In the old
  representation, the use-def chains would be reordered whenever a
  std::vector reached its capacity. The new implementation never changes
  the use-def chain order.

Note that some decisions in the code generator depend on the use-def
chain orders, so this patch may cause different assembly to be produced
in a few cases.

llvm-svn: 171598
2013-01-05 05:00:09 +00:00
Jakob Stoklund Olesen fe445cd646 Add MachineRegisterInfo::moveOperands().
This function works like memmove() for MachineOperands, except it also
updates any use-def chains containing the moved operands.

The use-def chains are updated without affecting the order of operands
in the list. That isn't possible when using the
removeRegOperandFromUseList() and addRegOperandToUseList() functions.

Callers to follow soon.

llvm-svn: 171597
2013-01-05 04:38:12 +00:00
Chandler Carruth 4a7c311008 Refactor the ScalarTargetTransformInfo API for querying about the
legality of an address mode to not use a struct of four values and
instead to accept them as parameters. I'd love to have named parameters
here as most callers only care about one or two of these, but the
defaults aren't terribly scary to write out.

That said, there is no real impact of this as the passes aren't yet
using STTI for this and are still relying upon TargetLowering.

llvm-svn: 171595
2013-01-05 03:36:17 +00:00
Chandler Carruth c892591596 Sink the AddressingModeMatcher helper class into an anonymous namespace
next to its only user. This helper relies on TargetLowering information
that shouldn't be generally used throughout the Transfoms library, and
so it made little sense as a generic utility.

This also consolidates the file where we need to remove the remaining
uses of TargetLowering in favor of the IR-layer abstract interface in
TargetTransformInfo.

llvm-svn: 171590
2013-01-05 02:09:22 +00:00