1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
Commit Graph

786 Commits

Author SHA1 Message Date
Guochun Shi
21f3083978 so far everything compiles
llvm-svn: 6423
2003-05-30 00:17:09 +00:00
Misha Brukman
51eb037b1e Correctly write out binary data as chars, before they're cast to ints.
llvm-svn: 6385
2003-05-28 18:27:19 +00:00
Misha Brukman
4960b8db94 Added a debugging code emitter that prints code to a file, debug to std::cerr,
and passes the real code to a memory-outputting code emitter. This may be
removed at a later point in development.

llvm-svn: 6379
2003-05-27 22:43:19 +00:00
Vikram S. Adve
681b3c77fa (1) Added special register class containing (for now) %fsr.
Fixed spilling of %fcc[0-3] which are part of %fsr.

(2) Moved some machine-independent reg-class code to class TargetRegInfo
    from SparcReg{Class,}Info.

(3) Renamed MachienOperand::opIsDef to MachineOperand::opIsDefOnly()
    and related functions and flags.  Fixed several bugs where only
    "isDef" was being checked, not "isDefAndUse".

llvm-svn: 6341
2003-05-27 00:05:23 +00:00
Misha Brukman
daf2cc3c48 Cleaned up code layout. No functional changes.
llvm-svn: 6304
2003-05-22 21:49:18 +00:00
Misha Brukman
7d91017b21 Kill `using' directives.
llvm-svn: 6301
2003-05-22 21:24:35 +00:00
Chris Lattner
a4fe60d3c1 Use a kill, not a dead definition, update comment
llvm-svn: 6131
2003-05-12 17:37:30 +00:00
Chris Lattner
e78921f048 * Keep LiveVariable information more up-to-date and consistent
* *** Finally mark values that are inputs to PHIs as killed when appropriate.
   This should make the generated code quite a bit better.  For example, the
   local-ra will not have to spill PHI inputs at the end of predecessor BB's
   anymore.

llvm-svn: 6117
2003-05-12 14:28:28 +00:00
Chris Lattner
ce4b5cd9bf Fix bug where we could iterate off the end of a basic block
llvm-svn: 6116
2003-05-12 14:26:38 +00:00
Chris Lattner
a8497e3094 * Keep the BBMap around as long as the pass is live
* Change getVarInfo to take real virtual register numbers and offset them
  itself.  This has caused me so much grief, it's not even funny.

llvm-svn: 6115
2003-05-12 14:24:00 +00:00
Chris Lattner
3ab77b0589 Fix N^2 algorithm
llvm-svn: 6112
2003-05-12 04:08:54 +00:00
Chris Lattner
30e6616afa * Fix several comments
* Update LiveVar info better, fixing bug: Jello/2003-05-11-PHIRegAllocBug.ll

llvm-svn: 6110
2003-05-12 03:55:21 +00:00
Chris Lattner
738ee6f0fd Fix tab infestation!
llvm-svn: 6109
2003-05-12 03:54:14 +00:00
Chris Lattner
3160b1235e Allow const functions
llvm-svn: 6056
2003-05-09 03:27:41 +00:00
Chris Lattner
a24e816c31 Add methods for stub function generation
llvm-svn: 6054
2003-05-08 21:54:18 +00:00
Chris Lattner
d3d53723a2 Add a vector to keep track of which registers are allocatable. Remove FIXMEs
llvm-svn: 6015
2003-05-07 20:08:36 +00:00
Chris Lattner
15d2a1b0b9 Re-add gross hack, it's still necessary. :(
llvm-svn: 6012
2003-05-06 21:44:54 +00:00
Chris Lattner
bfeffcec97 Remove hideously nasty hack
llvm-svn: 6011
2003-05-06 21:32:39 +00:00
Misha Brukman
cf277f9143 Debug output should go to cerr, not cout, because that's where bytecode goes.
llvm-svn: 6002
2003-05-04 22:51:30 +00:00
Chris Lattner
8f2c71cae2 Fix a bug which occurred with empty basic blocks
llvm-svn: 5982
2003-05-02 18:44:42 +00:00
Chris Lattner
00a12b165a Minor cleanup
llvm-svn: 5976
2003-05-01 21:18:47 +00:00
Chris Lattner
3e687b8b65 Remove unneccesary &*
llvm-svn: 5871
2003-04-23 16:36:11 +00:00
Misha Brukman
1d82003535 Just some code beautification changes I had sitting around in my tree.
llvm-svn: 5859
2003-04-22 23:00:08 +00:00
Misha Brukman
127a46eeba Fixed compilation errors, command-line argument declarations, cleaned up code to
look nicer and removed useless stuff.

Also renamed a few variables, moved them into namespaces, converted outputting
to a file into a print to std::cerr with a DEBUG() guard, as all passes should
do anyway.

No functional changes have been made. However, this code now compiles.

llvm-svn: 5769
2003-04-10 19:19:23 +00:00
Misha Brukman
1db4cefc28 Made the code readable:
* Lines must be wrapped at 80 chars. This is a hard limit.
* Consistent style on functions, braces, if, for, etc. Code must be readable.

No functional changes have been made, even though I added a new typedef.

llvm-svn: 5768
2003-04-09 21:51:34 +00:00
Guochun Shi
478533bb86 change the include file names and some class names to make it compile
llvm-svn: 5764
2003-04-06 23:56:19 +00:00
Guochun Shi
9ba51857c1 *** empty log message ***
llvm-svn: 5755
2003-03-27 17:57:44 +00:00
Chris Lattner
1d35ac61ce Print machine frame objects with the frame offset intrinsic to the machine
llvm-svn: 5329
2003-01-16 18:35:57 +00:00
Chris Lattner
3228091a65 Fix problems with empty basic blocks
llvm-svn: 5326
2003-01-16 18:06:43 +00:00
Chris Lattner
76fc0fcfa5 Arg, fix bugs in previous checkin...
llvm-svn: 5322
2003-01-16 02:24:20 +00:00
Chris Lattner
ba0f68ad4a Add assertion
llvm-svn: 5321
2003-01-16 02:22:08 +00:00
Chris Lattner
52c6c50212 * Insert prolog/epilog code before rewriting indexes
* Fix calculation of frame offsets when there is an offset.

llvm-svn: 5318
2003-01-15 22:52:34 +00:00
Chris Lattner
301e1307d2 Move sparc specific code into the Sparc backend
llvm-svn: 5317
2003-01-15 21:36:50 +00:00
Chris Lattner
4846297632 Adjust to new interfaces
llvm-svn: 5314
2003-01-15 21:14:01 +00:00
Chris Lattner
7f6d496ab0 Move headers around
llvm-svn: 5312
2003-01-15 21:02:16 +00:00
Chris Lattner
53a41beb57 Header is moved into local directory
llvm-svn: 5311
2003-01-15 21:00:02 +00:00
Chris Lattner
ec5237b2fe Fix bug in previous checkin
llvm-svn: 5310
2003-01-15 20:32:15 +00:00
Chris Lattner
405c4eb45e Add new method
llvm-svn: 5309
2003-01-15 20:28:36 +00:00
Chris Lattner
e5a3e82de5 #include RegClass.h explicitly
llvm-svn: 5307
2003-01-15 19:57:07 +00:00
Chris Lattner
c5e832b829 Remvoe dependency on RegClass.h
llvm-svn: 5306
2003-01-15 19:56:21 +00:00
Chris Lattner
760b144cf9 Prune #includes
llvm-svn: 5303
2003-01-15 19:48:13 +00:00
Chris Lattner
c934e3fa5f Minor changes
llvm-svn: 5302
2003-01-15 19:47:53 +00:00
Chris Lattner
cfa7a8f9a2 Remove obsolete ctor
llvm-svn: 5301
2003-01-15 19:47:02 +00:00
Chris Lattner
4c178a5732 Remove dead code
llvm-svn: 5298
2003-01-15 19:22:38 +00:00
Chris Lattner
c7ffc9b9e3 Use buildmi not MI ctor directly
llvm-svn: 5293
2003-01-15 18:08:07 +00:00
Chris Lattner
07b0e49989 Rename llvm/Analysis/LiveVar/FunctionLiveVarInfo.h -> llvm/CodeGen/FunctionLiveVarInfo.h
llvm-svn: 5284
2003-01-14 23:05:08 +00:00
Chris Lattner
57b5e8891e Move llvm/Analysis/LiveVar/ValueSet.h to CodeGen/ValueSet.h
llvm-svn: 5282
2003-01-14 22:56:37 +00:00
Chris Lattner
b27d60ccf1 Rename MachineInstrInfo -> TargetInstrInfo
llvm-svn: 5272
2003-01-14 22:00:31 +00:00
Chris Lattner
76e5849ba6 New files
llvm-svn: 5262
2003-01-13 20:01:16 +00:00
Chris Lattner
0e9b41cd57 * Use the PHI Elimination pass
llvm-svn: 5220
2003-01-13 00:26:08 +00:00
Chris Lattner
eb2bc51e49 * Convert to use LiveVariable analysis
* Convert to use PHIElimination pass
* Don't spill values which have just been reloaded (big win reducing spills)
* Add experimental support for eliminating spills before TwoAddress
  instructions.  It currently is broken so it is #ifdef'd out.
* Use new "is terminator" flag on instructions instead of looking for
  branches and returns explicitly.

llvm-svn: 5219
2003-01-13 00:25:40 +00:00
Chris Lattner
e9bef83e93 Convert to MachineFunctionPass
llvm-svn: 5218
2003-01-13 00:23:41 +00:00
Chris Lattner
acef9340fe Add support for 3 new forms of MachineOperand
llvm-svn: 5217
2003-01-13 00:23:24 +00:00
Chris Lattner
ed14156bf6 Add support for constant pool
Add helper methods for MachineFrameInfo

llvm-svn: 5216
2003-01-13 00:23:03 +00:00
Chris Lattner
93ba1b8b05 Add support for global address by string and constant pool values
llvm-svn: 5215
2003-01-13 00:22:37 +00:00
Chris Lattner
dfa3c21f1c More renamings of Target/Machine*Info to Target/Target*Info
llvm-svn: 5204
2002-12-29 03:13:05 +00:00
Chris Lattner
bff4411f3a Rename MachineOptInfo to TargetoptInfo
Rename MachineCacheInfo to TargetCacheInfo

llvm-svn: 5203
2002-12-29 02:50:35 +00:00
Chris Lattner
500e45fe72 Rename FunctionFrameInfo to MachineFrameInfo
llvm-svn: 5200
2002-12-28 21:08:26 +00:00
Chris Lattner
2407294a41 Rename MachineFrameInfo to TargetFrameInfo.h
llvm-svn: 5199
2002-12-28 21:00:25 +00:00
Chris Lattner
0ca1e472f2 Initial checkin of Prolog/Epilog code inserter, which is an important part
of the abstract frame representation

llvm-svn: 5198
2002-12-28 20:43:30 +00:00
Chris Lattner
c10678de64 * Convert to be a MachineFunctionPass instance
* Use new FunctionFrameInfo object to manage stack slots instead of doing
  it directly
* Adjust to new MRegisterInfo API
* Don't take a TM as a ctor argument
* Don't keep track of which callee saved registers are modified
* Don't emit prolog/epilog code or spill/restore code for callee saved regs
* Use new allocation_order_begin/end iterators to simplify dramatically the
  logic for picking registers to allocate
* Machine PHI nodes can no longer contain constant arguments

* Use a bitvector to keep track of registers used instead of a set
* Fix problem where explicitly referenced registers would be added to
  regsused set and never removed

llvm-svn: 5196
2002-12-28 20:42:14 +00:00
Chris Lattner
239563061c * Convert to be a MachineFunctionPass instance
* Use new FunctionFrameInfo object to manage stack slots instead of doing
  it directly
* Adjust to new MRegisterInfo API
* Don't take a TM as a ctor argument
* Don't keep track of which callee saved registers are modified
* Don't emit prolog/epilog code or spill/restore code for callee saved regs
* Use new allocation_order_begin/end iterators to simplify dramatically the
  logic for picking registers to allocate
* Machine PHI nodes can no longer contain constant arguments

llvm-svn: 5195
2002-12-28 20:40:43 +00:00
Chris Lattner
831939c09a * Add printing support for FrameIndex operands
llvm-svn: 5194
2002-12-28 20:37:37 +00:00
Chris Lattner
64b1ad63c1 * A bunch of functionality and data was removed from MachineFunction and put
into a new MachineFunctionInfo class
* Implement new FunctionFrameInfo class

llvm-svn: 5193
2002-12-28 20:37:16 +00:00
Chris Lattner
6ce5c54520 Frame info moved out of MachineFunction into a seperate object
llvm-svn: 5192
2002-12-28 20:35:34 +00:00
Chris Lattner
3a506e6f14 Adjust to simpler spill interface
Only spill and reload caller saved registers that are actually modified.

llvm-svn: 5145
2002-12-25 05:05:46 +00:00
Chris Lattner
1f19acbda7 Adjustments to work with the simpler spill interface
llvm-svn: 5144
2002-12-25 05:04:20 +00:00
Chris Lattner
10edd6367e Remove dependency on SSARegMap.h by MachineFunction.h
llvm-svn: 5143
2002-12-25 05:03:22 +00:00
Chris Lattner
7888f74224 Substantial fixes to live range handling, fixing several problems, getting
strtol to not miscompile, and fixing bug: 2002-12-23-LocalRAProblem.llx

llvm-svn: 5132
2002-12-24 00:04:55 +00:00
Chris Lattner
7abe5199b3 Fix compilation on GCC 2.96
llvm-svn: 5113
2002-12-23 23:44:04 +00:00
Chris Lattner
5ddc4b5f94 * Fix several register aliasing bugs
* Add a new option to eliminate spilling of registers that are only used
  within a basic block.

llvm-svn: 5106
2002-12-18 08:14:26 +00:00
Chris Lattner
bb2e7ec2b1 Implicit defs/uses list may be empty.
llvm-svn: 5103
2002-12-18 01:11:14 +00:00
Chris Lattner
c6ac5c70c6 Use new reginfo interface
llvm-svn: 5099
2002-12-17 04:19:40 +00:00
Chris Lattner
e66a7e80c3 Add prolog/epilog spills/reloads to counters
Move X86 specific alignment gunk to X86 files

llvm-svn: 5096
2002-12-17 03:16:10 +00:00
Chris Lattner
8dd15fd26c Fix many bugs, regallocator now saves callee-save registers instead of target
llvm-svn: 5093
2002-12-17 02:50:10 +00:00
Chris Lattner
cdcde16ad0 * Fix a gross X86 hack that was intended to avoid allocating SP and BP
* Implement register alias set support

llvm-svn: 5082
2002-12-16 17:44:42 +00:00
Chris Lattner
0ede83ee56 Keep the stack frame aligned.
llvm-svn: 5081
2002-12-16 17:42:40 +00:00
Chris Lattner
d44868a709 Initial checkin of "local" register allocator. Bugs are still present.
llvm-svn: 5078
2002-12-16 16:15:28 +00:00
Chris Lattner
064dd4ef95 Rename createSimpleX86RegisterAllocator to createSimpleRegisterAllocator.
Remvoe some dead code

llvm-svn: 5070
2002-12-16 14:37:00 +00:00
Chris Lattner
93b0272717 Some simpliciations to the spill/reload interface
llvm-svn: 5067
2002-12-15 23:01:26 +00:00
Chris Lattner
6a2d7bef14 Simplify PHI node elimination significantly by doing it as a prepass to
register allocation

llvm-svn: 5066
2002-12-15 22:39:53 +00:00
Chris Lattner
ebb82f7f96 Variety of small or trivial simplifications to the code, completely eliminated
the dependence on PhysRegClassMap

llvm-svn: 5064
2002-12-15 22:19:19 +00:00
Chris Lattner
370918a2db Remove unused savePhysRegToStack method
llvm-svn: 5061
2002-12-15 21:33:51 +00:00
Chris Lattner
35ceaa7322 Localize a map, remove another
llvm-svn: 5060
2002-12-15 21:24:30 +00:00
Chris Lattner
f499e065be Give simple reg allocator a nice Pass Name
llvm-svn: 5058
2002-12-15 21:13:12 +00:00
Chris Lattner
da3e75b117 Add a big assert making sure 2 address instructions are formed right
llvm-svn: 5057
2002-12-15 21:02:20 +00:00
Chris Lattner
e8acf72d80 Fix a problem that occurs when PHI nodes have multiple entries for the same predecessor
llvm-svn: 5055
2002-12-15 20:48:03 +00:00
Chris Lattner
234abaea18 Grab bag of minor cleanups. Export some statistics about the number of
spills and reloads emitted

llvm-svn: 5054
2002-12-15 20:36:09 +00:00
Chris Lattner
dd307412c4 Implement printing of MBB arguments
llvm-svn: 5053
2002-12-15 20:35:25 +00:00
Chris Lattner
4214ac384a Simplify interfaces used by regalloc to insert code
llvm-svn: 5052
2002-12-15 20:06:35 +00:00
Chris Lattner
351dc9af16 * Simplify code a bit by breaking the PHI node handling stuff out into a seperate
function from normal regalloc code
* Make the regalloc for a block a function instead of part of runOnMachineBB, which
  makes it easier to see what's going on in runOnMBB.

llvm-svn: 5051
2002-12-15 19:51:14 +00:00
Chris Lattner
6c5c2a58ee * Remove some unneccesary instance variables
* Make allocateStackSpaceFor only allocate the right amount of space

llvm-svn: 5048
2002-12-15 19:07:34 +00:00
Chris Lattner
c43cb38245 pull inverse reg class mapping into a class that is sharable and out of the
target register description classes.

llvm-svn: 5045
2002-12-15 18:38:59 +00:00
Chris Lattner
2c20e950be Prune #includes
llvm-svn: 5044
2002-12-15 18:19:24 +00:00
Chris Lattner
aab9196e79 Remove extraneous #includes, perform FIXME
llvm-svn: 5043
2002-12-15 18:15:24 +00:00
Chris Lattner
41ad5c9aff Fix borkness with not using MachineBasicBlocks in PHI nodes
llvm-svn: 5035
2002-12-15 08:02:51 +00:00
Misha Brukman
de680081ab Fixed a bug where moves due to phis were being neglected.
llvm-svn: 5019
2002-12-13 12:33:31 +00:00
Misha Brukman
1f57df5fad Need to insert all moves due to PHI nodes before *ALL* jumps in a predecessor
basic block, as there could be multiple.

llvm-svn: 5016
2002-12-13 11:55:59 +00:00
Misha Brukman
0bfbbc73f2 This should be more correct: invalidates physical registers that are used in
an instruction to avoid using them to allocate to other virtual registers.

llvm-svn: 5013
2002-12-13 11:33:22 +00:00
Misha Brukman
e694e406a4 Fixed bug with running out of registers. Also, reinstated namespace which
disappeared during the last checkin.

llvm-svn: 5007
2002-12-13 10:42:31 +00:00
Misha Brukman
af40b6adcd This should handle register allocating PHI nodes.
llvm-svn: 5002
2002-12-13 09:54:36 +00:00
Misha Brukman
e5a8dcc695 Start allocating stack space at [ebp-4] to not overwrite the return address.
Also make all loads & stores 4-byte aligned for performance. ;)

llvm-svn: 4982
2002-12-13 04:34:02 +00:00
Misha Brukman
12bec4ecef Take advantage of our knowledge of 2-address X86 instructions and
register-allocated them appropriately.

llvm-svn: 4976
2002-12-12 23:20:31 +00:00
Misha Brukman
8f56246d62 Added code generation for function prologues and epilogues.
llvm-svn: 4930
2002-12-04 23:58:08 +00:00
Misha Brukman
566bac5ec1 Fun arithmetic with iterators aimed at fixing a bug: inserting instructions
after the *current* instruction while keeping the iterator in the same
'logical' place.

llvm-svn: 4923
2002-12-04 19:24:45 +00:00
Chris Lattner
994984de43 Print out direct global references
llvm-svn: 4906
2002-12-04 06:44:41 +00:00
Misha Brukman
f13126a427 This should fix the bug seen with some registers not being allocated
correctly: skipping instructions by incorrectly incrementing the pointer.

Also adds support for building a reg-to-regclass map, and splits the function
for saving register to stack into two, one suitable for virtual registers
(which also assigns it a physical register) and one for simply storing back
physical registers.

llvm-svn: 4898
2002-12-03 23:15:19 +00:00
Chris Lattner
47478b4dce Checkin debug implementation of MCE
llvm-svn: 4893
2002-12-03 20:56:42 +00:00
Misha Brukman
f776547336 * Abstracted out stack space allocation into its own function
* Added saving of register values to the stack

llvm-svn: 4858
2002-12-02 21:11:58 +00:00
Misha Brukman
021bf57248 A simple (spilling) register allocator.
llvm-svn: 4828
2002-11-22 22:44:32 +00:00
Misha Brukman
2bf32bfea1 Initialize the SSARegMap.
llvm-svn: 4782
2002-11-20 18:55:27 +00:00
Chris Lattner
3afc487fba Print is const!
llvm-svn: 4737
2002-11-17 23:22:13 +00:00
Chris Lattner
8ac4eea84b Remove only uses of markDef/markDefAndUse methods
llvm-svn: 4719
2002-11-17 22:14:08 +00:00
Chris Lattner
0141841bc4 Fix warning
llvm-svn: 4649
2002-11-09 00:49:43 +00:00
Chris Lattner
0478222ec2 Move function to cpp file from header
llvm-svn: 4510
2002-11-02 22:07:51 +00:00
Chris Lattner
4b8d170d55 New iostream definitions
llvm-svn: 4482
2002-11-01 16:46:05 +00:00
Vikram S. Adve
8ecd939ce9 Restore support for indirect function calls (which briefly wasn't working
after I removed annotations on MachineInstr for the CallDescriptor).

llvm-svn: 4469
2002-10-31 15:34:48 +00:00
Chris Lattner
8fa0840abd Remove fixme
llvm-svn: 4447
2002-10-30 02:02:37 +00:00
Chris Lattner
98e6bad1ee Add special code to make printing SSA form machine instructions nicer
llvm-svn: 4446
2002-10-30 01:55:38 +00:00
Chris Lattner
8dfb0ef7b0 Use MRegisterInfo, if available, to print symbolic register names
llvm-svn: 4438
2002-10-30 00:58:19 +00:00
Chris Lattner
2cfa08e4bf Implement structured machine code printing
llvm-svn: 4435
2002-10-30 00:48:05 +00:00
Chris Lattner
e89cb8ba64 Make argsize calculation stuff optional, so that Targets without FrameInfo
objects yet don't die

llvm-svn: 4427
2002-10-29 23:40:03 +00:00
Chris Lattner
64fa3f3e97 Implement autoinserting ctor
llvm-svn: 4426
2002-10-29 23:19:00 +00:00
Chris Lattner
de3938a592 Rename annotation id
llvm-svn: 4425
2002-10-29 23:18:43 +00:00
Chris Lattner
fc88414ffd Merge with sparc backend
llvm-svn: 4403
2002-10-29 20:10:58 +00:00
Chris Lattner
0ac25d509c X86 merge is complete, eliminate unused code
llvm-svn: 4400
2002-10-29 20:07:16 +00:00
Vikram S. Adve
4acb69b4ea Remove separate vector of implicit refs from MachineInstr, and
instead record them as extra operands in the operands[] vector.
Also, move CallArgsDescriptor into this class instead of making it an
annotation on the machine instruction.

llvm-svn: 4399
2002-10-29 19:41:18 +00:00
Vikram S. Adve
1730a958ea Move CallArgsDescriptor into this class instead of making it an
annotation on the machine instruction.

llvm-svn: 4398
2002-10-29 19:38:46 +00:00
Chris Lattner
b49e35e745 Move TargetInstrDescriptors extern to the one .cpp file that refers to it:
MachineInstr.cpp

llvm-svn: 4392
2002-10-29 17:40:30 +00:00
Chris Lattner
fa303f1bb7 Use higher level methods, don't use TargetInstrDescriptors directly!
llvm-svn: 4389
2002-10-29 17:35:39 +00:00
Chris Lattner
c3e30fed7b Use higher level method
llvm-svn: 4386
2002-10-29 17:25:41 +00:00
Chris Lattner
80c0746b11 Remove #include, misleading comment, and a typedef used only once
llvm-svn: 4383
2002-10-29 17:08:05 +00:00
Chris Lattner
8ae0be7897 Inline typedef, eliminate unused method
llvm-svn: 4382
2002-10-29 17:03:19 +00:00
Chris Lattner
8ab1906b5f Remove long dead #if 0
llvm-svn: 4381
2002-10-29 17:00:19 +00:00
Chris Lattner
9739fc7ff1 Add #includes that were eliminated from headers
llvm-svn: 4380
2002-10-29 16:51:05 +00:00
Chris Lattner
0493b81eef De-inline methods
llvm-svn: 4379
2002-10-29 16:50:33 +00:00
Chris Lattner
6c092a9ea7 Remove #include
llvm-svn: 4378
2002-10-29 16:50:20 +00:00
Chris Lattner
4aba455989 Remove unneeded #include
llvm-svn: 4377
2002-10-29 16:50:06 +00:00
Chris Lattner
f658cf4988 Remove forward decl
llvm-svn: 4376
2002-10-29 16:49:44 +00:00
Chris Lattner
0cff6f7e16 Make assertIGNode be private to the InterferenceGraph.cpp file
llvm-svn: 4375
2002-10-29 16:42:34 +00:00
Chris Lattner
7d6709e213 MachineInstrInfo no longer #includes this header, so we must
llvm-svn: 4366
2002-10-28 23:54:47 +00:00
Chris Lattner
566b2147f9 Remove all traces of the "Opcode Mask" field in the MachineInstr class
llvm-svn: 4359
2002-10-28 21:17:20 +00:00
Chris Lattner
11f52470a0 Remove more default arguments that are never used
llvm-svn: 4358
2002-10-28 21:02:40 +00:00
Chris Lattner
990e074c2e Remove default operands that are never used
llvm-svn: 4357
2002-10-28 20:59:49 +00:00
Chris Lattner
de6ac9b0ff * Make MachineOperand ctors private, so MachineOperand can only be created
by MachineInstr.
* Add a bunch of new methods to allow incremental addition of operands to the
  machine instr instance.

llvm-svn: 4356
2002-10-28 20:48:39 +00:00
Misha Brukman
f9d06cfc80 Replaced uses of deprecated `MachineFunction::get(BasicBlock *BB)'.
llvm-svn: 4351
2002-10-28 20:00:31 +00:00
Chris Lattner
74f9160190 Remove two arguments that are never specified
llvm-svn: 4348
2002-10-28 19:46:59 +00:00
Chris Lattner
4b652d5505 Rename some regalloc fields
llvm-svn: 4346
2002-10-28 19:43:23 +00:00
Chris Lattner
bd1add2005 Eliminate usage of MachineBasicBlock::get
llvm-svn: 4344
2002-10-28 19:22:04 +00:00
Chris Lattner
fdca057f8d Remove usage of MachineBasicBlock::get
llvm-svn: 4342
2002-10-28 19:01:16 +00:00
Chris Lattner
a7ca1bd65c Remove usage of MachineBasicBlock::get
llvm-svn: 4341
2002-10-28 18:50:08 +00:00
Chris Lattner
2263f89d3b Eliminate unneccesary use of MachineBasicBlock::get
llvm-svn: 4339
2002-10-28 06:01:57 +00:00
Chris Lattner
f2cd0a8266 s/method/function
llvm-svn: 4338
2002-10-28 05:58:46 +00:00
Chris Lattner
7cdc2977f0 Change MachineBasicBlock's to not be Annotations, instead they are kept as
part of a linked list tracked by MachineFunction.  MachineBasicBlock::get
is now linear time instead of constant time, and thus is deprecated!

