Commit Graph

29391 Commits

Author SHA1 Message Date
Chris Lattner 2ae054adb0 move a bunch of constant folding code f rom Transforms/Utils/Local.cpp into
libanalysis/ConstantFolding.cpp.

llvm-svn: 33679
2007-01-30 23:45:45 +00:00
Chris Lattner 14789a92e1 remove now-dead code.
llvm-svn: 33678
2007-01-30 23:29:47 +00:00
Chris Lattner f94bed3f13 the inliner pass now passes targetdata down through the inliner api's
llvm-svn: 33677
2007-01-30 23:28:39 +00:00
Chris Lattner ad84a730ba The inliner/cloner can now optionally take TargetData info, which can be
used by constant folding.

llvm-svn: 33676
2007-01-30 23:22:39 +00:00
Chris Lattner a94523df7b reformat comment
llvm-svn: 33675
2007-01-30 23:16:22 +00:00
Chris Lattner e3eda25641 pass TD to constant folding apis
llvm-svn: 33674
2007-01-30 23:16:15 +00:00
Chris Lattner 8dbea5454d adjust to constant folding api changes.
llvm-svn: 33673
2007-01-30 23:15:43 +00:00
Chris Lattner 0d74d3c09b use smallvector instead of vector to make constant folding a bit more efficient
llvm-svn: 33672
2007-01-30 23:15:19 +00:00
Chris Lattner 6fc4b46d43 adjust to api change
llvm-svn: 33671
2007-01-30 23:14:52 +00:00
Chris Lattner 2c4610e4ca Change constant folding APIs to take an optional TargetData, and change
ConstantFoldInstOperands/ConstantFoldCall to take a pointer to an array
of operands + size, instead of an std::vector.

In some cases, switch to using a SmallVector instead of a vector.
This allows us to get rid of some special case gross code that was there
to avoid the cost of constructing a vector.

llvm-svn: 33670
2007-01-30 23:13:49 +00:00
Chris Lattner 1e6cf2ee3c Change constant folding APIs to take an optional TargetData, and change
ConstantFoldInstOperands/ConstantFoldCall to take a pointer to an array
of operands + size, instead of an std::vector.

llvm-svn: 33669
2007-01-30 23:12:47 +00:00
Evan Cheng 421fdb2a7e Combine two tests.
llvm-svn: 33668
2007-01-30 23:06:22 +00:00
Evan Cheng dd7a688bb8 During PEI, if the immediate value of sp + offset is too large (i.e. something
that would require > 3 instructions to materialize), load the immediate from a
constpool entry.

llvm-svn: 33667
2007-01-30 23:01:46 +00:00
Chris Lattner 2b15f2ba9d remove some bits that are not yet meant to land.
llvm-svn: 33666
2007-01-30 22:50:32 +00:00
Chris Lattner 4284f6463a Symbolically evaluate constant expressions like &A[123] - &A[4].f.
This occurs in C++ code like:

#include <iostream>
#include <iterator>
int a[] = { 1, 2, 3, 4, 5 };
int main() {
  using namespace std;
  copy(a, a + sizeof(a)/sizeof(a[0]), ostream_iterator<int>(cout, "\n"));
  return 0;
}

Before we would decide the loop trip count is:
sdiv (i32 sub (i32 ptrtoint (i32* getelementptr ([5 x i32]* @a, i32 0, i32 5) to i32), i32 ptrtoint ([5 x i32]* @a to i32)), i32 4)

Now we decide it is "5".  Amazing.

This code will need to be refactored, but I'm doing that as a separate
commit.

llvm-svn: 33665
2007-01-30 22:32:46 +00:00
Evan Cheng 83f35170fa - Fix codegen for pc relative constant (e.g. JT) in thumb mode:
.set PCRELV0, (LJTI1_0_0-(LPCRELL0+4))
LPCRELL0:
        add r1, pc, #PCRELV0
This is not legal since add r1, pc, #c requires the constant be a multiple of 4.
Do the following instead:
        .set PCRELV0, (LJTI1_0_0-(LPCRELL0+4))
LPCRELL0:
        mov r1, #PCRELV0
        add r1, pc

- In thumb mode, it's not possible to use .set generate a pc relative stub
  address. The stub is ARM code which is in a different section from the thumb
  code. Load the value from a constpool instead.
- Some asm printing clean up.

llvm-svn: 33664
2007-01-30 20:37:08 +00:00
Reid Spencer 5301e7c605 For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.

llvm-svn: 33663
2007-01-30 20:08:39 +00:00
Reid Spencer 3a0bbb0a4d Compaction tables no longer supported, remove its block ID.
llvm-svn: 33662
2007-01-30 19:37:26 +00:00
Reid Spencer f1826e2adf Bye, Bye Compaction Tables. The benefit compaction tables provides doesn't
outweight its computational costs. This patch removes all compaction
table handling from the bcreader and bcwriter. For the record, here's the
difference betweeen having and not having compaction tables for some tests:

Test             With       Without   Size Chg
Olden/mst       5,602         5,598      +0.1%
viterbi        18,026        17,795      +1.3%
obsequi       162,133       166,663      -2.8%
burg          224,090       228,148      -1.8%
kimwitu++   4,933,263     5,121,159      -3.8%
176.gcc     8,470,424     9,141,539      -7.3%

It seems that it is more beneficial to larger files, but even on the largest
test case we have (176.gcc) it only amounts ot an I/O saving of 7.3%.

llvm-svn: 33661
2007-01-30 19:36:46 +00:00
Reid Spencer af6a408117 For PR411:
Update these tests to not use the same name even though the type of the
value differs. After PR411 hits, type planes will be gone and it will be
illegal for a name to be used twice, regardless of type.

