Commit Graph

302 Commits

Author SHA1 Message Date
Vikram S. Adve 6d6deba9f9 Bug fix: incorrect SAVE instruction when using register for stack size.
llvm-svn: 3198
2002-08-01 14:26:11 +00:00
Vikram S. Adve c19b1cc168 Just improved comments and assertions.
llvm-svn: 3191
2002-07-31 21:13:31 +00:00
Vikram S. Adve defe6ec939 Add a missing case: converting float/double to unsigned integer types.
llvm-svn: 3188
2002-07-31 21:01:34 +00:00
Chris Lattner 31d05fdd0a * Move InstructionSelection pass to lib/CodeGen/InstrSelection so it is
shared by backends.

llvm-svn: 3146
2002-07-30 03:56:16 +00:00
Mehwish Nagda 26c7e5839e changed implementation of LLVM BYTECODE Length
llvm-svn: 3089
2002-07-25 17:22:48 +00:00
Chris Lattner 3091e11726 GCC 3.1 changes, finally the burm file builds the FIRST time a clean directory is built.
llvm-svn: 3073
2002-07-25 06:08:32 +00:00
Chris Lattner e98dd5fcac *** empty log message ***
llvm-svn: 3056
2002-07-24 21:21:32 +00:00
Mehwish Nagda f6f772b1af moved from CodeGen to this dir
llvm-svn: 2992
2002-07-22 22:09:35 +00:00
Anand Shukla 889faf8bc9 Adding code for outputing length in .s
llvm-svn: 2979
2002-07-21 09:35:01 +00:00
Chris Lattner 3e751859ec * Make global variables with external linkage get emitted correctly
* Do NOT add a prefix to global variables that are external
* Add newline after emitting a constpointerref

llvm-svn: 2925
2002-07-16 18:35:16 +00:00
Mehwish Nagda 382f286ae7 Added the Mapping Pass to out put Mapping Info to .s file
llvm-svn: 2913
2002-07-15 23:58:21 +00:00
Anand Shukla cf764680ad added std:: to vector
llvm-svn: 2874
2002-07-11 00:16:28 +00:00
Vikram S. Adve c5f8b52bd0 Changed interface to insertCallerSavingCode().
llvm-svn: 2859
2002-07-10 21:42:42 +00:00
Vikram S. Adve e997a11251 Stop using pseudo-instructions (SETX, SETUW, SETSW)
and generate actual machine instruction sequences directly.

llvm-svn: 2858
2002-07-10 21:42:13 +00:00
Vikram S. Adve 4e1ee14694 Add support to print %hh, %hm, %lm, or %lo in an operand field.
llvm-svn: 2857
2002-07-10 21:41:21 +00:00
Vikram S. Adve 58c904ace6 Major overhaul to stop using pseudo-instructions (SETX, SETUW, SETSW)
and generate actual machine instruction sequences directly.

Also a couple of bug fixes in code for putting constants into registers:
-- Do *not* sign-extend unsigned constant that is shorter than int reg size
-- Fix handling of address constant (a GlobalValue) vs. constant that
   must be loaded.

llvm-svn: 2856
2002-07-10 21:39:50 +00:00
Vikram S. Adve 4aee77c70b More important fixes:
-- FP argument to a function with no prototype going on stack
   was not being copied to the stack in colorCallArgs().
-- Put caller-saving code *before* argument copying code so that
   we don't trash a register before saving it!
-- Two other minor fixes.

llvm-svn: 2855
2002-07-10 21:36:00 +00:00
Anand Shukla 7e882db2f4 Added std:: to mem_fun for 64-bit gcc
llvm-svn: 2845
2002-07-09 19:16:59 +00:00
Vikram S. Adve a3697666eb Added support for printing constant global references to
assembly.

llvm-svn: 2842
2002-07-09 12:30:29 +00:00
Vikram S. Adve 5eb69429aa Numerous changes in interface to class SparcRegInfo corresponding to
changes in class MachineRegInfo (see MachineRegInfo.h for details).

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

