Commit Graph

10457 Commits

Author SHA1 Message Date
Owen Anderson 95020dfeda Forgot to commit these.
llvm-svn: 85180
2009-10-26 23:56:52 +00:00
Victor Hernandez de5ad42aa1 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.

llvm-svn: 85176
2009-10-26 23:43:48 +00:00
David Goodwin e056d1077e Allow the aggressive anti-dep breaker to process the same region multiple times. This is necessary because new anti-dependencies are exposed when "current" ones are broken.
llvm-svn: 85166
2009-10-26 22:31:16 +00:00
David Goodwin 661ea989e9 Define virtual destructor in *.cpp file.
llvm-svn: 85146
2009-10-26 19:41:00 +00:00
Dan Gohman 6a1d9eace9 Check in the experimental GEP splitter pass. This pass splits complex
GEPs (more than one non-zero index) into simple GEPs (at most one
non-zero index).  In some simple experiments using this it's not
uncommon to see 3% overall code size wins, because it exposes
redundancies that can be eliminated, however it's tricky to use
because instcombine aggressively undoes the work that this pass does.

llvm-svn: 85144
2009-10-26 19:12:14 +00:00
David Goodwin 6b16b5e741 Add virtual destructor.
llvm-svn: 85141
2009-10-26 19:00:47 +00:00
Dan Gohman be881ee758 Add CreateZExtOrBitCast and CreateSExtOrBitCast to TargetFolder
for consistency with ConstantFolder.

llvm-svn: 85137
2009-10-26 18:36:40 +00:00
David Goodwin 8370485db9 Break anti-dependence breaking out into its own class.
llvm-svn: 85127
2009-10-26 16:59:04 +00:00
Devang Patel c80b5c8707 Add support to encode type info using llvm::Constant.
Patch by Talin!

llvm-svn: 85126
2009-10-26 16:54:35 +00:00
Evan Cheng b81cb2a9a8 - Revert some changes from 85044, 85045, and 85047 that broke x86_64 tests and
bootstrapping. It's not safe to leave identity subreg_to_reg and insert_subreg
  around.
- Relax register scavenging to allow use of partially "not-live" registers. It's
  common for targets to operate on registers where the top bits are undef. e.g.
  s0 =
  d0 = insert_subreg d0<undef>, s0, 1
  ...
     = d0
  When the insert_subreg is eliminated by the coalescer, the scavenger used to
  complain. The previous fix was to keep to insert_subreg around. But that's
  brittle and it's overly conservative when we want to use the scavenger to 
  allocate registers. It's actually legal and desirable for other instructions
  to use the "undef" part of d0. e.g.
  s0 =
  d0 = insert_subreg d0<undef>, s0, 1
  ...
  s1 =
     = s1
     = d0
  We probably need add a "partial-undef" marker on machine operand so the
  machine verifier would not complain.

llvm-svn: 85091
2009-10-26 04:56:07 +00:00
Chandler Carruth 56869f22c4 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.

llvm-svn: 85086
2009-10-26 01:35:46 +00:00
Evan Cheng 1da682bb3c Add isIdentityCopy to check for identity copy (or extract_subreg, etc.)
llvm-svn: 85044
2009-10-25 07:47:07 +00:00
Nick Lewycky 54d7179a25 Remove ICmpInst::isSignedPredicate which was a reimplementation
CmpInst::isSigned.

llvm-svn: 85037
2009-10-25 05:20:17 +00:00
Nick Lewycky 7494b3b1d4 Sink isTrueWhenEqual from ICmpInst to CmpInst. Add a matching isFalseWhenEqual
which is equal to !isTrueWhenEqual for ints but not for floats.

llvm-svn: 85036
2009-10-25 03:50:03 +00:00
Dan Gohman ef41a1ce3c MapValue doesn't needs its LLVMContext argument.
llvm-svn: 85020
2009-10-24 23:37:16 +00:00
Dan Gohman 8f4078ba39 Rename isLoopExit to isLoopExiting, for consistency with the wording
used elsewhere - an exit block is a block outside the loop branched to
from within the loop. An exiting block is a block inside the loop that
branches out.

llvm-svn: 85019
2009-10-24 23:34:26 +00:00
Dan Gohman afbf256184 Make DominanceFrontier::addBasicBlock return the iterator for the newly
inserted block.

llvm-svn: 85010
2009-10-24 19:57:58 +00:00
Dan Gohman 8cd7c22527 Add an explicit keyword.
llvm-svn: 85009
2009-10-24 19:56:23 +00:00
Victor Hernandez e297149e26 Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.

llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Evan Cheng d638bc310a Identity copies should not contribute to spill weight.
llvm-svn: 84978
2009-10-23 23:09:19 +00:00
Jeffrey Yasskin d0fc8f809a Fix http://llvm.org/PR4822: allow module deletion after a function has been
compiled.

When functions are compiled, they accumulate references in the JITResolver's
stub maps. This patch removes those references when the functions are
destroyed.  It's illegal to destroy a Function when any thread may still try to
call its machine code.

This patch also updates r83987 to use ValueMap instead of explicit CallbackVHs
and fixes a couple "do stuff inside assert()" bugs from r84522.

llvm-svn: 84975
2009-10-23 22:37:43 +00:00
Victor Hernandez 8acf2956b8 Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
llvm-svn: 84969
2009-10-23 21:09:37 +00:00
Jeffrey Yasskin 61ade25834 Fix stylistic and documentation problems in ValueMap found by Nick Lewycky and
Evan Cheng.

llvm-svn: 84967
2009-10-23 20:54:00 +00:00
David Goodwin 02ad4cb32e Allow the target to select the level of anti-dependence breaking that should be performed by the post-RA scheduler. The default is none.
llvm-svn: 84911
2009-10-22 23:19:17 +00:00
Jeffrey Yasskin 4546d31235 Try r84890 again (adding ValueMap<>), now that I've tested the compile on
gcc-4.4.

llvm-svn: 84902
2009-10-22 22:11:22 +00:00
Eric Christopher 9d2acced69 size_t, not unsigned here to silence a warning.
llvm-svn: 84900
2009-10-22 22:06:50 +00:00
Benjamin Kramer ab304c9237 Random include cleanup.
llvm-svn: 84898
2009-10-22 21:49:41 +00:00
Jeffrey Yasskin 66db004d7e Revert r84890, which broke the linux build.
llvm-svn: 84892
2009-10-22 20:23:43 +00:00
Jeffrey Yasskin 6b80e6e2b7 Add a ValueMap<ValueOrSubclass*, T> type. ValueMap<Value*, T> is safe to use
even when keys get RAUWed and deleted during its lifetime. By default the keys
act like WeakVHs, but users can pass a third template parameter to configure
how updates work and whether to do anything beyond updating the map on each
action.

It's also possible to automatically acquire a lock around ValueMap updates
triggered by RAUWs and deletes, to support the ExecutionEngine.

