1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

12239 Commits

Author SHA1 Message Date
Jim Grosbach
3aa1632045 80-column and trailing whitespace cleanup
llvm-svn: 106885
2010-06-25 21:02:24 +00:00
Benjamin Kramer
afe7228ede Tweak MemoryBuffer to allocate the class itself, the name and possibly the
buffer in the same chunk of memory.

2 less mallocs for every uninitialized MemoryBuffer and 1 less malloc for every
MemoryBuffer pointing to a memory range translate into 20% less mallocs on
clang -cc1 -Eonly Cocoa_h.m.

llvm-svn: 106839
2010-06-25 11:50:40 +00:00
Oscar Fuentes
4c30188483 DataTypes.h.cmake (MSVC): Protect some #define's and use specific
suffixes for integer types.

llvm-svn: 106797
2010-06-24 22:05:52 +00:00
Jakob Stoklund Olesen
7a5bf34236 Remove the now unused LiveIntervals::getVNInfoSourceReg().
This method was always a bit too simplistic for the real world. It didn't really
deal with subregisters and such.

llvm-svn: 106781
2010-06-24 20:18:15 +00:00
Eric Christopher
7405c7bdb8 Silence some unused variable warnings.
llvm-svn: 106778
2010-06-24 20:14:34 +00:00
Jakob Stoklund Olesen
1a6a8cfc51 Remove the -fast-spill option.
This code path has never really been used, and we are going to be handling
spilling through the Spiller interface in the future.

llvm-svn: 106777
2010-06-24 19:56:08 +00:00
Jakob Stoklund Olesen
9f8104463f Replace a big gob of old coalescer logic with the new CoalescerPair class.
CoalescerPair can determine if a copy can be coalesced, and which register gets
merged away. The old logic in SimpleRegisterCoalescing had evolved into
something a bit too convoluted.

This second attempt fixes some crashes that only occurred Linux.

llvm-svn: 106769
2010-06-24 18:15:01 +00:00
Bob Wilson
2b2d62ad11 Edit and clarify comments for TargetInstrInfo methods:
None of the existing implementations of commuteInstruction create new
instructions unless the NewMI parameter is true, but the comment had
implied otherwise.

findCommutedOpIndices returns false, not true, when it doesn't know
how to commute the instruction.

llvm-svn: 106761
2010-06-24 16:48:26 +00:00
Dan Gohman
4f088f99fe Add a comment about a thread safety issue in Statistic.h.
llvm-svn: 106756
2010-06-24 16:31:32 +00:00
Dan Gohman
abeebe353c Add overloads for getFile and getFileOrSTDIN which take a const char *
instead of a StringRef, avoiding the need to copy the string in the
common case.

llvm-svn: 106754
2010-06-24 16:25:50 +00:00
Jakob Stoklund Olesen
f01eb3aab6 Be more strict about subreg-to-subreg copies in CoalescerPair.
Also keep track of the original DstREg before subregister adjustments.

llvm-svn: 106753
2010-06-24 16:19:28 +00:00
Dan Gohman
a08a9b8a0b Reapply r106634, now that the bug it exposed is fixed.
llvm-svn: 106746
2010-06-24 14:30:44 +00:00
Jakob Stoklund Olesen
1c9d50ed92 Revert "Replace a big gob of old coalescer logic with the new CoalescerPair class."
Whiny buildbots.

llvm-svn: 106710
2010-06-24 00:52:22 +00:00
Devang Patel
0c927a80fe Use ValueMap instead of DenseMap.
The ValueMapper used by various cloning utility maps MDNodes also.

llvm-svn: 106706
2010-06-24 00:33:28 +00:00
Jakob Stoklund Olesen
19abbf4387 Replace a big gob of old coalescer logic with the new CoalescerPair class.
CoalescerPair can determine if a copy can be coalesced, and which register gets
merged away. The old logic in SimpleRegisterCoalescing had evolved into
something a bit too convoluted.

llvm-svn: 106701
2010-06-24 00:12:39 +00:00
Devang Patel
373b10cbaa Cosmetic change.
Do not use "ValueMap" as a name for a local variable or an argument.

llvm-svn: 106698
2010-06-23 23:55:51 +00:00
Gabor Greif
4615fc1c93 minor enhancement to llvm::isFreeCall API: return CallInst; no functional change
llvm-svn: 106686
2010-06-23 21:51:12 +00:00
Daniel Dunbar
be50ef88bd Revert r106263, "Fold the ShrinkDemandedOps pass into the regular DAGCombiner pass,"... it was causing both 'file' (with clang) and 176.gcc (with llvm-gcc) to be miscompiled.
llvm-svn: 106634
2010-06-23 17:09:26 +00:00
Jim Grosbach
12afda541e Some targets don't require the fencing MEMBARRIER instructions surrounding
atomic intrinsics, either because the use locking instructions for the
atomics, or because they perform the locking directly. Add support in the
DAG combiner to fold away the fences.

llvm-svn: 106630
2010-06-23 16:07:42 +00:00
Jim Grosbach
395b0a671c remove trailing whitespace
llvm-svn: 106628
2010-06-23 15:49:18 +00:00
Dan Gohman
f44783ab4e Replace ScalarEvolution's private copy of getLoopPredecessor
with LoopInfo's public copy.

llvm-svn: 106603
2010-06-22 23:43:28 +00:00
Eric Christopher
835fc55fd0 Look for and use a different darwin crash reporter library.
llvm-svn: 106576
2010-06-22 21:01:04 +00:00
Dan Gohman
2303159bba Move PHIElimination's SplitCriticalEdge for MachineBasicBlocks out
into a utility routine, teach it how to update MachineLoopInfo, and
make use of it in MachineLICM to split critical edges on demand.

llvm-svn: 106555
2010-06-22 17:25:57 +00:00
Dan Gohman
29b845f3b7 Split out the code for finding a unique loop predecessor from
getLoopPreheader into a separate function, for clients which don't
require a proper preheader.

llvm-svn: 106543
2010-06-22 15:25:42 +00:00
Dan Gohman
5863f1e8c6 Add a comment explaining a non-obvious API.
llvm-svn: 106539
2010-06-22 13:57:08 +00:00
Devang Patel
f50b6147ad Use single interface, using twine, to get named metadata.
getNamedMetadata().