llvm-svn: 2839
2002-07-08 23:34:10 +00:00
Vikram S. Adve 1ce4096033 class MachineCodeForBasicBlock is now an annotation on BasicBlock.
llvm-svn: 2838
2002-07-08 23:31:24 +00:00
Vikram S. Adve 3bb830d337 BA no longer has the unused CC operand.
llvm-svn: 2837
2002-07-08 23:30:59 +00:00
Vikram S. Adve 82190d3e73 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.

llvm-svn: 2836
2002-07-08 23:30:14 +00:00
Vikram S. Adve c564520c5c BA has only one argument.
Added LDFSR, LDXFSR, STFSR and STXFSR.
Fixed operands info for RDCCR, WRCCR.

llvm-svn: 2835
2002-07-08 23:25:17 +00:00
Vikram S. Adve aee6701e63 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.

llvm-svn: 2834
2002-07-08 23:23:12 +00:00
Chris Lattner c28c7b9ccf Remove diff-cluttering tags
llvm-svn: 2808
2002-06-30 16:12:03 +00:00
Anand Shukla 458496c060 changes to make it compatible with 64bit gcc
llvm-svn: 2791
2002-06-25 20:55:50 +00:00
Chris Lattner 7076ff29ed MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt

llvm-svn: 2778
2002-06-25 16:13:21 +00:00
Chris Lattner 2152e03bfd Fix constness
llvm-svn: 2762
2002-06-05 18:11:37 +00:00
Chris Lattner c0b158b94d Fix Constness problems
llvm-svn: 2761
2002-06-05 18:08:26 +00:00
Chris Lattner 070cf77a40 Disable debugging output
llvm-svn: 2756
2002-06-04 03:09:57 +00:00
Chris Lattner abe98198a8 Convert RegClass::IsColorUsedArr from a dynamically allocated array to
a vector.  This makes asserting on array bounds easier.

llvm-svn: 2731
2002-05-23 15:50:03 +00:00
Mehwish Nagda 4dbcec4295 Fixed the makefile to not die when compiling a new, empty, source directory
llvm-svn: 2688
2002-05-21 15:58:24 +00:00
Chris Lattner 7f99b6f58c Rename IsPowerOf2 to isPowerOf2
llvm-svn: 2663
2002-05-19 21:20:19 +00:00
Vikram S. Adve e9327f0082 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

llvm-svn: 2640
2002-05-19 15:25:51 +00:00
Chris Lattner 181cc32365 Replace all usages of Type::isPointerType with isa<PointerType>
llvm-svn: 2486
2002-05-06 16:15:30 +00:00
Chris Lattner d5a847057b Eliminate duplicate or unneccesary #include's
llvm-svn: 2397
2002-04-29 17:42:12 +00:00
Chris Lattner 37104aace8 Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.

llvm-svn: 2395
2002-04-29 14:57:45 +00:00
Chris Lattner f12cc842b3 Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
llvm-svn: 2386
2002-04-28 21:27:06 +00:00
Chris Lattner 63c52f3805 Add #include that was removed from TargetMachine.h
llvm-svn: 2381
2002-04-28 20:40:59 +00:00
Chris Lattner ca14237696 Split ConstantVals.h into Constant.h and Constants.h
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner 776bfa20a9 Simplify code
Remove unneccesary getID variant for module's

llvm-svn: 2353
2002-04-28 04:50:54 +00:00
Chris Lattner f998685cd9 s/Method/Function
llvm-svn: 2336
2002-04-27 07:27:19 +00:00
Chris Lattner c8e665431b * 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