llvm-svn: 4337
2002-10-28 05:30:46 +00:00
Chris Lattner
89a424167f Make Scheduling Class variables be 'unsigned' instead of 'int'
llvm-svn: 4333
2002-10-28 04:53:02 +00:00
Chris Lattner
e309cdbc95 Rename the redundant MachineOperand::getOperandType() to MachineOperand::getType()
llvm-svn: 4331
2002-10-28 04:45:29 +00:00
Chris Lattner
7000bbb63f Fairly major overhaul of MachineInstr & Operand classes
- Inline methods that are mostly a single line anyway
  - Eliminate several methods that were never called
  - Group methods a bit more consistently

llvm-svn: 4329
2002-10-28 04:24:49 +00:00
Chris Lattner
dd22b9e8b6 Add #includes now that MachineInstr.h doesn't include llvm/Target/MachineInstrInfo.h
llvm-svn: 4327
2002-10-28 02:28:39 +00:00
Chris Lattner
a7e9d3e90f Don't #include <Support/*>, #include "Support/*"
llvm-svn: 4325
2002-10-28 02:11:53 +00:00
Chris Lattner
df1d87f5f3 *** empty log message ***
llvm-svn: 4323
2002-10-28 02:01:37 +00:00
Chris Lattner
6b66fadf2c MachineFunction now includes MachineBasicBlock so there is no need to
reinclude it

