Commit Graph

1815 Commits

Author SHA1 Message Date
Anand Shukla
b0ad8b002d Added std:: to mem_fun for 64-bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2845 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-09 19:16:59 +00:00
Chris Lattner
743cd3e2b8 Implementing shift left & shift right on pointers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2844 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-09 18:42:36 +00:00
Vikram S. Adve
ec0de5cb4b Added support for printing constant global references to
assembly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2842 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-09 12:30:29 +00:00
Vikram S. Adve
f86b4c1982 Fix iteration and InsertPos bugs introduced when Chris changed over to ilist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2840 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:37:07 +00:00
Vikram S. Adve
fe09fb22aa Numerous changes in interface to class SparcRegInfo corresponding to
changes in class MachineRegInfo (see MachineRegInfo.h for details).

Added {LD,ST}[X]FSR instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2839 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:34:10 +00:00
Vikram S. Adve
0b04064054 class MachineCodeForBasicBlock is now an annotation on BasicBlock.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2838 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:31:24 +00:00
Vikram S. Adve
b2debdc5a9 BA no longer has the unused CC operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2837 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:30:59 +00:00
Vikram S. Adve
6418eac2f1 Have to save a boolean (setCC) value whenever use is outside the current
basic block.

Mark setCCInstr used as dest. of conditional-move as both a def and a use.

BA instruction no longer has the unused CC argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2836 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:30:14 +00:00
Vikram S. Adve
97da3649dd BA has only one argument.
Added LDFSR, LDXFSR, STFSR and STXFSR.
Fixed operands info for RDCCR, WRCCR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2835 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:25:17 +00:00
Vikram S. Adve
76ee6f70ea Significant changes to correctly spill CC registers and to correctly
handle conditional move instructions:
-- cpMem<->Reg functions now support CC registers (int and FP) correctly.
   Also, cpMem<->Reg functions now return a vector of machine instructions.
-- Scratch registers must be explicitly provided to cpMem<->Reg when
   needed, since CC regs need one to be copied to/from memory.
-- CC regs are saved to a scratch register instead of stack.
-- All regs used by a instruction are now recorded in MachineInstr::regsUsed,
   since regs used to save values *across* an instruction are not obvious
   either from the operands or from the LiveVar sets.
-- An (explicit or implicit) operand may now be both a def and a use.
   This is needed for conditional move operations.
   So an operand may need spill code both before and after the instruction.

Other changes:
-- Added several get{Class,Type} functions.
-- Added unified-to-local register number conversion.
-- class MachineCodeForBasicBlock is now an annotation on BasicBlock.
-- Suggest/Color methods may modify the MachineInstr (and always did),
   so don't make that argument const!
-- Caller-saving code doesn't need its special purpose code for
   handling CC registers since cpMem<->Reg handle those correctly now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2834 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:23:12 +00:00
Vikram S. Adve
f5af636dbe Significant changes to correctly spill CC registers and to correctly
handle conditional move instructions:
-- cpMem<->Reg functions now support CC registers (int and FP) correctly.
-- Scratch registers must be explicitly provided to cpMem<->Reg when
   needed, since CC regs need one to be copied to/from memory.
-- CC regs are saved to a scratch register instead of stack.
-- All regs used by a instruction are now recorded in MachineInstr::regsUsed,
   since regs used to save values *across* an instruction are not obvious
   either from the operands or from the LiveVar sets.
-- An (explicit or implicit) operand may now be both a def and a use.
   This is needed for conditional move operations.
   So an operand may need spill code both before and after the instruction.
