Commit Graph

8631 Commits

Author SHA1 Message Date
Jay Foad
4e5ea553d0 Move helper functions for optimizing division by constant into the APInt
class.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70488 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 10:15:35 +00:00
Bill Wendling
581b93415e Remove unused flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 00:57:51 +00:00
Bill Wendling
b8cb0bb08c Remove LTO optimization level.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70445 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 23:40:42 +00:00
Bill Wendling
98a366d547 Instead of passing in an unsigned value for the optimization level, use an enum,
which better identifies what the optimization is doing. And is more flexible for
future uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70440 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 23:29:43 +00:00
Bill Wendling
b587f9662a Add support for a character after a command line option. Like '-Os'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70437 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 23:26:16 +00:00
Jakob Stoklund Olesen
ce9be2cf5d MachineInstr::isRegTiedTo{Use,Def}Operand can safely be made const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70408 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 20:57:16 +00:00
Nate Begeman
a641575828 Update comment, replace theoretically impossible check with an assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70391 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 18:13:31 +00:00
Sanjiv Gupta
b27fa0afe2 Add directive to declare external globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 08:23:18 +00:00
Nate Begeman
5a5ca1519e Implement review feedback for vector shuffle work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 05:20:52 +00:00
Sanjiv Gupta
a3518a1d6a Add a public method called getAddressSpace() to the GlobalAddressSDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 04:43:24 +00:00
Dan Gohman
1e59aa1332 Add some more doxygen comments to SCEVAddRec.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 00:59:03 +00:00
Bill Wendling
5e5cb7985d The second part of the change from -fast to -O#. This changes the JIT to accept
an optimization level instead of a simple boolean telling it to generate code
"fast" or the other type of "fast".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 00:32:19 +00:00
Bill Wendling
be8cc2a3de Second attempt:
Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to
use the old behavior, the flag is -O0. This change allows for finer-grained
control over which optimizations are run at different -O levels.

Most of this work was pretty mechanical. The majority of the fixes came from
verifying that a "fast" variable wasn't used anymore. The JIT still uses a
"Fast" flag. I'll change the JIT with a follow-up patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 00:15:41 +00:00
Bill Wendling
a24d1b1558 Correct comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 00:09:22 +00:00
Evan Cheng
8a8a0dfc3b Move getMatchingSuperReg() out of coalescer and into TargetRegisterInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70309 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 18:29:27 +00:00
Sanjiv Gupta
d3d965714b Initialized arrays can be in any address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 16:34:20 +00:00
Jakob Stoklund Olesen
fa4677b483 Move getSubRegisterRegClass from ScheduleDagSDNodesEmit.cpp to a TargetRegisterClass method.
Also make the method non-asserting. It will return NULL when given an invalid subreg index.

The method is needed by an upcoming patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70296 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 16:34:09 +00:00
Bill Wendling
c69d56f115 r70270 isn't ready yet. Back this out. Sorry for the noise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 01:04:53 +00:00
Bill Wendling
2e9d5f912a Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to
use the old behavior, the flag is -O0. This change allows for finer-grained
control over which optimizations are run at different -O levels.

Most of this work was pretty mechanical. The majority of the fixes came from
verifying that a "fast" variable wasn't used anymore. The JIT still uses a
"Fast" flag. I'm not 100% sure if it's necessary to change it there...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70270 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 00:21:31 +00:00
Jeffrey Yasskin
487fa01673 Add tests for WeakVH and AssertingVH. These pointed out that the overloads for
the comparison operators were not only unnecessary in the presence of the
implicit conversion; they caused ambiguous overload errors. So I deleted them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70243 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:32:07 +00:00
Chris Lattner
0370cc6399 give bitstreamreader an API to ignore names for blocks/records,
only llvm-bcanalyzer wants this info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:04:08 +00:00
Nate Begeman
9008ca6b6b 2nd attempt, fixing SSE4.1 issues and implementing feedback from duncan.
PR2957

ISD::VECTOR_SHUFFLE now stores an array of integers representing the shuffle
mask internal to the node, rather than taking a BUILD_VECTOR of ConstantSDNodes
as the shuffle mask.  A value of -1 represents UNDEF.

