Commit Graph

5586 Commits

Author SHA1 Message Date
Alkis Evlogimenos
503770cfc3 Add SUB{rm,mr,mi}{8,16,32} instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11543 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:17:40 +00:00
Chris Lattner
11390e76e7 Add support to the local allocator for fusing spill code into the instructions
that need them.  This is very useful on CISCy targets like the X86 because it
reduces the total spill pressure, and makes better use of it's (large)
instruction set.  Though the X86 backend doesn't know how to rewrite many
instructions yet, this already makes a substantial difference on 176.gcc for
example:

Before:
Time:
   8.0099 ( 31.2%)   0.0100 ( 12.5%)   8.0199 ( 31.2%)   7.7186 ( 30.0%)  Local Register Allocator

Code quality:
734559 asm-printer           - Number of machine instrs printed
111395 ra-local              - Number of registers reloaded
 79902 ra-local              - Number of registers spilled
231554 x86-peephole          - Number of peephole optimization performed

After:
Time:
   7.8700 ( 30.6%)   0.0099 ( 19.9%)   7.8800 ( 30.6%)   7.7892 ( 30.2%)  Local Register Allocator
Code quality:
733083 asm-printer           - Number of machine instrs printed
  2379 ra-local              - Number of reloads fused into instructions
109046 ra-local              - Number of registers reloaded
 79881 ra-local              - Number of registers spilled
230658 x86-peephole          - Number of peephole optimization performed