-- class MachineCodeForBasicBlock is now an annotation on BasicBlock.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2833 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:15:32 +00:00
Vikram S. Adve
c9a0ca5171 MachineInstr* in vector are not const (and never really were)
because operands may be modified directly to set register.
Also, class MachineCodeForBasicBlock is now an annotation on BasicBlock.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2832 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:07:26 +00:00
Vikram S. Adve
45c3877b5c Rename static struct Initializer to avoid name conflict with BB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2831 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:04:31 +00:00
Vikram S. Adve
432e1ca621 Fix printing of BB in dump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2830 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:03:54 +00:00
Vikram S. Adve
1dcfd3c1a6 Moved class MachineCodeForBasicBlock to MachineCodeForBasicBlock.h.
This class is now an annotation on BasicBlock.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2829 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:03:10 +00:00
Vikram S. Adve
bf82a42d1c MachineInstr::dump() now takes no arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2828 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:01:46 +00:00
Vikram S. Adve
11991ac70f Implementation of class MachineCodeForBasicBlock.
Moved here from MachineInstr.cpp to make it an annotation on BasicBlock.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2827 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:01:11 +00:00
Vikram S. Adve
0baf1c0911 A single MachineInstr operand may now be both a def and a use,
so additional dep. edges have to be added.
This was needed to correctly handle conditional move instructions!
MachineCodeForBasicBlock is now an annotation on BasicBlock.
Renamed "earliestForNode" to "earliestReadyTimeForNode".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2826 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 22:59:23 +00:00
Vikram S. Adve
9afa88c3a7 A single MachineInstr operand may now be both a def and a use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2825 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 22:56:34 +00:00
Vikram S. Adve
c2580ddb08 getUsableUniRegAtMI interface simplified slightly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2822 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 22:39:36 +00:00
Vikram S. Adve
7a4be9580e Moved class MachineCodeForBasicBlock to MachineCodeForBasicBlock.{cpp,h}.
An (explicit or implicit) operand may now be both a def and a use.
Also add a set of regs used by each instruction.
dump() no longer takes an optional argument, which doesn't work in gdb.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2821 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 22:38:45 +00:00
Vikram S. Adve
1871b2f1c2 MachineInstr* in vector are not const (and never really were)
because operands may be modified directly to set register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2820 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 22:34:40 +00:00
Vikram S. Adve
08272fbdb2 Moved MachineCodeForBB to be an annotation on BasicBlock.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2818 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 22:31:11 +00:00
Anand Shukla
ec07c755fc changes BBsorting and oredering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2817 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 19:37:06 +00:00
Anand Shukla
82f40e8210 small corrections
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2816 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 19:36:39 +00:00
Anand Shukla
d4d79067c0 changed function numbering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2815 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 19:36:01 +00:00
Chris Lattner
3e009942ed *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2813 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-30 16:25:25 +00:00
Chris Lattner
f739969911 Clean up anands patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2812 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-30 16:25:21 +00:00
Chris Lattner
f59391ab9e Remove diff-cluttering tags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2808 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-30 16:12:03 +00:00
Chris Lattner
000f60d1b1 Remove tag that just clutters diffs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2807 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-30 16:08:25 +00:00
Chris Lattner
e7f65d3b71 Fix anands changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2806 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-30 16:07:20 +00:00
Chris Lattner
194f0a56ac Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2805 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-30 16:04:37 +00:00
Chris Lattner
9fdaeb44b3 Fix anand's last checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2804 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-30 16:01:15 +00:00
Anand Shukla
d05e22cb6f changes for 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2801 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 22:07:38 +00:00
Anand Shukla
60a786e9e9 added include<iostream> for cerr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2800 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 22:04:00 +00:00
Anand Shukla
e6f74a9ce8 added include<iostream> for cerr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2796 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 21:29:10 +00:00
Anand Shukla
3b5eabb24b changes to make it compatible with 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2795 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 21:18:19 +00:00
Anand Shukla
5cafcfbab4 additions and bug fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2794 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 21:14:58 +00:00
Anand Shukla
881ed6bad4 added include<iostream> for cerr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2793 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 21:12:25 +00:00
Anand Shukla
5ba99bd124 changes to make it compatible with 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2792 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 21:07:58 +00:00
Anand Shukla
cfb22d3c14 changes to make it compatible with 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2791 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 20:55:50 +00:00
Anand Shukla
eea60fc59c changes to make it compatible with 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2790 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 20:44:04 +00:00
Anand Shukla
a928403ca4 changes to make it compatible with 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2789 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 20:35:19 +00:00
Anand Shukla
add9643e92 minor change in removing endl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2788 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 20:34:54 +00:00
Anand Shukla
4a9f933751 changes to make it compatible with 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2786 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 20:22:25 +00:00
Chris Lattner
7e70829632 MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2779 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 16:13:24 +00:00
Chris Lattner
0b12b5f50e MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2778 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 16:13:21 +00:00
Chris Lattner
18961504fc *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2777 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 16:12:52 +00:00
Chris Lattner
bb03efd7e5 * Update with MegaPatch
* Fix various bugs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2774 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 15:57:03 +00:00
Chris Lattner
24e845fa95 * Update to work with Megapatch
* Add two new checks:
  * PHI nodes must be the first thing in a basic block, all grouped together
  * All basic blocks should only end with terminator insts, not contain them


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2773 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 15:56:27 +00:00
Chris Lattner
9234d03373 Remove DynamicConstantMerge pass, because it did not fit in with the Pass
system correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2772 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 15:55:29 +00:00
Chris Lattner
ce0141ec22 Remove "fixers" for problems in GCC generated code that cannot be generated
anymore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2771 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 15:55:03 +00:00
Anand Shukla
c43fa80e1f Relocating Graph.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2770 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 14:28:55 +00:00
Chris Lattner
db241dcf51 Fix constness
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2762 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-05 18:11:37 +00:00
Chris Lattner
122787bcff Fix Constness problems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2761 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-05 18:08:26 +00:00
Chris Lattner
9fcccb0f36 Fix constness problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2759 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-05 17:49:40 +00:00
Chris Lattner
a48836b195 Fix constness problems now that the cast operators preserve the constness
of their argument


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2758 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-05 17:38:28 +00:00
Chris Lattner
51727bee39 * Be more typesafe: cast<x> now no longer discards constness
* The newly installed version of Bison now really likes there to be ;'s
  after productions.  Add them to avoid tons of warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2757 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-04 21:58:56 +00:00
Chris Lattner
44014418f5 Disable debugging output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2756 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-04 03:09:57 +00:00
Chris Lattner
0f99555ce4 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2755 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-03 22:10:52 +00:00
Chris Lattner
84369b323e Avoid deleting individual instructions until AFTER dead blocks have dropped
their references.  This fixes bug:
    test/Regression/Transforms/ADCE/2002-05-28-Crash*.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2753 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-28 21:38:16 +00:00
Chris Lattner
16da494c81 Simplify the interface to local DCE and Constant prop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2749 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-26 20:18:18 +00:00
Chris Lattner
9e77f77687 Support opaque type printing a little bit at least
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2748 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-26 20:17:54 +00:00
Chris Lattner
bd8619d3ef Do not remove type names that contain a .
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2747 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-26 20:17:35 +00:00
Chris Lattner
abe6c3d702 Fix "unimplemented features":
test/Regression/Transforms/FunctionResolve/retmismatch[12].ll

This makes it much more useful for running benchmarks that are missing
prototypes for some functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2745 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-24 21:33:26 +00:00
Chris Lattner
22ee3eb802 Split the FunctionResolution pass out of CleanGCCOutput.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2742 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-24 20:42:13 +00:00
Chris Lattner
d20a98e285 Fix comments to reflect reality
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2741 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-24 20:41:51 +00:00
Chris Lattner
47e0f3a8a0 Support programs that do not #include <malloc.h> or give a full prototype
for malloc and free.  Lots of crufty benchmarks are using stuff like:
char *malloc();
void free();

to forward declare malloc and free.  Now we recognize and raise these forms


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2740 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-24 20:29:18 +00:00
Chris Lattner
c2b42b38f9 Fold add X, 0 for floating point types as well
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2734 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-23 17:11:38 +00:00
Chris Lattner
89d46b0f09 Fix bug: test/Regression/Transforms/ADCE/2002-05-23-ZeroArgPHITest.ll
Which contains a description of why this is neccesary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2733 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-23 16:52:34 +00:00
Chris Lattner
85c5465e07 Convert RegClass::IsColorUsedArr from a dynamically allocated array to
a vector.  This makes asserting on array bounds easier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2731 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-23 15:50:03 +00:00
Chris Lattner
0c51266082 Avoid creating the symbol table if we don't need it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2728 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 22:53:05 +00:00
Chris Lattner
8ebccb7f0e Support function declarations with either %XXX or "XXX" style for now
"XXX" style should be considered deprecated, and will hopefully be removed
in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2727 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 22:33:00 +00:00
Chris Lattner
68e0278815 Print out function name with % style instead of "" style
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2726 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 22:29:26 +00:00
Chris Lattner
f09c74c385 Convert code to use the DEBUG macro so that debug code can simply be
enabled with the -debug command line option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2721 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 21:56:32 +00:00
Chris Lattner
d9036a1aad Fix and implement ADCE to finally work!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2720 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 21:32:16 +00:00
Chris Lattner
b3abf9d0d8 Convert transforms over to standardize debugging output on -debug option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2714 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 17:27:12 +00:00
Chris Lattner
f016ea4ff8 Use the new DEBUG(x) macro to allow debugging code to be enabled on the commandline
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2713 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 17:17:27 +00:00
Chris Lattner
70e60cbd4d Move debug options out of header files so that the header does not have
to #include CommandLine.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2712 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 17:08:27 +00:00
Chris Lattner
59dcbf9c03 Move the DEBUG_LV option out of the public header file into a private header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2711 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 17:07:26 +00:00
Chris Lattner
e87adaac31 Avoid #including CommandLine.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2710 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 17:06:56 +00:00
Chris Lattner
4435ac0097 Implement a new command line option, -debug, which is meant to unify all of
the random debugging macros scattered throughout llvm.