In addition to eliminating the creation of illegal BUILD_VECTORS just to 
represent shuffle masks, we are better about canonicalizing the shuffle mask,
resulting in substantially better code for some classes of shuffles.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:41:29 +00:00
Chris Lattner
f9a3ec86c1 Add two new record types to the blockinfo block:
BLOCKNAME and SETRECORDNAME.  This allows a bitcode
file to be self describing with pretty names for 
records and blocks in addition to numbers.  This
enhances llvm-bcanalyzer to use this to print prettily.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70165 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 22:21:57 +00:00
Chris Lattner
7919b966a8 make BitstreamCursor's copyable and assignable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 21:07:02 +00:00
Chris Lattner
962dde3cef Make a major API change to BitstreamReader: split all the reading
state out of the BitstreamReader class into a BitstreamCursor class.
Doing this allows the client to have multiple cursors into the same
file, each with potentially different live block stacks and
abbreviation records.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 20:59:02 +00:00
Bill Wendling
3485d25a0e I cast, therefore I think I know what I'm doing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 20:12:38 +00:00
Bill Wendling
b14a495c36 Use uint64_t instead of unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 19:46:41 +00:00
Chris Lattner
1e8db00e3b revert an incorrect patch. This causes crashes all over the place on a
64-bit build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 19:44:20 +00:00
Bill Wendling
610cb31ac9 Suppress warnings about conversion shortening 64-bit to 32-bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 18:10:20 +00:00
Chris Lattner
096fd7b5a7 Add a new TypeBuilder helper class, which eases making LLVM IR types.
Patch by Jeffrey Yasskin!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 22:14:04 +00:00
Chris Lattner
552672d285 improve documentation around memory lifetimes,
patch by Jeffrey Yasskin!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70083 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 22:10:06 +00:00
Bill Wendling
c2dbff3ba6 Use intptr_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 21:06:53 +00:00
Mon P Wang
8d34844bff size() should return a size_t; avoids a warning for 64 bit machines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70072 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 20:46:59 +00:00
Chris Lattner
11d8fb9609 DenseMap.h needs <new> because it explicitly calls operator new/delete.
Patch by John McCall!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70068 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 19:50:14 +00:00
Evan Cheng
0adb527d16 Do not share a single unknown val# for all the live ranges merged into a physical sub-register live interval. When coalescer is merging in clobbered virtaul register live interval into a physical register live interval, give each virtual register val# a separate val# in the physical register live interval. Otherwise, the coalescer would have lost track of the definitions information it needs to make correct coalescing decisions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70026 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 09:25:19 +00:00
Rafael Espindola
7431af050f Add LTO_SYMBOL_DEFINITION_WEAKUNDEF, use that on the gold plugin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 16:55:21 +00:00
Rafael Espindola
15684b2955 Revert 69952. Causes testsuite failures on linux x86-64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 12:40:33 +00:00
Chris Lattner
f6b9f260ed fix a typo noticed by duncan
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 06:37:12 +00:00
Chris Lattner
f3b0aac190 "I got annoyed at the compiler warnings from ConstantInt::get(Ty, -1,
true), and casts make me nervous and are verbose anyway, so here's a
ConstantInt::getSigned(Ty, int64_t) method. Just overloading
ConstantInt::get() to take an int64_t too would cause ambiguous
overload errors."

Patch by Jeffrey Yasskin!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69958 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 05:30:14 +00:00
Nate Begeman
b706d29f9c PR2957
ISD::VECTOR_SHUFFLE now stores an array of integers representing the shuffle
mask internal to the node, rather than taking a BUILD_VECTOR of ConstantSDNodes
as the shuffle mask.  A value of -1 represents UNDEF.

In addition to eliminating the creation of illegal BUILD_VECTORS just to 
represent shuffle masks, we are better about canonicalizing the shuffle mask,
resulting in substantially better code for some classes of shuffles.

A clean up of x86 shuffle code, and some canonicalizing in DAGCombiner is next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 03:42:54 +00:00
Dan Gohman
752ec7da50 Change SCEVExpander's expandCodeFor to provide more flexibility
with the persistent insertion point, and change IndVars to make
use of it. This fixes a bug where IndVars was holding on to a
stale insertion point and forcing the SCEVExpander to continue to
use it.