llvm-svn: 106518
2010-06-22 01:19:38 +00:00
Evan Cheng
a1ebf91a39 Tail merging pass shall not break up IT blocks. rdar://8115404
llvm-svn: 106517
2010-06-22 01:18:16 +00:00
Eric Christopher
68b77d45c2 Remove isTwoAddress from llvm.
llvm-svn: 106470
2010-06-21 20:35:09 +00:00
Dan Gohman
745765d0b8 Move several non-performance-critical member functinos out of line.
llvm-svn: 106444
2010-06-21 18:46:45 +00:00
Chris Lattner
42e833c9c4 make the Value constructor protected.
llvm-svn: 106427
2010-06-21 16:46:37 +00:00
Dan Gohman
fb091c213b Factor out duplicated code for reusing and inserting casts into
a helper function.

llvm-svn: 106388
2010-06-19 13:25:23 +00:00
Dan Gohman
823dff64cd Teach regular and fast isel to set dead flags on unused implicit defs
on calls and similar instructions.

llvm-svn: 106353
2010-06-18 23:28:01 +00:00
Evan Cheng
b5fadc47e0 Allow ARM if-converter to be run after post allocation scheduling.
- This fixed a number of bugs in if-converter, tail merging, and post-allocation
  scheduler. If-converter now runs branch folding / tail merging first to
  maximize if-conversion opportunities.
- Also changed the t2IT instruction slightly. It now defines the ITSTATE
  register which is read by instructions in the IT block.
- Added Thumb2 specific hazard recognizer to ensure the scheduler doesn't
  change the instruction ordering in the IT block (since IT mask has been
  finalized). It also ensures no other instructions can be scheduled between
  instructions in the IT block.

This is not yet enabled.

llvm-svn: 106344
2010-06-18 23:09:54 +00:00
Jim Grosbach
b8c94667a8 back-end libcall handling for ATOMIC_SWAP (__sync_lock_test_and_set)
llvm-svn: 106342
2010-06-18 23:03:10 +00:00
Jim Grosbach
91aae1c534 Add Expand-to-libcall support for additional atomics. This covers the usual
entries used by llvm-gcc. *_[U]MIN and such can be added later if needed.

This enables the front ends to simplify handling of the atomic intrinsics by
removing the target-specific decision about which targets can handle the
intrinsics.

llvm-svn: 106321
2010-06-18 21:43:38 +00:00
Dan Gohman
b5ec637e57 Revert r106304 (105548 and friends), which are the SCEVComplexityCompare
optimizations. There is still some nondeterminism remaining.

llvm-svn: 106306
2010-06-18 19:54:20 +00:00
Dan Gohman
527b570925 Reapply 105540, 105542, and 105548, and revert r105732.
llvm-svn: 106304
2010-06-18 19:26:04 +00:00
Dan Gohman
b220af45eb Add explicit keywords.
llvm-svn: 106300
2010-06-18 19:04:37 +00:00
Dan Gohman
1ccf40774e Start TargetRegisterClass indices at 0 instead of 1, so that
MachineRegisterInfo doesn't have to confusingly allocate an extra
entry.

llvm-svn: 106296
2010-06-18 18:13:55 +00:00
Jim Grosbach
60a3287950 Grammar.
llvm-svn: 106292
2010-06-18 17:40:42 +00:00
Dan Gohman
0422fad3a6 Don't bother calling releaseMemory before destroying the DominatorTreeBase.
llvm-svn: 106287
2010-06-18 16:09:11 +00:00
Dan Gohman
6c6e9a45ff Give NamedRegionTimer an Enabled flag, allowing all its clients to
switch from this:

  if (TimePassesIsEnabled) {
    NamedRegionTimer T(Name, GroupName);
    do_something();
  } else {
    do_something(); // duplicate the code, this time without a timer!
  }

to this:

  {
    NamedRegionTimer T(Name, GroupName, TimePassesIsEnabled);
    do_something();
  }

llvm-svn: 106285
2010-06-18 15:56:31 +00:00
Dan Gohman
e9dfb84007 Change UpdateNodeOperands' operand and return value from SDValue to
SDNode *, since it doesn't care about the ResNo value.

llvm-svn: 106282
2010-06-18 15:30:29 +00:00
Dan Gohman
e20e668c7e Remove getIntegerSCEV; it's redundant with getConstant, and getConstant
is more consistent with the ConstantInt API.

llvm-svn: 106281
2010-06-18 14:33:50 +00:00
Dan Gohman
0b5b93b20d Eliminate unnecessary uses of getZExtValue().
llvm-svn: 106279
2010-06-18 14:22:04 +00:00
Dan Gohman
22ff84372b isValueValidForType can be a static member function.
llvm-svn: 106278
2010-06-18 14:01:07 +00:00
Dan Gohman
8185674354 Fold the ShrinkDemandedOps pass into the regular DAGCombiner pass,
which is faster, simpler, and less surprising.

llvm-svn: 106263
2010-06-18 01:05:21 +00:00
Stuart Hastings
bd7194d21c Add a DebugLoc parameter to TargetInstrInfo::InsertBranch(). This
addresses a longstanding deficiency noted in many FIXMEs scattered
across all the targets.

This effectively moves the problem up one level, replacing eleven
FIXMEs in the targets with eight FIXMEs in CodeGen, plus one path
through FastISel where we actually supply a DebugLoc, fixing Radar
7421831.

llvm-svn: 106243
2010-06-17 22:43:56 +00:00
Jason Molenda
830bbc15f4 Add the entire range of DW_OP_lit[0..31], DW_OP_reg[0..31], and
DW_OP_breg[0..31] to Dwarf.h.

Add "DW_" prefix to the llvm::dwarf::*String methods which did not
already have them in Dwarf.cpp.

llvm-svn: 106197
2010-06-17 01:23:24 +00:00
Douglas Gregor
48c6838611 Revert r106117, which was the result of me misreading the C++98/03
specification.

