1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

17809 Commits

Author SHA1 Message Date
Reid Spencer
ee77d22f26 Make it possible to create an SCEVUnknown from an APInt as well as an int.
llvm-svn: 34816
2007-03-01 22:28:51 +00:00
Reid Spencer
e5456dea52 Although probably not necessary, guard against a potential assertion by
using isNullValue() instead of getZExtValue() == 0.

llvm-svn: 34815
2007-03-01 21:54:37 +00:00
Reid Spencer
3a7689fe22 Use isUnitValue() instead of getZExtValue() == 1 which will prevent an
assert if the ConstantInt's value is large.

llvm-svn: 34814
2007-03-01 21:51:23 +00:00
Reid Spencer
327ae8b712 Use APInt conversion to string so the result is correct regardless of the
bit width of the ConstantInt being converted.

llvm-svn: 34810
2007-03-01 21:00:32 +00:00
Reid Spencer
5790924b21 Use the APInt versions of the bit-wise conversions of float/double to int
and back. While this is not strictly necessary, it does pave the way for
future changes in casting. It should now be possible to improve vector
casting to deal with un-equal fp/int sizes.

llvm-svn: 34808
2007-03-01 20:44:23 +00:00
Reid Spencer
5d9574f37e Use modern variable name. ConstantUnsignedInt is long since dead. No
functional change with this patch.

llvm-svn: 34806
2007-03-01 20:27:41 +00:00
Jim Laskey
0b6492d5df Emit eh filter info.
llvm-svn: 34805
2007-03-01 20:26:43 +00:00
Jim Laskey
73e3ad1b10 Collect eh filter info.
llvm-svn: 34804
2007-03-01 20:25:32 +00:00
Reid Spencer
d7c97384ac Use a simpler constructor for ConstantInt.
llvm-svn: 34803
2007-03-01 20:25:31 +00:00
Jim Laskey
5f932644e9 Lower eh filter intrinsic.
llvm-svn: 34802
2007-03-01 20:24:30 +00:00
Reid Spencer
381752cb34 Wrap a long line.
llvm-svn: 34799
2007-03-01 19:48:16 +00:00
Reid Spencer
30758bbe85 Avoid a potential assert out if the loop increment is > 64 bits.
llvm-svn: 34798
2007-03-01 19:45:00 +00:00
Reid Spencer
29c98b589c Regenerate.
llvm-svn: 34797
2007-03-01 19:41:47 +00:00
Reid Spencer
30eac3e0b1 The 64-bit constructor for ConstantInt changes from int64_t to uint64_t.
This caused a warning for construction with -1. Avoid the warning by using
-1ULL instead.

llvm-svn: 34796
2007-03-01 19:33:52 +00:00
Reid Spencer
288f1db60d Construct ConstantInt with simpler constructor.
llvm-svn: 34795
2007-03-01 19:32:33 +00:00
Reid Spencer
125af87a25 Use a simpler constructor when constructing ConstantInt. Also, replace
verbose code to sext/trunc or zext/trunc and APInt with new methods on
that class.

llvm-svn: 34794
2007-03-01 19:32:01 +00:00
Reid Spencer
b0a7bfa105 Use a simpler constructor when constructing ConstantInst.
llvm-svn: 34793
2007-03-01 19:31:12 +00:00
Reid Spencer
b4e877c488 Drop the ConstantInt(const Type&, const APInt&) constructor. It is
redundant and more verbose than the ConstantInt(const APInt&) constructor.

llvm-svn: 34792
2007-03-01 19:30:34 +00:00
Reid Spencer
c94231581b Make the static table of results in sqrt const.
llvm-svn: 34791
2007-03-01 17:47:31 +00:00
Reid Spencer
18d663b62c Fix last night's 445.gobmk breakage which was caused by comparison of
APInt's of unequal bitwidth.

llvm-svn: 34790
2007-03-01 17:17:21 +00:00
Reid Spencer
6a95676875 Add methods for bit width modification: sextOrTrunc, zextOrTrunc.
llvm-svn: 34789
2007-03-01 17:15:32 +00:00
Anton Korobeynikov
eaf27d276a Ensure that fastcall'ed function is correctly mangled & stack is
properly aligned

llvm-svn: 34788
2007-03-01 16:29:22 +00:00
Nicolas Geoffray
4b5b81198a Implemented the frameaddress intrinsic for PPC.
llvm-svn: 34787
2007-03-01 13:11:38 +00:00
Evan Cheng
7d470c14cf Delete register scavenger when done with it.
llvm-svn: 34786
2007-03-01 10:23:33 +00:00
Evan Cheng
07dcde8ba2 Use a spilled free callee-saved register as scratch register.
llvm-svn: 34785
2007-03-01 08:57:52 +00:00
Evan Cheng
0aa68b9246 Add a version of FindUnusedReg that restrict search to a specific set of registers.
llvm-svn: 34784
2007-03-01 08:56:24 +00:00
Evan Cheng
8d3d4155e5 - Track which callee-saved registers are spilled.
- Some code clean up.

llvm-svn: 34783
2007-03-01 08:26:31 +00:00
Reid Spencer
3f3487918c Remove the "isSigned" parameters from ConstantRange. It turns out they
are not needed as the results are the same with or without it.

Patch by Nicholas Lewycky.

llvm-svn: 34782
2007-03-01 07:54:15 +00:00
Evan Cheng
f771a323c2 Switch from std::vector<bool> to BitVector.
llvm-svn: 34781
2007-03-01 07:52:44 +00:00
Reid Spencer
036051c002 APIntify various computations in ScalarEvolution
llvm-svn: 34780
2007-03-01 07:25:48 +00:00
Reid Spencer
0d77fe7f06 Use a real table in sqrt to shorten and quicken the code.
Thanks for the idea Chris.