This fixes PR4038.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 15:16:49 +00:00
Dan Gohman
6cdc727f2d Use BasicBlock::iterator instead of Instruction* for insert points,
to better handle inserting instructions at the end of a block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 16:05:50 +00:00
Dan Gohman
b928c57397 Make SCEVExpanders private methods private, instead of protected.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69806 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 16:00:36 +00:00
Owen Anderson
ddcb3415cb Add caching of predecessor counts as well as predecessors themselves.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69791 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 08:46:33 +00:00
Owen Anderson
747972914a Fix for PR3946, in which SmallVector could behave strangely in corner cases.
Patch by Peter Johnson.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 07:16:54 +00:00
Dan Gohman
f8a8be86e3 De-pImpl-ify ScalarEvolution. The pImpl pattern doesn't provide much
practical benefit in the case of ScalarEvolution, and it's otherwise
a nuisance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69749 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 23:15:49 +00:00
Evan Cheng
5b69ebac85 It has finally happened. Spiller is now using live interval info.
This fixes a very subtle bug. vr defined by an implicit_def is allowed overlap with any register since it doesn't actually modify anything. However, if it's used as a two-address use, its live range can be extended and it can be spilled. The spiller must take care not to emit a reload for the vn number that's defined by the implicit_def. This is both a correctness and performance issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 22:46:52 +00:00
Dan Gohman
84923602fd Factor out a common base class from SCEVTruncateExpr, SCEVZeroExtendExpr,
and SCEVSignExtendExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 01:25:57 +00:00
Dan Gohman
af79fb5f47 Introduce encapsulation for ScalarEvolution's TargetData object, and refactor
the code to minimize dependencies on TargetData.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 01:07:12 +00:00
Dan Gohman
b7ef72963b Convert ScalarEvolution to use raw_ostream instead of OStream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 00:47:46 +00:00
Bob Wilson
998e125a87 Move duplicated AddLiveIn function from X86 and ARM backends to be a method
in the MachineFunction class, renaming it to addLiveIn for consistency with
the same method in MachineBasicBlock.  Thanks for Anton for suggesting this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 18:36:57 +00:00
Bob Wilson
c885165e66 Revise my previous change 68996 as suggested by Duncan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 17:27:09 +00:00
Duncan Sands
c3bbf579ae These bitfields were being miscompiled on some
64 bit platforms when building with optimization.
So replace them by a hand-coded implementation.
This fixes PR3822.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 16:03:21 +00:00
Douglas Gregor
8f7be4731e Make all raw_ostreams support the tell() function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 07:34:17 +00:00
Nick Lewycky
7c53316922 Fix missing text in doxygen documentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69529 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 18:20:21 +00:00
Duncan Sands
4a930ecd2a Remove the SimpleTy enumerated type field from the MVT
value type union: this field was causing problems for
some compilers on 64 bit systems, presumably because
SimpleTy is 32 bits wide while the other fields are
64 bits wide.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69515 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 06:23:05 +00:00
Duncan Sands
b10b5ac8d9 Don't try to make BUILD_VECTOR operands have the same
type as the vector element type: allow them to be of
a wider integer type than the element type all the way
through the system, and not just as far as LegalizeDAG.
This should be safe because it used to be this way
(the old type legalizer would produce such nodes), so
backends should be able to handle it.  In fact only
targets which have legal vector types with an illegal
promoted element type will ever see this (eg: <4 x i16>
on ppc).  This fixes a regression with the new type
legalizer (vec_splat.ll).  Also, treat SCALAR_TO_VECTOR
the same as BUILD_VECTOR.  After all, it is just a
special case of BUILD_VECTOR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 20:16:54 +00:00
Dan Gohman
f4ccfcb704 Add a ScalarEvolution::getCouldNotCompute() function, and use it
instead of allocating and leaking new SCEVCouldNotCompute objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69452 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 17:58:19 +00:00
Dan Gohman
890f92b744 Use more const qualifiers with SCEV interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 17:56:28 +00:00
Evan Cheng
cccdb2b602 Add a new LiveInterval::overlaps(). It checks if the live interval overlaps a range specified by [Start, End).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69434 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 08:52:15 +00:00
Bob Wilson
dee46d7f6d Clean up formatting, remove trailing whitespace, fix comment typos and
punctuation.  No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69378 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 20:35:10 +00:00
Dan Gohman
276944ef30 Delete an unused field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 20:03:31 +00:00
Bob Wilson
1f595bb429 Use CallConvLower.h and TableGen descriptions of the calling conventions
for ARM.  Patch by Sandeep Patel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69371 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 19:07:39 +00:00
Bob Wilson
c91e40a179 Add a comment to describe LLVMMatchType.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 21:46:42 +00:00
Dan Gohman
f04fa483b8 Teach SCEVExpander::InsertCastOfTo to avoid creating inttoptr-of-ptrtoint
and ptrtoint-of-inttoptr expressions. This fixes a regression in 300.twolf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 15:52:57 +00:00
Dan Gohman
2d1be87ee4 Expand GEPs in ScalarEvolution expressions. SCEV expressions can now
have pointer types, though in contrast to C pointer types, SCEV
addition is never implicitly scaled. This not only eliminates the
need for special code like IndVars' EliminatePointerRecurrence
and LSR's own GEP expansion code, it also does a better job because
it lets the normal optimizations handle pointer expressions just
like integer expressions.

Also, since LLVM IR GEPs can't directly index into multi-dimensional
VLAs, moving the GEP analysis out of client code and into the SCEV
framework makes it easier for clients to handle multi-dimensional
VLAs the same way as other arrays.

Some existing regression tests show improved optimization.
test/CodeGen/ARM/2007-03-13-InstrSched.ll in particular improved to
the point where if-conversion started kicking in; I turned it off
for this test to preserve the intent of the test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 03:18:22 +00:00
Devang Patel
390f3ace34 If FastISel is run and it has known DebugLoc then use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69253 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 01:33:10 +00:00
Dan Gohman
c23e496879 Generalize one of the SelectionDAG::ReplaceAllUsesWith overloads
to support replacing a node with another that has a superset of
the result types. Use this instead of calling
ReplaceAllUsesOfValueWith for each value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 20:06:30 +00:00
Douglas Gregor
37a4d8dbbb Allow jumping to the end of a bitstream while reading
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 04:53:47 +00:00
Dan Gohman
61e08bd97f Don't use "protected:" in classes that aren't intended to be
subclassed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 01:47:03 +00:00
Dan Gohman
7beace5d06 Fix doxygen comment syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69128 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 01:44:07 +00:00
Dan Gohman
33f1c68cba Move MachineRegisterInfo::setRegClass out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69126 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 01:19:35 +00:00
Dan Gohman
593ea05957 Move MachineJumpTableInfo::ReplaceMBBInJumpTables out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 01:18:49 +00:00
Dan Gohman
3bc1a3735f Give RemoveRegOperandFromRegInfo a comment and move the
code out of line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69124 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 01:17:37 +00:00
Devang Patel
1be3eccecb Construct and emit DW_TAG_inlined_subroutine DIEs for inlined subroutine scopes (only in FastISel mode).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69116 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 00:10:26 +00:00
Devang Patel
af5b6bb6a5 Add a method to check that the subprogram holds debug info for the given Function or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 00:06:07 +00:00
Bob Wilson
b1303d05a8 Change SelectionDAG type legalization to allow BUILD_VECTOR operands to be
promoted to legal types without changing the type of the vector.  This is
following a suggestion from Duncan
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-February/019923.html).
The transformation that used to be done during type legalization is now
postponed to DAG legalization.  This allows the BUILD_VECTORs to be optimized
and potentially handled specially by target-specific code.