So by fusing 2300 instructions, we reduced the  static number of instructions
by 1500, and reduces the number of peepholes (and thus the work) by about 900.
This also clearly reduces the number of reload/spill instructions that are
emitted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11542 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:09:40 +00:00
Alkis Evlogimenos
18bd7bb4d4 Add support for folding memory operands for ADC, SBB and SUB instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11541 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:08:51 +00:00
Alkis Evlogimenos
69da6dba79 Add support for ADC{rm.mr}32 and SBB{rm,mr}32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11540 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:06:31 +00:00
Chris Lattner
ee0919bb10 Add a (hidden) option to print instructions that fail to fuse. It's looking
like compares and test's would be the next huge win...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11539 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 08:03:47 +00:00
Alkis Evlogimenos
17dc674c13 Add support for folding memory operands in MOVri{8,16,32} instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11538 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:47:20 +00:00
Chris Lattner
5b67252620 Expand the repertoire of the forms we can print and encode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11537 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:40:44 +00:00
Chris Lattner
651fd55d5f Disable this peephole for now. We can't keep track of the fact that the immediate is 8 bits,
but the memory reference is full sized.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11536 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:36:32 +00:00
Chris Lattner
cdee28724e Fix a bug in my previous refactoring change... arg!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11535 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 07:02:17 +00:00
Chris Lattner
9915cd9e9f The C backend is no longer in llvm-dis, it's in llc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11533 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 06:40:06 +00:00
Chris Lattner
a7660be6c2 Add an option to disable spill fusing in the X86 backend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11531 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 06:30:34 +00:00
Chris Lattner
e87331d11d Fix the mneumonics for the mov instructions to have the source and destination
order in the correct sense!! Arg!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11530 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 06:28:19 +00:00
Chris Lattner
7ddc3fbd22 Fix the last crimes against nature that used the 'ir' ordering to use the
'ri' ordering instead... no it's not possible to store a register into an
immediate!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11529 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 06:24:02 +00:00
Chris Lattner
f120ebbf8a GRRR. Move instructions have swapped the order of the r/m operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11528 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 06:20:20 +00:00
Chris Lattner
6e173a0d9c Rename MOVi[mr] instructions to MOV[rm]i
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11527 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 06:16:44 +00:00
Chris Lattner
90c38c8141 Whoops, got my cases swapped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11526 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 06:02:15 +00:00
Chris Lattner
5a051f65d3 Change to match the newer, simpler, interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11525 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 05:54:57 +00:00
Chris Lattner
0f9c491abc Add support for folding memory operands into AND and IMUL's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11523 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 05:46:06 +00:00
Chris Lattner
7c035b73a4 Scrunchify code, by adding helpers. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11522 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 05:35:13 +00:00
Chris Lattner
4ff7876c64 Add mem forms of AND instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11521 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 05:25:50 +00:00
Alkis Evlogimenos
7093d37304 Add LiveIntervals::Interval::empty() member function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11520 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 05:14:37 +00:00
Alkis Evlogimenos
b499866c05 Add API to check and fold memory operands into instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11519 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 04:33:18 +00:00
Chris Lattner
55b5481255 Rename the IMULri* instructions to IMULrri, as they are actually three address
instructions.  Add forms of these instructions that read from memory


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11518 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 04:26:43 +00:00
Chris Lattner
1e3812c1c5 Once we have a way to fold spill code reloads into instructions, we have a way to use it. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11517 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 04:08:37 +00:00
Alkis Evlogimenos
355a724bd8 Fix spilled interval update. It was too conservative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11516 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 04:04:20 +00:00
Chris Lattner
42e0a8fded Refactor code a bit. No functionality changes, though the comment hints at things to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11515 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 03:57:19 +00:00
Chris Lattner
ac89164fa2 Adjust to recent changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11514 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-17 03:03:47 +00:00
Alkis Evlogimenos
31bbb5190b Add peephole optimizations for ADD [MEM], IMM8 instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11511 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 23:50:18 +00:00
Alkis Evlogimenos
7271e0e107 Add two more variants of add. Update comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11510 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 23:48:42 +00:00
Chris Lattner
304e143b16 Only spit out warning for functions that take pointers, not for sin and the like
Add more special case handling for stdio functions.  I feel dirty, how about you?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11506 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 22:57:19 +00:00
Chris Lattner
2e9bb1a88e Move the folding of gep null, 0, 0, 0 to a place where it can be shared and
enjoyed by all, fixing a fixme.  Add an assert


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11505 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 20:46:13 +00:00
Chris Lattner
eee33b2691 memset and bcopy and now unified by the llvm.memset intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11503 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 18:37:40 +00:00
Chris Lattner
e0f636a068 Add some ADD instructions that take memory operands for Alkis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11502 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 18:19:31 +00:00
Alkis Evlogimenos
aad5c05051 Add LeakDetection to MachineInstr.
Move out of line member functions of MachineBasicBlock to
MachineBasicBlock.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11497 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 07:17:43 +00:00
Chris Lattner
19831ec853 Implement test/Regression/Transforms/SimplifyCFG/UncondBranchToReturn.ll,
see the testcase for the reasoning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11496 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 06:35:48 +00:00
Chris Lattner
7059f2e76b Fold PHI nodes of constants which are only used by a single cast. This implements
phi.ll:test4


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11494 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 05:07:08 +00:00
Chris Lattner
26ca7e145e Teach LLVM to unravel the "swap idiom". This implements:
Regression/Transforms/InstCombine/xor.ll:test20


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11492 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 03:54:20 +00:00
Chris Lattner
c317d39887 Implement Transforms/InstCombine/xor.ll:test19
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11490 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-16 01:20:27 +00:00
Chris Lattner
8709927af8 Fix a bug in the recent rewrite of the leakdetector that caused all of the
nightly tests to be really messed up.  The problem was that the new leakdetector
was depending on undefined behavior: the order of destruction of static objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11488 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 23:33:48 +00:00
Chris Lattner
e42cde2a14 Now that the lowerinvoke pass inserts calls to llvm.setjmp/llvm.longjmp, some
hacks can be banished.  Also, this gives us the opportunity to emit special code
for the setjmp/longjmps which alows the elimination of one GCC warning for every
setjmp/longjmp site (which is often THOUSANDS in C++ programs).  Yaay!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11484 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 22:51:47 +00:00
Chris Lattner
9b700f7951 By default, llvm.setjmp/llvm.longjmp intrinsics get lowered to their libc counterparts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11483 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 22:24:51 +00:00
Chris Lattner
860a16143c Instead of producing calls to setjmp/longjmp, produce uses of the
llvm.setjmp/llvm.longjmp intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11482 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 22:24:27 +00:00
Chris Lattner
588e72db75 Refactor code. Now the intrinsic lowering pass tries to recycle preexisting
prototypes, even if they don't precisely match what it would prefer to use.
This fixes: CBackend/2004-02-15-PreexistingExternals.llx compiling it into:

  ltmp_0_30 = memcpy(l14_C, 4u, 17);
  ltmp_1_30 = memcpy(((int *)l27_A), ((unsigned )(long)l27_B), ((int )123u));