llvm-svn: 84890
2009-10-22 20:10:20 +00:00
Devang Patel 1155fdf6dc Hide MetadataContext implementation details.
llvm-svn: 84886
2009-10-22 19:36:54 +00:00
Devang Patel 6da5dbf3c2 Fix getMDs() interface such that it does not expose implementation details.
llvm-svn: 84885
2009-10-22 18:55:16 +00:00
Devang Patel 084679e70a Using TrackingVH instead of WeakVH or WeakMetadataVH.
llvm-svn: 84884
2009-10-22 18:25:28 +00:00
Devang Patel 09c319e269 Sort handler names to ensure deterministic behavior.
llvm-svn: 84878
2009-10-22 17:40:37 +00:00
Chris Lattner 1664a4fd86 Move some constant folding logic for loads out of instcombine into
Analysis/ConstantFolding.cpp.  This doesn't change the behavior of
instcombine but makes other clients of ConstantFoldInstruction
able to handle loads.  This was partially extracted from Eli's patch
in PR3152.

llvm-svn: 84836
2009-10-22 06:25:11 +00:00
Mikhail Glushenkov 2300f65e8c Forgot a declaration.
llvm-svn: 84828
2009-10-22 04:15:24 +00:00
Devang Patel 0fffb49d56 Fix getHandlerNames() interface. Now it populate clinet supplied small vector with handler names.
llvm-svn: 84820
2009-10-22 01:01:24 +00:00
Devang Patel 6746d43a3f Use StringRef to construct MDString.
llvm-svn: 84811
2009-10-22 00:22:05 +00:00
Devang Patel dcb99d310a Remove meaningless const.
Pass StringRef by value.

llvm-svn: 84804
2009-10-22 00:10:15 +00:00
Devang Patel 27e0be274e Derive metadata hierarchy from Value instead of User.
llvm-svn: 84801
2009-10-21 23:57:35 +00:00
Dale Johannesen 1cfb958b00 Rename msasm to alignstack per review.
llvm-svn: 84795
2009-10-21 23:28:00 +00:00
Devang Patel 2505c1e17a Use StringRef.
llvm-svn: 84786
2009-10-21 21:57:13 +00:00
Devang Patel 49914e6eb3 Do not use SmallVector to store MDNode elements.
llvm-svn: 84784
2009-10-21 21:25:09 +00:00
Devang Patel 3eb5d33b65 Incorporate various suggestions Chris gave during metadata review.
- i < getNumElements()  instead of getNumElements() > i
- Make setParent() private
- Fix use of resizeOperands
- Reset HasMetadata bit after removing all metadata attached to an instruction
- Efficient use of iterators

llvm-svn: 84765
2009-10-21 17:33:41 +00:00
Jeffrey Yasskin 08fa03c740 Delete the MacOSJITEventListener per echristo's request. It was disabled by
default and didn't work anyway.

llvm-svn: 84720
2009-10-21 00:43:48 +00:00
Devang Patel 0c35dbdf03 Cosmetic changes.
s/validName/isValidName/g
s/with an Instruction/to an Instruction/g
s/RegisterMDKind/registerMDKind/g

llvm-svn: 84689
2009-10-20 22:50:27 +00:00
Jeffrey Yasskin 27c669242a Move the Function*->allocated blocks map from the JITMemoryManager to the
JITEmitter.

I'm gradually making Functions auto-remove themselves from the JIT when they're
destroyed. In this case, the Function needs to be removed from the JITEmitter,
but the map recording which Functions need to be removed lived behind the
JITMemoryManager interface, which made things difficult.

This patch replaces the deallocateMemForFunction(Function*) method with a pair
of methods deallocateFunctionBody(void *) and deallocateExceptionTable(void *)
corresponding to the two startFoo/endFoo pairs.

llvm-svn: 84651
2009-10-20 18:13:21 +00:00
Benjamin Kramer 3301207a15 Random #include pruning.
llvm-svn: 84632
2009-10-20 11:44:38 +00:00
Daniel Dunbar f0b3d15cfe Wire up the ARM MCInst printer, for llvm-mc.
llvm-svn: 84600
2009-10-20 05:15:36 +00:00
Dan Gohman d383c2f6ba Add getTopBlock and getBottomBlock member functions to MachineLoopInfo.
llvm-svn: 84596
2009-10-20 04:16:37 +00:00
Chris Lattner 86dfd73c38 add a twine version of MCContext::GetOrCreateSymbol.
llvm-svn: 84561
2009-10-19 22:49:00 +00:00
Jim Grosbach 5a5a3bc5d4 Adjust the scavenge register spilling to allow the target to choose an
appropriate restore location for the spill as well as perform the actual
save and restore.

The Thumb1 target uses this to make sure R12 is not clobbered while a spilled
scavenger register is live there.

llvm-svn: 84554
2009-10-19 22:27:30 +00:00
Jeffrey Yasskin 7d2edada7f Clean up the JITResolver stub/callsite<->function maps.
The JITResolver maps Functions to their canonical stubs and all callsites for
lazily-compiled functions to their target Functions. To make Function
destruction work, I'm going to need to remove all callsites on destruction, so
this patch also adds the reverse mapping for that.

There was an incorrect assumption in here that the only stub for a function
would be the one caused by needing to lazily compile it, while x86-64 far calls
and dlsym-stubs could also cause such stubs, but I didn't look for a test case
that the assumption broke.

This also adds DenseMapInfo<AssertingVH> so I can use DenseMaps instead of
std::maps.

llvm-svn: 84522
2009-10-19 18:49:59 +00:00
Chris Lattner b0c23e81e7 various cleanups.
llvm-svn: 84471
2009-10-19 07:10:59 +00:00
Evan Cheng f0236e011e Spill slots cannot alias.
llvm-svn: 84432
2009-10-18 19:58:47 +00:00
Evan Cheng 0e9d9ca855 -Revert parts of 84326 and 84411. Distinquishing between fixed and non-fixed
stack slots and giving them different PseudoSourceValue's did not fix the
problem of post-alloc scheduling miscompiling llvm itself.
- Apply Dan's conservative workaround by assuming any non fixed stack slots can
alias other memory locations. This means a load from spill slot #1 cannot 
move above a store of spill slot #2. 
- Enable post-alloc scheduling for x86 at optimization leverl Default and above.

llvm-svn: 84424
2009-10-18 18:16:27 +00:00
Chris Lattner 3462d75aab punctuate properly
llvm-svn: 84407
2009-10-18 05:08:07 +00:00
Chris Lattner 1fa98f0d74 remove the IndMemRemPass, which only made sense for when malloc/free were intrinsic
instructions.

llvm-svn: 84404
2009-10-18 05:02:09 +00:00
Chris Lattner 9e6882c8de add function passes for printing various dominator datastructures
accessible through opt.  Patch by Tobias Grosser!

llvm-svn: 84397
2009-10-18 04:10:40 +00:00
Chris Lattner da42426e04 make DOTGraphTraits public, patch by Tobias Grosser!
llvm-svn: 84396
2009-10-18 04:09:11 +00:00
Chris Lattner d3400b4c86 add nodes_begin/end/iterator for dominfo, patch by Tobias Grosser!
llvm-svn: 84395
2009-10-18 04:05:53 +00:00
Eric Christopher 4eafc31368 More warnings patrol: Another unused argument and more implicit
conversions.

llvm-svn: 84382
2009-10-17 23:56:18 +00:00
Nick Lewycky bb1410ea8b Fix test/Bindings/Ocaml/vmcore.ml. When IRBuilder::CreateMalloc was removed,
LLVMBuildMalloc was reimplemented but with the bug that it didn't insert the
resulting instruction.

