Commit Graph

1243 Commits

Author SHA1 Message Date
Chris Lattner
5b497ee7c2 Add new cleanup pass:
//  1. PHI nodes with multiple entries for the same predecessor.  GCC sometimes
//     generates code that looks like this:
//
//  bb7:  br bool %cond1004, label %bb8, label %bb8
//  bb8: %reg119 = phi uint [ 0, %bb7 ], [ 1, %bb7 ]
//
//     which is completely illegal LLVM code.  To compensate for this, we insert
//     an extra basic block, and convert the code to look like this:
//
//  bb7: br bool %cond1004, label %bbX, label %bb8
//  bbX: br label bb8
//  bb8: %reg119 = phi uint [ 0, %bbX ], [ 1, %bb7 ]
//


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1114 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 21:08:59 +00:00
Chris Lattner
3bf04d5b99 Add a helper function to PHI node
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1113 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 21:08:00 +00:00
Ruchira Sasanka
80b1a1a26a Added support for correct spilling of %ccr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1112 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 20:41:22 +00:00
Ruchira Sasanka
3839e6e309 Added code to support correct saving of %ccr across calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1111 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 19:59:59 +00:00
Chris Lattner
b20807f23e * Export method to merge identically named methods
* Add code to fix PHI nodes that are missing arguments.  These PHI nodes can
  be generated by GCC if there is an uninitialized variable flowing into a merge
  point.  For example:

int foo(int y) {
  int X;
  if (y) X = 1;
  return X;
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1110 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 19:51:56 +00:00
Chris Lattner
407c25bd82 Expose method to merge identically named methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1109 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 19:49:54 +00:00
Ruchira Sasanka
51bc0e7994 Arranged stack frame - needs furhter organization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1108 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 17:14:44 +00:00
Ruchira Sasanka
0d3ea0268f Moved InsertCallerSaveInstr to the SparcRegInfo.cpp and made machine independent
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1107 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 17:14:13 +00:00
Ruchira Sasanka
ef1b0cb9a5 Arranged stack frame - needs furhter organization
Moved InsertCallerSaveInstr to the SparcRegInfo.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1106 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 17:13:27 +00:00
Ruchira Sasanka
fca59d7dc9 Commented out code so that copies are inserted for all phi args
CahedCopyMap was disabled to insert phi elimination code for all phi args


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1105 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 17:09:59 +00:00
Chris Lattner
0f279b245d Be lenient on types so that programs that are not very typesafe will work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1104 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 10:15:32 +00:00
Chris Lattner
055c963f58 Changes to compile the TSP benchmark successfully. Favor warning instead of assertion failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1103 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 10:04:22 +00:00
Chris Lattner
b6b26921e3 Add code to link method together with the same name if one is vararg and the other isn't.
This resolves definitions like this:
   %list * "foo"(...)
   %list * "foo"(int)

together which can often occur because C programmers don't put prototypes in like they should.  GRR


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1102 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 09:19:00 +00:00
Chris Lattner
2c236f3e20 Don't forget to link type names together too. Fix for Olden/mst benchmark
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1094 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 05:18:24 +00:00
Chris Lattner
ebef5e5ba2 Remove debugging info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1093 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 03:31:39 +00:00
Chris Lattner
e244a25014 Fix major bugs in type resolution
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1092 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 03:27:53 +00:00
Chris Lattner
2d3e8bba62 Add extra code for debugging linker problems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1091 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 03:27:29 +00:00
Chris Lattner
d4f981d00f Fix the linker. This bug was not fun to track down. grr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1090 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-03 03:26:47 +00:00
Chris Lattner
3b1e3f45c0 Dramatically simplify recursive type processing. Fixed a few bugs, a few still remain :(
Why does this stuff have to come up NOW?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1089 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-02 07:51:31 +00:00
Chris Lattner
5084d032e5 Improve some debugging code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1088 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-02 07:46:26 +00:00
Chris Lattner
1e2c614864 Support floating point numbers in expodential form so that small numbers don't get truncated, which broke the health benchmark
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1087 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 22:06:08 +00:00
Chris Lattner
6eaa457343 Print floating point numbers in expodential form so that small numbers don't get truncated, which broke the health benchmark
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1086 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 22:06:00 +00:00
Chris Lattner
e99c66b74f * Add comments for peepholes
* Implement new peephole:
     // Peephole optimize the following instructions:
     // %t1 = cast {<...>} * %StructPtr to <ty> *
     //
     // Into: %t2 = getelementptr {<...>} * %StructPtr, <0, 0, 0, ...>
     //       %t1 = cast <eltype> * %t1 to <ty> *

  This peephole eliminated 9 evil casts in the health benchmark, and
  completely turned the addList method around.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1085 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 17:05:27 +00:00
Chris Lattner
68b07b7c5d Add DCE as integral part of the level raising to avoid processing instructions that are dead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1084 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 07:00:51 +00:00
Chris Lattner
a1f6e648be Expose the low level DCE mechanism to external users
Refactor code to support it


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1083 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 07:00:27 +00:00
Chris Lattner
fd0375bf86 Expose the low level DCE mechanism to external users
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1082 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 07:00:21 +00:00
Chris Lattner
35d64564c8 Implement new simpler constructors for if you don't have a index list
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1081 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 05:58:42 +00:00
Chris Lattner
dedee7bf15 * Implement expression type conversion for constant values
* Fix a problem setting a name on a constant value that died because no symbol table was passed in
* Add some comments describing the passes
* Implement a new peephole:
     // Peephole optimize the following instructions:
     // %t = cast <T1>* %P to <T2> * ;; If T1 is losslessly convertable to T2
     // store <T2> %V, <T2>* %t
     //
     // Into:
     // %t = cast <T2> %V to <T1>
     // store <T1> %t2, <T1>* %P


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1080 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 05:57:59 +00:00
Chris Lattner
edefaa1196 Simplify DCE code a lot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1079 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 05:55:29 +00:00
Chris Lattner
76ac1a45b4 Implement constant propogation of null pointer values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1078 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 05:55:13 +00:00
Chris Lattner
d558426b0e Add simpler to use ctors. Add getType() overload to specialize getelementptr's type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1077 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 05:54:28 +00:00
Chris Lattner
0eca13bf58 Add new isNullValue method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1076 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 05:53:56 +00:00
Chris Lattner
8d38e54c2f * Convert getelementptr/store pairs into a single store
* Convert getelementptr/load pairs into a single load


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1075 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 03:12:34 +00:00
Chris Lattner
d32a96121b Initial checkin of level raising code, after move and cleanup and expands from the opt directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1074 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 02:42:08 +00:00
Chris Lattner
d3f9a98f66 Initial checkin of level raising code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1073 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 02:41:52 +00:00
Chris Lattner
068f487ee5 Move the Raise xform from opt to transforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1072 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 02:41:09 +00:00
Chris Lattner
591bda986e Propogate name to the malloc itself instead of to the cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1071 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 02:40:36 +00:00
Chris Lattner
4cc5eb2615 Move level change xfor into the transforms directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1070 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 02:39:49 +00:00
Chris Lattner
b86751715c Add some useful accessors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1069 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 02:39:36 +00:00
Chris Lattner
dbe0514e12 crunch the output of GCC a bit to make it nicer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1068 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 06:36:48 +00:00
Chris Lattner
2305b6c3a7 Start testing the new cleangcc pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1067 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 06:36:34 +00:00
Chris Lattner
7ef6559718 Use the correct prototype for malloc and free
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1066 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 06:36:23 +00:00
Chris Lattner
bfe11108ad Implement code to convert %malloc and %free FUNCTION CALLS into the instruction equivalent
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1065 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 06:35:59 +00:00
Chris Lattner
37aabf28b3 Implemented constant propogation of cast instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1064 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 05:07:57 +00:00
Chris Lattner
11c862cf46 Fix dumb copy and paste typos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1063 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 04:33:33 +00:00
Chris Lattner
e51e03b3c6 Initial version of GCC cleanup pass: just removes extraneous global symbol table entries for types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1062 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 04:33:19 +00:00
Chris Lattner
2fa11445cd New GCC cleanup pass interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1061 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 04:32:53 +00:00
Chris Lattner
e166fe1910 Add hook for GCC cleanup pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1060 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 04:29:44 +00:00
Chris Lattner
f83bcfcd00 Build new gccas tool
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1059 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 04:29:30 +00:00
Chris Lattner
ecbde333a2 Initial checkin of GCCAS
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1058 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 04:28:11 +00:00