Commit Graph

1880 Commits

Author SHA1 Message Date
Vikram S. Adve e56681c891 Change rules for Not, since it is now implemented as Xor(reg,11..1).
Eliminate bool, boolreg and boolconst nonterminals, and just use
reg and Constant instead.

llvm-svn: 3440
2002-08-22 02:55:21 +00:00
Chris Lattner 675e7a9e3d - Fighting with linking problem due to removing the ::ID elements. Now the
implementation .cpp files for analyses are not being included into gccas
    and friends because it is linking to the .a file and there is no explicit
    symbol reference to bring in the .o file.  The new IncludeFile hack is the
    result.

llvm-svn: 3436
2002-08-21 23:51:51 +00:00
Chris Lattner 319c47adec - Fix asmparser and bytecode reader to not generate loads/stores with idxs
Now an obnoxious warning is emitted to discourage usage.  Eventually
    support will be removed.

llvm-svn: 3435
2002-08-21 23:51:21 +00:00
Chris Lattner c86203ace3 - Split Dominators.h into Dominators.h & PostDominators.h
llvm-svn: 3432
2002-08-21 23:43:50 +00:00
Chris Lattner dc23308820 Emit an obnoxious warning message for bytecode that includes load/store
instructions that use indexing.  Convert them transparently into a pair
of instructions.

llvm-svn: 3431
2002-08-21 22:55:27 +00:00
Chris Lattner 10d7b85d5e Remove debugging code accidentally checked in.
llvm-svn: 3430
2002-08-21 22:49:31 +00:00
Chris Lattner 6e041bdb12 - Implement the new AnalysisGroup feature, neccesary for Value#ing and pointer analysis
llvm-svn: 3426
2002-08-21 22:17:09 +00:00
Chris Lattner e49f299041 Do not generate loads/stores with indexing
llvm-svn: 3422
2002-08-21 22:11:33 +00:00
Chris Lattner 829ecb6dcd Remove extraneous #includes
llvm-svn: 3421
2002-08-21 22:11:14 +00:00
Chris Lattner 67a806ed90 Do not create load/stores with indexes
llvm-svn: 3420
2002-08-21 22:10:52 +00:00
Chris Lattner 6f66bc8016 Remove an optimization that isn't.
llvm-svn: 3419
2002-08-21 22:10:06 +00:00
Chris Lattner 1a386b6a73 - Do not expose ::ID from any of the analyses anymore.
llvm-svn: 3417
2002-08-21 17:09:49 +00:00
Chris Lattner c869ecbe42 - Do not expose ::ID from any of the analyses anymore.
llvm-svn: 3416
2002-08-21 17:09:45 +00:00
Chris Lattner 1230f23da8 - Do not expose ::ID from any of the analyses anymore.
llvm-svn: 3415
2002-08-21 17:09:15 +00:00
Chris Lattner 4b16963ca2 - Eliminate the need for analyses to expose an ::ID member.
llvm-svn: 3414
2002-08-21 17:08:37 +00:00
Chris Lattner 325398c6a4 fixed bug: test/Regression/Linker/2002-08-20-ConstantExpr.ll
llvm-svn: 3412
2002-08-20 19:35:11 +00:00
Chris Lattner e821d78432 Sort -time-passes report first by user+system, then by Wall clock time.
llvm-svn: 3407
2002-08-20 18:47:53 +00:00
Chris Lattner b8d6e40ed7 - instcombine (~(a < b)) into (a >= b)
llvm-svn: 3406
2002-08-20 18:24:26 +00:00
Chris Lattner dcf53552ce Add new SetCondInst::getInverseCondition() method.
llvm-svn: 3405
2002-08-20 18:17:12 +00:00
Chris Lattner 74469f858f This case JUST handles constantpointer nulls, not all pointers.
llvm-svn: 3402
2002-08-20 17:02:48 +00:00
Chris Lattner 7934dad0a0 Fix bug: 2002-08-20-UnnamedArgument.c
llvm-svn: 3401
2002-08-20 16:55:48 +00:00
Chris Lattner 9cd1e66155 - implemented instcombine of phi (X, X, X) -> X
llvm-svn: 3397
2002-08-20 15:35:35 +00:00
Chris Lattner f3a86f0b57 Implement ConstantExprs in CWriter
llvm-svn: 3394
2002-08-19 23:09:46 +00:00
Chris Lattner 9ccab2c89b Incorporate calcTypeNameVar into CWriter class, fixing
test/Regression/CBackend/2002-08-19-FunctionPointer.c in the process