instead of:

  ltmp_0_30 = memcpy(l14_C, 4u, 17);
  ltmp_1_27 = l43_memcpy(l27_A, l27_B, 123u);

Which does the wrong thing as you could imagine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11481 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 22:16:39 +00:00
Alkis Evlogimenos
f11800b718 This pass should not require phi elimination or live variable
analysis. It should only preserve them and update LiveVariables if it
already ran.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11479 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 21:50:32 +00:00
Chris Lattner
5aaf1d2820 Finegrainify namespacification
Remove one of the operands of a two operand instruction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11478 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 21:38:28 +00:00
Alkis Evlogimenos
859a18b583 Make dense maps keyed on physical registers smallerusing
MRegisterInfo::getNumRegs() instead of
MRegisterInfo::FirstVirtualRegister.

Also use MRegisterInfo::is{Physical,Virtual}Register where
appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11477 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 21:37:17 +00:00
Alkis Evlogimenos
843b160a20 Eliminate the use of spill (reserved) registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11476 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 10:24:21 +00:00
Chris Lattner
de512b5b2e Adjustments to support the new ConstantAggregateZero class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11474 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:55:15 +00:00
Chris Lattner
cfb0fd2ce8 Add support for the new ConstantAggregateZero class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11473 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:54:27 +00:00
Chris Lattner
dd2c82a427 Make the JIT zero out globals with memset instead of an element at a time. This
should speed it up a bit on a lot of programs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11472 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:54:06 +00:00
Chris Lattner
896481eaa8 No need to scan zero initializers. This should make DSA a bit faster.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11471 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:53:42 +00:00
Chris Lattner
40bbeb5d07 Add a new ConstantAggregateZero class, to fix PR239. This makes zero
initializers for constant structs and arrays take constant space, instead of
space proportinal to the number of elements.  This reduces the memory usage of
the LLVM compiler by hundreds of megabytes when compiling some nasty SPEC95
benchmarks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11470 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:53:04 +00:00
Chris Lattner
ca705fa31d ConstantArray::get and ConstantStruct::get now just return pointers to
'Constant', instead of specific subclass pointers.  In the future, these will
return an instance of ConstantAggregateZero if all of the inputs are zeros.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11467 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 04:14:47 +00:00
Chris Lattner
04d1fb6df9 Remove dependence on return type of ConstantStruct::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11466 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 04:07:32 +00:00
Chris Lattner
371064481a Remove dependence on the return type of ConstantArray::get
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11463 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 04:05:58 +00:00
Chris Lattner
aab54da21c Keep a cache of non-abstract null arrays and structs. This speeds up llvm-dis
from 16.57 -> 13.46s on 129.compress.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11462 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 02:46:46 +00:00
Chris Lattner
0e5b79c174 Implement llvm.(frame|return)address(0) correctly. They are used by the LLVM JIT, among other
applications


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11459 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 01:04:03 +00:00
Alkis Evlogimenos
b929bca027 Fix problem in DEBUG code. I could be pointing past the end and
dereferencing it causes an assertion error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11458 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 00:46:41 +00:00
Chris Lattner
96c3d2e2e7 Fix the 'have a framepointer' case, so that the frame pointer always points
to the old saved EBP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11455 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 00:15:37 +00:00
Chris Lattner
05d8350c12 Allow for fixed objects to reside in the local area, and if they don't to not
clobber them by allocating other objects in the same space!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11454 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 00:14:20 +00:00
Alkis Evlogimenos
c81efdc59c Add back machine code deleter pass until we get a MachineCode pass
that will be responsible for the creation of MachineFunctions and will
be required by all MachineFunctionPass passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11453 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 00:03:15 +00:00
Alkis Evlogimenos
b663d76f86 Modularize implementation of LeakDetector into a typed template
implementation class. This makes the code simpler and allows for more
types to be added easily. It also implements caching for generic
objects (it was only available for llvm objects).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11452 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 23:33:39 +00:00
Chris Lattner
3193556387 Add support for the 'pop' instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11451 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 21:06:02 +00:00
Chris Lattner
e9dd84ea8a There is no reason to align the stack pointer if there are no callees of this
function!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11450 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 20:11:07 +00:00
Chris Lattner
93799292c1 There is no reason to align the stack pointer if there are no callees of this function!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11449 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 20:10:59 +00:00
Chris Lattner
bb07ef97cf The prologue/epilogue related method calls have no reason to return a value,
make them return void.