llvm-svn: 4322
2002-10-28 02:01:35 +00:00
Chris Lattner
b8c6acfbc0 Rename MachineCodeForBasicBlock to MachineBasicBlock
llvm-svn: 4318
2002-10-28 01:41:47 +00:00
Chris Lattner
ef1475aa32 *** empty log message ***
llvm-svn: 4317
2002-10-28 01:41:27 +00:00
Chris Lattner
4f2c612b21 Inline some methods from .cpp files into .h files, minor cleanups
llvm-svn: 4313
2002-10-28 01:21:55 +00:00
Chris Lattner
61e42343e5 Minor cleanups
llvm-svn: 4312
2002-10-28 01:16:38 +00:00
Chris Lattner
33b00d8186 Move machine code generation/destruction passes out of Sparc.cpp because
they are generic

llvm-svn: 4310
2002-10-28 01:12:41 +00:00
Chris Lattner
ce3ede5938 Prune #includes
llvm-svn: 4307
2002-10-28 01:02:51 +00:00
Chris Lattner
ffa0482331 Updates to match misha's changes
llvm-svn: 4302
2002-10-28 00:37:53 +00:00
Misha Brukman
142795fd17 Changed MachineCodeForMethod' to MachineFunction'.
llvm-svn: 4301
2002-10-28 00:28:31 +00:00
Chris Lattner
a952881e00 Initial checkin of codegen infrastructure for LLVM-JIT
llvm-svn: 4282
2002-10-25 22:54:41 +00:00
Chris Lattner
47508d5c0f Tell PassManager that this pass does not invalidate the CFG so that dominator
information and Loop info will not have to be recomputed after this runs.

