Commit Graph

1815 Commits

Author SHA1 Message Date
Chris Lattner
d78700de8e - Remove unused STRING token from lexer & parser
- Changed parser to always use parenthesis on ConstExprs to be consistent
  - Parser now passes TRUE and FALSE tokens as a special case of the ConstExpr
    machinery instead of a special case of constant int stuff
  - Fix the AsmParser to use ValueRef ::= ConstExpr, and remove
    ResolvedVal ::= ConstExpr this allows constexprs to be used in PHI nodes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3362 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-16 21:14:40 +00:00
Chris Lattner
95586b8c83 Write constexpr casts using the cast X to Y notation, not using the implicit
type result


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3354 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 19:37:43 +00:00
Chris Lattner
ec1b8a0796 Parse const expr cast instruction the same way the instruction is formed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3353 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 19:37:11 +00:00
Chris Lattner
d05e359b10 Move ConstExpr production to unify ConstVal stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3351 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 18:17:28 +00:00
Chris Lattner
3101c25293 Fix bug: test/Regression/Assembler/2002-08-15-UnresolvedGlobalReference.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3350 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 17:58:33 +00:00
Chris Lattner
96ad1ec876 Simplify the code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3348 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 16:15:36 +00:00
Chris Lattner
3ecce66e25 Handle more cases of cast-of-cast in more general forms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3347 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 16:15:25 +00:00
Vikram S. Adve
85af131d9e Unary Not (boolean and bitwise) is no longer a separate LLVM instruction
but is instead implemented with XOR.  Note that the InstrForest opLabels
for Not and BNot remain the same, i.e., the XOR is recognized and
represented as a (boolean or bitwise) Not when building the instruction
trees.  But these tree nodes are now binary, not unary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3343 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 14:19:22 +00:00
Vikram S. Adve
ce08e1dd3e Revise code generation for unary Not (boolean and bitwise), which is
no longer a separate instruction but is instead implemented with XOR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3342 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 14:17:37 +00:00
Vikram S. Adve
1718337cf7 Added more helper functions for binary instructions emulating
unary Neg and Not: isNeg, isNot, getNegArgument, and getNotArgument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3341 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 14:15:48 +00:00
Chris Lattner
5cf6f112e6 Implement capability to fold this:
uint %test4(int %A, int %B) {
        %COND = setlt int %A, %B                ; <bool> [#uses=1]
        %result = cast bool %COND to uint               ; <uint> [#uses=1]
        ret uint %result
}
into a single cast instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3339 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 23:21:10 +00:00
Chris Lattner
b9a7793ecb Avoid creating 'load X, 0' instead of just 'load X'
This _trivial_ change causes GCSE and LICM to be much more effective at
hoisting loads.  Before it would not be able to eliminate 'load X' if there
was just a dominating 'load X, 0' because the expressions were not identical.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3337 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 22:11:52 +00:00
Chris Lattner
db6e4d6625 Avoid inserting an entry block unless we need it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3336 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 21:35:02 +00:00
Chris Lattner
ad333484ea Remove support for Not ConstantExpr. This simplifies the unary case to only
have to support the cast instruction, so the function is renamed to getCast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3328 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:24:09 +00:00
Chris Lattner
9b2b80fd48 Fix bug introduced in last checkin due to CastInst not being visible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3327 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:22:19 +00:00
Chris Lattner
9c16dba29f Remove support for unary operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3326 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:19:46 +00:00
Chris Lattner
0513e9fe03 Remove support for NOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3323 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:18:02 +00:00
Chris Lattner
48a4531ee4 Remove extra #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3322 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:17:32 +00:00
Chris Lattner
f4e3c006ac Remove constant propogation support for NOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3321 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:17:07 +00:00
Chris Lattner
20e8e01c5d Remove support for NOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3320 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:00:52 +00:00
Chris Lattner
b804760b56 Remove support for unary operators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3318 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:53:45 +00:00
Chris Lattner
a9261ff5b7 Implement two constructor functions for "unary" instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3317 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:52:27 +00:00
Chris Lattner
589fda514c Remove support forNOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3316 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:52:06 +00:00
Chris Lattner
af2930efa0 - Fix InstCombine pass to not generate or process NOT instructions
- Fixed testcases to not use them either.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3315 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:51:49 +00:00
Chris Lattner
e4c3764a9f Remove support for NOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3313 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:45:39 +00:00
Chris Lattner
699f1eb214 AsmParser turns 'not' instructions into 'xor' instructions now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3309 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:12:33 +00:00
Chris Lattner
227b86c5fb Return null on failure, instead of aborting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3308 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:12:13 +00:00
Vikram S. Adve
e2a78e3186 Add method MachineInstr::substituteValue() which substitutes
one Value with another one in all operands and implicit references
of the machine instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3306 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 16:52:58 +00:00
Chris Lattner
65629d5a16 Minor change to make lli print out characters numerically as well as symbolically
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3303 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-13 20:45:11 +00:00
Vikram S. Adve
ca710e9cc5 Bug fix in TargetData::getIndexedOffset: We were using the pointer
type instead of the element type for the element size for arrays.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3302 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-13 18:17:56 +00:00
Vikram S. Adve
6c0c3010da Several bug fixes in casting to signed int values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3301 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-13 18:04:08 +00:00
Chris Lattner
572f4a01a5 - Rename ConstantGenericIntegral -> ConstantIntegral
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3300 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-13 17:50:24 +00:00
Chris Lattner
9fb96412ae - Rename ConstantGenericIntegral -> ConstantIntegral
- Add new methods to ConstantIntegral: getMaxValue, getMinValue,
   getAllOnesValue


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3299 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-13 17:50:20 +00:00
Vikram S. Adve
65a2deef8c Handle small unsigned results correctly by clearing high bits.
Bug fixes in casting to signed int values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3297 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-13 17:40:54 +00:00
Brian Ensink
7b0925f4d3 Build correctly in the face of /shared.
-Chris


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3296 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-12 22:09:44 +00:00
Chris Lattner
9568568b75 - Clean up interface to Sparc register handling a bit:
- Eliminate Sparc*Order classes, moving contents to Sparc*Class classes
   - get register name methods now return const char * const pointers instead
     of std::string's.
   - Added file header comments to SparcRegClassInfo.(cpp|h)
   - Moved BIG constant arrays out of SparcRegClassInfo.h, into
     SparcRegInfo.cpp.  This should allow a LOT of std::string constructors to
     not have to be called.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3295 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-12 21:25:05 +00:00
Chris Lattner
994b9f337b - Added a new superclass of ConstantBool/ConstantInt: ConstantGenericIntegral
- Moved InstCombine: isMaxValue, isMinValue, isAllOnesValue to Constants.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3293 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-12 21:21:21 +00:00
Chris Lattner
233f7dcde3 * Factor a bunch of code by using ReplaceInstUsesWith
* Move isMaxValue, isMinValue, isAllOnesValue to Constants.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3290 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-12 21:17:25 +00:00
Chris Lattner
bb6342b052 Remove some extraneous #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3289 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-12 20:24:46 +00:00
Chris Lattner
4228b5aac4 Changes to make GlobalValueRefMap not derive from std::map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3288 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-12 20:23:29 +00:00
Chris Lattner
8b170945ea New functionality for instcombine:
* New ReplaceInstUsesWith function to factor out tons of common code
     This needs to be used more in the future still, but it's a good start
   * New InsertNewInstBefore to allow multi-instruction replacements
   * Change getMaxValue functions to isAllOnesValue function, which doesn't
     have to CREATE/lookup a new constant.  Also the name is accurate
   * Add new isMaxValue, isMinValue, isMaxValueMinusOne, isMinValuePlusOne
     functions:  This should be moved to Constant* classes eventually
   * Implement xor X, ALLONES -> not X
   * Fold ALL setcc's of booleans away
   * Handle various SetCC's for integers against values at the end of their
     ranges, possibly off by one.  This implements the setcc-strength-reduce.ll
     testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3286 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 23:47:40 +00:00
Chris Lattner
389694834a *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3282 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 22:52:08 +00:00
Chris Lattner
dc1e020444 UnaryOperator::create should take a name just like BinaryOperator::create
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3279 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 21:39:38 +00:00
Chris Lattner
035dfbe7f2 * Removed extraneous #includes
* Fixed file headers to be consistent with the rest of LLVM
* Other minor fixes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3278 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 20:08:06 +00:00
Chris Lattner
179cdfb5c8 * Removed extraneous #includes
* Fixed file headers to be consistent with the rest of LLVM
* Other minor fixes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3277 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 20:08:03 +00:00
Chris Lattner
b91b31c12d We are using std::vector, so remove extraneous namespace prefixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3275 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 20:05:34 +00:00
Chris Lattner
919c4f8a44 Change machinecode for instruction to not inherit from vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3274 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 20:04:28 +00:00
Chris Lattner
b0cfa6dfec Very minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3271 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 18:55:18 +00:00
Chris Lattner
180e568a70 Initial checkin of the "Hello World" Pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3266 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-08 20:10:38 +00:00
Chris Lattner
5f0eb8da62 - Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's.
 - Pass::getAnalysis<> now no longer takes an optional argument


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3265 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-08 19:01:30 +00:00