It turns out that this is also consistent with an optimization done by the
DAG combiner: a BUILD_VECTOR and INSERT_VECTOR_ELT may be combined by
replacing one of the BUILD_VECTOR operands with the newly inserted element;
but INSERT_VECTOR_ELT allows its scalar operand to be larger than the
element type, with any extra high bits being implicitly truncated.  The
result is a BUILD_VECTOR where one of the operands has a type larger the
the vector element type.

Any code that operates on BUILD_VECTORs may now need to be aware of the
potential type discrepancy between the vector element type and the
BUILD_VECTOR operands.  This patch updates all of the places that I could
find to handle that case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 22:05:19 +00:00
Dan Gohman
88c7af096b Rename COPY_TO_SUBCLASS to COPY_TO_REGCLASS, and generalize
it accordingly. Thanks to Jakob Stoklund Olesen for pointing
out how this might be useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 21:06:25 +00:00
Douglas Gregor
17893a5fb6 Add a static APInt::getNumWords
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68977 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 19:43:10 +00:00
Devang Patel
48c7fa21a3 Right now, Debugging information to encode scopes (DW_TAG_lexical_block) relies on DBG_LABEL. Unfortunately this intefers with the quality of optimized code.
This patch updates dwarf writer to encode scoping information in DWARF only in FastISel mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 18:13:16 +00:00
Devang Patel
0f7fef3872 Reapply 68847.
Now debug_inlined section is covered by TAI->doesDwarfUsesInlineInfoSection(), which is false by default.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 17:02:03 +00:00
Dan Gohman
f8c7394781 Add a new TargetInstrInfo MachineInstr opcode, COPY_TO_SUBCLASS.
This will be used to replace things like X86's MOV32to32_.

Enhance ScheduleDAGSDNodesEmit to be more flexible and robust
in the presense of subregister superclasses and subclasses. It
can now cope with the definition of a virtual register being in
a subclass of a use.

Re-introduce the code for recording register superreg classes and
subreg classes. This is needed because when subreg extracts and
inserts get coalesced away, the virtual registers are left in
the correct subclass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:38:05 +00:00
Dan Gohman
73099b1058 Add comments to INSERT_SUBREG, EXTRACT_SURBEG, SUBREG_TO_REG,
and IMPLICIT_DEF.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:12:29 +00:00
Chris Lattner
db1afd499e add AvailableExternally linkage to C bindings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68942 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 06:25:37 +00:00
Chris Lattner
266c7bbbbc Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 05:44:34 +00:00
Nick Lewycky
267fddbedd Regenerate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68938 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 04:26:27 +00:00
Owen Anderson
ddeed50d76 Use a hashtable for TargetRegisterClass::contains.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 22:31:17 +00:00
Chris Lattner
c5040ab606 optimize FastISel::UpdateValueMap to avoid duplicate map lookups,
and make it return the assigned register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 07:45:01 +00:00
Chris Lattner
0461c0a8f5 Add new TargetInstrDesc::hasImplicitUseOfPhysReg and
hasImplicitDefOfPhysReg methods.  Use them to remove a 
look in X86 fast isel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 07:26:51 +00:00
Dan Gohman
c6fa3ff0bd Revert r68847. It breaks the build on non-Darwin targets, with this message
from the assembler:

Error: unknown pseudo-op: `.debug_inlined'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 15:57:04 +00:00
Devang Patel
2057532679 Keep track of inlined functions and their locations. This information is collected when nested llvm.dbg.func.start intrinsics are seen. (Right now, inliner removes nested llvm.dbg.func.start intrinisics during inlining.)
Create debug_inlined dwarf section using these information. This info is used by gdb, at least on Darwin, to enable better experience debugging inlined functions. See DwarfWriter.cpp for more information on structure of debug_inlined section.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 00:16:47 +00:00
Devang Patel
03f0a2fba0 DebugLabelFolder ruthlessly deletes redundant labels. However, sometimes the redundant labels is referenced by debug info somewhere else. This patch provies a way so that dwarf writer can mark labels as used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 18:58:59 +00:00
Chris Lattner
5c5f5a2ec2 fix a broken assertion in ilist_iterator, which caused it to crash in the
bad case instead of actually assert.  Bug pointed out by Jakob Stoklund 
Olesen!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 15:47:17 +00:00
Nick Lewycky
cb8c4778d3 Cleanup. Remove redundant llvm:: , we don't need them since we're inside
namespace llvm already.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68774 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 06:54:06 +00:00
Chris Lattner
3584a47588 Add a new Type::getPointerTo method, which is shorthand for
llvm::PointerType::get().  Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68772 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 06:42:02 +00:00
Nick Lewycky
b9fc360857 Add utility function to IRBuilder that takes the difference between two
pointers, taking into account the size of the pointed-to object.
Patch by Jeffrey Yasskin!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68768 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 05:30:48 +00:00
Bill Wendling
7d16e85bfc Pass in the std::string parameter instead of returning it by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68747 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:12:49 +00:00
Bill Wendling
a6f02fbb75 Constify getter methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:00:25 +00:00
Dan Gohman
fc1665793e Remove the obsolete SelectionDAG::getNodeValueTypes and simplify
code that uses it by using SelectionDAG::getVTList instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 23:54:40 +00:00
Dan Gohman
168840662e Change the NumVTs field from short to int, since there's no
real need for it to be short.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 23:53:31 +00:00
Bill Wendling
f34be827ac StringMap<DIE*>::iterator::first() returns a pointer to the first character of
the key. This will cause it to create a new std::string, which isn't
wanted. Instead, pass back the "const char*". Modify the EmitString() method to
take a "const char*".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68741 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 23:51:31 +00:00
Owen Anderson
3ca15c989c Give register alias checking the hash table treatment too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68730 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 22:19:30 +00:00
Bob Wilson
d9df501704 Fix pr3954. The register scavenger asserts for inline assembly with
register destinations that are tied to source operands.  The
TargetInstrDescr::findTiedToSrcOperand method silently fails for inline
assembly.  The existing MachineInstr::isRegReDefinedByTwoAddr was very
close to doing what is needed, so this revision makes a few changes to
that method and also renames it to isRegTiedToUseOperand (for consistency
with the very similar isRegTiedToDefOperand and because it handles both
two-address instructions and inline assembly with tied registers).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68714 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 17:16:43 +00:00
Chris Lattner
56946ed5bb add an accessor method, patch by John McCall!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68684 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 05:56:58 +00:00
Owen Anderson
7d770be047 Convert TargetRegisterInfo's super-register checking to use a pre-computed hash table just like subregister checking does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68669 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 03:50:16 +00:00
Daniel Dunbar
6ddf2c1930 Add sys::Path::makeAbsolute().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 00:33:08 +00:00
Douglas Gregor
2eb65e292c Fix BitstreamReader's GetCurrentBitNo to return the correct bit number, and stop JumpToBit from covering up its mistakes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68648 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 22:26:47 +00:00
Douglas Gregor
0648f54b88 Use 8 instead of CHAR_BIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68616 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 16:57:40 +00:00
Douglas Gregor
b7e7886c79 Add BitstreamWriter::GetCurrentBitNo, to report where we are in the output bitstream
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 15:18:21 +00:00
Chris Lattner
00a7b52385 Remove AllowInverse: it leaks memory and is not the right
abstraction for CommandLine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 03:43:51 +00:00
Dan Gohman
97121ba2af Implement support for using modeling implicit-zero-extension on x86-64
with SUBREG_TO_REG, teach SimpleRegisterCoalescing to coalesce
SUBREG_TO_REG instructions (which are similar to INSERT_SUBREG
instructions), and teach the DAGCombiner to take advantage of this on
targets which support it. This eliminates many redundant
zero-extension operations on x86-64.

This adds a new TargetLowering hook, isZExtFree. It's similar to
isTruncateFree, except it only applies to actual definitions, and not
no-op truncates which may not zero the high bits.

Also, this adds a new optimization to SimplifyDemandedBits: transform
operations like x+y into (zext (add (trunc x), (trunc y))) on targets
where all the casts are no-ops. In contexts where the high part of the
add is explicitly masked off, this allows the mask operation to be
eliminated. Fix the DAGCombiner to avoid undoing these transformations
to eliminate casts on targets where the casts are no-ops.

Also, this adds a new two-address lowering heuristic. Since
two-address lowering runs before coalescing, it helps to be able to
look through copies when deciding whether commuting and/or
three-address conversion are profitable.

Also, fix a bug in LiveInterval::MergeInClobberRanges. It didn't handle
the case that a clobber range extended both before and beyond an
existing live range. In that case, multiple live ranges need to be
added. This was exposed by the new subreg coalescing code.

Remove 2008-05-06-SpillerBug.ll. It was bugpoint-reduced, and the
spiller behavior it was looking for no longer occurrs with the new
instruction selection.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 00:15:30 +00:00
Jim Grosbach
30eae3c022 PR2985 / <rdar://problem/6584986>
When compiling in Thumb mode, only the low (R0-R7) registers are available
for most instructions. Breaking the low registers into a new register class
handles this. Uses of R12, SP, etc, are handled explicitly where needed
with copies inserted to move results into low registers where the rest of
the code generator can deal with them.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 20:34:09 +00:00
Torok Edwin
eb55f3ea3c Another attempt at fixing PR2975.
Types can have references to eachother, so we can't just call destroy on them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 17:23:02 +00:00
Chris Lattner
ce8f9fe3c9 fix comment to reflect the implementation I ended up settling on.
Thanks to Duncan for noticing this


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68518 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 16:30:31 +00:00
Chris Lattner
ae7dd8004e Add an API for the bitstream reader to read blobs and return
them by reference, instead of packing each byte into a
smallvector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68486 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 02:56:46 +00:00
Chris Lattner
123f384879 allow clients to look up abbrev id's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68471 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 22:43:46 +00:00
Chris Lattner
298a82dd0d Add a new EmitRecordWithBlob API that allows a blob to be emitted
without converting each byte to a uint64_t to stick in a SmallVector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 22:26:26 +00:00
Chris Lattner
dcd006bf7b add a new Blob encoding abbreviation for bitcode files that emits
elements in a form that is efficient for the reader to just get a
pointer in memory and start reading.  APIs to do efficient reading
and writing are still todo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68465 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 21:50:39 +00:00
Chris Lattner
30910bf1c9 split ReadAbbreviatedLiteral out of ReadAbbreviatedField.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 21:37:10 +00:00
Chris Lattner
86bc23d5c1 reduce indentation with early-out
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 21:34:58 +00:00
Chris Lattner
96153a45fd simplify code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68461 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 21:20:01 +00:00
Chris Lattner
40728791f5 simplify to reduce indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68460 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 21:12:29 +00:00
Chris Lattner
e2a466bfa9 Teach llvm-bcanalyzer to skip over the header we use on LLVM IR files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68458 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 20:54:32 +00:00
Mikhail Glushenkov
4e9ca339b5 Add segment flag bits to ELF.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-05 09:07:08 +00:00
Nick Lewycky
21cc4460ef Add support for embedded metadata to LLVM. This introduces two new types of
Constant, MDString and MDNode which can only be used by globals with a name
that starts with "llvm." or as arguments to a function with the same naming
restriction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 07:22:01 +00:00
Chris Lattner
41c90738e9 "This adds a getName() method to TargetRegisterClass, just like in TargetRegisterInfo.
This makes debugging register classes a bit easier."

Patch by Jakob Stoklund Olesen!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68400 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 20:25:41 +00:00
Daniel Dunbar
38f4dd7b5e Add fast path for raw_ostream output of strings.
- Particularly nice for small constant strings, which get optimized
   down nicely. On a synthetic benchmark writing out "hello" in a
   loop, this is about 2x faster with gcc and 3x faster with
   llvm-gcc. llc on insn-attrtab.bc from 403.gcc is about .5% faster.

 - I tried for a fancier solution which wouldn't increase code size as
   much (by trying to match constant arrays), but can't quite make it
   fly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 18:43:17 +00:00
Chris Lattner
b7a00daa11 Work around an apparent GCC miscompilation by specializing different,
this fixes a regression on some compilers from r68147.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68356 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 00:26:01 +00:00
Dan Gohman
8f9643f0f7 Delete ISD::INSERT_SUBREG and ISD::EXTRACT_SUBREG, which are unused.
Note that these are distinct from TargetInstrInfo::INSERT_SUBREG
and TargetInstrInfo::EXTRACT_SUBREG, which are used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 00:25:26 +00:00
Chris Lattner
25f0ee5191 correct patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68353 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 00:10:56 +00:00
Chris Lattner
d72513417d add patch to go along with r68350
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 00:10:31 +00:00
Chris Lattner
6caced9564 add missing *
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 23:53:03 +00:00
Chris Lattner
d0dfbe096d fix overflow checks in SmallVector:
"The code was doing "if (End+NumInputs > Capacity) ...". If End is
close to 0xFFFFFFFF and NumInputs is large, it'll overflow, the
condition will come out false, and the vector won't grow to
accommodate the new elements, and the program will crash in memmove."

Patch by Jeffrey Yasskin!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68277 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 03:06:26 +00:00
Devang Patel
9dfa1671fc Clean up pass manager cache after each run.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 22:34:41 +00:00
Daniel Dunbar
23e97b05da Add llvm::Triple class for abstracting access to target triples.
- The code is silly, I'm just amusing myself. Rewrite to be efficient
   if you like. :)

Also, if you wish to debate the proper names of the triple components
I'm all ears.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 21:53:23 +00:00
Misha Brukman
b035842c34 Fixed spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 21:33:08 +00:00
Devang Patel
8a7eed3267 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 21:27:08 +00:00
Chris Lattner
dd255a6247 Add range insert method for DenseSet and define DenseMapInfo for chars.
Patch by Kevin Fan!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 19:50:49 +00:00
Dan Gohman
de551f91d8 Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented
calculations from target-oriented calculations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 18:45:54 +00:00
Misha Brukman
687b337a72 Fixed spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 16:13:29 +00:00
Ted Kremenek
6d7e49bb06 CMake: Have generated Xcode projects also contain the LLVM header files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68206 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 15:40:21 +00:00
Misha Brukman
d485e885f0 * Fixed spelling of `invertible'
* Simplified if statement


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 00:15:46 +00:00
Douglas Gregor
41222823db Allow the use of pointers to const within PointerUnion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 23:19:54 +00:00
Chris Lattner
b160f5d36d add a converting operator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 23:09:51 +00:00
Chris Lattner
722272df41 Add two new classes: WeakVH and AssertingVH. These are both "ValueHandles",
which are effectively smart pointers to Value*'s.  They are both very light
weight and simple, and react to values being destroyed or being RAUW'd.