llvm-svn: 4269
2002-10-23 03:30:47 +00:00
Chris Lattner
b8ffbe6966 Ensure definate initialization
llvm-svn: 4263
2002-10-22 23:34:11 +00:00
Chris Lattner
dfc8fbf16b - Two minor improvements to the MachineInstr class to reduce footprint and
overhead: Merge 3 parallel vectors into 1, change regsUsed hash_set to be a
    bitvector.  Sped up LLC a little less than 10% in a debug build!

llvm-svn: 4261
2002-10-22 23:16:21 +00:00
Vikram S. Adve
3a54b695ce Significant improvement: GEP used by a load or store no longer generates
a separate ADD; instead just use the indexed load/store instruction!
Also, a bug fix: folding a GEP with a leading non-zero index with
its predecessor was incorrect: now it only happens if the predecessor
is pointing to an indexable type (aka SequentialType).

llvm-svn: 4168
2002-10-14 16:30:55 +00:00
Vikram S. Adve
e18a54c249 Use vectors instead of hash_maps for issueGaps and conflictLists.
These hash lookups were a major sink of time because they happen so often!
Also, add option to disable scheduling.

llvm-svn: 4138
2002-10-13 00:40:37 +00:00
Vikram S. Adve
211f972d28 Major bug fix: was not adding CD edges for RETURNs!
llvm-svn: 4137
2002-10-13 00:39:22 +00:00
Vikram S. Adve
be4905b56a Major bug fix: spill code for an instruction in a delay slot was
merrily being inserted before/after the instruction!