llvm-svn: 106162
2010-06-16 22:32:18 +00:00
Daniel Dunbar
2c6d6693e2 MC: Simplify MCAssembler::isSymbolLinkerVisible to only take an MCSymbol.
llvm-svn: 106142
2010-06-16 20:04:29 +00:00
Daniel Dunbar
7631ddfec4 MC: Lift SwitchSection() and Finish() into MCObjectStreamer.
llvm-svn: 106141
2010-06-16 20:04:25 +00:00
Daniel Dunbar
d52ca1c3e5 MC: Factor out an MCObjectStreamer class, which will be shared by the concrete
object file format writers.

llvm-svn: 106140
2010-06-16 20:04:22 +00:00
Douglas Gregor
5ca7ded45a Eliminate a redundant "typename" keyword
llvm-svn: 106117
2010-06-16 17:42:01 +00:00
Devang Patel
3282324020 Use separate named MDNode to hold each function's local variable info.
This speeds up local variable handling in DwarfDebug.

llvm-svn: 106075
2010-06-16 00:53:55 +00:00
Jakob Stoklund Olesen
7fe0620525 Remove the local register allocator.
Please use the fast allocator instead.

llvm-svn: 106051
2010-06-15 21:58:33 +00:00
Benjamin Kramer
21a49e9375 simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0
llvm-svn: 106047
2010-06-15 21:34:25 +00:00
Chris Lattner
7420a283cf disable SmallVectorImpl's copy constructor. This prevents a class
of base class slicing bugs reported on irc

llvm-svn: 106028
2010-06-15 18:59:43 +00:00
Jakob Stoklund Olesen
f9a94f9154 Add CoalescerPair helper class.
Given a copy instruction, CoalescerPair can determine which registers to
coalesce in order to eliminate the copy. It deals with all the subreg fun to
determine a tuple (DstReg, SrcReg, SubIdx) such that:

- SrcReg is a virtual register that will disappear after coalescing.
- DstReg is a virtual or physical register whose live range will be extended.
- SubIdx is 0 when DstReg is a physical register.
- SrcReg can be joined with DstReg:SubIdx.

CoalescerPair::isCoalescable() determines if another copy instruction is
compatible with the same tuple. This fixes some NEON miscompilations where
shuffles are getting coalesced as if they were copies.

The CoalescerPair class will replace a lot of the spaghetti logic in JoinCopy
later.

llvm-svn: 105997
2010-06-15 16:04:21 +00:00
Alexis Hunt
7305f6de5c Add missing include to unbreak the build.
llvm-svn: 105971
2010-06-14 22:44:26 +00:00
Evan Cheng
358d77c810 - Do away with SimpleHazardRecognizer.h. It's not used and offers little value.
- Rename ExactHazardRecognizer to PostRAHazardRecognizer and move its header to include to allow targets to extend it.

llvm-svn: 105959
2010-06-14 21:06:53 +00:00
Bob Wilson
9fd54d618f Fix a comment typo.
llvm-svn: 105944
2010-06-14 18:29:23 +00:00
Benjamin Kramer
5d5812efa8 Let SmallVector take advantage of LiveRange's podness.
llvm-svn: 105913
2010-06-13 12:52:38 +00:00
Chris Lattner
3fdb8fcaeb declare a class with 'class' instead of struct to avoid tag mismatch
warnings, and don't shift by a bool.  Patch by Rizky Herucakra!

llvm-svn: 105886
2010-06-12 15:46:56 +00:00
Evan Cheng
c33e196177 Allow target to provide its own hazard recognizer to post-ra scheduler.
llvm-svn: 105862
2010-06-12 00:12:18 +00:00
Stuart Hastings
f9ef9ff3d6 Support for nested functions/classes in debug output. (Again.) Radar 7424645.
llvm-svn: 105828
2010-06-11 20:08:44 +00:00
John McCall
fade2aeb9f Define ContextualFoldingSet, which stores a context parameter to pass down to
the Profile method.  Currently this only works with the default FoldingSetTraits
implementation.

The point of this is to allow nodes to not store context values which are only
used during profiling.  A better solution would thread this value through the
folding algorithms, but then those would need to be (1) templated and
(2) non-opaque.

llvm-svn: 105819
2010-06-11 11:06:44 +00:00
Duncan Sands
83a8bdd9b7 Avoid many "variable 'Sub' set but not used [-Wunused-but-set-variable]" warnings
with gcc-4.6.  The warning is wrong, since Sub *is* used (perhaps gcc is confused
because the use of Sub is constant folded away?), but since it is trivial to avoid,
and massively reduces the amount of warning spew, just workaround the wrong warning.

llvm-svn: 105788
2010-06-10 15:06:05 +00:00
Duncan Sands
78593d094f Add includes to get ptrdiff_t. This is needed by gcc-4.6 which has
done some more header trimming, resulting in cstdef being included
by less header files.

llvm-svn: 105786
2010-06-10 10:13:58 +00:00
Evan Cheng
501c37c9ca Allow target to place 2-address pass inserted copies in better spots. Thumb2 will use this to try to avoid breaking up IT blocks.
llvm-svn: 105745
2010-06-09 19:26:01 +00:00
Evan Cheng
28c151ae52 Revert 105540, 105542, 105544, 105546, and 105548 to unbreak bootstrapping.
llvm-svn: 105740
2010-06-09 18:59:43 +00:00
Bill Wendling
ed674ae105 - Fix description of SUBREG_TO_REG. It's not going to generate a zext. But it
is used to assert that an *implicit* zext is performed.

- Fix grammar-o in INSERT_SUBREG. (required reformatting)

llvm-svn: 105735
2010-06-09 18:15:36 +00:00
Kenneth Uildriks
2c6b68924d Pulled CodeMetrics out of InlineCost.h and made it a bit more general, so it can be reused from PartialSpecializationCost
llvm-svn: 105725
2010-06-09 15:11:37 +00:00
Rafael Espindola
06df61cf04 Fix a gcc warning:
'class llvm::DAGDeltaAlgorithm' has virtual functions and accessible non-virtual destructor

Not sure if this is the best solution, but this class has state and some of the
classes that inherit from it also do, so it looks appropriate.