The new DEBUG(x) macro should be used instead of special purpose debug macros.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2709 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 17:06:20 +00:00
Chris Lattner
71fb71628a Add ability to update existing variables with values read from the command line
to certain classes.  This is nice because it means that in header files we can
just declare a value, and still have that value be set based on a command-line
argument.  The difference is now that the #include of CommandLine.h does not
need to go into the header file as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2708 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 17:03:05 +00:00
Chris Lattner
7f9412b50d Fix bug: test/Regression/Transforms/SCCP/2002-05-21-InvalidSimplify.ll
Improperly handling edges... by not marking them alive properly


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2707 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-22 16:07:20 +00:00
Chris Lattner
594b9fadb8 * Fix typeo
* Provide a #include of <malloc.h> so that the sun C compiler does not
  miscompile malloc function calls


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2702 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 21:10:04 +00:00
Chris Lattner
01d1ee3a4c Add implementation of SimplifyCFG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2701 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 20:50:24 +00:00
Chris Lattner
573527bd5d New CFG Simplification pass: removed from the old DCE pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2700 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 20:49:37 +00:00
Chris Lattner
76ae3445f8 Simplify interface to ConstantFoldTerminator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2697 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 20:04:50 +00:00
Chris Lattner
87a09b10f8 Fix bug: test/Regression/Transforms/CFGSimplify/2002-05-21-PHIElimination.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2694 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 19:52:49 +00:00
Chris Lattner
963b70bbf8 Fix bug: test/Regression/CBackend/2002-05-21-MissingReturn.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2690 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 18:05:19 +00:00
Mehwish Nagda
8532fb0d13 Fixed the makefile to not die when compiling a new, empty, source directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2688 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 15:58:24 +00:00
Chris Lattner
2e0769ea16 * Change commandline options a bit to be nicer
* Insert accurate prototypes for functions
* Insert casts to use accurate prototypes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2677 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-20 21:43:59 +00:00
Chris Lattner
ad86b74baf Hide debugging options
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2676 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-20 21:39:10 +00:00
Chris Lattner
1ee34a5a5b Remove explicit support for tracing code. It should be linked into the
executable just like everything else.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2674 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-20 21:17:16 +00:00
Chris Lattner
0fe380c683 Remove tracing code hack
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2673 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-20 21:16:46 +00:00
Chris Lattner
618b4a11bb Fix bug: test/Regression/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll
That was causing a miscompilation of strtol/atoi plus others


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2669 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-20 20:48:03 +00:00
Chris Lattner
5245f853c5 Don't lose namespace qualifications on previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2664 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-20 17:38:26 +00:00
Chris Lattner
36346c7a1e Rename IsPowerOf2 to isPowerOf2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2663 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 21:20:19 +00:00
Vikram S. Adve
53835b8081 Link with test/Libraries/libinstr32.a for runtime routines
supporting tracing.  That should be moved to a "runtime" directory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2660 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 16:00:28 +00:00
Vikram S. Adve
eb1a8453f9 Added external functions for hashing pointers to sequence numbers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2659 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:59:25 +00:00
Vikram S. Adve
0243ff9e62 InstrnsBefore and InstrnsAfter are now vectors instead of deques.
May be slightly less efficient but significantly reduces special
cases interfaces in code generation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2649 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:41:33 +00:00
Vikram S. Adve
1e2ddcf741 Hash pointer values to a sequence number to get identical results from
lli and llc.  This is controlled with options -tracehash on|off.

Also, added an option to specify which functions should be traced.
Particularly useful to reduce output volume in basic-block tracing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2646 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:39:02 +00:00
Vikram S. Adve
36f0a9e5a6 Better folding getelementptr operations with mixed
array and struct indexes.
Update operand values in CallArgsDescriptor (a new class)
when replacing constant values with immediates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2645 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:34:29 +00:00
Vikram S. Adve
629b70f274 cpValue2Value now needs a vector of MachineInstr to store return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2644 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:31:08 +00:00
Vikram S. Adve
7e684a956a Annotation class for MachineInstr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2643 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:30:21 +00:00
Vikram S. Adve
dabb41d93d Numerous bug fixes:
-- passing FP arguments to functions with more than 6 arguments
-- passing FP arguments to varargs functions
-- passing FP arguments to functions with no prototypes
-- incorrect coloring for CC registers (both int and FP): interferences
   were being completely ignored for int CC and were considered but no
   spills were marked for fp CC!

Also some code improvements:
-- better interface to generating machine instr for common cases
   (many places still need to be updated to use this interface)
-- annotations on MachineInstr to communicate information from
   one codegen phase to another (now used to pass information about
   CALL/JMPLCALL operands from selection to register allocation)
-- all sizes and offests in class TargetData are uint64_t instead of uint


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2642 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:29:31 +00:00
Vikram S. Adve
f66723fc4b Add integer register size field.
Make all sizes and offsets uint64_t instead of uint.
Fixed GetIndexedOffset to handle mixed array and struct indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2641 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:28:02 +00:00
Vikram S. Adve
242a8086aa Numerous bug fixes:
-- correct sign extensions for integer casts and for shift-by-constant
   instructions generated for integer multiply
-- passing FP arguments to functions with more than 6 arguments
-- passing FP arguments to varargs functions
-- passing FP arguments to functions with no prototypes
-- incorrect stack frame size when padding a section
-- folding getelementptr operations with mixed array and struct indexes
-- use uint64_t instead of uint for constant offsets in mem operands
-- incorrect coloring for CC registers (both int and FP): interferences
   were being completely ignored for int CC and were considered but no
   spills were marked for fp CC!