llvm-svn: 34779
2007-03-01 06:23:32 +00:00
Bill Wendling
2aabf75e82 Get rid of verboten <iostream> include.
llvm-svn: 34777
2007-03-01 06:05:39 +00:00
Reid Spencer
b6dd32889e Add a square root function.
llvm-svn: 34775
2007-03-01 05:39:56 +00:00
Reid Spencer
32d0051c64 Reduce #includage by taking a method out of line.
llvm-svn: 34774
2007-03-01 04:02:06 +00:00
Evan Cheng
ad431d7a94 A restore is promoted to copy (or deleted entirely), remove the kill from the last use of the targetted register.
llvm-svn: 34773
2007-03-01 02:27:30 +00:00
Evan Cheng
ce7f2618a9 Interface clean up.
llvm-svn: 34772
2007-03-01 02:25:51 +00:00
Evan Cheng
15a878202b Interface clean up.
llvm-svn: 34770
2007-03-01 02:19:39 +00:00
Evan Cheng
938b4d7817 Oops.
llvm-svn: 34768
2007-03-01 02:05:35 +00:00
Evan Cheng
d1fa618990 Track all joined registers and eliminate unneeded kills after all joining are done.
llvm-svn: 34767
2007-03-01 02:03:03 +00:00
Reid Spencer
67eedb21b7 For PR1205:
Make GetConstantFactor compute its result using an APInt.

llvm-svn: 34765
2007-02-28 23:31:17 +00:00
Dale Johannesen
f38e3d7085 Changes requested in review of last pass. Also pulled isThumb into a
member, instead of resetting in every function that uses it.

llvm-svn: 34764
2007-02-28 23:20:38 +00:00
Evan Cheng
5dc0ece7cb Doh. ARM::PC is obvious a reserved register.
llvm-svn: 34763
2007-02-28 23:12:34 +00:00
Reid Spencer
19e5279a38 For PR1205:
Adjust to changes in ConstantRange interface.

llvm-svn: 34762
2007-02-28 22:03:51 +00:00
Reid Spencer
f119927a6f 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
f632e1cd14 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
Jim Laskey
6dd0f88e75 Chain is on second operand.
llvm-svn: 34759
2007-02-28 20:43:58 +00:00
Reid Spencer
965067a054 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
a9d0cc903b 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
e2b4631435 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
Dale Johannesen
5ec68034ee Add intelligence about where to break large blocks.
llvm-svn: 34755
2007-02-28 18:41:23 +00:00
Chris Lattner
bcc44762bc remove dead option
llvm-svn: 34754
2007-02-28 18:39:53 +00:00
Jim Laskey
6b2170fefe Handle mix of personalities.
llvm-svn: 34752
2007-02-28 18:38:31 +00:00
Jim Laskey
1fea0fa316 Provide a more meaningful name.
llvm-svn: 34751
2007-02-28 18:37:50 +00:00
Jim Laskey
83d6baee5b MERGE_VALUES unnecessary.
llvm-svn: 34750
2007-02-28 18:37:04 +00:00
Chris Lattner
d8c7e8999e bugfix: fastcall does not require the first two params to be marked 'inreg',
they always get registers.

llvm-svn: 34748
2007-02-28 18:35:11 +00:00
Reid Spencer
2b933467ad 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
d91c898cc0 Make the trunc/sext/zext methods return APInt& so that these operations
can be chained together with other operations.

llvm-svn: 34743
2007-02-28 17:34:32 +00:00
Nate Begeman
7beafa54b3 Fix a typo, thanks Bill!
llvm-svn: 34741
2007-02-28 09:16:38 +00:00
Nate Begeman
2288ec3331 More Mach-O writer improvements.
llvm-svn: 34740
2007-02-28 07:40:50 +00:00
Chris Lattner
a66d550298 use high-level functions in CCState
llvm-svn: 34739
2007-02-28 07:09:55 +00:00
Chris Lattner
6d383bd2f1 add methods for analysis of call results and return nodes.
llvm-svn: 34738
2007-02-28 07:09:40 +00:00
Chris Lattner
3663b6e73a make use of helper functions in CCState for analyzing formals and calls.
llvm-svn: 34737
2007-02-28 07:00:42 +00:00
Chris Lattner
a68a949ba5 add methods to analyze calls and formals.
llvm-svn: 34736
2007-02-28 06:56:37 +00:00
Chris Lattner
5a20764bbb add a newline at end of file
llvm-svn: 34735
2007-02-28 06:42:11 +00:00
Chris Lattner
3762b44a0c switch LowerFastCCCallTo over to using the new fastcall description.
llvm-svn: 34734
2007-02-28 06:26:33 +00:00
Chris Lattner
a8dd712470 switch LowerFastCCArguments over to using the autogenerated Fastcall description.
llvm-svn: 34733
2007-02-28 06:21:19 +00:00
Chris Lattner
9a1f1c41b0 add new CC_X86_32_FastCall calling conv, which describes fastcall on win32.
Factor out a CC_X86_32_Common convention, which is the part shared between
ccc, stdcall and fastcall