llvm-svn: 84374
2009-10-17 23:52:26 +00:00
Daniel Dunbar 04f049f2f5 Move UnescapeString to a static function for its sole client; its inefficient and broken.
llvm-svn: 84358
2009-10-17 20:43:42 +00:00
Daniel Dunbar 59449581b2 Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.
llvm-svn: 84357
2009-10-17 20:43:29 +00:00
Daniel Dunbar 4108c43fd1 Add raw_ostream::write_escaped, for writing escaped strings.
llvm-svn: 84355
2009-10-17 20:43:08 +00:00
Mikhail Glushenkov 867f67301b First draft of the OptionPreprocessor.
More to follow...

llvm-svn: 84352
2009-10-17 20:09:29 +00:00
Daniel Dunbar 77668004c4 Move StringMap's string has function into StringExtras.h
llvm-svn: 84344
2009-10-17 18:21:06 +00:00
Evan Cheng 4729191bb2 Distinquish stack slots from other stack objects. They (and fixed objects) get FixedStack PseudoSourceValues.
llvm-svn: 84326
2009-10-17 09:20:14 +00:00
Evan Cheng 5119ce2d16 Re-arrange some fields.
llvm-svn: 84324
2009-10-17 08:57:09 +00:00
Daniel Dunbar 235889151b Add another required #include for freestanding .h files.
llvm-svn: 84322
2009-10-17 08:12:36 +00:00
Evan Cheng 8759585aba Revert 84315 for now. Re-thinking the patch.
llvm-svn: 84321
2009-10-17 07:53:04 +00:00
Evan Cheng 0818d87ed1 Rename getFixedStack to getStackObject. The stack objects represented are not
necessarily fixed. Only those will negative frame indices are "fixed."

llvm-svn: 84315
2009-10-17 06:22:26 +00:00
Daniel Dunbar 1fcdeb8e1b Add required #includes for freestanding .h files.
llvm-svn: 84302
2009-10-17 03:28:07 +00:00
Victor Hernandez a3aaf85e23 Remove MallocInst from LLVM Instructions.
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Dan Gohman f920463aae Add a splice member function which accepts a range instead of a
single iterator.

llvm-svn: 84294
2009-10-17 00:28:24 +00:00
Victor Hernandez c7d6a8327c Autoupgrade malloc insts to malloc calls.
Update testcases that rely on malloc insts being present.

Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step.

llvm-svn: 84292
2009-10-17 00:00:19 +00:00
Evan Cheng 007ceb4603 Change createPostRAScheduler so it can be turned off at llc -O1.
llvm-svn: 84273
2009-10-16 21:06:15 +00:00
Evan Cheng 5a28638560 Add a CodeGenOpt::Less level to match -O1. It'll be used by clients which do not want post-regalloc scheduling.
llvm-svn: 84272
2009-10-16 21:02:20 +00:00
Duncan Sands 0058c7bcb0 Strip trailing white space.
llvm-svn: 84256
2009-10-16 15:20:13 +00:00
Chris Lattner 4794b2b27b Add half precision floating point support (float16) to APFloat,
patch by Peter Johnson! (PR5195)

llvm-svn: 84239
2009-10-16 02:13:51 +00:00
Chris Lattner 27f2049305 add haiku support, patch by Paul Davey!
llvm-svn: 84238
2009-10-16 02:06:30 +00:00
Daniel Dunbar e024def785 Minor formatting tweaks.
llvm-svn: 84235
2009-10-16 01:58:15 +00:00
Daniel Dunbar 8e6d889d4c MC: Switch assembler API to using MCExpr instead of MCValue.
llvm-svn: 84234
2009-10-16 01:58:03 +00:00
Daniel Dunbar c3bd60e393 MC: Remove unneeded context argument to MCExpr::Evaluate*.
llvm-svn: 84233
2009-10-16 01:57:52 +00:00
Daniel Dunbar 17b9027b5c MC: Move assembler variable values from MCContext to MCSymbol.
llvm-svn: 84229
2009-10-16 01:33:57 +00:00
Daniel Dunbar 584a1b25ef MC: Switch MCContext value table to storing MCExprs.
llvm-svn: 84228
2009-10-16 01:33:11 +00:00
Victor Hernandez 13020b1faf Fix bug where array malloc with unexpected computation of the size argument resulted in MallocHelper
identifying the malloc as a non-array malloc.  This broke GlobalOpt's optimization of stores of mallocs 
to global variables.

The fix is to classify malloc's into 3 categories:
1. non-array mallocs
2. array mallocs whose array size can be determined
3. mallocs that cannot be determined to be of type 1 or 2 and cannot be optimized

getMallocArraySize() returns NULL for category 3, and all users of this function must avoid their 
malloc optimization if this function returns NULL.

Eventually, currently unexpected codegen for computing the malloc's size argument will be supported in
isArrayMalloc() and getMallocArraySize(), extending malloc optimizations to those examples.

llvm-svn: 84199
2009-10-15 20:14:52 +00:00
Jakob Stoklund Olesen 460ceae432 Move Blackfin intrinsics into the Target/Blackfin directory.
llvm-svn: 84194
2009-10-15 18:50:52 +00:00
Jakob Stoklund Olesen 923b5aa973 Clean up TargetIntrinsicInfo API. Add pure virtual methods.
llvm-svn: 84192
2009-10-15 18:49:26 +00:00
Eric Christopher ef40bd1533 One more iteration here and a yet better way to solve it.
llvm-svn: 84150
2009-10-14 22:14:18 +00:00
Eric Christopher 4abb36b946 Fix the unused argument problem here a different way - cast to void.
llvm-svn: 84147
2009-10-14 21:45:49 +00:00
Dan Gohman 1396b3f368 Delete bogus semicolons.
llvm-svn: 84132
2009-10-14 20:39:01 +00:00
Eric Christopher b980933c37 Remove a bunch of unused arguments from functions, silencing a
warning.

llvm-svn: 84130
2009-10-14 20:28:33 +00:00
Devang Patel ebaa76ed0d Add copyMD to copy metadata from one instruction to another instruction.
llvm-svn: 84113
2009-10-14 17:02:49 +00:00
Duncan Sands 8e6ccb65df I don't see any point in having both eh.selector.i32 and eh.selector.i64,
so get rid of eh.selector.i64 and rename eh.selector.i32 to eh.selector.
Likewise for eh.typeid.for.  This aligns us with gcc, which always uses a
32 bit value for the selector on all platforms.  My understanding is that
the register allocator used to assert if the selector intrinsic size didn't
match the pointer size, and this was the reason for introducing the two
variants.  However my testing shows that this is no longer the case (I
fixed some bugs in selector lowering yesterday, and some more today in the
fastisel path; these might have caused the original problems).

llvm-svn: 84106
2009-10-14 16:11:37 +00:00
Edward O'Callaghan edea326896 Undo pthread patch from rev. 83930 & 83823. Credit to Paul Davey.
llvm-svn: 84083
2009-10-14 11:12:33 +00:00
Dan Gohman c0779370e7 Fix resetCachedCostInfo to reset all of the cost information, instead of
just the NumBlocks field.

llvm-svn: 84056
2009-10-13 23:36:36 +00:00
Devang Patel d7ebfe3963 s/DebugLoc.CompileUnit/DebugLoc.Scope/g
s/DebugLoc.InlinedLoc/DebugLoc.InlinedAtLoc/g