llvm-svn: 2333
2002-04-27 06:56:12 +00:00
Chris Lattner e6dd75604e Use the cast<> operator in favor of C style casts
llvm-svn: 2331
2002-04-27 03:14:39 +00:00
Chris Lattner 2716b5e524 Change Constant::getNullConstant to Constant::getNullValue
llvm-svn: 2323
2002-04-27 02:25:14 +00:00
Chris Lattner 93ddab25e8 Simplify code a bit
llvm-svn: 2322
2002-04-27 02:24:17 +00:00
Vikram S. Adve 776df77d14 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.

llvm-svn: 2317
2002-04-25 04:43:45 +00:00
Vikram S. Adve a6d94c9a76 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.

llvm-svn: 2316
2002-04-25 04:42:21 +00:00
Vikram S. Adve a77a8eee50 Added functions to compute which register, if any, to use
for a particular argument in a list of arguments.

llvm-svn: 2315
2002-04-25 04:40:24 +00:00
Vikram S. Adve dccabec1ea 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.

llvm-svn: 2314
2002-04-25 04:37:51 +00:00
Chris Lattner c3728c281b * getAsString requires that the input array is string compatible, so
assert it.
* Use WriteAsOperand instead of getStringValue for constants

llvm-svn: 2296
2002-04-18 18:15:38 +00:00
Chris Lattner a8e24c494e Only print debug message if DEBUG_RA is on
llvm-svn: 2254
2002-04-15 22:41:48 +00:00
Chris Lattner 0b32d0d511 Handle the FP format problem, where outputed FP constants were not precise
enough.  This fixes compilation of the health benchmark.

llvm-svn: 2228
2002-04-11 21:44:02 +00:00
Chris Lattner 98d0ac0f8e Eliminate unneccesary extraneous iterators
llvm-svn: 2215
2002-04-09 19:46:27 +00:00
Chris Lattner 06be180225 Add explicit #includes of Function.h to make up for the removed #include
in iOther.h

llvm-svn: 2209
2002-04-09 19:08:28 +00:00
Chris Lattner 6b17c83fb0 iUse new form of pop_back to make code more concise
llvm-svn: 2202
2002-04-09 18:02:02 +00:00
Chris Lattner c71deb8412 Delete NOP instructions as they are eliminated.
llvm-svn: 2199
2002-04-09 15:05:04 +00:00
Chris Lattner 929d4a8bb5 * Add a useful file comment
* Move InsertPrologEpilogCode class to PrologEpilogCodeInserter.cpp
   -> Among other things, this eliminates the need for the minstrVec static
      global array.

llvm-svn: 2195
2002-04-09 05:21:26 +00:00
Chris Lattner f8a9bfbc03 Move the InsertPrologEpilogCode class out of the Sparc.cpp file into the
new PrologEpilogCodeInserter.cpp file, and include the bodies of the
GetInstructionsFor(Prolog|Epilog) functions from SparcInstrSelection.cpp
into the class.  This eliminates the need for a static global vector of
instructions and a class of errors that is really unneccesary.

llvm-svn: 2194
2002-04-09 05:20:15 +00:00
Chris Lattner 5074bb529e Move the InsertPrologEpilogCode class out of the Sparc.cpp file, and include
the bodies of the GetInstructionsFor(Prolog|Epilog) functions from
SparcInstrSelection.cpp into the class.  This eliminates the need for a static
global vector of instructions and a class of errors that is really unneccesary.

llvm-svn: 2193
2002-04-09 05:18:31 +00:00
Chris Lattner 35b90c22e9 Include prototype for interface to PrologEpilogCodeInserter.cpp file
llvm-svn: 2192
2002-04-09 05:16:36 +00:00
Chris Lattner 46f8b0e759 Use new higher level isFloatingPoint() function
llvm-svn: 2191
2002-04-09 05:16:08 +00:00
Chris Lattner 30e23dacbc Convert AddedInstrMapType to contain AddedInstrns by value instead of by
pointer so that they do not all get leaked!