llvm-svn: 3392
2002-08-19 22:17:53 +00:00
Chris Lattner b5815279c6 Output forward definitions of global vars to handle recursive intializers correctly.
llvm-svn: 3391
2002-08-19 21:48:40 +00:00
Chris Lattner fda3b293d8 - Change constant printing to be better integrated with the rest of the
CWriter class.  Write directly to stream instead of building a big
      string, then writing it out.
    - Implement printing of ConstantPointerRefs

llvm-svn: 3389
2002-08-19 21:32:41 +00:00
Chris Lattner ca5afe74ab Add missing space
llvm-svn: 3387
2002-08-19 20:42:12 +00:00
Chris Lattner 243b5751a0 Fix bug: test/Regression/Assembler/2002-08-19-BytecodeReader.llx
llvm-svn: 3384
2002-08-19 16:48:21 +00:00
Chris Lattner 5ec216b5fe Fix the -time-passes option to not print NaN when there is zero execution time
llvm-svn: 3382
2002-08-19 15:43:33 +00:00
Chris Lattner 8f3acc6fde - Made GlobalDCE worklist driven, making it more successful. Now can handle
cases like: test/Regression/Transforms/GlobalDCE/2002-08-17-WorkListTest.ll

llvm-svn: 3381
2002-08-18 01:28:30 +00:00
Chris Lattner 0c6e0b9042 - ConstantPointerRefs are now automatically removed from the module table
when they are destroyed, which makes Constant::destroyConstant an actually
    useful external interface.  Expose these methods publicly.
  - Implement destroyConstant on ConstPointerNull so that destroyConstant can
    be used on any derived type constant safely.

llvm-svn: 3379
2002-08-18 00:40:04 +00:00
Chris Lattner 6a33371529 Turn off a debugging optimization that just slows bytecode reading down
llvm-svn: 3377
2002-08-18 00:38:32 +00:00
Chris Lattner e0f6af9bb2 Add Module::dump() method
llvm-svn: 3375
2002-08-17 23:32:47 +00:00
Chris Lattner c59af1d257 Promote getelementptr instructions to constexprs if we can.
llvm-svn: 3368
2002-08-17 22:21:59 +00:00
Chris Lattner c8d952ebba Fix stupid oversight of missing #include.
llvm-svn: 3367
2002-08-17 22:02:41 +00:00
Chris Lattner 51fa0ef925 - Finally nailed: test/Regression/Assembler/2002-08-16-ConstExprInlined.llx
- ParseConstantPool was resolving reference to value using the function
      slot # instead of the global slot #.
  - Bytecode reader changes:
    - Remove the failure<> template from Bytecode Reader
    - Remove extraneous #includes
    - s/method/function/ a bit
    - Eliminate the fwdRefs class that just added abstraction where it was not
      needed, making things more complex.
    - Use a vector instead of a list for function signatures.

llvm-svn: 3366
2002-08-17 22:01:27 +00:00
Chris Lattner cfe8f53a4b Changed parser to always use parenthesis on ConstExprs to be consistent
llvm-svn: 3363
2002-08-16 21:17:11 +00:00
Chris Lattner 7f325cd0bc - 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

llvm-svn: 3362
2002-08-16 21:14:40 +00:00
Chris Lattner 83b396b830 Write constexpr casts using the cast X to Y notation, not using the implicit
type result

llvm-svn: 3354
2002-08-15 19:37:43 +00:00
Chris Lattner d8ecff793a Parse const expr cast instruction the same way the instruction is formed
llvm-svn: 3353
2002-08-15 19:37:11 +00:00
Chris Lattner 7f1c98d060 Move ConstExpr production to unify ConstVal stuff
llvm-svn: 3351
2002-08-15 18:17:28 +00:00
Chris Lattner 61643a01c3 Fix bug: test/Regression/Assembler/2002-08-15-UnresolvedGlobalReference.ll
llvm-svn: 3350
2002-08-15 17:58:33 +00:00
Chris Lattner 7f8e677715 Simplify the code
llvm-svn: 3348
2002-08-15 16:15:36 +00:00
Chris Lattner 3732acab85 Handle more cases of cast-of-cast in more general forms.
llvm-svn: 3347
2002-08-15 16:15:25 +00:00
Vikram S. Adve 3db97eb499 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.

llvm-svn: 3343
2002-08-15 14:19:22 +00:00
Vikram S. Adve caed269085 Revise code generation for unary Not (boolean and bitwise), which is
no longer a separate instruction but is instead implemented with XOR.

llvm-svn: 3342
2002-08-15 14:17:37 +00:00
Vikram S. Adve 243f187791 Added more helper functions for binary instructions emulating
unary Neg and Not: isNeg, isNot, getNegArgument, and getNotArgument.

llvm-svn: 3341
2002-08-15 14:15:48 +00:00
Chris Lattner 0bb75910e2 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.

