Commit Graph

10443 Commits

Author SHA1 Message Date
Eric Christopher
3a8ff4c8b6 More warnings patrol: Another unused argument and more implicit
conversions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84382 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 23:56:18 +00:00
Nick Lewycky
3fc35c594c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 23:52:26 +00:00
Daniel Dunbar
9bd34602fb Move UnescapeString to a static function for its sole client; its inefficient and broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:43:42 +00:00
Daniel Dunbar
ca107c5c18 Remove llvm::EscapeString, raw_ostream::write_escaped is much faster.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:43:29 +00:00
Daniel Dunbar
522b113a75 Add raw_ostream::write_escaped, for writing escaped strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:43:08 +00:00
Mikhail Glushenkov
0a22fb6664 First draft of the OptionPreprocessor.
More to follow...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 20:09:29 +00:00
Daniel Dunbar
4dee7fd2c2 Move StringMap's string has function into StringExtras.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84344 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 18:21:06 +00:00
Evan Cheng
491f54f1fd Distinquish stack slots from other stack objects. They (and fixed objects) get FixedStack PseudoSourceValues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84326 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 09:20:14 +00:00
Evan Cheng
a8e6542610 Re-arrange some fields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 08:57:09 +00:00
Daniel Dunbar
985577ec13 Add another required #include for freestanding .h files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 08:12:36 +00:00
Evan Cheng
6553155172 Revert 84315 for now. Re-thinking the patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 07:53:04 +00:00
Evan Cheng
bf125583f8 Rename getFixedStack to getStackObject. The stack objects represented are not
necessarily fixed. Only those will negative frame indices are "fixed."


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84315 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 06:22:26 +00:00
Daniel Dunbar
ca24a695e7 Add required #includes for freestanding .h files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84302 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 03:28:07 +00:00
Victor Hernandez
a276c603b8 Remove MallocInst from LLVM Instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 01:18:07 +00:00
Dan Gohman
b68d67caf3 Add a splice member function which accepts a range instead of a
single iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84294 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 00:28:24 +00:00
Victor Hernandez
13ad5aaaff 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84292 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 00:00:19 +00:00
Evan Cheng
fa16354e03 Change createPostRAScheduler so it can be turned off at llc -O1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 21:06:15 +00:00
Evan Cheng
bf57b52ba4 Add a CodeGenOpt::Less level to match -O1. It'll be used by clients which do not want post-regalloc scheduling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 21:02:20 +00:00
Duncan Sands
ed90342d8a Strip trailing white space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 15:20:13 +00:00
Chris Lattner
cc4287a374 Add half precision floating point support (float16) to APFloat,
patch by Peter Johnson! (PR5195)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 02:13:51 +00:00
Chris Lattner
a43fc3452b add haiku support, patch by Paul Davey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84238 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 02:06:30 +00:00
Daniel Dunbar
7eb85194f2 Minor formatting tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:58:15 +00:00
Daniel Dunbar
1253a6fa3b MC: Switch assembler API to using MCExpr instead of MCValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84234 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:58:03 +00:00
Daniel Dunbar
e00b011e6a MC: Remove unneeded context argument to MCExpr::Evaluate*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:57:52 +00:00
Daniel Dunbar
7c3600de94 MC: Move assembler variable values from MCContext to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84229 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:33:57 +00:00
Daniel Dunbar
e579849652 MC: Switch MCContext value table to storing MCExprs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84228 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:33:11 +00:00
Victor Hernandez
2491ce0353 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 20:14:52 +00:00
Jakob Stoklund Olesen
6ad8c84d70 Move Blackfin intrinsics into the Target/Blackfin directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 18:50:52 +00:00
Jakob Stoklund Olesen
0383606b65 Clean up TargetIntrinsicInfo API. Add pure virtual methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84192 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-15 18:49:26 +00:00
Eric Christopher
085b9c034f One more iteration here and a yet better way to solve it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 22:14:18 +00:00
Eric Christopher
7a8a05b340 Fix the unused argument problem here a different way - cast to void.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 21:45:49 +00:00
Dan Gohman
d10e68c2cb Delete bogus semicolons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 20:39:01 +00:00
Eric Christopher
41b5adf202 Remove a bunch of unused arguments from functions, silencing a
warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84130 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 20:28:33 +00:00
Devang Patel
5db2c52270 Add copyMD to copy metadata from one instruction to another instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 17:02:49 +00:00
Duncan Sands
b01bbdcc1a 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 16:11:37 +00:00
Edward O'Callaghan
5da60469f9 Undo pthread patch from rev. 83930 & 83823. Credit to Paul Davey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84083 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-14 11:12:33 +00:00
Dan Gohman
68cf03a314 Fix resetCachedCostInfo to reset all of the cost information, instead of
just the NumBlocks field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 23:36:36 +00:00
Devang Patel
1619dc3b9e s/DebugLoc.CompileUnit/DebugLoc.Scope/g
s/DebugLoc.InlinedLoc/DebugLoc.InlinedAtLoc/g



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84054 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 23:28:53 +00:00
Douglas Gregor
404aa26b26 Add is_same type trait
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84029 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 21:17:00 +00:00
Duncan Sands
3a66a68b0c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84027 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 21:04:12 +00:00
Dale Johannesen
4360298d2b 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 20:46:56 +00:00
Dan Gohman
e7f0ed5ace 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 19:58:07 +00:00
Ted Kremenek
9688079e07 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 19:08:10 +00:00
Dan Gohman
e4aeec003f Move the InlineCost code from Transforms/Utils to Analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:30:07 +00:00
Dan Gohman
9b39cf5ac8 Start refactoring the inline cost estimation code so that it can be used
for purposes other than inlining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:24:11 +00:00
Jeffrey Yasskin
4c5b23b24f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:42:08 +00:00
Devang Patel
740d0db812 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83977 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:00:54 +00:00
Duncan Sands
3653e1baae The eh.exception intrinsic only reads from memory, it doesn't
write to it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83963 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 09:24:02 +00:00
Nick Lewycky
cc271861da Add new "memory use marker" intrinsics. These indicate lifetimes and invariant
sections of memory objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 07:03:23 +00:00
Chris Lattner
c411c4be1e remove dead header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83943 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 05:33:26 +00:00
Dan Gohman
cbc7cc63b6 Add a ceilLogBase2 function to APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 01:49:02 +00:00
Edward O'Callaghan
2b7b37a4c9 Regenerate configure for rev. 83823 putback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 01:01:38 +00:00
Devang Patel
6e37f4878b Enable "debug info attached to an instruction" mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 23:22:09 +00:00
Dale Johannesen
3a6b9eb868 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83871 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 18:49:00 +00:00
Jeffrey Yasskin
6a9291ad55 Fix http://llvm.org/PR5160, to let CallbackVHs modify other ValueHandles on the
same Value without breaking things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83861 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 17:43:32 +00:00
Dan Gohman
465193a0a8 Delete some obsolete declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 16:43:44 +00:00
Chris Lattner
885dffc391 add some more hooks to the C bindings, patch by Kenneth Uildriks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 04:01:02 +00:00
Edward O'Callaghan
c6cf5fe595 Fix LLVM CMake build system so that it may now work on Solaris and AuroraUX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83819 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 04:00:11 +00:00
Nick Lewycky
706945764a Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83780 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 18:53:09 +00:00
Nick Lewycky
2bc6b9acd6 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83779 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 18:47:33 +00:00
Chris Lattner
f7a60d28a1 add a helper for matching "1".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83760 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 07:51:25 +00:00
Chris Lattner
1bd8d0a00b there is no need to run mem2reg after jump threading at LTO time now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83753 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 04:17:33 +00:00
Chris Lattner
2c5060dbde fix a bunch of bad formatting, delete the dead
ConstantInt::TheTrueVal/TheFalseVal members.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83752 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 04:03:22 +00:00
Chris Lattner
0bef562ea2 add a simple helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 23:41:48 +00:00
Chris Lattner
f5a1fb6b24 add ability for clients of SSAUpdater to find out about the
PHI nodes inserted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 23:15:24 +00:00
Chris Lattner
1a8d4de397 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83741 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 23:00:11 +00:00
Chris Lattner
5fb107287f rename GetValueInBlock -> GetValueAtEndOfBlock to better reflect
what it does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 22:41:58 +00:00
Chris Lattner
93f3bcf7f3 Implement an efficient and fully general SSA update mechanism that
works on unstructured CFGs.  This implements PR217, our oldest open PR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 09:04:27 +00:00
Chris Lattner
f6811274e1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 08:27:29 +00:00
Chris Lattner
fc61aeff2c change some static_cast into cast, pointed out by Gabor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 08:01:27 +00:00
Chris Lattner
ceaa457a9d add a version of PHINode::getIncomingBlock that takes a raw
Use, to complement the version that takes a use_iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 07:42:42 +00:00
Dan Gohman
c81b783e27 Make getMachineNode return a MachineSDNode* instead of a generic SDNode*
since it won't do any folding. This will help avoid some inconvenient
casting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83698 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 01:29:16 +00:00
Dan Gohman
3731bc026c Replace X86's CanRematLoadWithDispOperand by calling the target-independent
MachineInstr::isInvariantLoad instead, which has the benefit of being
more complete.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83696 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 00:34:18 +00:00
Dan Gohman
98976e4dcd The ScheduleDAG framework now requires an AliasAnalysis argument, though
it isn't needed in the ScheduleDAGSDNodes schedulers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83691 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 23:33:48 +00:00
Dan Gohman
a70dca156f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83687 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 23:27:56 +00:00
Devang Patel
ac1ceb3dd3 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83684 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 22:42:28 +00:00
Jeffrey Yasskin
c89d27a440 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 22:10:27 +00:00
Dan Gohman
769b7f8953 Add a const qualifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83677 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 22:09:05 +00:00
Dale Johannesen
bdb984bc27 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 21:42:02 +00:00
Dan Gohman
91e69c3715 Add basic infrastructure and x86 support for preserving MachineMemOperand
information when unfolding memory references.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 18:10:05 +00:00
Mikhail Glushenkov
17d70ab4fe Raise the limit on built-in plugins in llvmc to 10.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 04:15:52 +00:00
Evan Cheng
48bff92b60 Indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 00:57:38 +00:00
Dan Gohman
3645b01002 Add the ability to track HasNSW and HasNUW on more kinds of SCEV expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 00:10:36 +00:00
Bob Wilson
5fcbf0d26e Add a SelectionDAG getTargetInsertSubreg convenience function,
similar to getTargetExtractSubreg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83564 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 18:49:46 +00:00
Dan Gohman
8a261e44f7 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 17:00:02 +00:00
Chris Lattner
8ef27511e3 remove LoopVR pass. According to Nick:
"LoopVR's logic was copied into ScalarEvolution::getUnsignedRange and 
::getSignedRange. Please delete LoopVR."



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83531 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 06:42:44 +00:00
Jim Grosbach
65c58daa8b Re-enable register scavenging in Thumb1 by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83521 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 01:46:59 +00:00
Jim Grosbach
9f3a559dff reverting thumb1 scavenging default due to test failure while I figure out what's up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 22:49:41 +00:00
Chris Lattner
831a2bba04 second half of lazy liveness removal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 22:49:30 +00:00
Jim Grosbach
bafa3d9f6a Enable thumb1 register scavenging by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83496 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 22:26:31 +00:00
Devang Patel
beab41b874 Extract subprogram and compile unit information from the debug info attached to an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83491 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 22:04:08 +00:00
Dan Gohman
e33f44cfc5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83475 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 17:38:06 +00:00
Jim Grosbach
b58f498f75 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 17:12:56 +00:00
Torok Edwin
127445818e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83458 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 09:23:56 +00:00
Duncan Sands
83ed76869e Make getPointerTo return a const PointerType* rather than
an unqualified PointerType* because it seems more correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83454 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 07:35:19 +00:00
Dan Gohman
ad29b756e0 INTRINSIC_W_CHAIN and INTRINSIC_VOID do not use MemSDNode. They
may access memory, but they don't carry a MachineMemOperand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83449 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 03:00:18 +00:00
Devang Patel
60b35bd8ec Add support to handle debug info attached to an instruction.
This is not yet enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83400 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 18:37:31 +00:00
Dan Gohman
82a47e9118 Make LLVMContext's pImpl member const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83393 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 17:43:57 +00:00
Chris Lattner
7963e15951 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83390 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 16:59:46 +00:00
Duncan Sands
ac53a0b272 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 15:40:36 +00:00
Devang Patel
af0e272683 Update processDebugLoc() so that it can be used to process debug info before and after printing an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 02:19:11 +00:00
Jim Grosbach
540b05d227 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 22:30:23 +00:00
Dan Gohman
c6f69e94fa Remove an unnnecessary LLVMContext argument in
ConstantFoldLoadThroughGEPConstantExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 16:36:26 +00:00
Dan Gohman
e2d0af4d78 Fix a name in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83306 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 15:23:17 +00:00
Chris Lattner
5f7962c1b6 add more type predicates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83296 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 05:48:40 +00:00
Chris Lattner
375c032468 add some helper functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 05:05:57 +00:00
Chris Lattner
dbf75e813e 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").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 02:29:51 +00:00
Owen Anderson
08993acada Do away with the strange use of BitVectors in SSI, and just use normal sets. This makes the code much more C++/LLVM-ish.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83286 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-04 18:49:55 +00:00
Evan Cheng
d113c6b601 Rename enum NumOccurrences to NumOccurrencesFlag since there is a member named NumOccurrences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-04 05:25:42 +00:00
Lang Hames
cc3b0650f1 Renamed MachineInstrIndex to LiveIndex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 04:21:37 +00:00
Mike Stump
e4250396ea 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?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83216 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 22:08:58 +00:00
Jim Grosbach
95923d70d9 remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 20:45:06 +00:00
Dan Gohman
835b142edd Don't use identifiers that start with an underscore followed
by a capital letter, which invokes undefined behavior.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83206 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 17:39:52 +00:00
Douglas Gregor
9c091a4846 Teach CMake to look for bidirectional_iterator, iterator, forward_iterator, uint64_t, and u_int64_t, from Yonggang Luo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 17:25:36 +00:00
Evan Cheng
799d697bf8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 08:21:18 +00:00
Chris Lattner
99be299edb remove the GVNPRE pass. It has been subsumed by the GVN pass.
Ok'd by Owen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 02:18:36 +00:00
Devang Patel
a1434045c3 Add another MDNode into DebugLocTuple. This will be used to keep track of inlined functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83190 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 01:15:28 +00:00
Devang Patel
75549f4444 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 01:03:26 +00:00
Devang Patel
b0fdedb3fd Use MachineInstr as an processDebugLoc() argument.
This will allow processDebugLoc() to handle scopes for DWARF debug info. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 23:12:50 +00:00
Devang Patel
3d910835fc Use MDNode * directly as an RecordSourceLine() argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 22:51:28 +00:00
Devang Patel
a63710124a Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 22:43:52 +00:00
Devang Patel
ecbeb1a490 Add isFOO() helpers. Fix getDirectory() and getFilename() for DIScope.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83180 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 22:34:41 +00:00
Bob Wilson
29e066965f Use OutStreamer.SwitchSection instead of writing out textual section directives.
Add a new TargetLoweringObjectFileMachO::getConstTextCoalSection method to
get access to that section.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83178 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 22:25:37 +00:00
Bob Wilson
812209a58c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 22:06:26 +00:00
Reid Kleckner
c277ab08a2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 20:15:38 +00:00
Devang Patel
69cc57c325 Silence unused variable warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 17:13:41 +00:00
Evan Cheng
629adde699 Add a target hook to add pre- post-regalloc scheduling passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83144 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 08:49:50 +00:00
Devang Patel
fdc826f6e8 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83123 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 00:14:40 +00:00
David Goodwin
0dad89fa94 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83122 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 00:10:16 +00:00
Douglas Gregor
6deec348a8 Forward-declare ValueSymbolTable so that SymbolTableListTraits.h can be parsed by itself
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83121 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 00:08:25 +00:00
Mike Stump
3e4c9bdb67 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 00:08:22 +00:00
Devang Patel
74da40a96f Add removeMD().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 20:42:25 +00:00
Devang Patel
58a230a491 Only one custom meadata of each kind can be attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83105 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 20:30:57 +00:00
Devang Patel
5ccdd10b1a Remove std::string uses from DebugInfo interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83083 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 18:40:58 +00:00
Devang Patel
1e9a727f10 Create empty StringRef is incoming cstring is NULL.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83082 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 18:39:56 +00:00
Devang Patel
0475c9170e Parse custom metadata attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83033 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 00:01:14 +00:00
Dan Gohman
d0c5a292aa Add C API calls for building FNeg operations. Patch by KS Sreeram!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 21:51:41 +00:00
Devang Patel
e30e678865 s/class Metadata/class MetadataContext/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 21:41:20 +00:00
Devang Patel
a2148402ce Do not use global typedef for MDKindID.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 21:14:55 +00:00
Devang Patel
6b0901ecf1 Remove unnecessary include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 21:06:38 +00:00
Jakob Stoklund Olesen
26207e5bf1 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 20:32:26 +00:00
Dan Gohman
d84db11333 Convert LoopSimplify and LoopExtractor from FunctionPass to LoopPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 14:37:51 +00:00
Mikhail Glushenkov
ad981bfbcc Add a way to query the number of input files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 01:16:42 +00:00
Dan Gohman
9450b0e1a6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 00:27:48 +00:00
Dan Gohman
5c12adaa8b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 00:07:05 +00:00
Dan Gohman
3069b3193d Extract the code for inserting a loop into the loop queue into
a separate function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 23:49:43 +00:00
Dan Gohman
27a8fb8a54 Extract the code for releasing a pass into a separate function, and
tidy it up a little.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82944 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 23:38:27 +00:00
Nick Lewycky
ae05e7d945 Round out the API for the new optimization flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 21:33:04 +00:00
Tilmann Scheller
8ff95de83c Use explicit structs instead of std::pair to map callee saved regs to spill slots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82909 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 17:58:47 +00:00
Dan Gohman
be1123464a Remove a redundant assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 17:48:37 +00:00
Dan Gohman
22bf8f21b4 Add dominates and releaseMemory member functions to PostDominatorTree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82904 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 17:39:12 +00:00
Dan Gohman
3479d18b98 Clarify a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 15:41:19 +00:00
Dan Gohman
6e70e31810 Add a properlyDominates member function to ScalarEvolution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82898 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 15:26:03 +00:00
Nick Lewycky
6776064d19 Instruction::clone does not need to take an LLVMContext&. Remove that and
update all the callers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 07:38:41 +00:00
Chris Lattner
81f46d9ce1 remove support for "NoSub" from regex. It seems like a minor optimization
and makes the API more annoying.  Add a Regex::getNumMatches() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 21:27:04 +00:00
Duncan Sands
3548ea8e90 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 15:35:35 +00:00
Duncan Sands
b9c129d553 Add methods for creating NSW subtraction, as already exists
for addition.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 15:21:48 +00:00
Dan Gohman
b7532e2548 Add a comment describing natural loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 15:09:53 +00:00
Dan Gohman
a23643d5b7 Rename ConstantFP's getInf to getInfinity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 23:40:21 +00:00
Dan Gohman
4b2ebc1928 Move MachineMemOperand::getAlignment out of line, to avoid needing
MathExtras.h in MachineMemOperand.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82822 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 23:33:20 +00:00
Dan Gohman
f344f7f008 Add a ConstantFP::getInf utility function for creating infinity ConstantFPs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82818 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 23:00:48 +00:00
Jeffrey Yasskin
b7a8d400be 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82797 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 21:07:20 +00:00
Dan Gohman
c76909abfe 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82794 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 20:36:54 +00:00
Dan Gohman
602b0c8c17 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82790 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:54:59 +00:00
Victor Hernandez
3e0c99a26f Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:11:52 +00:00
Bob Wilson
0035f9c3b9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 14:41:49 +00:00
Bob Wilson
6263778d2c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82750 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 05:30:55 +00:00
Dan Gohman
8fc13cb4f7 Add a version of dumpr() that has a SelectionDAG* argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 00:34:34 +00:00
Chris Lattner
528700863a add and document regex support for FileCheck. You can now do stuff like:
; CHECK: movl {{%e[a-z][xi]}}, %eax