llvm-svn: 2188
2002-04-09 05:13:04 +00:00
Chris Lattner f739fa8541 s/Method/Function
llvm-svn: 2180
2002-04-08 22:03:57 +00:00
Chris Lattner 6915f8fc3c * Move include/llvm/Analysis/SlotCalculator.h to include/llvm/SlotCalculator.h
because the slot calculator is already part of the VMCore library.
* Rename incorporateMethod and purgeMethod to *Function

llvm-svn: 2154
2002-04-07 22:49:37 +00:00
Chris Lattner 62b7fd136e Change references to the Method class to be references to the Function
class.  The Method class is obsolete (renamed) and all references to it
are being converted over to Function.

llvm-svn: 2144
2002-04-07 20:49:59 +00:00
Chris Lattner e2f2f54f0c s/MethodType/FunctionType
llvm-svn: 2115
2002-04-04 22:19:18 +00:00
Vikram S. Adve 313ca14124 Case numbers were not updated when Sparc.burg.in was changed
to add separate label for bitwise NOT operator.

llvm-svn: 2091
2002-04-01 20:28:48 +00:00
Vikram S. Adve 4973f73ad1 1. Fix a leftover bug in generating memory instructions.
2. Fix type used for TmpInstruction holding the return address.

llvm-svn: 2075
2002-03-31 19:07:35 +00:00
Vikram S. Adve 02662bd390 Added function getCallInstIndirectAddrVal() to set call interference
for that value.

llvm-svn: 2074
2002-03-31 19:04:50 +00:00
Vikram S. Adve 07c874547b Minor cleanup in printing constants. I think this included a bug
fix related to putting a read-write variable in a read-only section,
but I'm not sure now.

llvm-svn: 2073
2002-03-31 19:03:58 +00:00
Vikram S. Adve bd4e68c280 Fix CreateUIntSetInstruction() to handle sign extensions correctly.
llvm-svn: 2059
2002-03-31 00:13:12 +00:00
Chris Lattner ff87436f48 s/Method/Function
llvm-svn: 2035
2002-03-29 03:51:11 +00:00
Chris Lattner 5d088b00bf Convert to use new style casts instead of direct checking
llvm-svn: 1990
2002-03-26 17:58:12 +00:00
Vikram S. Adve 75ee890af0 Bug re-fix: put back MachineCodeForInstruction::get(*I).dropAllReferences().
Also re-enable instr. scheduling pass.

llvm-svn: 1966
2002-03-24 03:35:16 +00:00
Vikram S. Adve be08b5ea15 Change latencies for Load, Store and Branch instructions.
llvm-svn: 1965
2002-03-24 03:33:53 +00:00
Vikram S. Adve 72213c9a66 Major enhancements to how array and structure indices are handled.
Improve checking for constants in Multiply.
Simpler method to keep track of when a node is folded into its parent.
Several other bug fixes.

llvm-svn: 1964
2002-03-24 03:33:02 +00:00
Vikram S. Adve 493b8241e0 Add support for code generation for array references.
Also, use distinct names for the three types of SetMachineOperand to
avoid painful overloading problems and errors.
Bug fix in converting-int-to-float.  Other minor stuff.

llvm-svn: 1896
2002-03-18 03:15:35 +00:00
Vikram S. Adve db1435f410 Bug fixes for not using unified reg. numbers, and for using the
wrong register class for saving CC registers.
Also, use distinct names for the three types of SetMachineOperand.

llvm-svn: 1895
2002-03-18 03:12:16 +00:00
Vikram S. Adve f9ab087be7 Use distinct names for the three types of SetMachineOperand to
avoid painful overloading problems and errors.

llvm-svn: 1893
2002-03-18 03:09:15 +00:00
Vikram S. Adve 55ee12bb25 Minor fixes.
llvm-svn: 1892
2002-03-18 03:08:07 +00:00
Vikram S. Adve 270f56a085 Handling of global names was severely broken when converting to 2 passes.
Different labels were generated for the same name in different passes.
Use an annotation to hold a fixed table of names.