llvm-svn: 3339
2002-08-14 23:21:10 +00:00
Chris Lattner 768c2b6bfe 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.

llvm-svn: 3337
2002-08-14 22:11:52 +00:00
Chris Lattner 313fd77767 Avoid inserting an entry block unless we need it
llvm-svn: 3336
2002-08-14 21:35:02 +00:00
Chris Lattner 330b7ac76c 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.

llvm-svn: 3328
2002-08-14 18:24:09 +00:00
Chris Lattner b80b69cc3e Fix bug introduced in last checkin due to CastInst not being visible
llvm-svn: 3327
2002-08-14 18:22:19 +00:00
Chris Lattner 8fd96fcdaf Remove support for unary operators.
llvm-svn: 3326
2002-08-14 18:19:46 +00:00
Chris Lattner b193ff8f70 Remove support for NOT instruction
llvm-svn: 3323
2002-08-14 18:18:02 +00:00
Chris Lattner 0f4093938a Remove extra #includes
llvm-svn: 3322
2002-08-14 18:17:32 +00:00
Chris Lattner 7a74051566 Remove support for NOT instruction
llvm-svn: 3320
2002-08-14 18:00:52 +00:00
Chris Lattner 6e1a1b1289 Remove support for unary operators
llvm-svn: 3318
2002-08-14 17:53:45 +00:00
Chris Lattner 3733c7374e Implement two constructor functions for "unary" instructions
llvm-svn: 3317
2002-08-14 17:52:27 +00:00
Chris Lattner 4ec79c3e6f Remove support forNOT instruction
llvm-svn: 3316
2002-08-14 17:52:06 +00:00
Chris Lattner 31ae863284 - Fix InstCombine pass to not generate or process NOT instructions
- Fixed testcases to not use them either.

llvm-svn: 3315
2002-08-14 17:51:49 +00:00
Chris Lattner b3c2af69fe Remove support for NOT instruction
llvm-svn: 3313
2002-08-14 17:45:39 +00:00
Chris Lattner db3b202be8 AsmParser turns 'not' instructions into 'xor' instructions now.
llvm-svn: 3309
2002-08-14 17:12:33 +00:00
Chris Lattner 31408f7a80 Return null on failure, instead of aborting.
llvm-svn: 3308
2002-08-14 17:12:13 +00:00
Vikram S. Adve fa99db77a8 Add method MachineInstr::substituteValue() which substitutes
one Value with another one in all operands and implicit references
of the machine instruction.

llvm-svn: 3306
2002-08-14 16:52:58 +00:00
Chris Lattner 42f596feda Minor change to make lli print out characters numerically as well as symbolically
llvm-svn: 3303
2002-08-13 20:45:11 +00:00
Vikram S. Adve a3efa260ea Bug fix in TargetData::getIndexedOffset: We were using the pointer
type instead of the element type for the element size for arrays.

llvm-svn: 3302
2002-08-13 18:17:56 +00:00
Vikram S. Adve 4f729affe6 Several bug fixes in casting to signed int values.
llvm-svn: 3301
2002-08-13 18:04:08 +00:00
Chris Lattner 8328263606 - Rename ConstantGenericIntegral -> ConstantIntegral
llvm-svn: 3300
2002-08-13 17:50:24 +00:00
Chris Lattner b1585a90d9 - Rename ConstantGenericIntegral -> ConstantIntegral
- Add new methods to ConstantIntegral: getMaxValue, getMinValue,
   getAllOnesValue

llvm-svn: 3299
2002-08-13 17:50:20 +00:00
Vikram S. Adve 3a5a29faf4 Handle small unsigned results correctly by clearing high bits.
Bug fixes in casting to signed int values.

llvm-svn: 3297
2002-08-13 17:40:54 +00:00
Brian Ensink 9c9e548596 Build correctly in the face of /shared.
-Chris

llvm-svn: 3296
2002-08-12 22:09:44 +00:00
Chris Lattner 56e9166b84 - 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.

llvm-svn: 3295
2002-08-12 21:25:05 +00:00
Chris Lattner 41e99a07f1 - Added a new superclass of ConstantBool/ConstantInt: ConstantGenericIntegral
- Moved InstCombine: isMaxValue, isMinValue, isAllOnesValue to Constants.h

llvm-svn: 3293
2002-08-12 21:21:21 +00:00
Chris Lattner e6794490ec * Factor a bunch of code by using ReplaceInstUsesWith
* Move isMaxValue, isMinValue, isAllOnesValue to Constants.h