llvm-svn: 84054
2009-10-13 23:28:53 +00:00
Douglas Gregor df09a2aade Add is_same type trait
llvm-svn: 84029
2009-10-13 21:17:00 +00:00
Duncan Sands 18a956cb4a Introduce new convenience methods for sign extending or
truncating an SDValue (depending on whether the target
type is bigger or smaller than the value's type); or zero
extending or truncating it.  Use it in a few places (this
seems to be a popular operation, but I only modified cases
of it in SelectionDAGBuild).  In particular, the eh_selector
lowering was doing this wrong due to a repeated rather than
inverted test, fixed with this change.

llvm-svn: 84027
2009-10-13 21:04:12 +00:00
Dale Johannesen fd04c74bc0 Add an "msasm" flag to inline asm as suggested in PR 5125.
A little ugliness is accepted to keep the binary file format
compatible.  No functional change yet.

llvm-svn: 84020
2009-10-13 20:46:56 +00:00
Dan Gohman 2ccea5d13f Split code not specific to Function inlining out into a separate class,
named CodeMetrics. Move it to be a non-nested class. Rename RegionInfo
back to FunctionInfo.

llvm-svn: 84013
2009-10-13 19:58:07 +00:00
Ted Kremenek 5d81cb2084 Provide a mode for ImmutableMap/ImmutableSet to not automatically canonicalize the internal functional AVL trees. This should speedup clients that use ImmutableMap/ImmutableSet but don't require fast comparisons of maps.
llvm-svn: 84010
2009-10-13 19:08:10 +00:00
Dan Gohman 4552e3cd73 Move the InlineCost code from Transforms/Utils to Analysis.
llvm-svn: 83998
2009-10-13 18:30:07 +00:00
Dan Gohman 5b3e05bcaa Start refactoring the inline cost estimation code so that it can be used
for purposes other than inlining.

llvm-svn: 83997
2009-10-13 18:24:11 +00:00
Jeffrey Yasskin f98e981cd0 Make the ExecutionEngine automatically remove global mappings on when their
GlobalValue is destroyed.  Function destruction still leaks machine code and
can crash on leaked stubs, but this is some progress.

llvm-svn: 83987
2009-10-13 17:42:08 +00:00
Devang Patel e6f26a7415 Copy metadata when value is RAUW'd. It is debatable whether this is the right approach for custom metadata data in general. However, right now the only custom data user, "dbg", expects this behavior while FE is constructing llvm IR with debug info.
llvm-svn: 83977
2009-10-13 17:00:54 +00:00
Duncan Sands 1008612b36 The eh.exception intrinsic only reads from memory, it doesn't
write to it.

llvm-svn: 83963
2009-10-13 09:24:02 +00:00
Nick Lewycky 6f7d8347c1 Add new "memory use marker" intrinsics. These indicate lifetimes and invariant
sections of memory objects.

llvm-svn: 83953
2009-10-13 07:03:23 +00:00
Chris Lattner 799dd8538e remove dead header.
llvm-svn: 83943
2009-10-13 05:33:26 +00:00
Dan Gohman c4e367b854 Add a ceilLogBase2 function to APInt.
llvm-svn: 83932
2009-10-13 01:49:02 +00:00
Edward O'Callaghan a5314b83d1 Regenerate configure for rev. 83823 putback.
llvm-svn: 83930
2009-10-13 01:01:38 +00:00
Devang Patel 9da3cc2b2d Enable "debug info attached to an instruction" mode.
llvm-svn: 83925
2009-10-12 23:22:09 +00:00
Dale Johannesen 06243d7bf2 Revert the kludge in 76703. I got a clean
bootstrap of FSF-style PPC, so there is some
reason to believe the original bug (which was
never analyzed) has been fixed, probably by
82266.

llvm-svn: 83871
2009-10-12 18:49:00 +00:00
Jeffrey Yasskin 406ac811ab Fix http://llvm.org/PR5160, to let CallbackVHs modify other ValueHandles on the
same Value without breaking things.

llvm-svn: 83861
2009-10-12 17:43:32 +00:00
Dan Gohman a8bacea11b Delete some obsolete declarations.
llvm-svn: 83856
2009-10-12 16:43:44 +00:00
Chris Lattner 40cf28d6eb add some more hooks to the C bindings, patch by Kenneth Uildriks!
llvm-svn: 83821
2009-10-12 04:01:02 +00:00
Edward O'Callaghan 396ed2bcaa Fix LLVM CMake build system so that it may now work on Solaris and AuroraUX.
llvm-svn: 83819
2009-10-12 04:00:11 +00:00
Nick Lewycky c7cf0b223b Fix typo.
llvm-svn: 83780
2009-10-11 18:53:09 +00:00
Nick Lewycky 5246987a76 Fix typo.
llvm-svn: 83779
2009-10-11 18:47:33 +00:00
Chris Lattner d1d23e1949 add a helper for matching "1".
llvm-svn: 83760
2009-10-11 07:51:25 +00:00
Chris Lattner 09677258e5 there is no need to run mem2reg after jump threading at LTO time now.
llvm-svn: 83753
2009-10-11 04:17:33 +00:00
Chris Lattner bb094e12f2 fix a bunch of bad formatting, delete the dead
ConstantInt::TheTrueVal/TheFalseVal members.

llvm-svn: 83752
2009-10-11 04:03:22 +00:00
Chris Lattner 9c382cebc5 add a simple helper method.
llvm-svn: 83745
2009-10-10 23:41:48 +00:00
Chris Lattner 249265de06 add ability for clients of SSAUpdater to find out about the
PHI nodes inserted.

llvm-svn: 83744
2009-10-10 23:15:24 +00:00
Chris Lattner 67cdd8b567 add the ability to get a rewritten value from the middle of a block,
not just at the end.  Add a big comment explaining when this could
be useful (which never happens for jump threading).

llvm-svn: 83741
2009-10-10 23:00:11 +00:00
Chris Lattner e474a8d3a7 rename GetValueInBlock -> GetValueAtEndOfBlock to better reflect
what it does.

llvm-svn: 83740
2009-10-10 22:41:58 +00:00
Chris Lattner 60d4e69c81 Implement an efficient and fully general SSA update mechanism that
works on unstructured CFGs.  This implements PR217, our oldest open PR.

llvm-svn: 83705
2009-10-10 09:04:27 +00:00
Chris Lattner 71db463fcf add some WeakVH::operator='s. Without these, assigning
a Value* to a WeakVH was constructing a temporary WeakVH
(due to the implicit assignment operator).  This avoids
that cost.

llvm-svn: 83704
2009-10-10 08:27:29 +00:00
Chris Lattner a0424f5372 change some static_cast into cast, pointed out by Gabor.
llvm-svn: 83703
2009-10-10 08:01:27 +00:00
Chris Lattner 99e02edef8 add a version of PHINode::getIncomingBlock that takes a raw
Use, to complement the version that takes a use_iterator.

llvm-svn: 83702
2009-10-10 07:42:42 +00:00
Dan Gohman a22f2d8614 Make getMachineNode return a MachineSDNode* instead of a generic SDNode*
since it won't do any folding. This will help avoid some inconvenient
casting.

llvm-svn: 83698
2009-10-10 01:29:16 +00:00
Dan Gohman e919de5acf Replace X86's CanRematLoadWithDispOperand by calling the target-independent
MachineInstr::isInvariantLoad instead, which has the benefit of being
more complete.

llvm-svn: 83696
2009-10-10 00:34:18 +00:00
Dan Gohman 918ec53c64 The ScheduleDAG framework now requires an AliasAnalysis argument, though
it isn't needed in the ScheduleDAGSDNodes schedulers.

llvm-svn: 83691
2009-10-09 23:33:48 +00:00
Dan Gohman 87b02d5bbc Factor out LiveIntervalAnalysis' code to determine whether an instruction
is trivially rematerializable and integrate it into
TargetInstrInfo::isTriviallyReMaterializable. This way, all places that
need to know whether an instruction is rematerializable will get the
same answer.

This enables the useful parts of the aggressive-remat option by
default -- using AliasAnalysis to determine whether a memory location
is invariant, and removes the questionable parts -- rematting operations
with virtual register inputs that may not be live everywhere.

llvm-svn: 83687
2009-10-09 23:27:56 +00:00
Devang Patel df45c7f642 Extract scope information from the variable itself, instead of relying on alloca or llvm.dbg.declare location.
While recording beginning of a function, use scope info from the first location entry instead of just relying on first location entry itself.

llvm-svn: 83684
2009-10-09 22:42:28 +00:00
Jeffrey Yasskin 307c053f2e ExecutionEngine::clearGlobalMappingsFromModule failed to remove reverse
mappings, which could cause errors and assert-failures.  This patch fixes that,
adds a test, and refactors the global-mapping-removal code into a single place.

llvm-svn: 83678
2009-10-09 22:10:27 +00:00
Dan Gohman f4eb6777e5 Add a const qualifier.
llvm-svn: 83677
2009-10-09 22:09:05 +00:00
Dale Johannesen 96a5b87ae2 Use names instead of numbers for some of the magic
constants used in inlining heuristics (especially
those used in more than one file).  No functional change.

llvm-svn: 83675
2009-10-09 21:42:02 +00:00
Dan Gohman dd76bb23d1 Add basic infrastructure and x86 support for preserving MachineMemOperand
information when unfolding memory references.

llvm-svn: 83656
2009-10-09 18:10:05 +00:00
Mikhail Glushenkov fc8809d0ac Raise the limit on built-in plugins in llvmc to 10.
llvm-svn: 83614
2009-10-09 04:15:52 +00:00
Evan Cheng f5970a019e Indentation.
llvm-svn: 83607
2009-10-09 00:57:38 +00:00
Dan Gohman 816fe0a4aa Add the ability to track HasNSW and HasNUW on more kinds of SCEV expressions.
llvm-svn: 83601
2009-10-09 00:10:36 +00:00
Bob Wilson 2a45a65511 Add a SelectionDAG getTargetInsertSubreg convenience function,
similar to getTargetExtractSubreg.

llvm-svn: 83564
2009-10-08 18:49:46 +00:00
Dan Gohman 09984279fd Add a form of addPreserved which takes a string argument, to allow passes
to declare that they preserve other passes without needing to pull in
additional header file or library dependencies. Convert MachineFunctionPass
and CodeGenLICM to make use of this.

llvm-svn: 83555
2009-10-08 17:00:02 +00:00
Chris Lattner 78765deded remove LoopVR pass. According to Nick:
"LoopVR's logic was copied into ScalarEvolution::getUnsignedRange and 
::getSignedRange. Please delete LoopVR."

llvm-svn: 83531
2009-10-08 06:42:44 +00:00
Jim Grosbach c0615aa17f Re-enable register scavenging in Thumb1 by default.
llvm-svn: 83521
2009-10-08 01:46:59 +00:00
Jim Grosbach 456735c54b reverting thumb1 scavenging default due to test failure while I figure out what's up.
llvm-svn: 83501
2009-10-07 22:49:41 +00:00
Chris Lattner 63fe7ff7d9 second half of lazy liveness removal.
llvm-svn: 83500
2009-10-07 22:49:30 +00:00
Jim Grosbach 267fa622fa Enable thumb1 register scavenging by default.
llvm-svn: 83496
2009-10-07 22:26:31 +00:00
Devang Patel 55571bd7bd Extract subprogram and compile unit information from the debug info attached to an instruction.
llvm-svn: 83491
2009-10-07 22:04:08 +00:00
Dan Gohman be8137b0b4 Replace TargetInstrInfo::isInvariantLoad and its target-specific
implementations with a new MachineInstr::isInvariantLoad, which uses
MachineMemOperands and is target-independent. This brings MachineLICM
and other functionality to targets which previously lacked an
isInvariantLoad implementation.

llvm-svn: 83475
2009-10-07 17:38:06 +00:00
Jim Grosbach fa14dd430c Add register-reuse to frame-index register scavenging. When a target uses
a virtual register to eliminate a frame index, it can return that register
and the constant stored there to PEI to track. When scavenging to allocate
for those registers, PEI then tracks the last-used register and value, and
if it is still available and matches the value for the next index, reuses
the existing value rather and removes the re-materialization instructions.
Fancier tracking and adjustment of scavenger allocations to keep more
values live for longer is possible, but not yet implemented and would likely
be better done via a different, less special-purpose, approach to the
problem.

eliminateFrameIndex() is modified so the target implementations can return
the registers they wish to be tracked for reuse.

ARM Thumb1 implements and utilizes the new mechanism. All other targets are
simply modified to adjust for the changed eliminateFrameIndex() prototype.

llvm-svn: 83467
2009-10-07 17:12:56 +00:00
Torok Edwin 822f634d29 Add a comment explaining how DenseMap::insert works, because it is not
intuitive.
It does NOT update the value if the key is already in the map,
it also returns false if the key is already in the map, regardless
if the value matched.

llvm-svn: 83458
2009-10-07 09:23:56 +00:00
Duncan Sands 986742a14f Make getPointerTo return a const PointerType* rather than
an unqualified PointerType* because it seems more correct.

llvm-svn: 83454
2009-10-07 07:35:19 +00:00
Dan Gohman 2a685bdbee INTRINSIC_W_CHAIN and INTRINSIC_VOID do not use MemSDNode. They
may access memory, but they don't carry a MachineMemOperand.

llvm-svn: 83449
2009-10-07 03:00:18 +00:00
Devang Patel 4598eb6214 Add support to handle debug info attached to an instruction.
This is not yet enabled.

llvm-svn: 83400
2009-10-06 18:37:31 +00:00
Dan Gohman e66abdc58f Make LLVMContext's pImpl member const.
llvm-svn: 83393
2009-10-06 17:43:57 +00:00
Chris Lattner a893f5bdf5 remove predicate simplifier, it never got the last bugs beaten
out of it, and jump threading, condprop and gvn are now getting
most of the benefit.  This was approved by Nicholas and Nicolas.

llvm-svn: 83390
2009-10-06 16:59:46 +00:00
Duncan Sands 9ed7b16bf3 Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type.  For example, to get
an i8* use getInt8PtrTy.

llvm-svn: 83379
2009-10-06 15:40:36 +00:00
Devang Patel 051454a16f Update processDebugLoc() so that it can be used to process debug info before and after printing an instruction.
llvm-svn: 83363
2009-10-06 02:19:11 +00:00
Jim Grosbach 2dfb5da6bb In Thumb1, the register scavenger is not always able to use an emergency
spill slot. When frame references are via the frame pointer, they will be
negative, but Thumb1 load/store instructions only allow positive immediate
offsets. Instead, Thumb1 will spill to R12.

llvm-svn: 83336
2009-10-05 22:30:23 +00:00
Dan Gohman e525d9ddc0 Remove an unnnecessary LLVMContext argument in
ConstantFoldLoadThroughGEPConstantExpr.

llvm-svn: 83311
2009-10-05 16:36:26 +00:00
Dan Gohman 5d36b9c447 Fix a name in a comment.
llvm-svn: 83306
2009-10-05 15:23:17 +00:00
Chris Lattner 3a2e503e33 add more type predicates.
llvm-svn: 83296
2009-10-05 05:48:40 +00:00
Chris Lattner cc1cfda9ea add some helper functions.
llvm-svn: 83293
2009-10-05 05:05:57 +00:00
Chris Lattner cb08fb7b83 remove llvm-db: it is completely broken and if anyone wants to do a debugger,
they should not base it on llvm-db (which not following almost any "best practices").

llvm-svn: 83288
2009-10-05 02:29:51 +00:00
Owen Anderson b5049bebb3 Do away with the strange use of BitVectors in SSI, and just use normal sets. This makes the code much more C++/LLVM-ish.
llvm-svn: 83286
2009-10-04 18:49:55 +00:00
Evan Cheng cd4c17aeaf Rename enum NumOccurrences to NumOccurrencesFlag since there is a member named NumOccurrences.
llvm-svn: 83273
2009-10-04 05:25:42 +00:00
Lang Hames 920301ecc5 Renamed MachineInstrIndex to LiveIndex.
llvm-svn: 83254
2009-10-03 04:21:37 +00:00
Mike Stump 70cb67fcf4 Expand api out in the usual inserter way, though, I do have a
question, can we get rid of the BasicBlock versions of all inserters
and use Head == 0 to indicate the old case when GetInsertBlock == 0?

llvm-svn: 83216
2009-10-01 22:08:58 +00:00
Jim Grosbach 7dbc2652b9 remove trailing whitespace
llvm-svn: 83213
2009-10-01 20:45:06 +00:00
Dan Gohman 8cf7907ba4 Don't use identifiers that start with an underscore followed
by a capital letter, which invokes undefined behavior.

llvm-svn: 83206
2009-10-01 17:39:52 +00:00
Douglas Gregor f99626ed11 Teach CMake to look for bidirectional_iterator, iterator, forward_iterator, uint64_t, and u_int64_t, from Yonggang Luo
llvm-svn: 83203
2009-10-01 17:25:36 +00:00
Evan Cheng 46668e09be Add instruction flags: hasExtraSrcRegAllocReq and hasExtraDefRegAllocReq. When
set, these flags indicate the instructions source / def operands have special
register allocation requirement that are not captured in their register classes.
Post-allocation passes (e.g. post-alloc scheduler) should not change their
allocations. e.g. ARM::LDRD require the two definitions to be allocated
even / odd register pair.

llvm-svn: 83196
2009-10-01 08:21:18 +00:00
Chris Lattner 5f3cc06cd2 remove the GVNPRE pass. It has been subsumed by the GVN pass.
Ok'd by Owen.

llvm-svn: 83193
2009-10-01 02:18:36 +00:00
Devang Patel 34986f12e6 Add another MDNode into DebugLocTuple. This will be used to keep track of inlined functions.
llvm-svn: 83190
2009-10-01 01:15:28 +00:00
Devang Patel 4dbca6dfd4 If location info is attached with an instruction then keep track of alloca slots used by a variable. This info will be used by AsmPrinter to emit debug info for variables.
llvm-svn: 83189
2009-10-01 01:03:26 +00:00
Devang Patel e0709cfc92 Use MachineInstr as an processDebugLoc() argument.
This will allow processDebugLoc() to handle scopes for DWARF debug info. 

llvm-svn: 83183
2009-09-30 23:12:50 +00:00
Devang Patel 3256c751f5 Use MDNode * directly as an RecordSourceLine() argument.
llvm-svn: 83182
2009-09-30 22:51:28 +00:00
Devang Patel 5c13c2d392 Remove dead code.
llvm-svn: 83181
2009-09-30 22:43:52 +00:00
Devang Patel a49be76f43 Add isFOO() helpers. Fix getDirectory() and getFilename() for DIScope.
llvm-svn: 83180
2009-09-30 22:34:41 +00:00
Bob Wilson b2120755a2 Use OutStreamer.SwitchSection instead of writing out textual section directives.
Add a new TargetLoweringObjectFileMachO::getConstTextCoalSection method to
get access to that section.

llvm-svn: 83178
2009-09-30 22:25:37 +00:00
Bob Wilson b633d7a665 Add a new virtual EmitStartOfAsmFile method to the AsmPrinter and use this
to emit target-specific things at the beginning of the asm output.  This
fixes a problem for PPC, where the text sections are not being kept together
as expected.  The base class doInitialization code calls DW->BeginModule()
which emits a bunch of DWARF section directives.  The PPC doInitialization
code then emits all the TEXT section directives, with the intention that they
will be kept together. But as I understand it, the Darwin assembler treats
the default TEXT section as a special case and moves it to the beginning of
the file, which means that all those DWARF sections are in the middle of
the text.  With this change, the EmitStartOfAsmFile hook is called before
the DWARF section directives are emitted, so that all the PPC text section
directives come out right at the beginning of the file.

llvm-svn: 83176
2009-09-30 22:06:26 +00:00
Reid Kleckner 8ff5c19ebd Fix integer overflow in instruction scheduling. This can happen if we have
basic blocks that are so long that their size overflows a short.

Also assert that overflow does not happen in the future, as requested by Evan.

This fixes PR4401.

llvm-svn: 83159
2009-09-30 20:15:38 +00:00
Devang Patel 7ba3c0906b Silence unused variable warning.
llvm-svn: 83151
2009-09-30 17:13:41 +00:00
Evan Cheng f305ead1cc Add a target hook to add pre- post-regalloc scheduling passes.
llvm-svn: 83144
2009-09-30 08:49:50 +00:00
Devang Patel c2105298cc Simplify.
llvm-svn: 83123
2009-09-30 00:14:40 +00:00
David Goodwin 17199b56b0 Remove -post-RA-schedule flag and add a TargetSubtarget method to enable post-register-allocation scheduling. By default it is off. For ARM, enable/disable with -mattr=+/-postrasched. Enable by default for cortex-a8.
llvm-svn: 83122
2009-09-30 00:10:16 +00:00
Douglas Gregor aa0beea9a1 Forward-declare ValueSymbolTable so that SymbolTableListTraits.h can be parsed by itself
llvm-svn: 83121
2009-09-30 00:08:25 +00:00
Mike Stump 14cf8ecf0b Add a way for a frontend to generate more complex dwarf location
information.  This allows arbitrary code involving DW_OP_plus_uconst
and DW_OP_deref.  The scheme allows for easy extention to include,
any, or all of the DW_OP_ opcodes.  I thought about just exposing all
of them, but, wasn't sure if people wanted the dwarf opcodes exposed
in the api.  Is that a layering violation?

With this scheme, the entire existing block scheme used by llvm-gcc
can be switched over to the new scheme.  I think that would be
cleaner, as then the compiler specific bits are not present in llvm
proper.  Before the old code can be yanked however, similar code in
clang would have to be removed.

Next up, more testing.

llvm-svn: 83120
2009-09-30 00:08:22 +00:00
Devang Patel b4034364d6 Add removeMD().
llvm-svn: 83107
2009-09-29 20:42:25 +00:00
Devang Patel 5bf7a49fd7 Only one custom meadata of each kind can be attached with an instruction.
llvm-svn: 83105
2009-09-29 20:30:57 +00:00
Devang Patel b296942f6d Remove std::string uses from DebugInfo interface.
llvm-svn: 83083
2009-09-29 18:40:58 +00:00
Devang Patel 73e8d43588 Create empty StringRef is incoming cstring is NULL.
llvm-svn: 83082
2009-09-29 18:39:56 +00:00
Devang Patel ba4a6fdd17 Parse custom metadata attached with an instruction.
llvm-svn: 83033
2009-09-29 00:01:14 +00:00
Dan Gohman f919bd6651 Add C API calls for building FNeg operations. Patch by KS Sreeram!
llvm-svn: 83021
2009-09-28 21:51:41 +00:00
Devang Patel 2d85eef974 s/class Metadata/class MetadataContext/g
llvm-svn: 83019
2009-09-28 21:41:20 +00:00
Devang Patel b1a4477f1f Do not use global typedef for MDKindID.
llvm-svn: 83016
2009-09-28 21:14:55 +00:00
Devang Patel 1709e8c084 Remove unnecessary include.
llvm-svn: 83013
2009-09-28 21:06:38 +00:00
Jakob Stoklund Olesen dc9efe8078 Introduce the TargetInstrInfo::KILL machine instruction and get rid of the
unused DECLARE instruction.

KILL is not yet used anywhere, it will replace TargetInstrInfo::IMPLICIT_DEF
in the places where IMPLICIT_DEF is just used to alter liveness of physical
registers.

llvm-svn: 83006
2009-09-28 20:32:26 +00:00
Dan Gohman 9a7320c711 Convert LoopSimplify and LoopExtractor from FunctionPass to LoopPass.
llvm-svn: 82990
2009-09-28 14:37:51 +00:00
Mikhail Glushenkov efc9763468 Add a way to query the number of input files.
llvm-svn: 82957
2009-09-28 01:16:42 +00:00
Dan Gohman 4dbb301f17 Move the dominator verification code out of special code embedded within
the PassManager code into a regular verifyAnalysis method.

Also, reorganize loop verification. Make the LoopPass infrastructure
call verifyLoop as needed instead of having LoopInfo::verifyAnalysis
check every loop in the function after each looop pass. Add a new
command-line argument, -verify-loop-info, to enable the expensive
full checking.

llvm-svn: 82952
2009-09-28 00:27:48 +00:00
Dan Gohman 277e767578 Extend the StartPassTimer and StopPassTimer functions so that the
code that stops the timer doesn't have to search to find the timer
object before it stops the timer. This avoids a lock acquisition
and a few other things done with the timer running.

llvm-svn: 82949
2009-09-28 00:07:05 +00:00
Dan Gohman adde5dfde2 Extract the code for inserting a loop into the loop queue into
a separate function.

llvm-svn: 82946
2009-09-27 23:49:43 +00:00
Dan Gohman 5e8ba5d514 Extract the code for releasing a pass into a separate function, and
tidy it up a little.

llvm-svn: 82944
2009-09-27 23:38:27 +00:00
Nick Lewycky 28a5f25d87 Round out the API for the new optimization flags.
llvm-svn: 82930
2009-09-27 21:33:04 +00:00
Tilmann Scheller 336e2bd91b Use explicit structs instead of std::pair to map callee saved regs to spill slots.
llvm-svn: 82909
2009-09-27 17:58:47 +00:00
Dan Gohman 2115154d44 Remove a redundant assert.
llvm-svn: 82907
2009-09-27 17:48:37 +00:00
Dan Gohman bb85dd6f33 Add dominates and releaseMemory member functions to PostDominatorTree.
llvm-svn: 82904
2009-09-27 17:39:12 +00:00
Dan Gohman e28bd65aed Clarify a comment.
llvm-svn: 82902
2009-09-27 15:41:19 +00:00
Dan Gohman f39a3a9288 Add a properlyDominates member function to ScalarEvolution.
llvm-svn: 82898
2009-09-27 15:26:03 +00:00
Nick Lewycky 42fb7452df Instruction::clone does not need to take an LLVMContext&. Remove that and
update all the callers.

llvm-svn: 82889
2009-09-27 07:38:41 +00:00
Chris Lattner 37d8015dc1 remove support for "NoSub" from regex. It seems like a minor optimization
and makes the API more annoying.  Add a Regex::getNumMatches() method.

llvm-svn: 82877
2009-09-26 21:27:04 +00:00
Duncan Sands 129de48982 For the NSWSub support in the builder to actually be useable,
there need to be corresponding changes to the constant folders,
done in this patch.

llvm-svn: 82862
2009-09-26 15:35:35 +00:00
Duncan Sands 8c0fb28992 Add methods for creating NSW subtraction, as already exists
for addition.

llvm-svn: 82860
2009-09-26 15:21:48 +00:00
Dan Gohman 534ad04302 Add a comment describing natural loops.
llvm-svn: 82859
2009-09-26 15:09:53 +00:00
Dan Gohman 394468dc8e Rename ConstantFP's getInf to getInfinity.
llvm-svn: 82823
2009-09-25 23:40:21 +00:00
Dan Gohman 5a6b11cb71 Move MachineMemOperand::getAlignment out of line, to avoid needing
MathExtras.h in MachineMemOperand.h.

llvm-svn: 82822
2009-09-25 23:33:20 +00:00
Dan Gohman feb5021134 Add a ConstantFP::getInf utility function for creating infinity ConstantFPs.
llvm-svn: 82818
2009-09-25 23:00:48 +00:00
Jeffrey Yasskin 14a5cc54e5 Fix a compile failure introduced by r82675 on MinGW which doesn't have
setenv().  This patch just disables the test rather than getting putenv() to
work.  Thanks to Sandeep Patel for reporting the problem.

llvm-svn: 82797
2009-09-25 21:07:20 +00:00
Dan Gohman 48b185d6f7 Improve MachineMemOperand handling.
- Allocate MachineMemOperands and MachineMemOperand lists in MachineFunctions.
   This eliminates MachineInstr's std::list member and allows the data to be
   created by isel and live for the remainder of codegen, avoiding a lot of
   copying and unnecessary translation. This also shrinks MemSDNode.
 - Delete MemOperandSDNode. Introduce MachineSDNode which has dedicated
   fields for MachineMemOperands.
 - Change MemSDNode to have a MachineMemOperand member instead of its own
   fields with the same information. This introduces some redundancy, but
   it's more consistent with what MachineInstr will eventually want.
 - Ignore alignment when searching for redundant loads for CSE, but remember
   the greatest alignment.

Target-specific code which previously used MemOperandSDNodes with generic
SDNodes now use MemIntrinsicSDNodes, with opcodes in a designated range
so that the SelectionDAG framework knows that MachineMemOperand information
is available.

llvm-svn: 82794
2009-09-25 20:36:54 +00:00
Dan Gohman 32f71d714b Rename getTargetNode to getMachineNode, for consistency with the
naming scheme used in SelectionDAG, where there are multiple kinds
of "target" nodes, but "machine" nodes are nodes which represent
a MachineInstr.

llvm-svn: 82790
2009-09-25 18:54:59 +00:00
Victor Hernandez e6ff7662b6 Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
llvm-svn: 82784
2009-09-25 18:11:52 +00:00
Bob Wilson d60367c198 pr4926: ARM requires the stack pointer to be aligned, even for leaf functions.
For the AAPCS ABI, SP must always be 4-byte aligned, and at any "public
interface" it must be 8-byte aligned.  For the older ARM APCS ABI, the stack
alignment is just always 4 bytes.  For X86, we currently align SP at
entry to a function (e.g., to 16 bytes for Darwin), but no stack alignment
is needed at other times, such as for a leaf function.

After discussing this with Dan, I decided to go with the approach of adding
a new "TransientStackAlignment" field to TargetFrameInfo.  This value
specifies the stack alignment that must be maintained even in between calls.
It defaults to 1 except for ARM, where it is 4.  (Some other targets may
also want to set this if they have similar stack requirements. It's not
currently required for PPC because it sets targetHandlesStackFrameRounding
and handles the alignment in target-specific code.) The existing StackAlignment
value specifies the alignment upon entry to a function, which is how we've
been using it anyway.

llvm-svn: 82767
2009-09-25 14:41:49 +00:00
Bob Wilson 0bb2a929a2 Update the description of MachineFrameInfo's OffsetAdjustment. The value of
this adjustment does not change the direction or the signs of the object
offsets, and the details of the offset calculations can be target-specific.
Also mention that for most targets this value is only used to generate debug
info.

llvm-svn: 82750
2009-09-25 05:30:55 +00:00
Dan Gohman ebdfe4af62 Add a version of dumpr() that has a SelectionDAG* argument.
llvm-svn: 82742
2009-09-25 00:34:34 +00:00
Chris Lattner f08d2db928 add and document regex support for FileCheck. You can now do stuff like:
; CHECK: movl {{%e[a-z][xi]}}, %eax

or whatever.

llvm-svn: 82717
2009-09-24 21:47:32 +00:00
David Goodwin bf97147a7e Make the end-of-itinerary mark explicit. Some cleanup.
llvm-svn: 82709
2009-09-24 20:22:50 +00:00
Chris Lattner 1ce83629df tidy up, fix a memory leak in Regex::isValid
llvm-svn: 82707
2009-09-24 20:15:51 +00:00
Victor Hernandez 46cd467310 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.

llvm-svn: 82694
2009-09-24 17:47:49 +00:00
Evan Cheng a21aac3811 Clean up LiveVariables and change how it deals with partial updates and kills. This also eliminate the horrible check which scan forward to the end of the basic block. It should be faster and more accurate.
llvm-svn: 82676
2009-09-24 02:15:22 +00:00
Dan Gohman 99bdae2992 Spruce up some comments.
llvm-svn: 82655
2009-09-23 21:06:36 +00:00
Dan Gohman 08c0a95ac6 Rename several variables from EVT to more descriptive names, now that EVT
is also the name of their type, as declarations like "EVT EVT" look
really odd.

llvm-svn: 82654
2009-09-23 21:02:20 +00:00
Dan Gohman 2366ffd2cb Add an EVT::getStoreSize function, like getStoreSizeInBits but in bytes.
llvm-svn: 82653
2009-09-23 20:59:10 +00:00
Dan Gohman 49f271afb3 Correct a comment.
llvm-svn: 82648
2009-09-23 20:40:16 +00:00
Devang Patel add586526e Do not leave behind metadata while cloning an instruction.
llvm-svn: 82638
2009-09-23 18:32:25 +00:00
Devang Patel e4e8181111 s/*Location/*DebugLocation/g
llvm-svn: 82635
2009-09-23 17:20:43 +00:00
John McCall 0110327ae3 Make the type traits for a const pointer defer to those for a unqualified
pointer, instead of providing independent values modelled on the default
implementation.

llvm-svn: 82620
2009-09-23 06:53:51 +00:00
Evan Cheng 262f86ed90 Fix PR5024. LiveVariables physical register defs should *commit* only after all
of the defs are processed.
Also fix a implicit_def propagation bug: a implicit_def of a physical register
should be applied to uses of the sub-registers.

llvm-svn: 82616
2009-09-23 06:28:31 +00:00
Dan Gohman c0353bfff5 Give MachineMemOperand an operator<<, factoring out code from
two different places for printing MachineMemOperands.

Drop the virtual from Value::dump and instead give Value a
protected virtual hook that can be overridden by subclasses
to implement custom printing. This lets printing be more
consistent, and simplifies printing of PseudoSourceValue
values.

llvm-svn: 82599
2009-09-23 01:33:16 +00:00
Devang Patel 320a1c4083 Add SetLocation() to allow IRBuilder user to set location info for an instruction already created.
llvm-svn: 82570
2009-09-22 20:56:31 +00:00
Devang Patel 276b02b325 Check exisiting dbg MDKind first.
llvm-svn: 82568
2009-09-22 20:54:13 +00:00
Daniel Dunbar 7e3aa3f68c Revert "Don't allow formatted_ostream to be unbuffered, even if its underlying
buffer", while we work out a solution.

Dan convinced me that making debugging annoying for him is worse than 10x being
slower for me. :)

llvm-svn: 82553
2009-09-22 16:33:42 +00:00
Evan Cheng 0570bbbd0f Forgot this.
llvm-svn: 82536
2009-09-22 08:47:59 +00:00
Daniel Dunbar 7b446a001d Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
ExecuteAndWait.

llvm-svn: 82522
2009-09-22 04:44:56 +00:00
Daniel Dunbar 78faee0664 Switch FoldingSet::AddString to StringRef based API.
- This also fixes a dereference of std::string::end, which makes MSVC unhappy and was causing all the static analyzer clang tests to fail.

llvm-svn: 82517
2009-09-22 03:34:53 +00:00
Daniel Dunbar 0356483539 Switch DIDescriptor to use a TrackingVH. - This makes it much safer to work with debug info, since it was extraordinarily easy to have dangling pointers thanks to MDNode uniquing.
llvm-svn: 82507
2009-09-22 02:03:18 +00:00
Daniel Dunbar 70d4fb0d97 Add a TrackingVH value handle.
This is designed for tracking a value even when it might move (like WeakVH), but it is an error to delete the referenced value (unlike WeakVH0. TrackingVH is templated like AssertingVH on the tracked Value subclass, it is an error to RAUW a tracked value to an incompatible type.

For implementation reasons the latter error is only diagnosed on accesses to a mis-RAUWed TrackingVH, because we don't want a virtual interface in a templated class.

The former error is also only diagnosed on access, so that clients are allowed to delete a tracked value, as long as they don't use it. This makes it easier for the client to reason about destruction.

llvm-svn: 82506
2009-09-22 02:02:33 +00:00