Commit Graph

17023 Commits

Author SHA1 Message Date
Chris Lattner
03dd25ca96 Move some symbolic constant folding code out of instcombine into a place
it can be used by multiple clients.  This specifically allows the inliner
to constant fold symbolically.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33687 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 00:51:48 +00:00
Chris Lattner
2e3a1d137c The local "ConstantFold" method is now just a watered down version of
ConstantFoldInstOperands.  Switch to ConstantFoldInstOperands and remove
ConstantFold.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33683 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:52:44 +00:00
Chris Lattner
79066fa6ac Adjust #includes to match movement of constant folding code from transformutils to libanalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33680 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:46:24 +00:00
Chris Lattner
5520732b24 move a bunch of constant folding code f rom Transforms/Utils/Local.cpp into
libanalysis/ConstantFolding.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33679 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:45:45 +00:00
Chris Lattner
4973190b07 remove now-dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33678 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:29:47 +00:00
Chris Lattner
ff2dad3128 the inliner pass now passes targetdata down through the inliner api's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33677 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:28:39 +00:00
Chris Lattner
1dfdf8255e The inliner/cloner can now optionally take TargetData info, which can be
used by constant folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33676 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:22:39 +00:00
Chris Lattner
3cab071f6f reformat comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33675 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:16:22 +00:00
Chris Lattner
0a19ffaf58 pass TD to constant folding apis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33674 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:16:15 +00:00
Chris Lattner
72d88ae544 adjust to constant folding api changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33673 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:15:43 +00:00
Chris Lattner
cd2492e6ff use smallvector instead of vector to make constant folding a bit more efficient
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33672 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:15:19 +00:00
Chris Lattner
6c1f56574c adjust to api change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33671 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:14:52 +00:00
Chris Lattner
9fa038dc21 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33670 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:13:49 +00:00
Evan Cheng
36640905e1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33667 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:01:46 +00:00
Chris Lattner
db43c63389 remove some bits that are not yet meant to land.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33666 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 22:50:32 +00:00
Chris Lattner
c5eff4488b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33665 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 22:32:46 +00:00
Evan Cheng
c60e76d139 - 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33664 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:37:08 +00:00
Reid Spencer
5cbf985dcb For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:08:39 +00:00
Reid Spencer
d2bb887cd1 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%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33661 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 19:36:46 +00:00
Evan Cheng
ad1b9a503c Copy and paste bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33658 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 08:22:33 +00:00
Evan Cheng
b267ca17d1 Darwin -static should codegen static ctors / dtors to .constructor / .destructor sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33657 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 08:04:53 +00:00
Evan Cheng
c322a9ac14 Misseed thumb jumptable branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33656 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 08:03:06 +00:00
Evan Cheng
236f677e48 In thumb mode, round up stack frame size to multiple of 4 since add/sub
sp, imm instructions implicitly multiply the offset by 4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33653 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 02:57:02 +00:00
Evan Cheng
5b91c7f69a Thumb eliminateFrameIndex fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 02:36:01 +00:00
Evan Cheng
cea117d2de 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33651 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 02:35:32 +00:00
Evan Cheng
d1b2c1e88f - 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33650 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 01:18:38 +00:00
Evan Cheng
225dfe973b Use BL to implement Thumb far jumps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 01:13:37 +00:00
Evan Cheng
29836c330f Factor GetInstSize() out of constpool island pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33644 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 23:45:17 +00:00
Chris Lattner
367f109ba9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33643 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 23:45:14 +00:00
Jim Laskey
c1c47c3fa4 Out of line function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33641 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 23:40:33 +00:00
Devang Patel
f5b17fd938 Use StartPassTimer() and StopPassManager()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33640 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 23:29:54 +00:00
Jim Laskey
e078d1a14a Only gather frame info if debug or eh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33639 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 23:20:22 +00:00
Devang Patel
c874eb54ec - 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33638 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 23:10:37 +00:00
Nate Begeman
bcc5f36765 Finish off bug 680, allowing targets to custom lower frame and return
address nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33636 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:58:52 +00:00
Nate Begeman
1f259e9d7a We'd still like to register allocate r2 on darwin before the callee-save
regs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33635 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:57:48 +00:00
Jim Laskey
73c5624375 rename flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33634 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:40:03 +00:00
Evan Cheng
24f7fb3267 Comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33633 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:23:02 +00:00
Evan Cheng
78268b9436 Remember if LR register has been spilled in this function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 22:22:24 +00:00
Anton Korobeynikov
1620f1ad91 Save all registers by default, as they can be used to pass parameters
for "inreg" calls


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33631 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 21:28:01 +00:00
Nate Begeman
908049b7b6 Update some of the llvm in the readme
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33630 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 21:21:22 +00:00
Nate Begeman
1257c855d7 Properly support cstrings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33629 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 21:20:42 +00:00
Jim Laskey
1b340dc8e2 Flag to control exception handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33628 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 20:48:32 +00:00
Devang Patel
f82aa1cf73 Measure timings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33627 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 20:08:03 +00:00
Devang Patel
b05ef6a8eb Move TimingInfo into PassManagers.h so that other libs can use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33626 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 20:06:26 +00:00
Jim Laskey
d683ef6655 Disable zero landing pads for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33625 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 20:01:41 +00:00
Jim Laskey
072200c36d Landing pad-less eh for PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33622 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 18:51:14 +00:00
Reid Spencer
73a27c894f Remove tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 17:55:50 +00:00
Reid Spencer
519e239b1f Implement use of new IntrinsicLowering interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33619 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 17:51:02 +00:00
Reid Spencer
6addf2ceeb Use TargetData to obtain the correct size of the "size_t" argument for
functions like memcpy, memmove and memset. Ensure only one prototype is
used for these functions and that it matches the system definition by
using the appropriate type for the size argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33618 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 17:42:06 +00:00
Nick Lewycky
6a08f918b6 Simplify names of lattice values. SGTUNE becomes SGT, for example.
Fix initializeConstant, now initializeInt. Fixes major performance
bottleneck.

X == Y || X->DominatedBy(Y) is redundant. Remove the X == Y part.

Fix crasher in makeEqual where getOrInsertNode would add a new constant,
producing an NE relationship between the two members we're trying to make
equal. This now allows us to mark more BBs as unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33612 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-29 02:56:54 +00:00