Also some code improvements:
-- better interface to generating machine instr for common cases
   (many places still need to be updated to use this interface)
-- annotations on MachineInstr to communicate information from
   one codegen phase to another (now used to pass information about
   CALL/JMPLCALL operands from selection to register allocation)
-- all sizes and offests in class TargetData are uint64_t instead of uint


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2640 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-19 15:25:51 +00:00
Chris Lattner
78771c886a Fix bug: test/Regression/CBackend/2002-05-16-NameCollide.ll by tracking
which global variables would have name collisions if they were not mangled,
and use this info to mangle them iff they would collide.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2639 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-17 04:55:35 +00:00
Chris Lattner
a36e6c8cd5 * Make debug output conditional on #define
* Add optimization to rank computation to not recursively search when
  unneccesary.
* More agressively negate expressions to open reassociation opportunities.
* Linearize (A+B)+(C+D) into ((A+B)+C)+D


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2637 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-16 04:37:07 +00:00
Chris Lattner
0f9fd5b0f8 * Fix bug: test/Regression/Transforms/GCSE/2002-05-14-OperandSwap.ll
By making sure to consider binary expressions identical if their operands
are backwards, but swappable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2629 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-14 19:57:25 +00:00
Chris Lattner
86c25fd556 Fix bug: test/Regression/Transforms/InstCombine/2002-05-14-SubFailure.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2627 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-14 16:44:07 +00:00
Chris Lattner
afc38686b4 Avoid emitting a useless comment for a basic block with no uses (which
often happens for the entry basic block of a function)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2624 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-14 16:02:05 +00:00
Chris Lattner
b3bc8fa755 Fix bug: test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll
"This testcase caused instcombine to fail because it got the same instruction on
it's worklist more than once (which is ok), but then deleted the instruction.
Since the inst stayed on the worklist, as soon as it came back up to be
processed, bad things happened, and opt asserted."


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2623 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-14 15:24:07 +00:00
Chris Lattner
c99428f3c9 Fix a major source of "type unsafety", where a cast is neccesary, but can
be put either before or after a load.  We chose to cast the value loaded
instead of the pointer to load from.

Fixes bug: test/Regression/Transforms/LevelRaise/2002-05-10-LoadPeephole.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2621 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-14 05:23:45 +00:00
Chris Lattner
18fb2a6682 Implement elimination of loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2620 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-14 05:02:40 +00:00
Chris Lattner
2172db04e7 Trivial cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2617 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-13 22:04:46 +00:00
Chris Lattner
ef704a23b4 Add method to check to see if two _Instructions_ dominate each other
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2616 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-13 22:03:16 +00:00
Chris Lattner
e0e734eea0 Initial checkin of LICM pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2615 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-10 22:44:58 +00:00
Chris Lattner
d6b60805e8 We actually need this code for the release build to prevent link errors,
un#ifdef it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2606 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-10 18:54:35 +00:00
Chris Lattner
3dec1f2722 Add support for printing out statistics information when -stats is added to
the command line


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2601 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-10 15:38:35 +00:00
Chris Lattner
55547274bc Fix some bugs, straighten stuff out, more work needs to be done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2600 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-10 15:37:35 +00:00
Chris Lattner
f3f4fd50f2 Initial checkin of Statistic class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2598 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-10 15:36:46 +00:00
Chris Lattner
3c0193742a * Add support for the -stats command line option to report how much is changed
* Make cast-of-self-ty DCE the dead cast instruction immediately instead of
  waiting for it to be DCE'd by another sweep over the function.  This speeds
  this up noticably.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2597 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-10 15:29:25 +00:00
Chris Lattner
87fea85934 Initial checkin of the PiNodeInsertion pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2593 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-10 05:41:34 +00:00
Chris Lattner
3af3ba8b38 Last minor cleanups, this code still does not work for all cases, but it
works much better than it used to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2588 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 21:31:18 +00:00
Chris Lattner
d0c668c380 Two Cleanups to generated C code:
1. Avoid printing *(&globalvariable), instead print globalvariable alone
   as a special case.
2. Inline subexpressions into expressions as much as legal that preserves
   execution characteristics of expressions.  Now we get nice (but
   over-parenthesized, oh well) things like:

     ltmp_428_7 = spec__putc(((unsigned char )((bsBuff) >> 24)), (bsStream));

   instead of five seperate instructions (bsBuff & bsStream are globals).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2587 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 21:18:38 +00:00
Chris Lattner
4fbf26d2fc * Remove CInstPrintVisitor class, incorporating it into the CWriter class
* Reorder code in the file to make it more logically laid out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2586 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:53:56 +00:00
Chris Lattner
497e19aee0 Remove CLocalVars data structure entirely, instead of building stuff and
then printing it out, just print as we go.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2585 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:39:03 +00:00
Chris Lattner
7683a12e20 Simplify code by removing InstLocalVarsVisitor, replacing it with a simple
inst_iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2584 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:33:35 +00:00
Chris Lattner
1f02c8910a * Clean up how PHI nodes are handled
* Correct global variable references
* Fix loads & stores with zero indices
* Do not emit an else part of a branch if there is no code (no phi node
  and a fallthrough branch), makes code more readable to get:
  if (l2_cond240) {
    goto l13_bb10;
  }

with no else{} branch


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2583 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:14:10 +00:00
Chris Lattner
53a5b57737 Handle setcc <global*>, 0 instructions, Global pointers are never null!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2582 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:11:54 +00:00
Chris Lattner
0aa7cd605d Give the longer name to the instruction that will probably be eliminated later
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2581 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:11:23 +00:00
Chris Lattner
8c8a37061a Emit:
l3_reg109 = l81_this->field0;
Instead of:
  l3_reg109 = l81_this[0u].field0;

where possible


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2579 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 15:59:50 +00:00
Chris Lattner
8c3c4bfcfe * Print structures types correctly
* Clean up generated code to not emit basic block labels and goto
  instructions if they are unneccesary (for example, fall throughs)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2578 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 15:49:41 +00:00
Chris Lattner
deed7a5ae3 * Continue cleanup of type printing code
* Print a newline after a malloc instruction
* Convert unprintable characters to x_ instead of _x so that we don't
  generate identifiers that start with underscores


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2577 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 15:18:52 +00:00
Chris Lattner
3ef6dc7bdd Gut the type printing code so there is only one copy of it instead of 3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2576 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 14:40:11 +00:00
Chris Lattner
2d05a1acb0 * Remove dead "constant printing" code
* Mangle names with only a prefix so that they are easier on the eyes.
* Put spaces around binary operators with low precedence to make them easier to read
* Don't prefix function names with &, although it's correct, it's unnecesary and
  easier to read without it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2575 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 05:16:40 +00:00