llvm-svn: 1891
2002-03-18 03:07:26 +00:00
Vikram S. Adve 0513e01bee Several sundry bug fixes.
llvm-svn: 1890
2002-03-18 03:02:42 +00:00
Vikram S. Adve 15148e7e8c Fix include error.
llvm-svn: 1819
2002-03-03 20:46:32 +00:00
Chris Lattner 5536c9c938 Clean up std namespace issues
Silence warning

llvm-svn: 1790
2002-02-24 23:02:40 +00:00
Chris Lattner 83d485b310 * Pull BasicBlock::pred_* and BasicBlock::succ_* out of BasicBlock.h and into
llvm/Support/CFG.h
* Make pred & succ iterators for intervals global functions
* Add #includes that are now neccesary because BasicBlock.h doesn't include
  InstrTypes.h anymore

llvm-svn: 1750
2002-02-12 22:39:50 +00:00
Chris Lattner 60a6591d83 Method.h no longer includes BasicBlock.h
Method::inst_* is now in llvm/Support/InstIterator.h
GraphTraits specializations for BasicBlock and Methods are now in llvm/Support/CFG.h

llvm-svn: 1746
2002-02-12 21:07:25 +00:00
Chris Lattner 774cbceb0b Write llvm bytecode to output .s file as last step of LLC.
llvm-svn: 1728
2002-02-11 22:35:46 +00:00
Chris Lattner 74ed5cf1e6 Fix build error
llvm-svn: 1722
2002-02-11 17:11:43 +00:00
Chris Lattner ea13e0afa0 Convert operand iterator over to work like an STL iterator
llvm-svn: 1720
2002-02-05 06:02:59 +00:00
Chris Lattner 7e5ee4253c Minor change: Methods that return ValueSet's that are guaranteed to be valid
return references instead of pointers.

llvm-svn: 1719
2002-02-05 04:20:12 +00:00
Chris Lattner d30f989cda * Code Cleanups
* Removal dependencies on Type.h & remove uses of getTypeID()

llvm-svn: 1718
2002-02-05 03:52:29 +00:00
Chris Lattner b0af9cdbda * Eliminate the LiveVarSet class, making applyTranferFuncForMInst a static
function in the one .cpp file that uses it.  Use ValueSet's instead.
* Prepare to delete LiveVarSet.h & LiveVarSet.cpp
* Eliminate the ValueSet class, making all old member functions into global
  templates that will eventually be moved to Support.
* Eliminate some irrelevant const's

llvm-svn: 1712
2002-02-05 02:52:05 +00:00
Chris Lattner 30e8fb69c5 * Code Cleanups
* Introduce RAV to allow stream I/O instead of using printValue

llvm-svn: 1710
2002-02-05 01:43:49 +00:00
Chris Lattner 1cb37628d9 The interface to instruction scheduling is now just a call to get the pass.
llvm-svn: 1702
2002-02-04 20:03:43 +00:00
Chris Lattner e6b511dc0a * ValueSet interface converted from add/remove to insert/erase
llvm-svn: 1690
2002-02-04 16:37:09 +00:00
Chris Lattner f48173a875 Convert RegisterAllocator interface to opaque pass type, so that users do not
need to know _anything_ about RegAlloc to use it.  Well in the end maybe.

llvm-svn: 1681
2002-02-04 15:54:09 +00:00
Chris Lattner 13b2227ccc EmitAssembly doesn't need an UltraSparc, it can do with any TargetMachine
llvm-svn: 1680
2002-02-04 15:53:23 +00:00
Chris Lattner 5216cc55f7 * Minor cleanups
* Reduce number of #includes
* Remove blatently misleading qualifiers (how do you have an inlined pure virtual function?)
* Remove unnecesary & ignored qualifiers (const int argument vs int argument)
* SparcInternals.h now no longer #includes RegClass.h or SparcRegClassInfo.h
* Pull inlined functions out of .h file if they are virtual and interfere with dependencies

llvm-svn: 1677
2002-02-04 05:59:25 +00:00