This allows us to avoid some costly MBB.size() calls


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11448 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 19:49:54 +00:00
Chris Lattner
300d0eda6f finegrainify namespacification, fix 80col prob
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11445 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 06:00:36 +00:00
Chris Lattner
cc42d2c3cc A target that doesn't support these intrinsics will still meet spec (the
intrinsic will always produce zero), but it will behave unexpectedly, so
warn like GCC does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11444 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 04:52:06 +00:00
Chris Lattner
9f87a6ce6f Urg, right. These need an input value...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11443 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 04:47:23 +00:00
Chris Lattner
2a0f224ce9 Codegen llvm.memset into rep stos[bwd]. Simplify code for llvm.memcpy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11442 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 04:46:05 +00:00
Chris Lattner
b89abef577 add 'rep stos[bwd]' instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11441 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 04:45:37 +00:00
Chris Lattner
fe1554a080 Add support for the returnaddress and frameaddress intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11433 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 02:55:36 +00:00
Chris Lattner
cf89908381 Add llvm.memset/frameaddress/returnaddress intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11431 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 02:47:17 +00:00
Alkis Evlogimenos
f81af21caf Use newly added next() and prior() utility functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11430 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 01:18:34 +00:00
Alkis Evlogimenos
6ab5c15962 Use std::numeric_limits<float>::infinity() instead of
std::numeric_limits<float>::max() for weighting preallocated
intervals.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11427 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 00:44:07 +00:00
Chris Lattner
4ef51373c4 Use intrinsic lowering like the rest of the backends. Get rid of crufty hacky
code that worked around problems in the mangler


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11426 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 00:31:10 +00:00
Chris Lattner
a6acb4f5fd Fix the logic in the name mangler. If there are two symbols named 'X', and one
is external, make sure to mangle the *internal* one, not external one


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11424 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-14 00:30:23 +00:00
Chris Lattner
0712283e43 There is no need to emit a shift if the size is constant, which is common
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11420 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 23:36:47 +00:00
Chris Lattner
c01ab8f3e1 Moved directory, update makefile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11417 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 23:31:12 +00:00
Chris Lattner
0f2aecef5a CBackend is no longer here
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11416 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 23:29:37 +00:00
Chris Lattner
76a92ae84a CBackend now lives here
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11415 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 23:29:20 +00:00
Chris Lattner
f31182a531 Convert the C backend into a target, for use with LLC. This allows us to use
the lowerallocations pass to eliminate malloc/free warnings and hackish code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11409 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 23:18:48 +00:00
Chris Lattner
94f4f8ea10 Make the cwriter use the lowerinvoke pass so that it can either use "disabled exceptions" or
"expensive exceptions" controlled by an option.  Also refactor and eliminate a bunch of cruft.
This is a temporary solution and causes millions of warnings to pour out of programs that use
exceptions, but it should fix the problem with sparc and the 'write' declaration (PR190).
Subsequent changes will make this stink much less


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11405 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 23:00:29 +00:00
Chris Lattner
339d8df4c0 Add support for a bunch more functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11395 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 21:21:48 +00:00
Alkis Evlogimenos
be766c7246 Remove getAllocatedRegNum(). Use getReg() instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11393 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 21:01:20 +00:00
Chris Lattner
68300db685 Add support for fopen/fclose. Specifically with fopen, we were marking all of the
operands as incomplete, though fopen is known to only read them.  This just adds
fclose for symmetry, though it doesn't gain anything.  This makes the dsgraphs for
181.mcf much more precise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11390 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 20:05:32 +00:00
Alkis Evlogimenos
4de473bc59 Use getNumVirtualRegs().
Whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11389 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 18:20:47 +00:00
Chris Lattner
494b6920b0 Fix compilation of 126.gcc: intrinsic functions cannot throw, so they are not
allowed in invoke instructions.  Thus, if we are inlining a call to an intrinsic
function into an invoke site, we don't need to turn the call into an invoke!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11384 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 16:47:35 +00:00
Chris Lattner
0db085baec Intrinsic functions cannot throw
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11383 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 16:46:46 +00:00
Chris Lattner
cefc18e7d9 Expose a pass ID that can be 'required'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11376 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 16:16:16 +00:00
Chris Lattner
b4198a2880 Squish warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11375 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 16:14:50 +00:00
Chris Lattner
a07b72ff3d Restructure code to handle memcpy/memmove
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11374 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 16:09:54 +00:00
Brian Gaeke
e62589058c Fix off-by-one in Interpreter::getFirstVarArg(), which was punishing
any attempts by LLI to use varargs (possibly left over from the introduction
of IntrinsicLowering??)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11370 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 06:18:39 +00:00
Chris Lattner
897bf0dea5 Fine grainify namespacification, prune #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11369 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 06:18:21 +00:00
Brian Gaeke
d8400d86dd The Interpreter was failing the AtExit UnitTest. This fixes it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11367 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 05:48:00 +00:00
Brian Gaeke
90421cd8f9 Refactor MachineFunction::print() into MachineBasicBlock::print().
Add MachineBasicBlock::dump().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11364 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 04:39:55 +00:00
Brian Gaeke
21326fc2ad Add head-of-file comments and Doxygen comments. Tighten up a lot of whitespace.
Rename SetMachineOperandConst's formal parameters to match other methods here.
Mark some methods as being used only by the SPARC back-end.
Fix a missing-paren bug in OutputValue().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11363 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 04:39:32 +00:00
Chris Lattner
f8cd9148f9 Add support for memcpy and memmove intrinsics. Why isn't the cwriter using
the intrinsiclowering code?? :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11362 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 23:13:33 +00:00
Alkis Evlogimenos
ab8672c8bb Add parent pointer to MachineInstr that points to owning
MachineBasicBlock. Also change opcode to a short and numImplicitRefs
to an unsigned char so that overall MachineInstr's size stays the
same.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11357 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 18:49:07 +00:00
Chris Lattner
2751e76a70 Add support for the llvm.memmove intrinsic
Patch graciously contributed by Reid Spencer!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11355 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 18:11:20 +00:00
Chris Lattner
915e5e56d7 Add support for the rep movs[bwd] instructions, and emit them when code
generating the llvm.memcpy intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11351 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 17:53:22 +00:00
Chris Lattner
5fe51cc2c4 Implement the llvm.memcpy intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11349 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 17:01:09 +00:00
Chris Lattner
2a90ba6017 Rename the opCode instance variable to Opcode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11348 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 16:09:53 +00:00
Chris Lattner
3081db8d01 This field is never read
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11346 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 16:04:49 +00:00
Alkis Evlogimenos
024126ee23 Change interface so that we can add to the end of a basic block
without getting an assertion from ilist that we are dereferencing
ilist<T>::end().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11345 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 08:11:04 +00:00
Brian Gaeke
17247c64f2 Remove this MachineOpCodeFlags assertion - its test can never be false.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11342 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 04:01:07 +00:00
Alkis Evlogimenos
c0b9dc5be7 Change MachineBasicBlock's vector of MachineInstr pointers into an
ilist of MachineInstr objects. This allows constant time removal and
insertion of MachineInstr instances from anywhere in each
MachineBasicBlock. It also allows for constant time splicing of
MachineInstrs into or out of MachineBasicBlocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11340 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 02:27:10 +00:00
Brian Gaeke
918cdd420b getOpCode() --> getOpcode().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11339 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-12 01:34:05 +00:00
Brian Gaeke
12c1d2c25a MachineInstr::getOpCode() --> getOpcode() in SPARC back-end.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11335 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 20:47:34 +00:00
Chris Lattner
b009c0088c s/getOpCode/getOpcode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11332 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 19:26:28 +00:00
Chris Lattner
d6a556b3fd Cosmetic improvements to this option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11331 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 19:14:04 +00:00
Chris Lattner
945871df86 Actually load profiling information now! Block layout can use real, live,
actual profile info, and works!  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11324 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 18:21:05 +00:00
Chris Lattner
c6fca42a66 Fix a typeo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11323 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 18:20:41 +00:00
Alkis Evlogimenos
6557262ee7 Increase constness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11322 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 17:55:09 +00:00
Chris Lattner
ecefc96f05 Fix copy-and-pastos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11319 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 06:10:18 +00:00
Chris Lattner
927fec3c38 Add skeleton profileinfoloader pass. This will be enhanced to actually LOAD
a profile tommorow.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11318 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 06:10:05 +00:00
Alkis Evlogimenos
f8efea53c2 Remove assert as the only integer registers on the sparc are physical.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11317 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 06:04:51 +00:00
Alkis Evlogimenos
af862116df Fix previous broken commit. A MachineOperand may have opType ==
MO_VirtualRegister but if the register number is one of a physical
register is it considered as a physical register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11315 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 05:55:00 +00:00
Chris Lattner
bc44aa61c4 Factor this code out of llvm-prof
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11314 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 05:54:25 +00:00
Chris Lattner
5f55aaf0f0 Remove obsolete comment. Unreachable blocks will automatically be left at the
end of the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11313 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 05:20:50 +00:00
Chris Lattner
206805e172 Add an _embarassingly simple_ implementation of basic block layout. This is
more of a testcase for profiling information than anything that should reasonably
be used, but it's a starting point.  When I have more time I will whip this into
better shape.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11311 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 04:53:20 +00:00
Alkis Evlogimenos
ccd79f2c21 Remove assert as it is meaningless. MachineOperands can be tagged as
MO_VirtualRegister but actually be representing a physical register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11310 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 04:52:30 +00:00
Chris Lattner
b060194a70 Make sure to register the 'no profile' implementation as the default for ProfileInfo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11309 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 04:47:54 +00:00
Chris Lattner
40c5767b70 Simplify implementation, and probably speed things up too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11308 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 03:57:16 +00:00
Chris Lattner
723c66d4c0 Implement SimplifyCFG/PhiEliminate.ll
Having a proper 'select' instruction would allow the elimination of a lot
of the special case cruft in this patch, but we don't have one yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11307 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 03:36:04 +00:00
Chris Lattner
82a5ff4c54 Initialize the count instance variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11305 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 03:29:16 +00:00
Chris Lattner
6565043120 Expose the "Other" value type to tablegen targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11304 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 03:08:45 +00:00
Chris Lattner
b171942441 Remove obsolete method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11302 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 01:17:33 +00:00
Chris Lattner
2355f948c5 The hasConstantReferences predicate always returns false.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11301 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-11 01:17:07 +00:00
Chris Lattner
171de656eb An initial implementation of an LLVM ProfileInfo class which is designed to
eventually allow Passes to use profiling information to direct them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11294 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 22:11:42 +00:00
Chris Lattner
61b08f193a Add #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11285 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 21:18:55 +00:00
Chris Lattner
1cbe4d0ad0 Do not use MachineOperand::isVirtualRegister either!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11283 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 21:12:22 +00:00
Chris Lattner
9d58a500fc Stop using this method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11282 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 21:12:06 +00:00
Chris Lattner
c31ecb9aae Remove uses of MachineOperand::isVirtualRegister
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11281 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:55:47 +00:00
Chris Lattner
ebcd7941f0 Remvoe use of MO.isVirtualRegister(), turn an assertion into an assert()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11280 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:47:24 +00:00
Chris Lattner
3d878d80d6 Eliminate users of MachineOperand::isPhysicalRegister
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11278 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:41:10 +00:00
Chris Lattner
bd0485034c Remove use of isPhysicalRegister
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11277 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:35:42 +00:00
Chris Lattner
6d21518718 Don't use MachineOperator::is(Phys|Virt)Register
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11276 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:31:28 +00:00
Chris Lattner
0bbf3052c2 Tighten up checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11274 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 20:25:13 +00:00
Chris Lattner
81d1a2207d initialization calls now return argc. If the program uses the argc value
passed into main, make sure they use the return value of the init call
instead of the one passed in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11262 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 17:41:01 +00:00
Chris Lattner
21e79cbacd Fix PR228: [sparc] Boolean constants are emitted as true and false
I will observe that the concept of using WriteAsOperand is completely broken,
but then we all knew that, didn't we?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11255 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-10 05:16:44 +00:00
Misha Brukman
2647c3925b Doxygenify comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11252 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 23:18:42 +00:00
Chris Lattner
f1d0d3519f Only add the global variable with the abort message if an unwind actually
occurs in the program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11249 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 22:48:47 +00:00
John Criswell
ccb2a677af Fix PR#226: When emitting padding, always emit it as bytes. Bytes can be
placed into any alignment situation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11247 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 22:15:33 +00:00
Chris Lattner
16af11d962 It turns out that the two dimensional vectors were causing big slowdowns
in this for programs with lots of types (like the testcase in PR224).
The problem was that the type ID that the outer vector was using was not
very dense (as many types are getting resolved), so the vector is large
and gets reallocated a lot.