llvm-svn: 105675
2010-06-09 03:00:05 +00:00
Bruno Cardoso Lopes
255fda615d Reapply r105521, this time appending "LLU" to 64 bit
immediates to avoid breaking the build.

llvm-svn: 105652
2010-06-08 22:51:23 +00:00
Daniel Dunbar
956f97134b ADT: Add DAGDeltaAlgorithm, which is a DAG minimization algorithm built on top of the standard 'delta debugging' algorithm.
- This can give substantial speedups in the delta process for inputs we can construct dependency information for.

llvm-svn: 105612
2010-06-08 16:21:22 +00:00
Benjamin Kramer
d62b29412b Use realloc instead of malloc+memcpy when growing a POD SmallVector. A smart
realloc implementation can try to expand the allocated memory block in-place,
avoiding the copy.

llvm-svn: 105605
2010-06-08 11:44:30 +00:00
Dan Gohman
490f4d7020 The FoldingSet hash data includes pointer values, so it isn't
determinstic. Instead, give SCEV objects an arbitrary sequence
number.

llvm-svn: 105548
2010-06-07 19:36:14 +00:00
Dan Gohman
65954b2eb4 Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't go
scrounging through SCEVUnknown contents and SCEVNAryExpr operands;
instead just do a simple deterministic comparison of the precomputed
hash data.

Also, since this is more precise, it eliminates the need for the slow
N^2 duplicate detection code.

llvm-svn: 105540
2010-06-07 19:06:13 +00:00
Bill Wendling
a96eaed21d Create new accessors to get arguments for call/invoke instructions. It breaks
encapsulation to force the users of these classes to know about the internal
data structure of the Operands structure. It also can lead to errors, like in
the MSIL writer.

llvm-svn: 105539
2010-06-07 19:05:06 +00:00
Chris Lattner
33d0622cdc revert r105521, which is breaking the buildbots with stuff like this:
In file included from X86InstrInfo.cpp:16:
X86GenInstrInfo.inc:2789: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2790: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2792: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2793: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2808: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2809: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2816: error: integer constant is too large for 'long' type
X86GenInstrInfo.inc:2817: error: integer constant is too large for 'long' type

llvm-svn: 105524
2010-06-05 04:17:30 +00:00
Bruno Cardoso Lopes
b05131d907 Initial AVX support for some instructions. No patterns matched
yet, only assembly encoding support.

llvm-svn: 105521
2010-06-05 03:53:24 +00:00
Dan Gohman
884aaf23ee Make MachineFunctionPass::createPrinterPass private, as no subclasses
should be calling it.

llvm-svn: 105517
2010-06-05 01:19:12 +00:00
Stuart Hastings
37ed2a9663 Revert 105492 & 105493 due to a testcase regression. Radar 7424645.
llvm-svn: 105511
2010-06-05 00:39:29 +00:00
Dan Gohman
1865db1b89 LSR needs to remember inserted instructions even in postinc mode, because
there could be multiple subexpressions within a single expansion which
require insert point adjustment. This fixes PR7306.

llvm-svn: 105510
2010-06-05 00:33:07 +00:00
Dan Gohman
e1853a7473 Implement operator== and operator!= for SetVector.
llvm-svn: 105508
2010-06-05 00:26:02 +00:00
Stuart Hastings
eb78f8db98 Support for nested functions/classes in debug output. Radar 7424645.
llvm-svn: 105492
2010-06-04 22:36:03 +00:00
Jakob Stoklund Olesen
f0226fee37 Slightly change the meaning of the reMaterialize target hook when the original
instruction defines subregisters.

Any existing subreg indices on the original instruction are preserved or
composed with the new subreg index.

Also substitute multiple operands mentioning the original register by using the
new MachineInstr::substituteRegister() function. This is necessary because there
will soon be <imp-def> operands added to non read-modify-write partial
definitions. This instruction:

  %reg1234:foo = FLAP %reg1234<imp-def>

will reMaterialize(%reg3333, bar) like this:

  %reg3333:bar-foo = FLAP %reg333:bar<imp-def>

Finally, replace the TargetRegisterInfo pointer argument with a reference to
indicate that it cannot be NULL.

llvm-svn: 105358
2010-06-02 22:47:25 +00:00
Rafael Espindola
f7170870cf Remove the TargetRegisterClass member from CalleeSavedInfo
llvm-svn: 105344
2010-06-02 20:02:30 +00:00
Bob Wilson
fd208cef5d Rename canCombinedSubRegIndex method to something more grammatically correct
and tidy up the comment describing it.

llvm-svn: 105339
2010-06-02 18:54:47 +00:00
Jim Grosbach
90ca622864 remove trailing whitespace
llvm-svn: 105333
2010-06-02 17:45:54 +00:00
Rafael Espindola
7b9d713f40 Remove uses of getCalleeSavedRegClasses from outside the
backends and removes the virtual declaration. With that out of the way
I should be able to cleanup one backend at a time.

llvm-svn: 105321
2010-06-02 12:39:06 +00:00
Dan Gohman
940f8f3947 Don't call flush() at a library level which isn't checking for errors
and doesn't know where the output is going.

llvm-svn: 105274
2010-06-01 16:31:34 +00:00
Dan Gohman
196387f66e Fix a typo in a comment.
llvm-svn: 105272
2010-06-01 16:10:08 +00:00
Dan Gohman
ed310b8bca SelectionDAG shouldn't have a FunctionLoweringInfo member. RegsForValue
shouldn't have a TargetLoweringInfo member. And FunctionLoweringInfo::set
doesn't needs its EnableFastISel argument.

llvm-svn: 105101
2010-05-29 17:03:36 +00:00
Nick Lewycky
c80024c896 Fix typo.
llvm-svn: 105096
2010-05-29 06:11:16 +00:00
Dan Gohman
85f0f45ea1 Split the logic behind CastInst::isNoopCast into a separate static function,
as is done with most other cast opcode predicates.

llvm-svn: 105008
2010-05-28 21:41:37 +00:00
Dan Gohman
9de9456806 Fix a comment; vectors are not a special case here.
llvm-svn: 105006
2010-05-28 21:22:45 +00:00
Jakob Stoklund Olesen
6a3738d96a Add a TargetRegisterInfo::composeSubRegIndices hook with a default
implementation that is correct for most targets. Tablegen will override where
needed.