WeakVN does a best effort to follow a value around, including through RAUW 
operations and will get nulled out of the value is destroyed.  This is useful
for the eventual "metadata that references a value" work, because it is a
reference to a value that does not show up on its use_* list.

AssertingVH is a pointer that compiles down to a dumb raw pointer when 
assertions are disabled.  When enabled, it emits an assertion if the 
pointed-to value is destroyed while it is still being referenced.  This
is very useful for Maps and other things, and should have caught the recent
bugs in CallGraph and Reassociate, for example.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68149 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 22:11:05 +00:00
Chris Lattner
f385167b85 teach PointerLikeTypeTraits that all pointers to pointers may only be 4-byte aligned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 21:28:39 +00:00
Chris Lattner
bdd376ccb2 add some accessors so I can play games with DenseMaps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 20:57:23 +00:00
Dan Gohman
968dc7a207 Reapply 68073, with fixes. EH Landing-pad basic blocks are not
entered via fall-through. Don't miss fallthroughs from blocks
terminated by conditional branches. Also, move
isOnlyReachableByFallthrough out of line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 18:39:13 +00:00
Douglas Gregor
da84b25b13 Stop guessing, start thinking, and make PointerUnion3::is actually be correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68126 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 18:31:03 +00:00
Daniel Dunbar
be46c79501 Add llvm::sys::getHostTriple and remove
llvm::sys::getOS{Name,Version}.