Chris Lattner
2a7ab2e46d Remove gross "Operand" instance variable
Remove lots of unneccesary arguments to methods


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2574 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 04:39:00 +00:00
Chris Lattner
2f49902374 Simplify and clean up function calls.
Now indirect function calls work, except that function pointer types are not correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2573 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 04:21:21 +00:00
Chris Lattner
2f5eb4e9a5 * Remove dead function
* Print C strings correctly
* Expand C escape sequences nicely (ie \n \t, etc get generated instead of hex escapes)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2572 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:56:52 +00:00
Chris Lattner
4440826cae Make Getelementptr, load & store all work the right way.
Handle global variables correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2571 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:50:42 +00:00
Chris Lattner
2f5f51a852 Many random fixes:
* Use binary operator logic for shifts instead of cloning code
 * Unary not is '~' not '!'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2570 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:28:37 +00:00
Chris Lattner
f34ee81c5e Incorporate and purge function before and after printing them so unnamed values
have some hope of working right.

Function calls do not try to emit an lvalue if they return void.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2569 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:12:34 +00:00
Chris Lattner
b5af06a0ec Factor out the code to print a value to ONE place.
It turns out that unnamed values DO NOT work at all, that's next on the list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2568 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:06:06 +00:00
Chris Lattner
16c7bb2c8f First wave of cleanups, looks like the first of many.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2567 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 02:28:59 +00:00
Chris Lattner
403717156b Add ability to transform (x - (y - z)) into (x + (z - y))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2566 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 01:29:19 +00:00
Chris Lattner
4874680b65 Print out post dominance data structures more nicely
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2562 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-08 23:11:08 +00:00
Chris Lattner
5c4afb9034 * Combine: A-(-B) -> A + B
* Bugfix:  A + -B and -A + B


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2561 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-08 22:46:53 +00:00
Chris Lattner
4fd56003ab Initial checkin of expression reassociation pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2559 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-08 22:19:27 +00:00
Chris Lattner
56732fb869 Verify that function call arguments match the function signature
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2553 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-08 19:49:50 +00:00
Sumant Kowshik
9ddc86c6e5 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2552 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-08 18:09:58 +00:00
Chris Lattner
8ca21c245c Give the unified exit node a name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2550 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 22:14:45 +00:00
Chris Lattner
ea54ab9cd2 Fix bug: test/Regression/Transforms/ADCE/2002-01-31-UseStuckAround.ll
Cleanup code a lot


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2547 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 22:11:39 +00:00
Chris Lattner
54753e2790 Implement constant propogation of PHI instructions like this:
X = phi(0, 0, 0)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2543 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 20:44:59 +00:00
Chris Lattner
022103b3f3 Merge all individual .h files into a single Scalar.h file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2537 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 20:03:00 +00:00
Chris Lattner
a869b8dbd3 This doesn't use DCE!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2536 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 20:02:44 +00:00
Chris Lattner
a163fdfc80 Extend TargetData::getIndexedOffset to support arrays and pointers!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2535 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 20:00:33 +00:00
Chris Lattner
fc514f40a6 Move UnifyFunctionExitNodes to Utils library: final resting place this time
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2531 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 19:18:48 +00:00
Chris Lattner
65e96e57c5 fix comments and documentation in file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2530 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 19:04:39 +00:00
Chris Lattner
ade686e79b Split ChangeAllocations.cpp into Raise & LowerAllocations.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2529 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 19:02:48 +00:00
Chris Lattner
b444a1fff4 Cleanup implementation a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2526 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:51:25 +00:00
Chris Lattner
c8cc4cb03b Updates to move some header files out of include/llvm/Transforms into
the Scalar and Utils subdirectories


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2523 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:36:35 +00:00
Chris Lattner
497c60c0ed Reduce dependance on TransformInternals.h, instead using the TransformUtils library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2518 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:12:18 +00:00
Chris Lattner
6d7491c3cc Add #include no longer included by llvm/Transforms/Scalar/ConstantProp.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2517 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:11:30 +00:00
Chris Lattner
2ed01d8f0b Factor code out to the TransformUtils library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2516 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:10:55 +00:00
Chris Lattner
5a4337a8fc Factor code out of TransformInternals into the Transform Utils library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2515 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:09:15 +00:00
Chris Lattner
0ed2e4b554 Build Transforms Utils library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2514 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:08:50 +00:00
Chris Lattner
4d1e46e7b0 Add code pulled out of TransformInternals.cpp, ConstProp.cpp, and DCE.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2513 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 18:07:59 +00:00
Chris Lattner
071d0ad2f1 * Convert InstWorkList to vector instead of set, because on big programs it
is empirically faster by a noticable margin, even though duplicates can
  happen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2511 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 04:29:32 +00:00
Chris Lattner
92deeaf7a3 * Remove all cfg simplification stuff for a new cfg simplify pass (todo)
* Convert to worklist instead of iterative algorithm


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2510 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-07 04:24:11 +00:00
Chris Lattner
07a228d1f7 Mark analyses that only depend on the CFG of a function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2507 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 19:32:07 +00:00
Chris Lattner
27ad137d5e Make functions that preserve the CFG not invalidate analyses that only depend
on the CFG of a function


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2506 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 19:31:52 +00:00
Chris Lattner
d661937352 Only do masking for unsigned values!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2504 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 18:54:59 +00:00
Chris Lattner
89df1b58a9 * Eliminate dead code that should have been removed in last revision
* Convert main constant propogation pass to be worklist driven instead of
  iterative.
* -constprop pass no longer "constant propogates" terminator instructions
   - CFG is now preserved!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2502 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 18:21:31 +00:00