Add MachineOperand::subst{Virt,Phys}Reg methods that correctly handle existing
subreg indices when sustituting registers.

llvm-svn: 104985
2010-05-28 18:18:53 +00:00
Dan Gohman
0d7d3faf8e Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of
lib/Transforms/Utils and into lib/Analysis so that Analysis passes
can use them.

llvm-svn: 104949
2010-05-28 16:19:17 +00:00
Dan Gohman
f7bbeb021a Fix a comment.
llvm-svn: 104947
2010-05-28 16:06:09 +00:00
Jakob Stoklund Olesen
d76041cf58 Add a -regalloc=default option that chooses a register allocator based on the -O
optimization level.

This only really affects llc for now because both the llvm-gcc and clang front
ends override the default register allocator. I intend to remove that code later.

llvm-svn: 104904
2010-05-27 23:57:25 +00:00
Jakob Stoklund Olesen
9f9fed5a7c Remove ancient prototype.
llvm-svn: 104903
2010-05-27 23:57:19 +00:00
Jim Grosbach
d788f9b580 back out 104862/104869. Can reuse stacksave after all. Very cool.
llvm-svn: 104897
2010-05-27 23:11:57 +00:00
Dan Gohman
92ee877dcd Make ParseIRFile and getLazyIRFileModule incoporate the underlying
error message string into their own error message string, so that
the information isn't lost.

llvm-svn: 104887
2010-05-27 20:47:38 +00:00
Dan Gohman
d13e45d0ec Don't special-case stdout in llvm::WriteBitcodeToFile; just consider
it to be the caller's responsibility to provide a stream in binary
mode. This fixes a layering violation and avoids an outs() call.

llvm-svn: 104878
2010-05-27 20:06:51 +00:00
Jim Grosbach
0ff473d68a hook ISD::STACKADDR to an intrinsic
llvm-svn: 104869
2010-05-27 18:52:11 +00:00
Jim Grosbach
c2c7753f15 add ISD::STACKADDR to get the current stack pointer. Will be used by sjlj EH
to update the jmpbuf in the presence of VLAs.

llvm-svn: 104862
2010-05-27 18:23:48 +00:00
Dan Gohman
9789093ab7 Add basic error checking to MemoryBuffer::getSTDIN.
llvm-svn: 104855
2010-05-27 17:31:51 +00:00
Jim Grosbach
73ce6687df remove incorrect GCCBuiltin<> usage
llvm-svn: 104833
2010-05-27 15:04:02 +00:00
Gabor Greif
d8e3e9f572 typo
llvm-svn: 104832
2010-05-27 09:48:47 +00:00
Dan Gohman
0b5922b032 Fix Lint printing warnings multiple times. Remove the ErrorStr
option from lintModule, which was an artifact from being
based on Verifier code.

llvm-svn: 104765
2010-05-26 22:28:53 +00:00
Daniel Dunbar
bf243d9440 MC: Add TargetMachine support for setting the value of MCRelaxAll with
-filetype=obj.

llvm-svn: 104747
2010-05-26 21:48:55 +00:00
Jakob Stoklund Olesen
1c0aa5f14a Add StringRef::compare_numeric and use it to sort TableGen register records.
This means that our Registers are now ordered R7, R8, R9, R10, R12, ...
Not R1, R10, R11, R12, R2, R3, ...

llvm-svn: 104745
2010-05-26 21:47:28 +00:00
Jim Grosbach
bb4860d2a2 Adjust eh.sjlj.setjmp to properly have a chain and to have an opcode entry in
ISD::. No functional change.

llvm-svn: 104734
2010-05-26 20:22:18 +00:00
Bill Wendling
fbe85886bb Move the check for "calls setjmp" to SelectionDAGISel so that it can be used by
more than just the stack slot coloring algorithm.

llvm-svn: 104722
2010-05-26 19:46:12 +00:00
Dan Gohman
616845c384 Eliminate the use of PriorityQueue and just use a std::vector,
implementing pop with a linear search for a "best" element. The priority
queue was a neat idea, but in practice the comparison functions depend
on dynamic information.

llvm-svn: 104718
2010-05-26 18:52:00 +00:00
Dan Gohman
3391366b42 Fix indentation.
llvm-svn: 104717
2010-05-26 18:37:48 +00:00
Daniel Dunbar
1b8e1aafae MC: Change RelaxInstruction to only take the input and output instructions.
llvm-svn: 104713
2010-05-26 18:15:06 +00:00
Daniel Dunbar
77240e2337 MC: Simplify MayNeedRelaxation to not provide the fixups, so we can query it
before encoding.

llvm-svn: 104707
2010-05-26 17:45:29 +00:00
Jakob Stoklund Olesen
83d2cfd6cd Replace the SubRegSet tablegen class with a less error-prone mechanism.
A Register with subregisters must also provide SubRegIndices for adressing the
subregisters. TableGen automatically inherits indices for sub-subregisters to
minimize typing.

CompositeIndices may be specified for the weirder cases such as the XMM sub_sd
index that returns the same register, and ARM NEON Q registers where both D
subregs have ssub_0 and ssub_1 sub-subregs.

It is now required that all subregisters are named by an index, and a future
patch will also require inherited subregisters to be named. This is necessary to
allow composite subregister indices to be reduced to a single index.

llvm-svn: 104704
2010-05-26 17:27:12 +00:00
Daniel Dunbar
87dcbd1ee5 MC: Eliminate MCAsmFixup, replace with MCFixup.
llvm-svn: 104699
2010-05-26 15:18:56 +00:00
Daniel Dunbar
fe22195ea6 MC: Simplify MCFixup and increase the available offset size.
llvm-svn: 104698
2010-05-26 15:18:40 +00:00
Daniel Dunbar
55c1bf55fe MC: Use accessors for access to MCAsmFixup.
llvm-svn: 104697
2010-05-26 15:18:31 +00:00
Daniel Dunbar
a06aa279f4 MC: Eliminate MCFragment vtable, which was unnecessary.
llvm-svn: 104689
2010-05-26 06:50:57 +00:00
Eric Christopher
13ac28ede3 Temporarily revert r104655 as it's breaking the bots.
llvm-svn: 104664
2010-05-26 01:59:55 +00:00
Jakob Stoklund Olesen
0fefdf4d2a Revert "Replace the SubRegSet tablegen class with a less error-prone mechanism."
This reverts commit 104654.