llvm-svn: 34732
2007-02-28 06:20:01 +00:00
Chris Lattner
3b16744840 rearrange code
llvm-svn: 34731
2007-02-28 06:10:12 +00:00
Chris Lattner
023751c20b remove fastcc (not fastcall) support
llvm-svn: 34730
2007-02-28 06:05:16 +00:00
Chris Lattner
012066f78b switch LowerCCCArguments over to using autogenerated CC.
llvm-svn: 34729
2007-02-28 05:46:49 +00:00
Chris Lattner
6424f8e245 simplify sret handling
llvm-svn: 34728
2007-02-28 05:39:26 +00:00
Chris Lattner
76147834d6 switch LowerCCCCallTo over to using an autogenerated callingconv
llvm-svn: 34727
2007-02-28 05:31:48 +00:00
Chris Lattner
d663281088 rename stuff
llvm-svn: 34726
2007-02-28 05:30:29 +00:00
Chris Lattner
99f65b22c9 rename some CCActions, add CCIfInReg
llvm-svn: 34725
2007-02-28 05:29:33 +00:00
Chris Lattner
eef57fed6e switch return value passing and the x86-64 calling convention information
over to being autogenerated from the X86CallingConv.td file.

llvm-svn: 34722
2007-02-28 04:55:35 +00:00
Chris Lattner
3eb95551d7 make subtarget references work.
llvm-svn: 34721
2007-02-28 04:51:41 +00:00
Reid Spencer
f8e59cd357 Implement reading of arbitrary precision integers.
llvm-svn: 34718
2007-02-28 02:25:48 +00:00
Reid Spencer
4beda9543b Implement writing of arbitrary precision integers.
llvm-svn: 34717
2007-02-28 02:25:20 +00:00
Reid Spencer
2f6d8e2243 Regenerate.
llvm-svn: 34716
2007-02-28 02:24:54 +00:00
Reid Spencer
36f506df46 Implement arbitrary integer constants through the use of APInt values.
Positive, negative, and hexadecimal integer constants will now return an
APInt for values having > 64 bits of precision.

llvm-svn: 34715
2007-02-28 02:24:27 +00:00
Reid Spencer
14d26ed070 Implement support for aribrary precision integers by creating two new
tokens: ESAPINTVAL and EUAPINTVAL and adding an APInt* as a semantic value.
This allows us to extend the definition of an integer constant to allow
arbitrary precision integer constant values.

llvm-svn: 34714
2007-02-28 02:23:44 +00:00
Reid Spencer
b1eaa7bd52 Fix a bug in RoundDoubleToAPInt where it would force the size to 64 bits
instead of honoring the client's requested bit width.

llvm-svn: 34712
2007-02-28 01:30:08 +00:00
Evan Cheng
db591ecaa8 Make requiresRegisterScavenging determination on a per MachineFunction basis.
llvm-svn: 34711
2007-02-28 00:59:19 +00:00
Evan Cheng
cfb0f8cfc6 Temporary: make R12 available in ARM mode if RegScavenger is being used.
llvm-svn: 34709
2007-02-28 00:22:44 +00:00
Evan Cheng
fa23d8e51f Start making use of RegScavenger.
llvm-svn: 34708
2007-02-28 00:21:58 +00:00
Evan Cheng
116f97f2c7 PEI now passes a RegScavenger ptr to eliminateFrameIndex.
llvm-svn: 34707
2007-02-28 00:21:17 +00:00
Evan Cheng
ee2e5de4fb MRegisterInfo disowns RegScavenger. It's immutable.
llvm-svn: 34706
2007-02-28 00:17:36 +00:00
Reid Spencer
e306ef6798 Join two lines that can be joined.
llvm-svn: 34705
2007-02-27 23:49:07 +00:00
Reid Spencer
24430077d5 Pull out the stops.
llvm-svn: 34703
2007-02-27 23:33:03 +00:00
Reid Spencer
58f7a497bb Remove some redundancy.
llvm-svn: 34702
2007-02-27 23:27:26 +00:00
Evan Cheng
4357509984 Minor tweak. Allocate r0 to r3 in reverse order, r3 is least likely to be livein to a function.
llvm-svn: 34701
2007-02-27 23:03:55 +00:00
Evan Cheng
ec12bdd7ea Some more code clean up.
llvm-svn: 34700
2007-02-27 22:58:43 +00:00
Chris Lattner
da909a2df7 reenable generation of CC info
llvm-svn: 34699
2007-02-27 22:12:19 +00:00
Evan Cheng
2402ddad92 Oops.
llvm-svn: 34698
2007-02-27 22:10:52 +00:00
Reid Spencer
edbe747bab 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
b314459812 Back out previous commit temporarily.
llvm-svn: 34694
2007-02-27 21:47:22 +00:00
Evan Cheng
a19dd6f388 Let MRegisterInfo now owns RegScavenger; eliminateFrameIndex must preserve register kill info.
llvm-svn: 34692
2007-02-27 21:12:35 +00:00
Evan Cheng
4c4e56df47 Let MRegisterInfo now owns RegScavenger.
llvm-svn: 34691
2007-02-27 21:10:33 +00:00
Evan Cheng
f03b87c1ff RegScavenger interface change to make it more flexible.
llvm-svn: 34690
2007-02-27 21:09:48 +00:00
Chris Lattner
0d05dc2523 implement CCMatchIfCC in terms of CCMatchIf
llvm-svn: 34685
2007-02-27 20:45:02 +00:00
Chris Lattner
4d29a90170 build cc info
llvm-svn: 34684
2007-02-27 20:44:31 +00:00
Reid Spencer
8178fd7bd5 Adjust to changes in the APInt interface.
llvm-svn: 34681
2007-02-27 20:25:25 +00:00
Reid Spencer
9e66d0921a 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
e0c8670bfe Conform to single person attribution in file comment.
llvm-svn: 34678
2007-02-27 19:31:09 +00:00
Reid Spencer
a3b5b71616 For PR1205:
Implement review feedback:
1. Use new APInt::RoundDoubleToAPInt interface to specify the bit width so
   that we don't have to truncate or extend in constant folding.