llvm-svn: 33660
2007-01-30 16:16:01 +00:00
Reid Spencer 6f880918d0 Add a gxxcmd variable for the g++ command line used to build llvm.
llvm-svn: 33659
2007-01-30 16:06:55 +00:00
Evan Cheng 95b85e34ff Copy and paste bug.
llvm-svn: 33658
2007-01-30 08:22:33 +00:00
Evan Cheng 0e083d0161 Darwin -static should codegen static ctors / dtors to .constructor / .destructor sections.
llvm-svn: 33657
2007-01-30 08:04:53 +00:00
Evan Cheng ce8fa3ed83 Misseed thumb jumptable branch.
llvm-svn: 33656
2007-01-30 08:03:06 +00:00
Reid Spencer 6ebc06f702 Make the input legal.
llvm-svn: 33655
2007-01-30 06:32:25 +00:00
Evan Cheng fcb9b8b0b7 Add / merge tests.
llvm-svn: 33654
2007-01-30 03:06:19 +00:00
Evan Cheng e43ca022bf In thumb mode, round up stack frame size to multiple of 4 since add/sub
sp, imm instructions implicitly multiply the offset by 4.

llvm-svn: 33653
2007-01-30 02:57:02 +00:00
Evan Cheng c419d983d6 Thumb eliminateFrameIndex fixes.
llvm-svn: 33652
2007-01-30 02:36:01 +00:00
Evan Cheng 1cd3c0efb8 Change the operand orders to t_addrmode_s* to make it easier to morph
instructions that use these address modes to instructions that use
t_addrmode_sp.

llvm-svn: 33651
2007-01-30 02:35:32 +00:00
Evan Cheng 7fa6964dc2 - In thumb mode, if size of MachineFunction is >= 2048, force LR to be
spilled (if it is not already).
- If LR is spilled, use BL to implement far jumps. LR is not used as a GPR
  in thumb mode so it can be clobbered if it is properly spilled / restored
  in prologue / epilogue.
- If LR is force spilled but no far jump has been emitted, try undo'ing the
  spill by:
  push lr -> delete
  pop pc -> bx lr

llvm-svn: 33650
2007-01-30 01:18:38 +00:00
Evan Cheng 863736b0ad Use BL to implement Thumb far jumps.
llvm-svn: 33649
2007-01-30 01:13:37 +00:00
Chris Lattner 6acab41ede test that the 'ir' constraint works.
llvm-svn: 33646
2007-01-29 23:55:20 +00:00
Evan Cheng 760c68b8af Factor GetInstSize() out of constpool island pass.
llvm-svn: 33644
2007-01-29 23:45:17 +00:00
Chris Lattner d27f95e08d add initial support for handling inline asms with multiple constraints.
This doesn't do the "right thing" but will probably work in most cases.

This implements CodeGen/PowerPC/2007-01-29-lbrx-asm.ll.

llvm-svn: 33643
2007-01-29 23:45:14 +00:00
Chris Lattner 9699e54088 new testcase
llvm-svn: 33642
2007-01-29 23:45:03 +00:00
Jim Laskey ee23de6c36 Out of line function.
llvm-svn: 33641
2007-01-29 23:40:33 +00:00
Devang Patel b64c433619 Use StartPassTimer() and StopPassManager()
llvm-svn: 33640
2007-01-29 23:29:54 +00:00
Jim Laskey 3f9f250928 Only gather frame info if debug or eh.
llvm-svn: 33639
2007-01-29 23:20:22 +00:00
Devang Patel 1c3633e461 - Undo previous check-in (i.e. Do not export TimingInfo class through
PassManagers.h).

- Add StopPassTimer() and StartPassTimer() to expose TimingInfo to
CallGraphPassManager

- Use these two APIs in CalLgraphPassManager to measure timings.

llvm-svn: 33638
2007-01-29 23:10:37 +00:00
Nate Begeman eda5997cc8 Finish off bug 680, allowing targets to custom lower frame and return
address nodes.

llvm-svn: 33636
2007-01-29 22:58:52 +00:00
Nate Begeman e3b09fbbb0 We'd still like to register allocate r2 on darwin before the callee-save
regs.

llvm-svn: 33635
2007-01-29 22:57:48 +00:00
Jim Laskey 52726f5837 rename flag
llvm-svn: 33634
2007-01-29 22:40:03 +00:00
Evan Cheng 8953edc8a5 Comment.
llvm-svn: 33633
2007-01-29 22:23:02 +00:00
Evan Cheng 43e8518d8b Remember if LR register has been spilled in this function.
llvm-svn: 33632
2007-01-29 22:22:24 +00:00
Anton Korobeynikov b8d8b82950 Save all registers by default, as they can be used to pass parameters
for "inreg" calls

llvm-svn: 33631
2007-01-29 21:28:01 +00:00
Nate Begeman 17f250005a Update some of the llvm in the readme
llvm-svn: 33630
2007-01-29 21:21:22 +00:00
Nate Begeman 2a562ba47b Properly support cstrings
llvm-svn: 33629
2007-01-29 21:20:42 +00:00
Jim Laskey d1154860a4 Flag to control exception handling.
llvm-svn: 33628
2007-01-29 20:48:32 +00:00
Devang Patel 5a4a315aed Measure timings.
llvm-svn: 33627
2007-01-29 20:08:03 +00:00
Devang Patel 55bcb50840 Move TimingInfo into PassManagers.h so that other libs can use it.
llvm-svn: 33626
2007-01-29 20:06:26 +00:00