llvm-svn: 104660
2010-05-26 01:21:14 +00:00
Dan Gohman
59cddd1327 Change push_all to a non-virtual function and implement it in the
base class, since all the implementations are the same.

llvm-svn: 104659
2010-05-26 01:10:55 +00:00
Dan Gohman
ba28c900a2 Delete an unused function.
llvm-svn: 104658
2010-05-26 00:56:27 +00:00
Bill Wendling
04fbdac5ac Dale and Evan suggested putting the "check for setjmp" much earlier in the
machine code generation. That's a good idea, so I made it so.

llvm-svn: 104655
2010-05-26 00:32:40 +00:00
Jakob Stoklund Olesen
a2f0c34e41 Replace the SubRegSet tablegen class with a less error-prone mechanism.
A Register with subregisters must also provide SubRegIndices for adressing the
subregisters. TableGen automatically inherits indices for sub-subregisters to
minimize typing.

CompositeIndices may be specified for the weirder cases such as the XMM sub_sd
index that returns the same register, and ARM NEON Q registers where both D
subregs have ssub_0 and ssub_1 sub-subregs.

It is now required that all subregisters are named by an index, and a future
patch will also require inherited subregisters to be named. This is necessary to
allow composite subregister indices to be reduced to a single index.

llvm-svn: 104654
2010-05-26 00:28:19 +00:00
Eric Christopher
371732bd2a Start adding mach-o tls reloc support.
llvm-svn: 104651
2010-05-26 00:02:12 +00:00
Jakob Stoklund Olesen
41388819f1 Drop the SuperregHashTable. It is essentially the same as SubregHashTable.
llvm-svn: 104650
2010-05-25 23:43:18 +00:00
Jakob Stoklund Olesen
9210d3b189 Print symbolic SubRegIndex names on machine operands.
llvm-svn: 104628
2010-05-25 19:49:38 +00:00
Jakob Stoklund Olesen
696fbed514 Remove NumberHack entirely.
SubRegIndex instances are now numbered uniquely the same way Register instances
are - in lexicographical order by name.

llvm-svn: 104627
2010-05-25 19:49:33 +00:00
Eric Christopher
627e887b3d Make sure aeskeygenassist uses an unsigned immediate field.
Fixes rdar://8017638

llvm-svn: 104617
2010-05-25 17:33:22 +00:00
Jakob Stoklund Olesen
d1f4d14609 Switch SubRegSet to using symbolic SubRegIndices
llvm-svn: 104571
2010-05-24 23:03:18 +00:00
Jakob Stoklund Olesen
3a19b732d8 Replace the tablegen RegisterClass field SubRegClassList with an alist-like data
structure that represents a mapping without any dependencies on SubRegIndex
numbering.

This brings us closer to being able to remove the explicit SubRegIndex
numbering, and it is now possible to specify any mapping without inventing
*_INVALID register classes.

llvm-svn: 104563
2010-05-24 21:46:58 +00:00
Evan Cheng
e34814c0bc Avoid adding duplicate function live-in's.
llvm-svn: 104560
2010-05-24 21:33:37 +00:00
Jakob Stoklund Olesen
9a54fec092 Add the SubRegIndex TableGen class.
This is the beginning of purely symbolic subregister indices, but we need a bit
of jiggling before the explicit numeric indices can be completely removed.

llvm-svn: 104492
2010-05-24 14:48:12 +00:00
Daniel Dunbar
eb23d9ac22 MC: Add an MCLoggingStreamer, for use in debugging integrated-as mismatches.
llvm-svn: 104463
2010-05-23 17:44:06 +00:00
Daniel Dunbar
ee525943d8 tblgen/AsmMatcher: Change AsmOperandClass to allow a list of superclasses instead of just one.
llvm-svn: 104452
2010-05-22 21:02:29 +00:00
John Mosby
cec9b7fc9c Trivial change to dump() function for SparseBitVector
llvm-svn: 104433
2010-05-22 05:13:17 +00:00
Evan Cheng
241d2c434e Implement @llvm.returnaddress. rdar://8015977.
llvm-svn: 104421
2010-05-22 01:47:14 +00:00
Jim Grosbach
b6cc69c655 Implement eh.sjlj.longjmp for ARM. Clean up the intrinsic a bit.
Followups: docs patch for the builtin and eh.sjlj.setjmp cleanup to match
longjmp.

llvm-svn: 104419
2010-05-22 01:06:18 +00:00
Eric Christopher
6bd67791da Add a new section and accessor for TLS data.
llvm-svn: 104411
2010-05-22 00:00:58 +00:00
Eric Christopher
0df4e8b6a5 Fix comment and whitespace.
llvm-svn: 104392
2010-05-21 22:39:11 +00:00
Evan Cheng
3c850aecf6 - Change MachineInstr::findRegisterDefOperandIdx so it can also look for defs
that are aliases of the specified register.
- Rename modifiesRegister to definesRegister since it's looking a def of the
specific register or one of its super-registers. It's not looking for def of a
sub-register or alias that could change the specified register.
- Added modifiesRegister to look for defs of aliases.

llvm-svn: 104377
2010-05-21 20:53:24 +00:00
Jakob Stoklund Olesen
0f1087b284 Add MachineInstr::readsWritesVirtualRegister() to determine if an instruction
reads or writes a register.

This takes partial redefines and undef uses into account.

Don't actually use it yet. That caused miscompiles.

llvm-svn: 104372
2010-05-21 20:02:01 +00:00
Nathan Jeffords
28b485543b added an assertion to MCObjectWriter::WriteBytes to catch misuse of the ZeroFillSize parameter
If the size of the string is greater than the zero fill size, the function will attempt to write a very large string of zeros to the object file (~4GB on 32 bit platforms). This assertion will catch the scenario and crash the program before the write occurs.