Right now the implementation just derives from LLVM_HOSTTRIPLE (which
is wrong, but it doesn't look like we have a define for the target
triple). Ideally this routine would actually be able to compute the
triple for targets we care about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 17:30:15 +00:00
Bill Wendling
df4881c68a Really temporarily revert r68073.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68100 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 08:42:40 +00:00
Bill Wendling
e67f5e4273 Oy! When reverting r68073, I added in experimental code. Sorry...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 08:41:31 +00:00
Bill Wendling
8fe00540fc Revert r68073. It's causing a failure in the Apple-style builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68092 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 08:26:26 +00:00
Chris Lattner
c4ef551192 shrink subclassid, liberating some bits for future (ab)use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 07:25:22 +00:00
Douglas Gregor
a7425d7fde Really, really fix PointerUnion3::is
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 00:34:31 +00:00
Dan Gohman
80c93e7442 Except in asm-verbose mode, avoid printing labels for blocks that are
only reachable via fall-through edges. This dramatically reduces the
number of labels printed, and thus also the number of labels the
assembler must parse and remember.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 22:55:17 +00:00
Douglas Gregor
2048cdb08e Make PointerUnion3::get work properly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68067 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 21:44:13 +00:00
Chris Lattner
f54229192c update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 20:44:04 +00:00
Chris Lattner
e8bc475668 add a PointerUnion3 class and generalize PointerUnion to work with
anything pointer-like, which may or may not actually be a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 20:29:27 +00:00
Chris Lattner
c6a4b6b78b fix the PointerLikeTypeTraits specialization for PointerIntPair to
allow the traits to be specified as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 20:28:50 +00:00
Dan Gohman
6d1b89e74f Constify arguments in isSuccessor and isLayoutSuccessor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68054 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 20:06:29 +00:00
Anton Korobeynikov
ca6234944c Clearify local/global relocations wording
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68037 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 17:38:00 +00:00
Anton Korobeynikov
fca82deecb Do not propagate ELF-specific stuff (data.rel) into other targets. This simplifies code and also ensures correctness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68032 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 15:27:43 +00:00
Anton Korobeynikov
71a7c6cde0 Add data.rel stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68031 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 15:27:03 +00:00
Misha Brukman
031b7481c8 Updated the comment for isArithmeticShift() to match reality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 20:41:38 +00:00
Bill Wendling
31fd5a571e Constify check. This fixes PR3900.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 20:08:56 +00:00
Anton Korobeynikov
db2323148b Honour relocation behaviour stuff for ro objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68005 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 17:13:49 +00:00
Anton Korobeynikov
ab267a2823 Extend the relocation tracker handler, so we can filter on different 'kinds' of relocations required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 17:13:18 +00:00
Chris Lattner
54e01d06db add missing space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67995 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 13:26:05 +00:00
Chris Lattner
3a9fe06bfe add some comments, add a dyn_cast method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 07:03:30 +00:00
Chris Lattner
f341a47d10 When forming sentinels for empty/tombstone, make sure to respect the
pointer's expected number of zero low-bits.

This should fix the breakage I introduced recently.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:33:22 +00:00
Chris Lattner
ba315c1ee7 add helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67989 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:32:46 +00:00
Chris Lattner
2491e4657d Add a simple type-safe bit-mangling pointer union class. This allows
you to do things like:

  ///    PointerUnion<int*, float*> P;
  ///    P = (int*)0;
  ///    printf("%d %d", P.is<int*>(), P.is<float*>()); // prints "1 0"
  ///    X = P.get<int*>();     // ok.
  ///    Y = P.get<float*>();   // runtime assertion failure.
  ///    Z = P.get<double*>();  // does not compile.
  ///    P = (float*)0;
  ///    Y = P.get<float*>();   // ok.
  ///    X = P.get<int*>();     // runtime assertion failure.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:06:02 +00:00