llvm-svn: 3290
2002-08-12 21:17:25 +00:00
Chris Lattner 68fe621771 Remove some extraneous #includes
llvm-svn: 3289
2002-08-12 20:24:46 +00:00
Chris Lattner 7d9a14d5d9 Changes to make GlobalValueRefMap not derive from std::map.
llvm-svn: 3288
2002-08-12 20:23:29 +00:00
Chris Lattner 6d14f2a7ae 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.

llvm-svn: 3286
2002-08-09 23:47:40 +00:00
Chris Lattner 0d92ff0488 *** empty log message ***
llvm-svn: 3282
2002-08-09 22:52:08 +00:00
Chris Lattner a09b01b2c1 UnaryOperator::create should take a name just like BinaryOperator::create
llvm-svn: 3279
2002-08-09 21:39:38 +00:00
Chris Lattner 959a5fbf8e * Removed extraneous #includes
* Fixed file headers to be consistent with the rest of LLVM
* Other minor fixes

llvm-svn: 3278
2002-08-09 20:08:06 +00:00
Chris Lattner 02e7a86fec * Removed extraneous #includes
* Fixed file headers to be consistent with the rest of LLVM
* Other minor fixes

llvm-svn: 3277
2002-08-09 20:08:03 +00:00
Chris Lattner 3c3457ccea We are using std::vector, so remove extraneous namespace prefixes
llvm-svn: 3275
2002-08-09 20:05:34 +00:00
Chris Lattner e08000ac9f Very minor cleanups
llvm-svn: 3271
2002-08-09 18:55:18 +00:00
Chris Lattner ed7ac42c6a Initial checkin of the "Hello World" Pass.
llvm-svn: 3266
2002-08-08 20:10:38 +00:00
Chris Lattner f0ed55d1ee - Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's.
 - Pass::getAnalysis<> now no longer takes an optional argument

llvm-svn: 3265
2002-08-08 19:01:30 +00:00
Chris Lattner 40eb9dafed - Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's.
 - Pass::getAnalysis<> now no longer takes an optional argument

llvm-svn: 3264
2002-08-08 19:01:28 +00:00
Chris Lattner 650449a1df Remove extraneous #includes
llvm-svn: 3262
2002-08-08 19:00:34 +00:00
Chris Lattner b3ce9fc449 Minor changes to DEBUG()'s
llvm-svn: 3261
2002-08-07 21:41:11 +00:00
Chris Lattner 3147fd226a Reorder #includes to be right
llvm-svn: 3260
2002-08-07 21:41:03 +00:00
Chris Lattner c93df6bf22 Merge three loops into one.
llvm-svn: 3259
2002-08-07 21:39:48 +00:00
Chris Lattner e64e62eff9 Fix breakage in the build
llvm-svn: 3258
2002-08-07 21:39:39 +00:00
Chris Lattner b4101b1373 Simplify writing custom parsers.
llvm-svn: 3256
2002-08-07 18:36:37 +00:00
Mehwish Nagda 428a0ba612 added Mapping and Function Pass
llvm-svn: 3251
2002-08-05 23:23:19 +00:00
Vikram S. Adve 482ab44175 Bug fix in CreateCodeToLoadConst(): use sign of dest, not operand,
in choosing how to create int-set instructions.

llvm-svn: 3248
2002-08-04 20:55:37 +00:00
Vikram S. Adve 71895b28cc Bug fix in TargetData::getIndexedOffset(): handle struct offset
after array offset correctly.  The type was not being updated for
array offsets!

llvm-svn: 3246
2002-08-04 20:52:39 +00:00
Vikram S. Adve b4a9685872 Bug fix in SetOperandsForMemInstr: handle leading zeros correctly
when folding or not folding GEPs.

llvm-svn: 3245
2002-08-04 20:51:05 +00:00
Vikram S. Adve 1a1c3ed56d Add function GetConstantValueAsUnsignedInt.
Fix 2 bugs in FoldGetElemChain so index vector is not modified
when no GEPs are folded in, and so a hasLeadingZero is computed
only for the last folded GEP, not the one after that if any.

llvm-svn: 3244
2002-08-04 20:49:49 +00:00
Chris Lattner b430c3f395 Fix compilation problem. IsIndexZero doesn't exist, use IsZero instead.
llvm-svn: 3243
2002-08-03 20:57:38 +00:00
Vikram S. Adve 1944064801 Simplified handling of array indexes in SetMemOperands_Internal.
llvm-svn: 3236
2002-08-03 13:48:21 +00:00
Vikram S. Adve 4737dd7268 Eliminate cast instructions: use only GEPs in decomposed sequence.
Don't decompose if there are 2 indices with 0 as first index.
Compute Changed flag correctly in runOnBasicBlock().

llvm-svn: 3233
2002-08-03 13:21:15 +00:00