2. Fix a pasteo in SDiv that prevented a check for overflow.
3. Fix the shift operators: undef happens when the shift amount is equal
   to the bitwidth.

llvm-svn: 34677
2007-02-27 19:29:54 +00:00
Reid Spencer
b61f731ddd 1. Fix three serious bugs in the comparison code.
2. Change RoundDoubleToAPInt to take a bit width parameter. Use that
   parameter to limit the bit width of the result.

llvm-svn: 34673
2007-02-27 18:23:40 +00:00
Chris Lattner
da49dee51d a note
llvm-svn: 34670
2007-02-27 17:21:09 +00:00
Devang Patel
89791371ce Make getPassManagerType() const.
llvm-svn: 34669
2007-02-27 15:00:39 +00:00
Nicolas Geoffray
a144ebf568 Fix parenthesis for BCTRL_{ELF|Macho} test.
llvm-svn: 34668
2007-02-27 13:10:41 +00:00
Nicolas Geoffray
a562e5c1c5 Differentiate between the MachO and the ELF ABI the CALL instruction.
llvm-svn: 34667
2007-02-27 13:01:19 +00:00
Jim Laskey
f5b5a3cf77 Duplicate use of LR, take 2.
llvm-svn: 34666
2007-02-27 11:55:45 +00:00
Reid Spencer
b05cb31bdf Allow the AsmWriter to print out arbitrary precision integers.
llvm-svn: 34664
2007-02-27 08:34:09 +00:00
Reid Spencer
74764708fa Correct the implelmentation of ConstantInt::getAllOnesValue() for bit
widths > 64 bits.

llvm-svn: 34663
2007-02-27 07:57:53 +00:00
Reid Spencer
1e498b04f5 Get rid of extraneous // in file comment.
llvm-svn: 34662
2007-02-27 07:35:18 +00:00
Chris Lattner
90c768b913 Add calling convention info
llvm-svn: 34661
2007-02-27 06:59:52 +00:00
Reid Spencer
de3bbe0489 For PR1205:
Implement constant folding via APInt instead of uint64_t.

llvm-svn: 34660
2007-02-27 06:23:51 +00:00
Chris Lattner
9f0e5d8b03 move target independent calling convention stuff to TargetCallingConv.td
llvm-svn: 34659
2007-02-27 05:57:32 +00:00
Chris Lattner
2b737abea1 fill in some holes
llvm-svn: 34658
2007-02-27 05:51:05 +00:00
Chris Lattner
9117648533 switch x86-64 return value lowering over to using same mechanism as argument
lowering uses.

llvm-svn: 34657
2007-02-27 05:28:59 +00:00
Chris Lattner
11a1c2113c Minor refactoring of CC Lowering interfaces
llvm-svn: 34656
2007-02-27 05:13:54 +00:00
Chris Lattner
e34136f6d5 move CC Lowering stuff to its own public interface
llvm-svn: 34655
2007-02-27 04:43:02 +00:00
Chris Lattner
cac44e283d refactor x86-64 argument lowering yet again, this time eliminating templates,
'clients', etc, and adding CCValAssign instead.

llvm-svn: 34654
2007-02-27 04:18:15 +00:00
Chris Lattner
ae7cc3e0e0 ConstantFolding.cpp/h -> ConstantFold.cpp/h to avoid confusion with
lib/Analysis/ConstantFolding.

llvm-svn: 34653
2007-02-27 03:05:06 +00:00
Evan Cheng
f54dbab209 Backing out Jim's LR spill changes. This was causing llvm-gcc bootstrapping
to infinite loop:
PPCMachineFunctionInfo.h updated: 1.2 -> 1.3
PPCRegisterInfo.cpp updated: 1.110 -> 1.111
PPCRegisterInfo.h updated: 1.28 -> 1.29

llvm-svn: 34652
2007-02-27 02:55:29 +00:00
Evan Cheng
341fc2bf88 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
67498a4072 Simplify and document RoundDoubleToAPInt.
llvm-svn: 34648
2007-02-27 01:28:10 +00:00
Reid Spencer
c8cc0f997e 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
Reid Spencer
97d7d18442 1. Make sure all delete operators of arrays use the array form of delete.
2. Rewrite operator=(const APInt& RHS) to allow the RHS to be a different
   bit width than the LHS. This makes it possible to use APInt as the key
   of a DenseMap, as needed for the IntConstants map in Constants.cpp
3. Fix operator=(uint64_t) to clear unused bits in case the client assigns
   a value that has more bits than the APInt allows.
4. Assert that bit widths are equal in operator==
5. Revise getHashValue() to put the bit width in the low order six bits.
   This should help to make i1 0, i2 0, ... i64 0 all distinct in the
   IntConstants DenseMap.

llvm-svn: 34646
2007-02-26 23:38:21 +00:00
Evan Cheng
0fd5788077 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
2dc808284e Implement the getHashValue method.
Fix toString use of getValue to use getZExtValue()

llvm-svn: 34642
2007-02-26 21:02:27 +00:00
Devang Patel
c13055b251 Use efficient container SmallPtrSet
llvm-svn: 34640
2007-02-26 20:22:50 +00:00
Chris Lattner
d4cd3a31e6 always lower to RETFLAG, never leave it as just ret.
llvm-svn: 34639
2007-02-26 19:44:02 +00:00
Devang Patel
b0b949f93e Do not unswitch loop on same value again and again.
llvm-svn: 34638
2007-02-26 19:31:58 +00:00
Chris Lattner
656996aab8 fix attribution
llvm-svn: 34637
2007-02-26 18:56:07 +00:00
Chris Lattner
948965f809 Add a description of the X86-64 calling convention and the return
conventions.  This doesn't do anything yet, but may in the future.