Chris Lattner
540db8bcb8 Allow a specific PointerIntPair instance to use a specific Pointer trait:
some pointer instances have properties that not all of a type have.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:02:20 +00:00
Chris Lattner
911c8b21da Add a PointerLikeTypeTraits specialization for uintptr_t
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:00:21 +00:00
Chris Lattner
aab3d88bc4 Value* only has 2 bits free as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67984 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 05:45:43 +00:00
Chris Lattner
e30173ac33 Replace the PointerLikeTypeTraits::getNumLowBitsAvailable
function with a new NumLowBitsAvailable enum, which makes the
value available as an integer constant expression.

Add PointerLikeTypeTraits specializations for Instruction* and
Use** since they are only guaranteed 4-byte aligned.

Enhance PointerIntPair to know about (and enforce) the alignment
specified by PointerLikeTypeTraits.  This should allow things 
like PointerIntPair<PointerIntPair<void*, 1,bool>, 1, bool> 
because the inner one knows that 2 low bits are free.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 04:32:37 +00:00
Chris Lattner
8ee1b5e916 rename PointerLikeTypeInto to PointerLikeTypeTraits, add trait for
# low bits free, and move to its own header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:39:30 +00:00
Chris Lattner
6a0dcc1077 now that you can put a PointerIntPair in a SmallPtrSet, remove some
hackish workarounds from memdep


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:24:04 +00:00
Chris Lattner
4d4177b9b3 teach SmallPtrSet that PointerIntPair is "basically a pointer".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:18:42 +00:00
Arnold Schwaighofer
e75fd69f15 Enable tail call optimization for functions that return a struct (bug 3664) and for functions that return types that need extending (e.g i1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 08:33:27 +00:00
Chris Lattner
1717f3af08 declare everything as class to avoid angering the VC++ gods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67931 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 07:48:03 +00:00
Chris Lattner
6de6030718 add a traits class for SmallPtrSet that allows us to stick things that are
"basically pointers" into it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 07:44:53 +00:00
Evan Cheng
0b0cd9113a Optimize some 64-bit multiplication by constants into two lea's or one lea + shl since imulq is slow (latency 5). e.g.
x * 40
=>
shlq    $3, %rdi
leaq    (%rdi,%rdi,4), %rax

This has the added benefit of allowing more multiply to be folded into addressing mode. e.g.
a * 24 + b
=>
leaq    (%rdi,%rdi,2), %rax
leaq    (%rsi,%rax,8), %rax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67917 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 05:57:29 +00:00
Chris Lattner
e8b64106ec move a large method out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 02:08:47 +00:00
Gabor Greif
d257f7d96b "ghostify" the ilist<Function> sentinel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 22:28:33 +00:00
Mike Stump
5c1f715d4b Allow invertable -xno- style optins as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 20:12:55 +00:00
Dan Gohman
9c01f2dd0b Revert r67844. This fixes the llvm-gcc-4.2 build on Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 18:37:13 +00:00
Duncan Sands
76d3838454 Reapply r66415, which was reverted in r66426 for
causing a bootstrap failure.  Bootstraps here on
x86-32-linux and x86-64-linux.  Requested by the
author Gabor Greif who says that a bug that might
have been causing the failure has since been fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 15:29:38 +00:00
Mikhail Glushenkov
d50d32b940 -write-graph now can be used with -o.
Makes it possible to set the output file name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 12:57:14 +00:00
Evan Cheng
42bf74be14 CodeGen still defaults to non-verbose asm, but llc now overrides it and default to verbose.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 01:47:28 +00:00
Dale Johannesen
16581bf931 Use a SmallPtrSet instead of std::set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 23:39:20 +00:00
Evan Cheng
2824a65550 Fix PR3391 and PR3864. Reg allocator infinite looping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67544 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 18:24:37 +00:00
Dan Gohman
3974667c1a Add a new bit to SUnit to record whether a node has implicit physreg
defs, regardless of whether they are actually used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67528 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 16:10:52 +00:00
Dan Gohman
f49f0cdb48 Clarify a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 15:54:02 +00:00
Dan Gohman
b45088cd96 Make getOperandNumForIncomingValue and getOperandNumForIncomingBlock
static member functions, and add getIncomingValueNumForOperand
and getIncomingBlockNumForOperand, which are the respective
inverses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67522 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 15:48:29 +00:00
Evan Cheng
fb11288109 Model inline asm constraint which ties an input to an output register as machine operand TIED_TO constraint. This eliminated the need to pre-allocate registers for these. This also allows register allocator can eliminate the unneeded copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67512 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 08:01:15 +00:00
Chris Lattner
dae2206390 Fix PR3860 by correcting a predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-22 19:22:53 +00:00
Chris Lattner
4cc2b85861 add method to access a template argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67458 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-22 00:18:18 +00:00
Duncan Sands
64da9409cb Factorize out a concept - no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67454 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-21 21:27:31 +00:00