Since there are a lot of values in the program (the .ll file is 10M),
each reallocation has to copy the subvectors, which is also quite slow
(this wouldn't be a problem if C++ supported move semantics, but it
doesn't, at least not yet :(

Changing the outer data structure to a map speeds a release build of
llvm-as up from 11.21s to 5.13s on the testcase in PR224.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11244 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 21:03:38 +00:00
Chris Lattner
a44fb0d362 Remove the statistics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11243 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 21:01:23 +00:00
Chris Lattner
c3b5849e92 Speed up type resolution some more. On the testcase in PR224, for example,
this speeds up a release llvm-as from 21.95s to 11.21s, because before it
would do an expensive traversal of the type-graph of every type resolved.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11242 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 20:23:44 +00:00
Chris Lattner
026a8ce312 When resolving upreferences, if multiple uprefs will be resolved to the same
type at the same time, resolve the upreferences to each other before resolving
it to the outer type.  This shaves off some time from the testcase in PR224, from
25.41s -> 21.72s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11241 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 18:53:54 +00:00
Brian Gaeke
f738db0818 Move InstrSchedule's iterator begin/end methods inline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11239 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 18:42:46 +00:00
Brian Gaeke
0dc5753f2b Make SchedGraph::dump() use SchedGraphNodeCommon's const_iterator
instead of randomly groping about inside its outEdges array.
Make SchedGraph::addDummyEdges() use getNumOutEdges() instead of
outEdges.size().
Get rid of ifdefed-out code in SchedGraph::buildGraph().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11238 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 18:42:05 +00:00