llvm-svn: 34636
2007-02-26 18:17:14 +00:00
Reid Spencer
728cf2d5cf Re-enable this. The header was committed.
llvm-svn: 34634
2007-02-26 08:10:54 +00:00
Chris Lattner
7165ee9b6b switch to smallvector
llvm-svn: 34633
2007-02-26 07:59:53 +00:00
Chris Lattner
4b7b0a145a another missing header :( :( :(
llvm-svn: 34632
2007-02-26 07:51:00 +00:00
Chris Lattner
3fe1132dcd initial hack at splitting the x86-64 calling convention info out from the
mechanics that process it.  I'm still not happy with this, but it's a step
in the right direction.

llvm-svn: 34631
2007-02-26 07:50:02 +00:00
Reid Spencer
050bd4479e 1. Remove redundant calls to clearUsedBits().
2. Fix countTrailingZeros to use a faster algorithm.
3. Simplify sext() slightly by using isNegative().
4. Implement ashr using word-at-a-time logic instead of bit-at-a-time
5. Rename locals named isNegative so they don't clash with method name.
6. Fix fromString to compute negated value correctly.

llvm-svn: 34629
2007-02-26 07:44:38 +00:00
Chris Lattner
d0c941c89e the truncate must always be done, it's only the assert that is conditional.
llvm-svn: 34628
2007-02-26 05:21:05 +00:00
Chris Lattner
cdbef93603 reapply my previous patch with a bugfix.
llvm-svn: 34627
2007-02-26 05:02:39 +00:00
Chris Lattner
96aac36de5 revert my previous change, something strange is happening.
llvm-svn: 34626
2007-02-26 04:43:19 +00:00
Chris Lattner
decf97fae2 add an accessor.
llvm-svn: 34625
2007-02-26 04:01:25 +00:00
Chris Lattner
2e7125dc74 in X86-64 CCC, i8/i16 arguments are already properly zext/sext'd on input.
Capture this so that downstream zext/sext's are optimized out.  This
compiles:
  int test(short X) { return (int)X; }

to:

_test:
        movl %edi, %eax
        ret

instead of:

_test:
        movswl %di, %eax
        ret


GCC produces this bizarre code:

_test:
        movw    %di, -12(%rsp)
        movswl  -12(%rsp),%eax
        ret

llvm-svn: 34623
2007-02-26 03:18:56 +00:00
Chris Lattner
65de507797 Fold (sext (truncate x)) more aggressively, by avoiding creation of a
sextinreg if not needed.   This is useful in two cases: before legalize,
it avoids creating a sextinreg that will be trivially removed.  After legalize
if the target doesn't support sextinreg, the trunc/sext would not have been
removed before.

llvm-svn: 34621
2007-02-26 03:13:59 +00:00
Chris Lattner
38db1ad2ab track signedness of formal argument, though we have a fixme here.
llvm-svn: 34620
2007-02-26 02:56:58 +00:00
Reid Spencer
6177d67365 Rewrite lshr to not do bit by bit copy but to copy and shift whole words.
This makes it much more efficient.

llvm-svn: 34618
2007-02-26 01:19:48 +00:00
Reid Spencer
82a5b300ad Fix sext operation. Shifting by zero would leave an incorrect mask.
llvm-svn: 34617
2007-02-25 23:54:00 +00:00
Reid Spencer
c0d07ad61a 1. Fix the flip() method to correctly flip all words of the APInt.
2. Implement the trunc, sext, and zext operations.
3. Improve fromString to accept negative values as input.

llvm-svn: 34616
2007-02-25 23:44:53 +00:00
Chris Lattner
ad14e21b97 Fix an X86-64 abi bug. We now compile:
void foo(short);
void bar(unsigned short A) {
  foo(A);
}

into:

_bar:
        subq $8, %rsp
        movswl %di, %edi
        call _foo
        addq $8, %rsp
        ret

instead of:

_bar:
        subq $8, %rsp
        call _foo
        addq $8, %rsp
        ret

Testcase here: test/CodeGen/X86/x86-64-shortint.ll

llvm-svn: 34615
2007-02-25 23:10:46 +00:00
Chris Lattner
15c167cc61 fix CodeGen/X86/2007-02-25-FastCCStack.ll, a regression from my patch last
night:  fastcc returns should only go in XMM0 if we have SSE2 or above.

llvm-svn: 34613
2007-02-25 22:23:46 +00:00
Jim Laskey
c2e9ceb475 Fix for PR1224.
llvm-svn: 34610
2007-02-25 21:43:59 +00:00
Chris Lattner
50be7cd320 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
Chris Lattner
2fbfbcd9cd disable some noisy debug output
llvm-svn: 34606
2007-02-25 20:42:59 +00:00
Chris Lattner
796625a49d no really, this is the right patch
llvm-svn: 34605
2007-02-25 20:01:40 +00:00
Chris Lattner
49fc72110a always promote float varargs to double.
llvm-svn: 34604
2007-02-25 19:59:18 +00:00
Reid Spencer
e6f7201099 1. Provide more detail in file comment.
2. Move comments for methods to .h file, delete them in .cpp file.
3. All places that were doing manual clear of high order bits now call the
   clearUnusedBits() method in order to not depend on undefined behavior
   of the >> operator when the number of bits shifted equals the word size.
4. Reduced # of loc by using the new result of clearUnusedBits() method.
5. Simplified logic (decreased indentation) in a few places.
6. Added code comments to larger functions that needed them.
7. Added FIXME notes about weak implementations of things (e.g. bit-by-bit
   shift right is sub-optimal).

llvm-svn: 34603
2007-02-25 19:32:03 +00:00
Chris Lattner
b5ce97a83a one important bugfix: PPC32 didn't have both elf and macho support for
external symbols and global addresses.  Add the missing ones.

one important workaround: PPCISD::CALL is matched by both PPCcall_ELF
and PPCcall_Macho, disable the _ELF patterns for now.

llvm-svn: 34601
2007-02-25 19:20:53 +00:00
Chris Lattner
a9c561b9e6 optimize duplicate ValueMap lookups
llvm-svn: 34599
2007-02-25 18:40:32 +00:00
Dale Johannesen
f6f34ec2e0 cosmetic changes from review of last patch. obvious
llvm-svn: 34598
2007-02-25 18:31:31 +00:00
Evan Cheng
550798e5d5 A couple of more places where a register liveness has been extended and its last kill should be updated accordingly.
llvm-svn: 34597
2007-02-25 09:51:27 +00:00
Evan Cheng
13e48f975c Add an assertion.
llvm-svn: 34596
2007-02-25 09:47:31 +00:00
Evan Cheng
189678c421 Fix a couple of bugs related IsDead back propagation during coalescing.
llvm-svn: 34595
2007-02-25 09:46:31 +00:00
Evan Cheng
8f3e6bfeb3 If the liveinterval of the source instruction has been extended, remove the IsKill marker.
llvm-svn: 34594
2007-02-25 09:41:59 +00:00
Evan Cheng
9968353d64 Only add liveinterval to livein set if it isn't assigned a stack slot.
llvm-svn: 34593
2007-02-25 09:39:02 +00:00
Chris Lattner
65ba08d627 fastcc functions that return double values now return them in xmm0 on x86-32.
This implements CodeGen/X86/fp-stack-ret.ll:test[23]

llvm-svn: 34592
2007-02-25 09:31:16 +00:00
Chris Lattner
e4ba88824d allow vectors to be passed to stdcall/fastcall functions
llvm-svn: 34590
2007-02-25 09:14:25 +00:00
Chris Lattner
fac0b30da0 move LowerRET into the 'Return Value Calling Convention Implementation'
section of the file.

llvm-svn: 34589
2007-02-25 09:12:39 +00:00
Chris Lattner
65d915a3b6 make all Lower*CallTo implementations use LowerCallResult to handle their
result value stuff.  This eliminates a bunch of duplicated code and now
GetRetValueLocs is the sole place that decides where a value is returned.

llvm-svn: 34588
2007-02-25 09:10:05 +00:00
Chris Lattner
423224a7b4 pass the calling convention into Lower*CallTo, instead of using ad-hoc flags.
llvm-svn: 34587
2007-02-25 09:06:15 +00:00
Chris Lattner
8fa75c3ae8 factor a bunch of code out of LowerCCCCallTo into a new LowerCallResult
function.  This function now uses GetRetValueLocs to determine *where*
the result values are located and concerns itself with *how* to pull the
values out.

llvm-svn: 34586
2007-02-25 08:59:22 +00:00
Chris Lattner
3bfbc23ccd move some code around, pass in calling conv, even though it is unused
llvm-svn: 34585
2007-02-25 08:29:00 +00:00
Chris Lattner
e9c4c19b27 fold trivial token factor nodes. This allows us to compile
test/CodeGen/X86/fp-stack-ret.ll into:

        movl 4(%esp), %eax
        fldl (%eax)
        ret

instead of:

        subl $12, %esp
        movl 16(%esp), %eax
        movsd (%eax), %xmm0
        movsd %xmm0, (%esp)
        fldl (%esp)
        addl $12, %esp
        ret

by eliminating a token factor that blocked a check.

llvm-svn: 34584
2007-02-25 08:24:27 +00:00
Chris Lattner
f119813ff4 simplify result value lowering by splitting the selection of *where* to return
registers out from the logic of *how* to return them.

This changes X86-64 to mark EAX live out when returning a 32-bit value,
where before it marked RAX liveout.

llvm-svn: 34582
2007-02-25 08:15:11 +00:00
Reid Spencer
ec6159bbea Allow this to compile now that the header file is checked in.
llvm-svn: 34581
2007-02-25 07:30:14 +00:00
Chris Lattner
bcce79717b make void-return not a special case
llvm-svn: 34579
2007-02-25 07:18:38 +00:00
Chris Lattner
d00fcb3277 eliminate a bunch more temporary vectors from X86 lowering.
llvm-svn: 34578
2007-02-25 07:10:00 +00:00
Chris Lattner
f7eeef816d eliminate temporary vectors created during X86 lowering.
llvm-svn: 34577
2007-02-25 06:40:16 +00:00
Chris Lattner
6f25082e67 remove std::vector's in RET lowering.
llvm-svn: 34576
2007-02-25 06:21:57 +00:00
Chris Lattner
041fb5bc67 implement support for the linux/ppc function call ABI. Patch by
Nicolas Geoffray!

llvm-svn: 34574
2007-02-25 05:34:32 +00:00
Chris Lattner
ed4920842f Add XLForm_1_ext template, patch by Nicolas Geoffray.
llvm-svn: 34573
2007-02-25 05:07:49 +00:00
Chris Lattner
42cfb7c452 Improve JIT support for linux/ppc: Patch by Nicolas Geoffray!
llvm-svn: 34572
2007-02-25 05:04:13 +00:00
Chris Lattner
5adebeb207 this doesn't compile, disable it
llvm-svn: 34571
2007-02-25 02:32:44 +00:00
Reid Spencer
0fd90c3447 Clean up lshr and ashr to coding standards.
Handle the single word cases for shiftAmt == BitWidth.

llvm-svn: 34569
2007-02-25 01:56:07 +00:00
Dale Johannesen
6e366a1006 remove crediting of Evan Cheng and me.
llvm-svn: 34568
2007-02-25 01:42:36 +00:00
Chris Lattner
b9f2992e38 initialize a instance variable
llvm-svn: 34567
2007-02-25 01:28:05 +00:00
Reid Spencer
66e162cfcd Whoops, last word with bits in large shift left wasn't correct.
llvm-svn: 34565
2007-02-25 01:08:58 +00:00
Reid Spencer
4dcbccdc99 Fix the > 64 bits case for left shift.
llvm-svn: 34564
2007-02-25 00:56:44 +00:00
Dale Johannesen
ccecc12da5 Removed WaterListOffset, inserted BBOffsets. Remove TODO item about this
from README.
When no water available, use end of block if in range.  (More to do here.)

llvm-svn: 34563
2007-02-25 00:47:03 +00:00
Reid Spencer
ecc067a698 Fix the remainder shifting in KnuthDiv.
llvm-svn: 34562
2007-02-24 20:38:01 +00:00
Reid Spencer
d6956a0e8c 1. Fix a bug in fromString for the <= 64bits case
2. Fix shl when shiftAmount == BitWidth.

llvm-svn: 34560
2007-02-24 20:19:37 +00:00
Reid Spencer
e2bb0cf83e 1. Fix last bug in KnuthDiv. All divide tests pass up to 1024 bits now.
2. Clean up comments, style, coding standards, etc.
3. Simplify a constructor.

Extended testing revealed some additional bugs in shifting. I'll fix these
tomorrow.

llvm-svn: 34559
2007-02-24 10:01:42 +00:00
Jim Laskey
53e71a9657 Deal with cases when MMI is not requested.
llvm-svn: 34556
2007-02-24 09:45:44 +00:00
Jim Laskey
10c6c6b46d Drop unused operand.
llvm-svn: 34555
2007-02-24 09:44:17 +00:00
Reid Spencer
b45646b14e 1. Make internal functions take const arguments where they should, just
to be safe.
2. Make internal functions that return a carry/borrow return bool instead
   of uint64_t because the carry/borrow can only be in range [0,1].
3. Assert that the pointers to KnuthDiv are all different so that the
   result and operands can't overlap.
4. Add debug output to KnuthDiv function.
5. Fix a problem with KnuthDiv by separating the b's complement operation
   from the subtraction borrow operation. This fixes a wide range of
   division problems, but alas, not all of them.

llvm-svn: 34554
2007-02-24 03:58:46 +00:00
Chris Lattner
28f1c620c6 Fix PR1216 by cleaning up the ownership of JITResolver.
llvm-svn: 34552
2007-02-24 02:57:03 +00:00
Chris Lattner
6faf9e8e97 Fix CodeGen/Generic/2007-02-23-DAGCombine-Miscompile.ll and PR1219
llvm-svn: 34551
2007-02-24 02:09:29 +00:00
Chris Lattner
e37ee33c4e remove folding set debug output
llvm-svn: 34549
2007-02-24 01:41:48 +00:00
Chris Lattner
5480ffb904 Fix Transforms/ConstProp/2007-02-23-sdiv.ll and PR1215
llvm-svn: 34548
2007-02-24 01:19:50 +00:00
Chris Lattner
14217fb105 Fix InstCombine/2007-02-23-PhiFoldInfLoop.ll and PR1217
llvm-svn: 34546
2007-02-24 01:03:45 +00:00
Chris Lattner
0eb72353e4 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
Bill Wendling
2c5f64532b PR1164:
Generate local names with a "llvm_cbe_" prefix using the actual name of the
variable instead of a temporary name.

llvm-svn: 34540
2007-02-23 22:45:08 +00:00
Chris Lattner
042d3195c9 Avoid TBAA issue.
llvm-svn: 34539
2007-02-23 22:31:24 +00:00
Lauro Ramos Venancio
19040a3f0d bugfix: SP wasn't updated for varargs when frame pointer was eliminated.
llvm-svn: 34537
2007-02-23 21:53:48 +00:00
Evan Cheng
a68efe308e Reuse extends the liveness of a register. Transfer the kill to the operand that reuse it.
llvm-svn: 34536
2007-02-23 21:47:50 +00:00
Jim Laskey
dda4a7577f Handle improper cast.
llvm-svn: 34535
2007-02-23 21:45:01 +00:00
Evan Cheng
f2035d3916 Handle cases when joining live intervals of two virtual registers.
llvm-svn: 34534
2007-02-23 20:40:13 +00:00
Jim Laskey
704423b797 Don't spill LR as a callee saved register.
llvm-svn: 34533
2007-02-23 20:34:16 +00:00
Lauro Ramos Venancio
7c2f17b629 Fix stack alignment in functions with varargs.
llvm-svn: 34532
2007-02-23 20:32:57 +00:00
Chris Lattner
6334a918d8 fix an obscure and tricky bug the inliner can hit sometimes.
llvm-svn: 34531
2007-02-23 19:54:30 +00:00
Devang Patel
e0c0b3bea6 Fix thinko.
llvm-svn: 34528
2007-02-23 18:05:55 +00:00
Devang Patel
06b8983669 Loop passes are set up to accept pointer.
llvm-svn: 34527
2007-02-23 17:53:17 +00:00
Evan Cheng
bdc95679a3 Mark livein registers as being in used.
llvm-svn: 34525
2007-02-23 08:41:19 +00:00
Dale Johannesen
544968d665 rewrite of constant islands
llvm-svn: 34523
2007-02-23 05:02:36 +00:00
Evan Cheng
2d4b1cb0ca Added -march=thumb; removed -enable-thumb.
llvm-svn: 34521
2007-02-23 03:14:31 +00:00
Evan Cheng
3ddb5d1018 80 col. violation.
llvm-svn: 34520
2007-02-23 03:03:16 +00:00
Anton Korobeynikov
b7350e191e External weak linkage is supported by recent binutils on mingw32.
llvm-svn: 34519
2007-02-23 01:58:50 +00:00
Reid Spencer
3573b012d3 1. Fix a carry out problem in add if destination and x point to the same
memory (as done in fromString).
2. Implement Knuth divide more closely to what is recommended in his book.
3. Fix computation of the remainder for Knuth Divide (bad shifting).
4. Remove some cruft from the file

llvm-svn: 34518
2007-02-23 01:57:13 +00:00
Evan Cheng
b8a95dcdbf A spill kills the register being stored. But it is later being reused by spiller, its live range has to be extended.
llvm-svn: 34517
2007-02-23 01:13:26 +00:00
Evan Cheng
92429f4cca First potential client of register scavenger.
llvm-svn: 34516
2007-02-23 01:11:26 +00:00
Evan Cheng
da51cf986a By default, spills kills the register being stored.
llvm-svn: 34515
2007-02-23 01:10:04 +00:00
Evan Cheng
bd3219f5bf Add option to turn on register scavenger; By default, spills kills the register being stored.
llvm-svn: 34514
2007-02-23 01:09:11 +00:00
Evan Cheng
387f1c2bdf Use findRegisterUseOperand to find a kill of particular register.
llvm-svn: 34512
2007-02-23 01:04:26 +00:00
Evan Cheng
f9ef2bfd8a 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
Devang Patel
46cad14ab8 Teach LoopPass to assign itself one Loop Pass Manager.
llvm-svn: 34510
2007-02-23 00:36:57 +00:00
Devang Patel
9a7b18fa3d Add facility that allows LoopPass to re-insert a loop into
Loop Pass Manager's queue.

llvm-svn: 34509
2007-02-23 00:16:44 +00:00
Devang Patel
bbfd00e658 Add LPPassManager interface that LoopPass can use to skip
rest of the passes in the queue for a loop.

llvm-svn: 34508
2007-02-23 00:10:16 +00:00
Chris Lattner
f8d7232532 remove obsolete file
llvm-svn: 34506
2007-02-22 23:48:43 +00:00
Devang Patel
d7448faaed Populate and walk loop queue.
llvm-svn: 34505
2007-02-22 23:45:15 +00:00
Devang Patel
b170ebf833 Add LoopQueue. This is used by loop pass manager to manage loop nest.
llvm-svn: 34504
2007-02-22 23:30:07 +00:00
Evan Cheng
68e7fe47f6 Remove unnecessary isKill properties if a live range has been lengthened due to coalescing.
llvm-svn: 34503
2007-02-22 23:03:39 +00:00
Jim Laskey
322a2e8899 Update comment.
llvm-svn: 34502
2007-02-22 18:51:19 +00:00
Jim Laskey
1dd7563e22 Missing end of abbreviations - correction
llvm-svn: 34501
2007-02-22 18:48:52 +00:00
Jim Laskey
e177fd58b3 Missing end of abbreviations.
llvm-svn: 34500
2007-02-22 18:22:42 +00:00
Jim Laskey
f29366635a Need to init.
llvm-svn: 34499
2007-02-22 18:04:49 +00:00
Jim Laskey
8c79f0f892 Remove isAccessable.
llvm-svn: 34497
2007-02-22 16:39:03 +00:00
Jim Laskey
25993e18e6 Use exception flag.
llvm-svn: 34496
2007-02-22 16:22:15 +00:00
Jim Laskey
8ddfb7141b Revert changes for a simplier solution.
llvm-svn: 34495
2007-02-22 16:21:18 +00:00
Jim Laskey
4990356454 Remove assertion.
llvm-svn: 34494
2007-02-22 16:12:17 +00:00
Jim Laskey
f6f24530c0 Tighten up error checking of args.
llvm-svn: 34493
2007-02-22 16:10:05 +00:00
Jim Laskey
dccc6d3a82 Handle lowering invoke to call correctly.
llvm-svn: 34492
2007-02-22 15:38:06 +00:00
Jim Laskey
655bea55fe Simplify lowering and selection of exception ops.
llvm-svn: 34491
2007-02-22 15:37:19 +00:00
Jim Laskey
b57ee1fc37 Simplify lowering and selection of exception ops.
llvm-svn: 34488
2007-02-22 14:56:36 +00:00
Devang Patel
aabb87cffe Add Loop Pass Manager.
llvm-svn: 34487
2007-02-22 08:56:17 +00:00
Reid Spencer
cbff120eeb When converting from 64 to 32-bits, use the actual number of words to
extract the value, not the number of words implied by the active bits.
This fixes numerous, but not all divide bugs.

llvm-svn: 34484
2007-02-22 00:58:45 +00:00
Reid Spencer
d51b03d452 Fix countLeadingZeros in the case that the bitwidth evenly divides the
word size. This fixes all reads of uninitialized data (buffer over read)
and makes APInt.cpp memory clean, per valgrind. The only remaining
problem is division in a few cases.

llvm-svn: 34483
2007-02-22 00:22:00 +00:00
Jim Laskey
6a937ad320 Support to provide exception and selector registers.
llvm-svn: 34482
2007-02-21 22:54:50 +00:00
Jim Laskey
58eaac9160 Selection and lowering for exception handling.
llvm-svn: 34481
2007-02-21 22:53:45 +00:00
Jim Laskey
2bbd4312c0 Itanium ABI exception handing support.
llvm-svn: 34480
2007-02-21 22:49:50 +00:00