llvm-svn: 4116
2002-10-11 16:12:40 +00:00
Vikram S. Adve
f19f08c3ab Don't pad variables in stack slots for performance!
llvm-svn: 4115
2002-10-11 16:10:53 +00:00
Vikram S. Adve
01e64b5eef Bug fix in folding getElementPtr instructions: don't fold one into
a predecessor if it has a non-zero first index and the predecessor
ends with a struct index.

llvm-svn: 3982
2002-09-29 22:55:05 +00:00
Vikram S. Adve
69d19cf9a9 Convert DIRS to PARALLEL_DIRS. They can be built independently.
llvm-svn: 3972
2002-09-29 11:52:14 +00:00
Vikram S. Adve
59778ef96d Added a couple of helper methods for live range construction.
llvm-svn: 3970
2002-09-28 17:05:43 +00:00
Vikram S. Adve
2710051771 Live ranges for Return value and return address of a Call are now
created here, simply by handling all implicit operands (which should
have been done anyway).

llvm-svn: 3969
2002-09-28 17:05:22 +00:00
Vikram S. Adve
7e39b876eb Fixed method getReturnValue(): it should return NULL if the
callee does not return a value.

llvm-svn: 3968
2002-09-28 17:03:54 +00:00
Vikram S. Adve
7c0175962a Fixed incorrect assertion: spill code for function ptr should be
handled like normal operands, not like other call arguments.

