Owen Anderson
3062625451
Use the GCC built-in for PopulationCount when it's available, and use a faster
...
algorithm when it's not. This should be particularly noticeable in the
64-bit case.
llvm-svn: 34776
2007-03-01 05:41:28 +00:00
Reid Spencer
d99feafd5f
Add a square root function.
...
llvm-svn: 34775
2007-03-01 05:39:56 +00:00
Reid Spencer
5a642a7991
Reduce #includage by taking a method out of line.
...
llvm-svn: 34774
2007-03-01 04:02:06 +00:00
Reid Spencer
0f49976928
Add an IntegerType::getMask() method to get an APInt mask for the type.
...
llvm-svn: 34771
2007-03-01 02:25:03 +00:00
Evan Cheng
71c2d65e74
Clean up interface.
...
llvm-svn: 34769
2007-03-01 02:18:06 +00:00
Evan Cheng
8a703ad4b6
Track all joined registers and eliminate unneeded kills after all joining are done.
...
llvm-svn: 34767
2007-03-01 02:03:03 +00:00
Evan Cheng
d97ccab64d
MachineBasicBlock fields should not be public.
...
llvm-svn: 34766
2007-03-01 02:00:40 +00:00
Reid Spencer
9b3d6ec983
Move ConstantRange class to lib/Support from lib/Analysis and make its
...
interface not depend on Type or ICmpInst.
llvm-svn: 34761
2007-02-28 22:02:48 +00:00
Reid Spencer
0286bc1af5
Provide an ICmpInst::makeConstantRange to generate a ConstantRange value
...
from a predicate and an APInt. This is removed from ConstantRange class
so that ConstantRange doesn't have to depend on lib/VMCore.
llvm-svn: 34760
2007-02-28 22:00:54 +00:00
Reid Spencer
3a7e9d8e75
For PR1205:
...
Remove ConstantInt from ConstantRange interface and adjust its users to
compensate.
llvm-svn: 34758
2007-02-28 19:57:34 +00:00
Reid Spencer
8774fe816a
Implement a convenience method to construct a ConstantInt directly from an
...
APInt. The implied type is the integer type that corresponds to the bit
width of the APInt.
llvm-svn: 34757
2007-02-28 19:50:21 +00:00
Reid Spencer
56f784d12d
For PR1205:
...
First round of ConstantRange changes. This makes all CR constructors use
only APInt and not use ConstantInt. Clients are adjusted accordingly.
llvm-svn: 34756
2007-02-28 18:57:32 +00:00
Jim Laskey
c114990526
Provide a more meaningful name.
...
llvm-svn: 34751
2007-02-28 18:37:50 +00:00
Reid Spencer
e1f3f1919c
For PR1205:
...
Convert ConstantRange class to use APInt internally as its value type for
the constant range, instead of ConstantInt.
llvm-svn: 34745
2007-02-28 17:36:23 +00:00
Reid Spencer
074b8a080e
Make APInt a little more friendly to its users:
...
* Add support for + and - of a uint64_t.
* Make trunc/sext/zext return *this so it can be chained with other ops
* Add smin, smax, umin, umax functions for getting min/max values.
llvm-svn: 34742
2007-02-28 17:33:36 +00:00
Nate Begeman
e0232ec706
More Mach-O writer improvements.
...
llvm-svn: 34740
2007-02-28 07:40:50 +00:00
Chris Lattner
74bb92902e
add methods for analysis of call results and return nodes.
...
llvm-svn: 34738
2007-02-28 07:09:40 +00:00
Chris Lattner
e74744143f
add methods to analyze calls and formals.
...
llvm-svn: 34736
2007-02-28 06:56:37 +00:00
Reid Spencer
f8470272a7
getActiveWords should return the number of words, not the index of the
...
highest active words. Increment its result by one.
llvm-svn: 34713
2007-02-28 02:20:49 +00:00
Evan Cheng
e8af69632f
Make requiresRegisterScavenging determination on a per MachineFunction basis.
...
llvm-svn: 34711
2007-02-28 00:59:19 +00:00
Evan Cheng
589ba3964b
MRegisterInfo disowns RegScavenger. It's immutable.
...
llvm-svn: 34706
2007-02-28 00:17:36 +00:00
Reid Spencer
98765e17df
Add some syntactic sugar.
...
llvm-svn: 34704
2007-02-27 23:47:33 +00:00
Evan Cheng
a7e4b60b85
Some more code clean up.
...
llvm-svn: 34700
2007-02-27 22:58:43 +00:00
Evan Cheng
8a8dc04e7e
Oops.
...
llvm-svn: 34698
2007-02-27 22:10:52 +00:00
Reid Spencer
31acef50ad
Implement countLeadingOnes() and getMinSignedBits(). This helps to minimize
...
the bit width of negative numbers by computing the minimum bit width for a
negative value. E.g. 0x1800000000000000 could be just 0x8000000000000000
llvm-svn: 34695
2007-02-27 21:59:26 +00:00
Evan Cheng
51f54640de
RegScavenger interface change to make it more flexible.
...
llvm-svn: 34690
2007-02-27 21:09:48 +00:00
Evan Cheng
16fd33ac5c
Let MRegisterInfo owns RegScavenger.
...
llvm-svn: 34689
2007-02-27 21:08:07 +00:00
Evan Cheng
6b70685aa5
Pass IsImp, IsKill, and IsDead to ChangeToRegister.
...
llvm-svn: 34688
2007-02-27 21:06:57 +00:00
Reid Spencer
70cb5d4287
Improve APInt interface:
...
1. Add unsigned and signed versions of methods so a "bool" argument doesn't
need to be passed in.
2. Make the various getMin/getMax functions all be inline since they are
so simple.
3. Simplify sdiv and srem code.
llvm-svn: 34680
2007-02-27 20:24:31 +00:00
Reid Spencer
c561bd2f18
Allow the RoundDoubleToAPInt function to specify a width to use.
...
llvm-svn: 34672
2007-02-27 18:22:31 +00:00
Devang Patel
28349abeab
Make getPassManagerType() const.
...
llvm-svn: 34669
2007-02-27 15:00:39 +00:00
Chris Lattner
9f059194a7
Minor refactoring of CC Lowering interfaces
...
llvm-svn: 34656
2007-02-27 05:13:54 +00:00
Chris Lattner
dc3adc83e7
move CC Lowering stuff to its own public interface
...
llvm-svn: 34655
2007-02-27 04:43:02 +00:00
Evan Cheng
ca25c0ee0d
forward() should not increment internal iterator. Its client may insert instruction between now and next forward() call.
...
llvm-svn: 34649
2007-02-27 01:58:48 +00:00
Reid Spencer
b31bffed96
For PR1205:
...
Implement the first step towards arbitrary precision integer support in
LLVM. The APInt class provides arbitrary precision arithmetic and value
representation. This patch changes ConstantInt to use APInt as its value
representation without supporting bit widths > 64 yet. That change will
come after ConstantFolding handles bit widths > 64 bits.
llvm-svn: 34647
2007-02-26 23:54:03 +00:00
Evan Cheng
bdec83e4d2
Joining an interval with a dead copy instruction. Shorten the live range to the last use.
...
llvm-svn: 34645
2007-02-26 21:37:37 +00:00
Reid Spencer
3d88599863
Fix indentation.
...
llvm-svn: 34643
2007-02-26 21:06:05 +00:00
Reid Spencer
eed186ee58
1. Split getValue() into getSExtValue() and getZExtValue() to match
...
ConstantInt better.
2. Add a getHashValue() method.
llvm-svn: 34641
2007-02-26 20:57:12 +00:00
Reid Spencer
62530f93b3
Implement inline methods that make transition of ConstantInt to use APInt
...
easier to comprehend and might be useful elsewhere.
llvm-svn: 34635
2007-02-26 17:50:32 +00:00
Reid Spencer
862ee00550
Make isNegative() a const function since it doesn't modify the APInt.
...
llvm-svn: 34630
2007-02-26 07:45:40 +00:00
Reid Spencer
5aa8560eab
Add an isNegative method to determine if the APInt's value is negative.
...
This is much less expensive than a test against zero.
llvm-svn: 34619
2007-02-26 01:20:59 +00:00
Chris Lattner
76ac8f82bd
Rework GlobalValue::removeDeadConstantUsers to always remove dead constant
...
exprs hanging off a global, even if the global is not otherwise dead. This
requires some tricky iterator gymnastics.
This implements Transforms/GlobalOpt/constantexpr-dangle.ll by deleting a
constantexpr that made it appear that the address of the function was taken.
llvm-svn: 34608
2007-02-25 21:06:13 +00:00
Reid Spencer
a7bd1d0b04
Fix clearUnusedBits to not depend on "undefined behavior" of >> operator
...
when the bit size is equal to the word size. This happens to work out okay
on x86, but might not on other platforms. The change just detects when
there are no bits to clear (because BitWidth is a multiple of the word size)
and returns early.
Also, move some comments from .cpp file into header.
llvm-svn: 34602
2007-02-25 19:26:01 +00:00
Reid Spencer
16f043a12a
Add a private constructor for efficiency.
...
llvm-svn: 34580
2007-02-25 07:29:03 +00:00
Reid Spencer
8fe5240289
Improve documentation.
...
Make divide function internal (it was briefly external for testing).
llvm-svn: 34557
2007-02-24 09:50:13 +00:00
Chris Lattner
2195fc41ec
Refactor the setName stuff, moving it down the inheritance hierarchy, to
...
solve a crash in -instcombine -debug that was hit while investigating PR1217
llvm-svn: 34544
2007-02-24 00:55:48 +00:00
Devang Patel
d3ccdfd04d
Loop passes are set up to accept pointer.
...
llvm-svn: 34527
2007-02-23 17:53:17 +00:00
Evan Cheng
c6ee20233e
Temporay hook to enable register scavening for specific targets only.
...
llvm-svn: 34513
2007-02-23 01:07:04 +00:00
Evan Cheng
9965aebd5d
Use findRegisterUseOperand to find a kill of particular register.
...
llvm-svn: 34512
2007-02-23 01:04:26 +00:00
Evan Cheng
956fdeb694
Initial check in of register scavenger. Its only current functionality is tracking live registers per MBB.
...
llvm-svn: 34511
2007-02-23 01:01:19 +00:00