or whatever.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82717 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 21:47:32 +00:00
David Goodwin
1f52895692 Make the end-of-itinerary mark explicit. Some cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 20:22:50 +00:00
Chris Lattner
48ba9ff3c4 tidy up, fix a memory leak in Regex::isValid
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 20:15:51 +00:00
Victor Hernandez
96b930ddc7 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 17:47:49 +00:00
Evan Cheng
ad934b821c 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82676 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 02:15:22 +00:00
Dan Gohman
d1f3cee976 Spruce up some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 21:06:36 +00:00
Dan Gohman
8a55ce4a39 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82654 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 21:02:20 +00:00
Dan Gohman
54d4a53c42 Add an EVT::getStoreSize function, like getStoreSizeInBits but in bytes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 20:59:10 +00:00
Dan Gohman
9f765dd0ee Correct a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82648 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 20:40:16 +00:00
Devang Patel
6c6c016b1b Do not leave behind metadata while cloning an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 18:32:25 +00:00
Devang Patel
2e3f2c48d8 s/*Location/*DebugLocation/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 17:20:43 +00:00
John McCall
470e08e1d1 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82620 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 06:53:51 +00:00
Evan Cheng
296925dc16 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82616 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 06:28:31 +00:00
Dan Gohman
cd26ec5f3c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82599 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 01:33:16 +00:00
Devang Patel
7815d71167 Add SetLocation() to allow IRBuilder user to set location info for an instruction already created.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 20:56:31 +00:00
Devang Patel
14433c96c6 Check exisiting dbg MDKind first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 20:54:13 +00:00
Daniel Dunbar
b759865495 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. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82553 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 16:33:42 +00:00
Evan Cheng
dace0ed8c7 Forgot this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82536 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 08:47:59 +00:00
Daniel Dunbar
57d6903dea Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
ExecuteAndWait.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82522 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 04:44:56 +00:00
Daniel Dunbar
27dba671c3 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82517 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:34:53 +00:00
Daniel Dunbar
48a097bfb6 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82507 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:03:18 +00:00
Daniel Dunbar
e5b18362db 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:02:33 +00:00
Chris Lattner
75c7c995b7 move DominatorTree::dominates for instructions out of line,
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82490 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 22:30:50 +00:00
Dan Gohman
28f02fdd76 Change MachineMemOperand's alignment value to be the alignment of
the base pointer, without the offset. This matches MemSDNode's
new alignment behavior, and holds more interesting information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 19:47:04 +00:00
Chris Lattner
0c1f688954 add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 05:52:45 +00:00
Daniel Dunbar
cc1c702f62 Don't allow formatted_ostream to be unbuffered, even if its underlying buffer
is.
 - The problem is that formatted_ostream forces its underlying buffer to be
   unbuffered, so if some client happens to wrap a formatted_ostream around
   something, but still use the underlying stream, then we can end up writing on
   a fully unbuffered output (which was never intended to be unbuffered).

 - This makes clang (and presumably llvm-gcc) -emit-llvm -S a mere 10x faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82434 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:56:00 +00:00
Reid Kleckner
2763217fbd Implement the JIT side of the GDB JIT debugging interface. To enable this
feature, either build the JIT in debug mode to enable it by default or pass
-jit-emit-debug to lli.

Right now, the only debug information that this communicates to GDB is call
frame information, since it's already being generated to support exceptions in
the JIT.  Eventually, when DWARF generation isn't tied so tightly to AsmPrinter,
it will be easy to push that information to GDB through this interface.

Here's a step-by-step breakdown of how the feature works:

- The JIT generates the machine code and DWARF call frame info
  (.eh_frame/.debug_frame) for a function into memory.
- The JIT copies that info into an in-memory ELF file with a symbol for the
  function.
- The JIT creates a code entry pointing to the ELF buffer and adds it to a
  linked list hanging off of a global descriptor at a special symbol that GDB
  knows about.
- The JIT calls a function marked noinline that GDB knows about and has put an
  internal breakpoint in.
- GDB catches the breakpoint and reads the global descriptor to look for new
  code.
- When sees there is new code, it reads the ELF from the inferior's memory and
  adds it to itself as an object file.
- The JIT continues, and the next time we stop the program, we are able to
  produce a proper backtrace.

Consider running the following program through the JIT:

#include <stdio.h>
void baz(short z) {
  long w = z + 1;
  printf("%d, %x\n", w, *((int*)NULL));  // SEGFAULT here
}
void bar(short y) {
  int z = y + 1;
  baz(z);
}
void foo(char x) {
  short y = x + 1;
  bar(y);
}
int main(int argc, char** argv) {
  char x = 1;
  foo(x);
}

Here is a backtrace before this patch:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaaabdfbd10 (LWP 25476)]
0x00002aaaabe7d1a8 in ?? ()
(gdb) bt
#0  0x00002aaaabe7d1a8 in ?? ()
#1  0x0000000000000003 in ?? ()
#2  0x0000000000000004 in ?? ()
#3  0x00032aaaabe7cfd0 in ?? ()
#4  0x00002aaaabe7d12c in ?? ()
#5  0x00022aaa00000003 in ?? ()
#6  0x00002aaaabe7d0aa in ?? ()
#7  0x01000002abe7cff0 in ?? ()
#8  0x00002aaaabe7d02c in ?? ()
#9  0x0100000000000001 in ?? ()
#10 0x00000000014388e0 in ?? ()
#11 0x00007fff00000001 in ?? ()
#12 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70,
F=0x14024e0, ArgValues=@0x7fffffffe050)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395
#13 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain
(this=0x1405b70, Fn=0x14024e0, argv=@0x13f06f8, envp=0x7fffffffe3b0)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377
#14 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe398,
envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208

And a backtrace after this patch:
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaabe7d1a8 in baz ()
(gdb) bt
#0  0x00002aaaabe7d1a8 in baz ()
#1  0x00002aaaabe7d12c in bar ()
#2  0x00002aaaabe7d0aa in foo ()
#3  0x00002aaaabe7d02c in main ()
#4  0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70,
F=0x14024e0, ArgValues=...)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395
#5  0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain
(this=0x1405b70, Fn=0x14024e0, argv=..., envp=0x7fffffffe3c0)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377
#6  0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe3a8,
envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82418 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 23:52:43 +00:00
Chris Lattner
c936fe8cb3 write rfind in terms of npos as daniel requested
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 22:54:26 +00:00
Chris Lattner
19e74991f3 remove a dead method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 22:46:42 +00:00
Chris Lattner
1908aea3a6 smallvectorize getExtraOptionNames
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 06:21:43 +00:00
Chris Lattner
f00a7d91c0 add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 06:21:20 +00:00
Daniel Dunbar
65b660743c A few more tabs -> spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 04:03:25 +00:00
Chris Lattner
05a32c8ab1 move a couple non-trivial methods out of line, add new
find_first_of/find_first_of methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:22:16 +00:00
Chris Lattner
99c5c7b7df convert a bunch more stuff to use StringRef. The ArgName arguments are now
stringref because they may not be nul terminated.  For options like -Lfoo
this now avoids a O(n)  temporary std::strings where N is the length of 
the string after -L.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82345 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 00:40:49 +00:00
Chris Lattner
db513bc096 add size_t and a version of rfind that allows specification of where
to scan from.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 00:38:28 +00:00
Chris Lattner
63c6b7dc67 add some more overloads of StringRef::getAsInteger for
common and useful integer types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82338 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 23:58:48 +00:00
Chris Lattner
3670a01d0b add a simple c_str() method to SmallString.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 23:57:31 +00:00
Daniel Dunbar
7dd76a1088 Prefer super class constructor to explicit initialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:40:28 +00:00
Daniel Dunbar
3fc19bbbbb Tabs -> spaces (really?)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:40:21 +00:00
Daniel Dunbar
f612ff6cfb Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82332 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:40:05 +00:00
Daniel Dunbar
7e32c4fa72 RHS of assignment should be const reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82331 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:39:50 +00:00
Nick Lewycky
c332fba828 Remove the default value for ConstantStruct::get's isPacked parameter and
update the code which was broken by this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82327 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:30:26 +00:00
Chris Lattner
cea1438cf5 provide a "strtoull" operation that works on StringRef's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 19:47:14 +00:00
Chris Lattner
a460beb5cd convert a bunch of std::strings to use StringRef. This should eliminate
a massive number of temporary strings created when parsing a command line.
More still left to eliminate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 18:55:05 +00:00
Nick Lewycky
875646f376 Lett users of sparse propagation do their own thing with phi nodes if they want
to. This can be combined with LCSSA or SSI form to store more information on a
PHINode than can be computed by looking at its incoming values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 18:33:36 +00:00
Evan Cheng
0002e506de Update comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 10:08:51 +00:00
Chris Lattner
4a86348bfb remove an extraneous mem2reg pass early in the pipe. Since
this is run after the 'standard function passes', SRoA was
recently run.  This saves a domfrontier construction. Thanks
to Eli for noticing this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82291 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 22:03:29 +00:00
Chris Lattner
d7a5983e48 reduce indentation by using an early exit, and add a comment,
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82290 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 22:01:30 +00:00
Evan Cheng
fb2e752e41 Enhance EmitInstrWithCustomInserter() so target can specify CFG changes that sdisel will use to properly complete phi nodes.
Not functionality change yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 21:02:19 +00:00
Chris Lattner
bd23d5fda8 add a new hook to allow targets to splat stuff at the end of the file.
Overriding doFinalization is pretty lame.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 20:17:03 +00:00
Devang Patel
e8e0213cc3 Write and read metadata attachments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:26:43 +00:00
Victor Hernandez
88d9839d07 Update malloc call creation code (AllocType is now the element type of the malloc, not the resulting type).
In getMallocArraySize(), fix bug in the case that array size is the product of 2 constants.

Extend isArrayMalloc() and getMallocArraySize() to handle case where malloc is used as char array.

Ensure that ArraySize in LowerAllocations::runOnBasicBlock() is correct type.

Extend Instruction::isSafeToSpeculativelyExecute() to handle malloc calls.

Add verification for malloc calls.

Reviewed by Dan Gohman.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:20:02 +00:00
Anton Korobeynikov
c6f729ed55 Allow symbols to start from the digit if target requests it. This allows, e.g. pinning
variables to specified absolute address. Make use of this feature for MSP430.
This unbreaks PR4776.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 16:57:42 +00:00
Xerxes Ranby
e2394e9bfe Revert r82214 completely to fix build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 09:50:00 +00:00
Evan Cheng
f8a56255a5 Fix a bug in sdisel switch lowering code. When it updates the phi nodes in switch successor blocks, it can introduce multiple phi operands of the same value from different blocks (and may not be on the predecessor list).
This can be seen on CodeGen/Generic/2006-09-06-SwitchLowering.ll. But it's not known to cause any real regression (but I have added an assertion for it now).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82214 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:16:04 +00:00
Julien Lerouge
cb89f6cc10 Use __attribute__((__used__)) if GCC >= 3.1 (seems to be the oldest GCC
supporting this attribute).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82177 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 23:27:10 +00:00
John McCall
2fed70daaf Fix a few places where PointerIntPair was using PointerLikeTypeTraits<PointerTy>
instead of the PtrTraits provided.  Allows PointerIntPair to contain a
PointerUnion safely, as long as the bits add up.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 20:35:18 +00:00
Chris Lattner
8609c7c931 pass machinemoduleinfo down into getSymbolForDwarfGlobalReference,
currently unused.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 18:49:52 +00:00
Dan Gohman
1f96e67f78 Teach ScalarEvolution how to reason about no-wrap flags on loops
where the induction variable has a non-unit stride, such as {0,+,2}, and
there are expressions such as {1,+,2} inside the loop formed with
or or add nsw operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 18:05:20 +00:00
Jim Grosbach
10f9101c4c grammar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82149 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 17:55:55 +00:00
Evan Cheng
f436463dbd Remove simple regalloc. It has bit rotted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 05:48:07 +00:00
Chris Lattner
d7bd78e36e add a version of the APFloat constructor that initializes to 0.0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 01:08:43 +00:00
Daniel Dunbar
e65512809a Add StringRef::{rfind, rsplit}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 22:38:48 +00:00
Dan Gohman
6f65d79750 Add a new pass for doing late hoisting of floating-point and vector
constants out of loops. These aren't covered by the regular LICM
pass, because in LLVM IR constants don't require separate
instructions. They're not always covered by the MachineLICM pass
either, because it doesn't know how to unfold folded constant-pool
loads. This is somewhat experimental at this point, and off by
default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 20:25:11 +00:00
Devang Patel
43215788d5 Print debug info attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82075 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 20:21:17 +00:00
Devang Patel
1b75f44bd9 Provide a way to extract location info from DILocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82064 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 18:20:05 +00:00
Devang Patel
95c1984e6b Add an interface to attach debugging information with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82062 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 18:16:11 +00:00
Devang Patel
937b1e92a9 Add llvm::Metadata to manage metadata used in a context.
This interface will be used to attach metadata with an instruction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 18:09:00 +00:00
Andreas Neustifter
9233272679 Reapplied r81355 with the problems fixed.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090907/086737.html and
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090907/086746.html)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82039 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 11:35:50 +00:00
Andreas Neustifter
ad80981a10 Preserve ProfileInfo during CodeGenPrepare.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 09:26:52 +00:00
Chris Lattner
dc62ea0f1c move FnStubs/GVSTubs/HiddenGVStub handling out of the X86 asmprinter
and use MachineModuleInfoMachO instead.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82022 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 06:25:03 +00:00
Chris Lattner
686cb3df6a add a new MachineModuleInfoMachO class, which is the per-module
stuff common across all macho targets.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82018 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 06:03:48 +00:00
Chris Lattner
f18545550e the pointer MMI keeps will start out with object-file format specific stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82012 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 05:26:00 +00:00
Chris Lattner
4edd187ddd remove the AsmPrinter::printMCInst hook hack now that
we have MCInstPrinter.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 04:57:15 +00:00
Chris Lattner
8c6ed05157 Big change #1 for personality function references:
Eliminate the PersonalityPrefix/Suffix & NeedsIndirectEncoding
fields from MAI: they aren't part of the asm syntax, they are
related to the structure of the object file.

To replace their functionality, add a new 
TLOF::getSymbolForDwarfGlobalReference method which asks targets
to decide how to reference a global from EH in a pc-relative way.

The default implementation just returns the symbol.  The default
darwin implementation references the symbol through an indirect
$non_lazy_ptr stub.  The bizarro x86-64 darwin specialization
handles the weird "foo@GOTPCREL+4" hack.

DwarfException.cpp now uses this to emit the reference to the
symbol in the right way, and this also eliminates another 
horrible hack from DwarfException.cpp:

-    if (strcmp(MAI->getPersonalitySuffix(), "+4@GOTPCREL"))
-      O << "-" << MAI->getPCSymbol();



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 01:46:41 +00:00
Chris Lattner
4f3e7aa154 add a helper method for creating MCSymbol and MCSymbolRefExpr at
the same time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81984 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 01:26:31 +00:00
Chris Lattner
25d812bd7d inline AsmPrinter::getCurrentFunctionEHName into its only caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 00:35:39 +00:00
Chris Lattner
24620fa174 remove a dead bool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81968 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 00:24:31 +00:00
Chris Lattner
1c90c6f1c5 Eliminate AsmPrinter::EmitExternalGlobal, inlining its (now)
one implementation into its one caller.  This eliminates a totally
awesome and gratuitous hack where we casted a Function* to 
GlobalVariable*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 00:17:39 +00:00
Chris Lattner
334fd1f259 eliminate the horrid AsmPrinter::getGlobalLinkName method, inlining
it into all of its call sites and simplifying them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 00:08:41 +00:00
Chris Lattner
bfd1e50c4f remove some horrible MAI hooks which fortunately turn out to be always empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 23:11:32 +00:00
Chris Lattner
a70e2e3d48 add hooks to hang target-specific goop off MachineModuleInfo,
move MachineFunctionInfo virtual method out of line to give it
a home.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 22:44:26 +00:00