llvm-svn: 3967
2002-09-28 17:02:40 +00:00
Vikram S. Adve
c795b90eac Sign-extend integer constants from original type size to 64 bits!
llvm-svn: 3958
2002-09-27 14:26:20 +00:00
Vikram S. Adve
07a33b5553 Add method IGNode::getCombinedDegree to count the sum of the degrees
of two nodes, excluding duplicates.

llvm-svn: 3848
2002-09-20 00:55:04 +00:00
Vikram S. Adve
1d139cf8de Add PostOpts/ and rename PreSelection/ to PreOpts/.
llvm-svn: 3847
2002-09-20 00:53:53 +00:00
Vikram S. Adve
47303cde2d Add method MachineInstr::replace to rewrite a machine instruction in place.
llvm-svn: 3843
2002-09-20 00:47:49 +00:00
Vikram S. Adve
ccb33335a3 Allow copy coalescing in more cases: if sum of node degrees is more than
than #available regs, compute the sum excluding duplicates and if that
is less than #regs, go ahead and coalesce.
Add method IGNode::getCombinedDegree to count excluding duplicates.

llvm-svn: 3842
2002-09-20 00:45:47 +00:00
Vikram S. Adve
82b15d7253 Peephole optimization pass on final machine code.
llvm-svn: 3840
2002-09-20 00:42:11 +00:00
Vikram S. Adve
8dc14ec198 Files moved to CodeGen/PreOpts.
llvm-svn: 3839
2002-09-20 00:30:46 +00:00
Vikram S. Adve
6f0ad9998b Moving these files from Code/PreSelection to here.
Original logs for PreSelection.cpp:

  revision 1.2
  date: 2002/09/17 23:50:32;  author: lattner;  state: Exp;  lines: +1 -3
  Don't put default parameter values into .cpp files, it breaks 3.x compilers

  revision 1.1
  date: 2002/09/16 15:31:13;  author: vadve;  state: Exp;
  New preselection pass that specializes LLVM code for a target machine,
  while remaining in legal portable LLVM form and preserving type
  information and type safety.