Chris Lattner
473945d1dc Handle X = phi Y --> X = Y
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2501 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 18:06:38 +00:00
Chris Lattner
a803899af5 Move a bunch of code to a .cpp file, don't #include Instruction.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2499 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:54:50 +00:00
Chris Lattner
178414c3cf Move code out of header file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2498 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:54:27 +00:00
Chris Lattner
f51825e3fb * Use simplified interface to constant propogation stuff.
* Remove dead PHI case (which could not work due to getNumOperands rather than
  getNumIncomingValues.  This really belongs in InstCombine, anyway so we'll
  move it there.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2497 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:54:10 +00:00
Chris Lattner
db93124d41 Add #include removed from ConstantHandling.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2496 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:53:10 +00:00
Chris Lattner
dfe81ab87a Clean up ADCE by removing extraneous wrapper class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2494 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:27:57 +00:00
Chris Lattner
ed3a55005d Combine not (not X) -> X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2493 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:03:21 +00:00
Chris Lattner
b35dde1df4 Support more cases...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2490 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 16:49:18 +00:00
Chris Lattner
45d8b917be Change usage of isPointerType to use isa
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2487 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 16:15:49 +00:00
Chris Lattner
9b625030c8 Replace all usages of Type::isPointerType with isa<PointerType>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2486 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 16:15:30 +00:00
Chris Lattner
d44023ecb7 Implement getPrimitiveSize()
don't use isPointerType()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2485 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 16:14:39 +00:00
Chris Lattner
3f5b877dd4 Add many more instruction combination simplifications
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2484 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 16:14:14 +00:00
Chris Lattner
05dcf353fc Remove dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2473 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 03:03:09 +00:00
Chris Lattner
cdac78b8a4 Merge blocks like this:
void "test3"(bool %T) {
        br bool %T, label %BB1, label %BB1
BB1:
        ret void
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2472 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 03:02:02 +00:00
Chris Lattner
4c1061f58c Implement constant propogation of shift instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2471 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 03:01:37 +00:00
Chris Lattner
cf4929fa27 Implement constant propogation of shifts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2470 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 03:00:54 +00:00
Chris Lattner
03e2acb37f Print functions with curly braces instead of begin/end
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2469 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 03:00:40 +00:00
Chris Lattner
cb6d70c6e0 Implement two iterator remove method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2467 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 02:59:34 +00:00
Chris Lattner
44540ddaa0 Implement remainder
Fix implementation of Not


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2464 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-03 21:41:07 +00:00
Chris Lattner
bdd15ad565 Implement remainder
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2463 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-03 21:40:37 +00:00
Chris Lattner
905f311d05 Fix bug: test/Regression/Transforms/SCCP/2002-05-03-NotOperator.ll
by using the ~ operator instead of !


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2458 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-03 20:09:52 +00:00
Chris Lattner
2adcd83b89 Implement the NOT operator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2455 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-03 19:52:30 +00:00
Chris Lattner
9b02cc365c Allow open/closing curly braces instead of begin/end to define the body of a function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2451 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-03 18:23:48 +00:00
Chris Lattner
904ec289c2 Ok, really it only takes me 3 times to get this right!
Now use #if 0 instead of #ifdef 0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2448 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 21:49:50 +00:00
Chris Lattner
52a9a1def8 Oops, disable debugging code all the way. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2447 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 21:47:40 +00:00
Chris Lattner
b9a6634466 * Finish the implementation of isEdgeFeasible this fixes bug:
test/Regression/Transforms/SCCP/2002-05-02-EdgeFailure.ll
* SCCP now preserves the CFG:  It leaves conditional branches the way they
  are in the program, not simplifying them.  A seperate pass should eliminate
  the potentially dead basic blocks and edges in the CFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2446 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 21:44:00 +00:00
Chris Lattner
59f0ce2a41 * Enable SCCP debugging to be turned on with a simple change of #define
* Change worklist to a set so that duplicates cannot happen
* Add support for the invoke instruction
* Avoid marking store and free instructions as overdefined, since they
  cannot produce a value anyway.
* Inline the OperandChangedState implementation
* Add isEdgeFeasible in preparation to fix a bug.  Right now it behaves
  exactly as before.
* Remove obsolete comment about constant pools


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2445 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 21:18:01 +00:00
Chris Lattner
0e9c515439 * Simplify the code by not bothering to name the folded constant
* Do not skip the instruction immediately after a folded instruction.  This
  was causing the testcase failure:
	test/Regression/Transforms/SCCP/2002-05-02-MissSecondInst.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2443 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 20:32:51 +00:00
Chris Lattner
f4dca807d8 Implement cast operations on booleans to allow casting bools to ints, f.e.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2437 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 19:28:45 +00:00
Chris Lattner
9705a15b1a * Fix a bug (test/Regression/Assembler/2002-05-02-InvalidForwardRef.ll)
introduced in the 1.66 revision of this file.
* Convert a hard coded constant to a symbolic value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2436 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 19:27:42 +00:00
Chris Lattner
b05ca44eb9 The implementation keyword is no longer neccesary
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2434 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 19:11:29 +00:00
Chris Lattner
0e73ce6d94 The "implementation" is now allowed but not required by the parser. All type
definitions must still occur before function bodies, but the wierd keyword is
no longer neccesary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2433 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 19:11:13 +00:00
Chris Lattner
872265ee1b ExprTypeConvert will already do this transformation, no need to specialize
it here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2431 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 17:38:55 +00:00
Chris Lattner
1f8d13c361 Be a little more efficient, do not generate loads and stores with indices in them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2430 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 17:38:14 +00:00
Chris Lattner
bbad858b3a Fix bug: test/Regression/Transforms/LevelRaise/2002-05-02-BadCastElimination.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2429 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 17:37:34 +00:00
Chris Lattner
a1be566213 * Add ability to eliminate a bunch of different cascading cast variations
* Allow elimination of getelementptr X, uint 0 (which is a noop)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2428 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-02 17:06:02 +00:00
Chris Lattner
68d024dde4 Fixed bug: test/Regression/Transforms/Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2423 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-01 15:38:23 +00:00
Chris Lattner
71d3934bad Remove unneccesary pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2420 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-30 20:52:49 +00:00
Chris Lattner
ee37bb34d1 Fix problem where subpasses would invalidate all analyses outstanding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2418 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-30 18:50:17 +00:00
Chris Lattner
6c1ce21ee6 Add folding rules for mul X, 0 and mul X, 2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2417 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 22:24:47 +00:00
Chris Lattner
0dbfc05a2a Significantly clean up SCCP pass. Now the two classes are merged and in
an anonymous namespace where they belong.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2415 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 21:26:08 +00:00
Chris Lattner
f737121054 Range insertion now returns an iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2414 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 21:25:34 +00:00
Chris Lattner
ea1e8c70eb Make the range insert operation return an iterator, even though the STL
range insert doesn't


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2413 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 21:23:30 +00:00
Chris Lattner
94cf3b1c67 Remove unused files: This is the old induction varaible cannonicalization
pass built on top of interval analysis


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2411 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 20:18:00 +00:00
Chris Lattner
4840146b46 Fix for problem when allocating something like this:
malloc(100-i);


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2409 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 20:09:21 +00:00
Chris Lattner
e2cbbce6aa Fix #include broken by iMemory.h not including DerivedTypes.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2407 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 18:56:45 +00:00
Chris Lattner
86e9187dcc Add neccesary #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2406 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 18:48:55 +00:00
Chris Lattner
72a1d4e126 changes because iMemory.h no longer #includes DerivedTypes.h
This only requires Type.h anyway


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2405 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 18:48:30 +00:00
Chris Lattner
3eb59c0074 Changes so that iMemory.h doesn't include DerivedTypes.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2404 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 18:46:50 +00:00
Chris Lattner
924025e9ad Fix bug: test/Regression/Other/2002-04-29-NameBinding.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2402 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 18:25:33 +00:00
Chris Lattner
f772f8ef38 Eliminate dead global variables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2400 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 18:13:11 +00:00
Chris Lattner
c6f3ae5c66 Eliminate duplicate or unneccesary #include's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2397 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 17:42:12 +00:00
Chris Lattner
8b054c0eb9 Remove broken assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2396 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 16:20:25 +00:00
Chris Lattner
96c466b06a Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2395 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 14:57:45 +00:00
Chris Lattner
691fa3cfb1 Add a new command line option for PassManager using utilities.
Now for llc, gccas, analyze, opt, etc you can specify the -time-passes
command line option that outputs a timing summary report that indicates
how long each pass takes to execute.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2394 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 04:04:29 +00:00
Chris Lattner
097632eae3 More cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2392 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 01:58:47 +00:00
Chris Lattner
2f6f03bddd Code cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2391 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-29 01:22:55 +00:00
Chris Lattner
18b24ea4b6 Remove dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2390 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 21:57:50 +00:00
Chris Lattner
cc82cc174c FIXME removed: malloc/alloca ALWAYS have a size argument
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2389 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 21:57:33 +00:00
Chris Lattner
9d73279ec8 Todo has been implemented, remove it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2387 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 21:45:02 +00:00
Chris Lattner
97e52e4336 Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2386 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 21:27:06 +00:00
Chris Lattner
3330e5be7a Move FunctionPass::doesNotModifyCFG to AnalysisUsage::preservesCFG()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2384 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 21:25:41 +00:00
Chris Lattner
d30efaf56e * Add a stub to FunctionPass so that subclasses can declare that they do not
modify the CFG.  It currently does nothing, but will in the future.
* Changes to make the public PassManager.h be MUCH smaller, and devoid of
  implementation details.  Now PassManager is just a Pimpl class that wraps
  PassManagerT<Module>, but lib/VMCore/Pass.cpp is now the only class that
  has to #include PassManagerT.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2383 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 20:46:05 +00:00
Chris Lattner
3adc069c8b Move include/llvm/PassManager.h to lib/VMCore/PassManagerT.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2382 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 20:42:50 +00:00
Chris Lattner
d50b671280 Add #include that was removed from TargetMachine.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2381 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 20:40:59 +00:00
Chris Lattner
97453d60c6 Include appropriate file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2379 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 20:40:16 +00:00
Chris Lattner
31bcdb822f Split ConstantVals.h into Constant.h and Constants.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2378 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 19:55:58 +00:00
Chris Lattner
bfeec103e1 Simplify and update code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2376 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 19:20:10 +00:00
Chris Lattner
b9ddce65c2 Eliminate the PromoteInstance class, incorporating it into the PromotePass
class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2375 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 19:12:38 +00:00
Chris Lattner
0adb9f95ea Eliminate visited, CurrentValue, and WriteSets as instance variables of
PromoteInstance.  Make them local variables that are passed around as
appropriate.  Especially in the case of CurrentValue, this makes the
code simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2374 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 18:54:01 +00:00
Chris Lattner
5b5df1747f * Fix bug: test/Regression/Transforms/Mem2Reg/2002-03-28-UninitializedVal.ll
* Minor cleanup that was missed in last patch


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2373 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 18:39:46 +00:00
Chris Lattner
9f4eb01dd4 This huge changeset is a strictly cleanup change
Bugfixes will come in the next revision so that the diff is obvious.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2372 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 18:27:55 +00:00
Chris Lattner
1b7f7dc4b4 Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
to the global namespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2370 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 16:21:30 +00:00
Chris Lattner
8fc2f2072d Remove all contents of the cfg namespace to the global namespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2369 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 16:19:42 +00:00
Chris Lattner
39dd0246bd Remove extra unused argument from CheckFailed method
Remove extraneous \n's from assert strings


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2367 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 16:06:24 +00:00
Chris Lattner
794caa1d2c The check to see if an external function was marked internal was not reachable!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2366 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 16:04:26 +00:00
Chris Lattner
100d6daca4 Be careful not to make "external" function internal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2363 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 05:48:34 +00:00
Chris Lattner
dbb1735673 Initial checkin of new "Internalize" pass for GCCLD
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2362 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 05:43:27 +00:00
Chris Lattner
2e9175a085 Minor changes to allow Modules (which are no longer Values) to work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2361 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 05:14:06 +00:00
Chris Lattner
2312b1c594 Eliminate use of SymTabValue class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2357 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:55:14 +00:00
Chris Lattner
67e08db3b9 The contents of the SymTabValue class have been incorporated into the
Module and Function classes directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2356 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:52:28 +00:00
Chris Lattner
11aa4770fe * Incorporate the contents of SymTabValue into Function and Module
* Module no longer subclasses Value


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2355 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:51:51 +00:00
Chris Lattner
5240dac674 Module's are no longer values
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2354 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:51:09 +00:00
Chris Lattner
fd63f25fbd Simplify code
Remove unneccesary getID variant for module's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2353 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:50:54 +00:00
Chris Lattner
09c66f07c0 Remove unneccesary #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2352 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:50:19 +00:00
Chris Lattner
96d0f3011a Module's are no longer Value subclasses
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2351 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:50:00 +00:00
Chris Lattner
3bed5b46ba Fix signed/unsigned comparison warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2350 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 04:49:43 +00:00
Chris Lattner
d80e973cec Initial checkin of simple&fast SSA based GCSE algorithm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2338 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 00:47:11 +00:00
Chris Lattner
a298d27808 Change the Dominator info and LoopInfo classes to keep track of BasicBlock's, not
const BasicBlocks


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2337 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 00:15:57 +00:00
Chris Lattner
483e14ee04 s/Method/Function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2336 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 07:27:19 +00:00
Chris Lattner
f57b845547 * Rename MethodPass class to FunctionPass
- Rename runOnMethod to runOnFunction
* Transform getAnalysisUsageInfo into getAnalysisUsage
  - Method is now const
  - It now takes one AnalysisUsage object to fill in instead of 3 vectors
    to fill in
  - Pass's now specify which other passes they _preserve_ not which ones
    they modify (be conservative!)
  - A pass can specify that it preserves all analyses (because it never
    modifies the underlying program)
* s/Method/Function/g in other random places as well


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2333 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 06:56:12 +00:00
Chris Lattner
f2361c5e5c Changes because the Terminator::getSuccessor function now FAILS if successor
IDX is out of range instead of returning null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2332 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 03:15:45 +00:00
Chris Lattner
35504209a0 Use the cast<> operator in favor of C style casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2331 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 03:14:39 +00:00
Chris Lattner
8e343330a5 * Change Constant::getNullConstant to Constant::getNullValue
* Add support for pool allocating array allocations of varying size


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2329 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:29:32 +00:00
Chris Lattner
ee7eafa054 Add support for tracking array allocations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2328 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:28:41 +00:00
Chris Lattner
2aa51be083 Allow the inline limit to be modified on the commandline for debugging
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2327 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:27:48 +00:00
Chris Lattner
c72114ca72 Trivial simplification of code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2325 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:26:03 +00:00
Chris Lattner
95b876e0b6 * Change Constant::getNullConstant to Constant::getNullValue
* Remove some unused code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2324 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:25:43 +00:00
Chris Lattner
1a18b7cf80 Change Constant::getNullConstant to Constant::getNullValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2323 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:25:14 +00:00
Chris Lattner
87e873bd3d Simplify code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2322 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-27 02:24:17 +00:00
Vikram S. Adve
d23a229c4c Don't record instructions for copying method arguments in the
AddedInstrns sets for the first machine instruction.  It is hard
to ensure that the right order is preserved, and sure enough, the
order was broken.  Instead, use a separate set for the function entry.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2318 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:46:28 +00:00
Vikram S. Adve
0bc0516078 Don't pad spills and temp. stack areas for alignment.
Freeze auto vars and spill areas when their sizes are used
for computing other offsets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2317 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:43:45 +00:00
Vikram S. Adve
31f78c4f6b Major changes to how int and FP arguments are handled. Varargs
function calls were simply wrong; other functions were just not
using all available registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2316 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:42:21 +00:00
Vikram S. Adve
6d78311fd2 Added functions to compute which register, if any, to use
for a particular argument in a list of arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2315 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:40:24 +00:00
Vikram S. Adve
dbc4fad577 Insert copy operations for FP arguments to a varargs function,
to copy the FP arg. to an integer.  Necessary so that the
register allocator has two different live ranges for the FP value
and the int. argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2314 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:37:51 +00:00
Vikram S. Adve
a4a943dd5a Implementation of class MachineFrameInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2313 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:35:27 +00:00
Vikram S. Adve
4876209aa6 Don't record instructions for copying method arguments in the
AddedInstrns sets for the first machine instruction.  It is hard
to ensure that the right order is preserved, and sure enough, the
order was broken.  Instead, use a separate set for the function entry.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2312 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:34:15 +00:00
Vikram S. Adve
93240fe6b1 Improve printing during dumps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2311 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:31:18 +00:00
Vikram S. Adve
03d33bd264 Optional args are no longer allocated as they are discovered.
(This can be improved to avoid making the initial pass over the method.)
Also, ensure automatic vars and reg. spills areas are not extended
if their sizes are used for computing some other offset.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2310 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-25 04:30:43 +00:00
Chris Lattner
a00409ea1a * Abort program on verification errors
* Verify that load, store, and GEP instructions indices are correct, because
  they _continually_ bite me on this pool allocations stuff


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2309 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-24 19:12:21 +00:00
Chris Lattner
efdd0a2c2e Add some basic checks of CallInst's.
Assert now returns from the current function on error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2308 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 22:11:52 +00:00
Chris Lattner
7b5577b371 Programs that actually free memory were broken
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2307 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 22:11:30 +00:00
Chris Lattner
d231fc3254 * Convert the verifier to use an InstVisitor to be better structured
* Implement checking that a binary operator's two sides are the same type
* Actually check that an instruction does not have a name if it has a void
  return type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2305 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 20:37:37 +00:00
Chris Lattner
bac27a49b1 Add new api for basic signal handling for tools
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2302 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 19:53:53 +00:00
Chris Lattner
68d892dc0d Move asmwriter/getStrValue cruft into AsmWriter.cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2300 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:53:33 +00:00
Chris Lattner
66e810be9f Pull all of the getStrValue implementation cruft out of Constants.cpp and
put it into the AsmWriter.  This code is kinda gross and could probably be
cleaned up, but not now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2299 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:53:13 +00:00
Chris Lattner
0154505ab7 Add a fixme so that we don't forget this is broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2298 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:52:03 +00:00
Chris Lattner
4b1de8eb99 * getAsString requires that the input array is string compatible, so
assert it.
* Use WriteAsOperand instead of getStringValue for constants


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2296 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:15:38 +00:00
Chris Lattner
ccc259635a Make debugging code not use getStrValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2295 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:14:56 +00:00
Chris Lattner
6228106e9f Just use << isntead of forcing getStrValue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2294 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:14:40 +00:00
Chris Lattner
595d2f670a Print argument scalars as ellipses instead of boxes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2293 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 18:14:19 +00:00
Chris Lattner
dd841aeb8d Significantly rework InstructionCombining to work better and to be cleaner.
We now use an InstVisitor to delegate to different cases that we are
interested in handling.  We also fix the FIXME's by adding users to the
worklist when appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2292 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 17:39:14 +00:00
Chris Lattner
2a632551a7 Convert SCCP over to use InstVisitor instead of hand crafted switch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2286 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 15:13:15 +00:00
Chris Lattner
d59b0af98b Remove gep::isStructSelector
CTor's do not allow names anymore for StoreInst objects


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2285 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 14:44:53 +00:00
Chris Lattner
6428a27ee3 GEP instructions can never be constant propogated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2284 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-18 14:44:13 +00:00