llvm-svn: 104334
2010-05-21 18:23:56 +00:00
Chris Lattner
1794093960 constify accessor.
llvm-svn: 104325
2010-05-21 17:47:50 +00:00
Jakob Stoklund Olesen
a3cca88b41 Revert "Use MachineInstr::readsWritesVirtualRegister to determine if a register is read."
This reverts r104322. I think it was causing miscompilations.

llvm-svn: 104323
2010-05-21 17:36:32 +00:00
Jakob Stoklund Olesen
edf8136011 Use MachineInstr::readsWritesVirtualRegister to determine if a register is read.
This correctly handles partial redefines and undef uses.

llvm-svn: 104322
2010-05-21 16:42:30 +00:00
Jakob Stoklund Olesen
6c22635216 If the first definition of a virtual register is a partial redef, add an
<imp-def> operand for the full register. This ensures that the full physical
register is marked live after register allocation.

llvm-svn: 104320
2010-05-21 16:32:16 +00:00
Matt Fleming
5d40d53cab Currently, createMachOStreamer() is invoked directly in llvm-mc which
isn't ideal if we want to be able to use another object file format.

Add a createObjectStreamer() factory method so that the correct object
file streamer can be instantiated for a given target triple.

llvm-svn: 104318
2010-05-21 12:54:43 +00:00
Matt Fleming
0ca99c0262 Add support for parsing the ELF .type assembler directive.
llvm-svn: 104316
2010-05-21 11:36:59 +00:00
Lang Hames
b579a16d82 Removed scaleNumbering method declaration from LiveInterval (not defined, not used).
llvm-svn: 104311
2010-05-21 03:04:04 +00:00
Evan Cheng
b5de7de4ce Allow targets more controls on what nodes are scheduled by reg pressure, what for latency in hybrid mode.
llvm-svn: 104293
2010-05-20 23:26:43 +00:00
Devang Patel
3d4cd812aa Rename variable. add comment.
llvm-svn: 104274
2010-05-20 20:35:24 +00:00
Daniel Dunbar
64807873ec tblgen/Target: Add a isAsmParserOnly bit, and teach the disassembler to honor
it.

llvm-svn: 104270
2010-05-20 20:20:32 +00:00
Evan Cheng
0d88ad2de1 Add a hybrid bottom up scheduler that reduce register usage while avoiding
pipeline stall. It's useful for targets like ARM cortex-a8. NEON has a lot
of long latency instructions so a strict register pressure reduction
scheduler does not work well.
Early experiments show this speeds up some NEON loops by over 30%.

llvm-svn: 104216
2010-05-20 06:13:19 +00:00
Eric Christopher
09658d704d Fix build by actually declaring the variable.
llvm-svn: 104201
2010-05-20 00:59:30 +00:00
Eric Christopher
1a7bc06b28 Partial code for emitting thread local bss data.
llvm-svn: 104197
2010-05-20 00:49:07 +00:00
Jim Grosbach
523fa7acaa Fix the post-RA instruction scheduler to handle instructions referenced by
more than one dbg_value instruction. rdar://7759363

llvm-svn: 104174
2010-05-19 22:57:06 +00:00
Jakob Stoklund Olesen
56998cc8aa Add MachineInstr::readsVirtualRegister() in preparation for proper handling of
partial redefines.

We are going to treat a partial redefine of a virtual register as a
read-modify-write:

  %reg1024:6 = OP

Unless the register is fully clobbered:

  %reg1024:6 = OP, %reg1024<imp-def>

MachineInstr::readsVirtualRegister() knows the difference. The first case is a
read, the second isn't.

llvm-svn: 104149
2010-05-19 20:36:22 +00:00
Evan Cheng
46e08acfa5 Code refactoring: pull SchedPreference enum from TargetLowering.h to TargetMachine.h and put it in its own namespace.
llvm-svn: 104147
2010-05-19 20:19:50 +00:00
mike-m
f12653f97d Fix enum to address array bounds regression.
llvm-svn: 104058
2010-05-18 21:22:12 +00:00
Eric Christopher
4a9013f115 Make EmitTBSSSymbol take a section argument so that we can find it later.
Fix up callers and users.

llvm-svn: 104057
2010-05-18 21:16:04 +00:00
Kevin Enderby
14c986967b Added support in MC for Directional Local Labels.
llvm-svn: 103989
2010-05-17 23:08:19 +00:00
Eric Christopher
6ea9cf8425 More data/parsing support for tls directives. Add a few more testcases
and cleanup comments as well.

llvm-svn: 103985
2010-05-17 22:53:55 +00:00
Daniel Dunbar
7e141838cd MC: Add dyn_cast support to MCSection.
- Of questionable utility, since in general anything which wants to do this should probably be within a target specific hook, which can rely on the sections being of the appropriate type. However, it can be useful for short term hacks.

llvm-svn: 103980
2010-05-17 21:54:26 +00:00
Eric Christopher
380e16a725 Add some section and constant support for darwin TLS.
llvm-svn: 103974
2010-05-17 21:02:07 +00:00
Jakob Stoklund Olesen
011cea42b9 Optimize empty DenseMap iteration.
llvm-svn: 103962
2010-05-17 20:01:24 +00:00
Daniel Dunbar
8f5da3624f llvm-mc: Support reassignment of variables in one special case, when the
variable has not yet been used in an expression. This allows us to support a few
cases that show up in real code (mostly because gcc generates it for Objective-C
on Darwin), without giving up a reasonable semantic model for assignment.

llvm-svn: 103950
2010-05-17 17:46:23 +00:00
Zhongxing Xu
a44f4d62bc Remove unused member variable.
llvm-svn: 103936
2010-05-17 09:47:55 +00:00
Anton Korobeynikov
925a32ae37 Add support for thiscall calling convention.
Patch by Charles Davis and Steven Watanabe!

llvm-svn: 103902
2010-05-16 09:08:45 +00:00
Chris Lattner
a1f4042939 improve portability to systems that don't have round, patch by
Evzen Muller!