llvm-svn: 3838
2002-09-20 00:29:28 +00:00
Chris Lattner
86e6e0f6e3 Don't put default parameter values into .cpp files, it breaks 3.x compilers
llvm-svn: 3799
2002-09-17 23:50:32 +00:00
Chris Lattner
7c1b7e5889 Add support for GCC 2.96
llvm-svn: 3777
2002-09-17 17:23:09 +00:00
Vikram S. Adve
04cace44d8 Add subdirectory PreSelection.
llvm-svn: 3739
2002-09-16 15:32:07 +00:00
Vikram S. Adve
a5b251ed67 New preselection pass that specializes LLVM code for a target machine,
while remaining in legal portable LLVM form and preserving type
information and type safety.

llvm-svn: 3738
2002-09-16 15:31:13 +00:00
Vikram S. Adve
3d9c3e8751 Dump routine now writes out allocated register numbers if available.
llvm-svn: 3737
2002-09-16 15:18:53 +00:00
Vikram S. Adve
df1e95af82 Improve and fix error in allocating stack slots: adjust alignment after adding
base address of the relevant region (instead of assuming that each region
is maximally aligned).

llvm-svn: 3736
2002-09-16 15:18:16 +00:00
Vikram S. Adve
533c888d4a Add a version of ChooseRegOrImmed to handle numerical constants
introduced by InstrSelection.

llvm-svn: 3735
2002-09-16 15:15:57 +00:00
Vikram S. Adve
74823d9145 Add an assertion.
llvm-svn: 3734
2002-09-16 15:13:59 +00:00
Vikram S. Adve
69cf056052 Fix typos in previous checkin.
llvm-svn: 3726
2002-09-15 15:33:48 +00:00
Chris Lattner
db2c0b75ab RegAllocCommon no longer includes CommandLine.h so we have to include it
here.

llvm-svn: 3725
2002-09-15 07:07:55 +00:00
Vikram S. Adve
2ebafaf8ff Break RA_DEBUG option into several levels to get better control over
debug output.

llvm-svn: 3724
2002-09-14 23:05:33 +00:00
Vikram S. Adve
8d2a9260ef Remove unnecessary include.
llvm-svn: 3723
2002-09-14 23:04:52 +00:00
Vikram S. Adve
263de0387d Break RA_DEBUG option into several levels to get better output.
llvm-svn: 3722
2002-09-14 22:18:37 +00:00
Vikram S. Adve
7cad54b354 Moving to lib/CodeGen/RegAlloc.
llvm-svn: 3718
2002-09-14 11:57:17 +00:00
Chris Lattner
23bd92aeeb Fix a bug I introduced into the code generator. :(
llvm-svn: 3694
2002-09-12 20:27:10 +00:00
Chris Lattner
18e3c4ff50 - Change getelementptr instruction to use long indexes instead of uint
indexes for sequential types.

llvm-svn: 3681
2002-09-11 01:21:29 +00:00
Chris Lattner
22bcab6bd5 Make sure the leakdetector is told about temporary Phi nodes also, so it doesn't
erroneously report them as leaks

llvm-svn: 3624
2002-09-08 21:19:29 +00:00
Chris Lattner
1c2e1ebb5c Inform the memory leak detector that TmpInstruction objects should not be
subject to memory leak checking.

llvm-svn: 3623
2002-09-08 21:08:43 +00:00
Chris Lattner
3ce5b343c5 - Renamed Type::isIntegral() to Type::isInteger()
- Added new method Type::isIntegral() that is the same as isInteger, but
    also accepts bool.

llvm-svn: 3574
2002-09-03 01:08:28 +00:00
Anand Shukla
9a0d43e242 moved this file from lib/Reoptimizer/Mapping
llvm-svn: 3519
2002-08-27 22:47:33 +00:00
Anand Shukla
687dea3dcf Makefile for new sub directory
llvm-svn: 3518
2002-08-27 22:46:38 +00:00
Anand Shukla
5bb28c7358 Added Mapping subdir
llvm-svn: 3517
2002-08-27 22:45:49 +00:00
Vikram S. Adve
b8a0f00662 Use newly-added type inspection support in InstTreeNode subclasses.
llvm-svn: 3501
2002-08-24 21:02:09 +00:00
Vikram S. Adve
3190395e10 Moved code here to extract memory instruction indices and to check
whether FoldGetElemNodes should be called.  This is machine-independent
but was in the Sparc directory.  This is in a new function: GetMemInstArgs.

llvm-svn: 3500
2002-08-24 21:00:08 +00:00
Anand Shukla
656de9732b Added #include <alloca.h>
llvm-svn: 3491
2002-08-23 10:54:26 +00:00
Chris Lattner
20b85d96e4 Eliminated the MemAccessInst class, folding contents into GEP class.
llvm-svn: 3487
2002-08-22 23:37:20 +00:00
Vikram S. Adve
0672c43566 dumpNode() does not need to print MachineInstrs.
llvm-svn: 3444
2002-08-22 02:59:46 +00:00
Vikram S. Adve
21b0deb4ab 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
87928f2098 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
8a4787495a * 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
4d9fadc44a * 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
c95ce32146 We are using std::vector, so remove extraneous namespace prefixes
llvm-svn: 3275
2002-08-09 20:05:34 +00:00
Chris Lattner
12af061d07 Very minor cleanups
llvm-svn: 3271
2002-08-09 18:55:18 +00:00
Chris Lattner
a21e315db4 - 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
91d4742562 - 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
Vikram S. Adve
3489677a7e 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
44a988ebf2 * Move InstructionSelection Pass here instead of living in Sparc.cpp. It
is platform independant afterall.
* Object orientize the functions, cleanup code a bit.  Instead of static
  global functions, the helpers for instruction selection are now part of
  the InstructionSelection Pass class.

llvm-svn: 3147
2002-07-30 03:57:36 +00:00
Chris Lattner
17bb18af72 Remove unused vector
llvm-svn: 3143
2002-07-30 02:52:40 +00:00
Chris Lattner
9da0755dd0 Refix stuff for GCC 2.95, 3.0.4 & 3.1
llvm-svn: 3094
2002-07-25 18:04:48 +00:00
Mehwish Nagda
4968d78ef0 now removes deleted nops from MachineCodeForInstruction
llvm-svn: 3090
2002-07-25 17:31:05 +00:00
Chris Lattner
05fe67c0d2 *** empty log message ***
llvm-svn: 3075
2002-07-25 06:17:51 +00:00
Chris Lattner
5d262d3846 *** empty log message ***
llvm-svn: 3058
2002-07-24 21:21:33 +00:00
Chris Lattner
ad8fc4ba3e Non-standard hash classes are not in the std:: namespace
llvm-svn: 3057
2002-07-24 21:21:33 +00:00
Chris Lattner
9860e64083 *** empty log message ***
llvm-svn: 3056
2002-07-24 21:21:32 +00:00
Mehwish Nagda
7311aa4f84 moving to the Reoptimizer/Mapping dir
llvm-svn: 2993
2002-07-22 22:10:55 +00:00
Chris Lattner
99ad379582 *** empty log message ***
llvm-svn: 2985
2002-07-22 02:10:13 +00:00
Mehwish Nagda
78d892eb4f changed size computation
llvm-svn: 2974
2002-07-19 22:54:08 +00:00
Mehwish Nagda
219eac01f4 added check for Function with 0 BB
llvm-svn: 2942
2002-07-17 23:40:33 +00:00
Mehwish Nagda
01b0cf5ea1 Now will profile all Basic Blocks
llvm-svn: 2922
2002-07-16 17:48:27 +00:00
Mehwish Nagda
b73d836e54 Initial checking : Writes LLVM - MI mappiing to the .s file
llvm-svn: 2911
2002-07-15 23:08:49 +00:00
Anand Shukla
d70cde528d added std:: to endl
llvm-svn: 2875
2002-07-11 00:17:17 +00:00
Vikram S. Adve
cd544ed252 Fix print of BB name in dump().
llvm-svn: 2861
2002-07-10 21:45:30 +00:00
Vikram S. Adve
62f569e4ea Add support for marking each operand as a %hh, %hm, %lm or %lo.
Represent previous bools and these ones with flags in a single byte
per operand.

llvm-svn: 2860
2002-07-10 21:45:04 +00:00
Anand Shukla
33b491bba2 changed mem_fun to std::mem_fun
llvm-svn: 2847
2002-07-09 19:18:56 +00:00
Vikram S. Adve
0b32273208 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.

llvm-svn: 2833
2002-07-08 23:15:32 +00:00
Vikram S. Adve
a8c7633d5b 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.

llvm-svn: 2832
2002-07-08 23:07:26 +00:00
Vikram S. Adve
3e8b72f0e3 Rename static struct Initializer to avoid name conflict with BB.
llvm-svn: 2831
2002-07-08 23:04:31 +00:00
Vikram S. Adve
25d81936d2 Fix printing of BB in dump.
llvm-svn: 2830
2002-07-08 23:03:54 +00:00