llvm-svn: 103877
2010-05-15 17:11:55 +00:00
Jakob Stoklund Olesen
420d93c484 Add reg_nodbg_iterator
llvm-svn: 103856
2010-05-15 02:52:58 +00:00
Evan Cheng
85497bd415 Allow TargetLowering::getRegClassFor() to be called on illegal types. Also
allow target to override it in order to map register classes to illegal
but synthesizable types. e.g. v4i64, v8i64 for ARM / NEON.

llvm-svn: 103854
2010-05-15 02:18:07 +00:00
Evan Cheng
0a651c3314 Teach two-address pass to do some coalescing while eliminating REG_SEQUENCE
instructions.

e.g.
%reg1026<def> = VLDMQ %reg1025<kill>, 260, pred:14, pred:%reg0
%reg1027<def> = EXTRACT_SUBREG %reg1026, 6
%reg1028<def> = EXTRACT_SUBREG %reg1026<kill>, 5
...
%reg1029<def> = REG_SEQUENCE %reg1028<kill>, 5, %reg1027<kill>, 6, %reg1028, 7, %reg1027, 8, %reg1028, 9, %reg1027, 10, %reg1030<kill>, 11, %reg1032<kill>, 12

After REG_SEQUENCE is eliminated, we are left with:

%reg1026<def> = VLDMQ %reg1025<kill>, 260, pred:14, pred:%reg0
%reg1029:6<def> = EXTRACT_SUBREG %reg1026, 6
%reg1029:5<def> = EXTRACT_SUBREG %reg1026<kill>, 5

The regular coalescer will not be able to coalesce reg1026 and reg1029 because it doesn't
know how to combine sub-register indices 5 and 6. Now 2-address pass will consult the
target whether sub-registers 5 and 6 of reg1026 can be combined to into a larger
sub-register (or combined to be reg1026 itself as is the case here). If it is possible, 
it will be able to replace references of reg1026 with reg1029 + the larger sub-register
index.

llvm-svn: 103835
2010-05-14 23:21:14 +00:00
Dan Gohman
2859ef1a1b Add some comments about undef.
llvm-svn: 103834
2010-05-14 23:01:02 +00:00
Bill Wendling
e346a38ed4 Rename "HasCalls" in MachineFrameInfo to "AdjustsStack" to better describe what
the variable actually tracks.

N.B., several back-ends are using "HasCalls" as being synonymous for something
that adjusts the stack. This isn't 100% correct and should be looked into.

llvm-svn: 103802
2010-05-14 21:14:32 +00:00
Devang Patel
2b99c27e47 Add support to preserve type info for the variables that are removed by the optimizer.
llvm-svn: 103798
2010-05-14 21:01:35 +00:00
Dan Gohman
6815a4c74d Use PassManagerBase, to give clients the option of using either
FunctionPassManager or regular PassManager.

llvm-svn: 103773
2010-05-14 15:35:10 +00:00
Dan Gohman
9383d0f144 Add an isNodeHidden to the graph traits, to support definition of
subgraph views.

llvm-svn: 103772
2010-05-14 15:29:31 +00:00
Evan Cheng
ec0d7e6cf2 Get rid of the bit twiddling to read / set OpActions and ValueTypeActions. The small saving in memory isn't worth the increase in runtime and code complexity in my opinion.
llvm-svn: 103768
2010-05-14 07:37:40 +00:00
Eric Christopher
ebea91f168 Add AsmParser support for darwin tbss directive.
Nothing uses this yet.

llvm-svn: 103757
2010-05-14 01:50:28 +00:00
Nick Lewycky
aeb998db39 Fix typo.
llvm-svn: 103755
2010-05-14 01:02:48 +00:00
Daniel Dunbar
7fee3c7b28 MC: Switch to completely lazy layout.
- The eliminates the last major algorithmic problem with MC.

llvm-svn: 103754
2010-05-14 00:51:14 +00:00
Daniel Dunbar
66c2ccec2d MC: Extend MCAsmLayout to explicitly track which fragments have been layed out, and enforce several invariants to LayoutFragment to ensure we only do layout in a sensible order.
llvm-svn: 103753
2010-05-14 00:37:21 +00:00
Daniel Dunbar
11467b2eaa MC: Switch MCFragment to storing the layout order index, not its index in the file.
llvm-svn: 103751
2010-05-14 00:37:14 +00:00
Daniel Dunbar
b2a98e0a16 MC: Change LayoutSection() to only do the section initializiation.
Also, elimminate MCAsmLayout::set*, which are no longer needed.

llvm-svn: 103750
2010-05-14 00:37:11 +00:00
Evan Cheng
775549c9e7 Adding a v8i64 512-bit vector type. This will be used to model ARM NEON intrinsics which translate into a pair of vld / vst instructions that can load / store 8 consecutive 64-bit (D) registers.
llvm-svn: 103746
2010-05-13 23:55:47 +00:00
Evan Cheng
5e115a09ec Eliminate use of magic numbers to access OpActions. It also has the effect of allowing more than 31 scalar value types. MAX_ALLOWED_VALUETYPE had already been updated to 64 a while back.
llvm-svn: 103743
2010-05-13 23:25:21 +00:00
Evan Cheng
f2572ea73b Fix up LoadExtActions, TruncStoreActions, and IndexedModeActions representation and setter and getter's so they will continue to work if the number of scalar ValueType's exceeds 31.
llvm-svn: 103742
2010-05-13 23:01:26 +00:00
Daniel Dunbar
86825a9719 MC: Move Layout{Fragment,Section} into MCAsmLayout, and add LayoutFile().
llvm-svn: 103738
2010-05-13 20:40:12 +00:00
Dan Gohman
33e9c347bf Teach MachineLICM and MachineSink how to clear kill flags conservatively
when they move instructions.

llvm-svn: 103737
2010-05-13 20:34:42 +00:00
Evan Cheng
fd47525512 80 col violation.
llvm-svn: 103733
2010-05-13 20:14:58 +00:00
Dan Gohman
223379b3a9 Add a utility function for conservatively clearing kill flags, and make
use of it in MachineCSE.

llvm-svn: 103726
2010-05-13 19:24:00 +00:00
Daniel Dunbar
b142c00db4 MC: Factor out MCAssembler::ComputeFragmentSize.
llvm-svn: 103724
2010-05-13 18:35:06 +00:00