Chris Lattner
02e835bf9a
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
dfa238f665
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
f895418b47
Implement printing of MBB arguments
...
llvm-svn: 5053
2002-12-15 20:35:25 +00:00
Chris Lattner
e2533336f5
Simplify interfaces used by regalloc to insert code
...
llvm-svn: 5052
2002-12-15 20:06:35 +00:00
Chris Lattner
c1c7cc290f
* 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
094fd5e758
Changes to make new TargetRegisterClass interface.
...
llvm-svn: 5050
2002-12-15 19:29:34 +00:00
Chris Lattner
f2acd842b4
* 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
0d1447d64a
* Simplify TargetRegisterClass implementations
...
* Change regclass iterators to use an extra level of pointers
llvm-svn: 5047
2002-12-15 18:40:36 +00:00
Chris Lattner
b772cd05c5
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
cf1955cb16
Prune #includes
...
llvm-svn: 5044
2002-12-15 18:19:24 +00:00
Chris Lattner
1af3af463a
Remove extraneous #includes, perform FIXME
...
llvm-svn: 5043
2002-12-15 18:15:24 +00:00
Chris Lattner
76bff3438b
Fix bug: Assembler/2002-12-15-GlobalResolve.ll
...
llvm-svn: 5039
2002-12-15 16:41:52 +00:00
Chris Lattner
d53daec3e1
planes is not spelled with an O
...
llvm-svn: 5037
2002-12-15 16:20:23 +00:00
Chris Lattner
477af9d0fa
Fix borkness with not using MachineBasicBlocks in PHI nodes
...
llvm-svn: 5035
2002-12-15 08:02:51 +00:00
Chris Lattner
3263e5787f
Add support to cast from a bool type
...
Add support for boolean constants
add getClassB method
llvm-svn: 5034
2002-12-15 08:02:15 +00:00
Chris Lattner
ce35108606
Use MachineOperand::isFoo methods instead of our own global functions
...
llvm-svn: 5033
2002-12-15 08:01:39 +00:00
Chris Lattner
3aa7767352
Fix a huge performance problem in reassociate by introducing a
...
rank map cache for instruction ranks
llvm-svn: 5030
2002-12-15 03:56:00 +00:00
Chris Lattner
f96c8befe0
Minor changes:
...
* Reword comment to make more clear
* Don't print out BB's after modification made
* Don't delete and new an instruction when we need to move something, just move it.
llvm-svn: 5029
2002-12-15 03:49:50 +00:00
Chris Lattner
c4eb1ed23c
Implement indirect function calls
...
llvm-svn: 5024
2002-12-13 14:13:27 +00:00
Misha Brukman
ca8eb8af18
Make function code generation printing debug-only.
...
llvm-svn: 5023
2002-12-13 13:16:14 +00:00
Chris Lattner
a1cf9a7c0a
Fix bork in doMultiply
...
llvm-svn: 5021
2002-12-13 13:07:42 +00:00
Chris Lattner
f1874b0677
Add sanity checks
...
llvm-svn: 5020
2002-12-13 13:04:04 +00:00
Misha Brukman
a1aa29b125
Fixed a bug where moves due to phis were being neglected.
...
llvm-svn: 5019
2002-12-13 12:33:31 +00:00
Misha Brukman
3374ec7c1b
Cleaned up the code: factored out switch/case into a separate function, put
...
constants in an array for quick lookup. Stole the idea from elsewhere in
Jello.
llvm-svn: 5017
2002-12-13 12:00:06 +00:00
Misha Brukman
86ca8840a1
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
Chris Lattner
d4c5013c04
Insert phi code at top of block
...
llvm-svn: 5015
2002-12-13 11:52:34 +00:00
Brian Gaeke
61edd534b4
lib/Target/X86/InstSelectSimple.cpp:
...
The MachineBasicBlock variable name patrol hereby fines Chris Lattner
one bag of nachos, for shadowing global names while his license to do so
was under suspension.
llvm-svn: 5014
2002-12-13 11:39:18 +00:00
Misha Brukman
35a358d981
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
Chris Lattner
0a37046358
Implement cast bool to X
...
llvm-svn: 5012
2002-12-13 11:31:59 +00:00
Brian Gaeke
85b78b7372
Rename all BMI MachineBasicBlock operands to MBB.
...
Try to mess around with emitGEPOperation's elementSizeReg to make it work,
again.
llvm-svn: 5011
2002-12-13 11:22:48 +00:00
Chris Lattner
825be9ad5d
Finish up iterator stuph
...
llvm-svn: 5009
2002-12-13 10:50:40 +00:00
Misha Brukman
121ae7d3a7
Treat longs as ints => pretend they're all 32-bit values and squeeze them into
...
32-bit registers.
llvm-svn: 5008
2002-12-13 10:43:09 +00:00
Misha Brukman
89ff3fbcd6
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
Chris Lattner
e189edf272
Code gen phi's correctly
...
llvm-svn: 5004
2002-12-13 10:09:43 +00:00
Chris Lattner
2889d2e50c
Print X86 PHI nodes in a sane manner
...
llvm-svn: 5003
2002-12-13 09:59:26 +00:00
Misha Brukman
a739167305
This should handle register allocating PHI nodes.
...
llvm-svn: 5002
2002-12-13 09:54:36 +00:00
Misha Brukman
78401cbb3c
Added moveReg2Reg() and moveImm2Reg() to accomodate moving data around due to
...
PHI nodes.
llvm-svn: 5001
2002-12-13 09:54:12 +00:00
Brian Gaeke
eaeacc5872
lib/Target/X86/InstSelectSimple.cpp: Start counting arguments with 2,
...
because arguments start two stack slots off of EBP. Break out of the
for loop once the argument is found. Increment the counter at the end
of the loop instead of the beginning. Use addRegOffset and compute
the scale * index part at compile time instead of using the fancy
load instruction. Just because an instruction set has wacky addressing
modes doesn't mean we ought to use them (at least, if you believe Dave
Patterson).
lib/Target/X86/X86InstrBuilder.h: Add some comments.
test/Regression/Jello/test-loadstore.ll: Let main return int 0.
llvm-svn: 4999
2002-12-13 09:28:50 +00:00
Brian Gaeke
44876fdee4
InstSelectSimple.cpp: Give promote32 a comment. Add initial
...
implementation of getReg() for arguments.
MachineCodeEmitter.cpp: Fix using EBP with index, scale and no
displacement (whew!) due to Chris.
Printer.cpp: Fix printing out index and scale in memory references.
llvm-svn: 4998
2002-12-13 07:56:18 +00:00
Chris Lattner
179519bf77
Implement getelementptr constant exprs
...
Implement ConstantPointerRefs
Treat long/ulongs as if they were integers. A hack, but an effective one
llvm-svn: 4995
2002-12-13 06:56:29 +00:00
Brian Gaeke
4e2c30d894
brg
...
InstSelectSimple.cpp: Add stub implementation of visitFreeInst.
Add comments that mention how we are failing to implement malloc/free.
Add initial implementation of visitAllocaInst.
X86TargetMachine.cpp: Include llvm/Transforms/Scalar.h.
Add LowerAllocations pass before instruction selection.
jello/Makefile: Add scalaropts.a.
llvm-svn: 4994
2002-12-13 06:46:31 +00:00
Chris Lattner
e791322602
Emit the right form of mod/rm mod field
...
llvm-svn: 4986
2002-12-13 05:05:05 +00:00
Chris Lattner
e600a4ebe8
Nicify a bit
...
llvm-svn: 4985
2002-12-13 05:04:37 +00:00
Chris Lattner
82f1580ee8
Fix encoding of CBW instruction
...
llvm-svn: 4983
2002-12-13 04:41:31 +00:00
Misha Brukman
4ef74c8079
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
862f3ef8bc
Moves now select correct opcode based on the data size.
...
llvm-svn: 4981
2002-12-13 04:24:53 +00:00
Chris Lattner
1176170c16
Remove extranous #include
...
llvm-svn: 4980
2002-12-13 04:12:24 +00:00
Chris Lattner
ec0bc92146
Rename MemArg* to Arg*
...
llvm-svn: 4979
2002-12-13 03:51:55 +00:00
Chris Lattner
343e4b1810
Make mem size an assert
...
Add mem size flags to all instructions using an imm
llvm-svn: 4978
2002-12-13 03:50:13 +00:00
Misha Brukman
2ef75daf78
This is supposed to provide correct size for datatypes. Supposedly.
...
llvm-svn: 4977
2002-12-13 02:13:15 +00:00
Misha Brukman
260dbc79fc
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
7b21678aed
Added the flag to mark instructions which are really 2-address instructions in
...
X86, but would be 3-address in any normail architecture.
llvm-svn: 4974
2002-12-12 23:19:11 +00:00
Brian Gaeke
5e91d38ecb
This checkin is brought to you by the brian gaeke allnighter fund.
...
(lib/Target/X86) InstSelectSimple.cpp:
Include llvm/DerivedTypes.h and iostream.
Refactor visitMul out into a wrapper around doMultiply(), so that we
can do multiplications on temporary values when we are doing
getelementptrs.
Refactor part of getReg out into makeAnotherReg, so that we can create
registers willy-nilly to hold temporary values, when we are doing
getelementptrs.
Add stub implementations of visitMallocInst and visitAllocaInst.
Add initial implementation of visitGetElementPtrInst.
In copyConstantToRegister:
We throw a *lot* of our asserts here. So, when we want to throw an
assert, print out to stderr whatever expr or whatever constant made
us barf.
Support copying ConstantPointerNull to register, using a move immediate
of zero.
Rename FLDr4 and FLDr8 to FLDr32 and FLDr64, so that they match the meanings
of the numbers in the other instruction names. All uses modified.
Teach visitCallInst to extract byte- and short-class return values
from subregs of EAX. Add a FIXME note about how we would do it for
float-class return values.
Add a FIXME note about how we would cast float to int and back.
X86InstrInfo.def:
Rename FLDr4 and FLDr8 to FLDr32 and FLDr64, so that they match the meanings
of the numbers in the other instruction names. All uses modified.
(tools/jello) GlobalVars.cpp:
Include iostream.
If we have to emit a floating-point constant to memory, gamble and use
the same method as for ints.
If we have to emit a ConstantPointerNull to memory, try using a "void *"
and "NULL".
Otherwise, if we are going to throw an assert, print out whatever constant
made us barf, first.
llvm-svn: 4973
2002-12-12 15:33:40 +00:00
Misha Brukman
1028ac46d6
'graph' is spelled without a 'c'.
...
Also added Statistic counters for NoAlias and MayAlias.
llvm-svn: 4972
2002-12-12 05:34:10 +00:00
Chris Lattner
c42ada2e5e
Remove #includes
...
llvm-svn: 4968
2002-12-12 03:47:27 +00:00
Vikram S. Adve
d9676ed983
External routines used to identify Cilk operations inserted by the
...
parallelization pass.
llvm-svn: 4965
2002-12-10 13:08:48 +00:00
Vikram S. Adve
c864ab1e33
This file implements the function DemoteRegToStack(), which takes a
...
virtual register computed by an Instruction& X and replaces it with
a slot in the stack frame, allocated via alloca.
llvm-svn: 4964
2002-12-10 13:07:58 +00:00
Vikram S. Adve
9a672d17ae
This file implements a pass that automatically parallelizes a program,
...
using the Cilk multi-threaded runtime system to execute parallel code.
The current version inserts too many sync() operations in the program
because it does not attempt to optimize their placement.
llvm-svn: 4962
2002-12-10 00:43:34 +00:00
Vikram S. Adve
775e51d87a
Iterator that enumerates the ProgramDependenceGraph (PDG) for a function,
...
i.e., enumerates all data and control dependences for the function.
llvm-svn: 4958
2002-12-08 14:13:19 +00:00
Vikram S. Adve
8975afdfc4
An explicit representation of dependence graphs, and a pass that
...
computes a dependence graph for data dependences on memory locations
using interprocedural Mod/Ref information.
llvm-svn: 4957
2002-12-08 13:26:29 +00:00
Chris Lattner
3552d79ac1
Namespacify more
...
llvm-svn: 4956
2002-12-08 06:01:34 +00:00
Chris Lattner
4f96aa450e
Add support to count the number of dynamic instructions executed by LLI
...
llvm-svn: 4955
2002-12-08 05:51:08 +00:00
Chris Lattner
3935d2b1ec
Add total instruction, bb, & function counts
...
llvm-svn: 4954
2002-12-07 23:24:24 +00:00
Chris Lattner
1ee7f8e6bb
Fix bug that was bugging bugpoint
...
llvm-svn: 4953
2002-12-07 21:27:16 +00:00
Chris Lattner
688ac5b723
Remove dead code
...
llvm-svn: 4952
2002-12-07 18:42:13 +00:00
Vikram S. Adve
04aee9478c
Two bug fixes:
...
(1) Make entries for Constant values in the ScalarMap.
(2) Set MOD bit for the node pointed to by the
argument of a free instruction.
llvm-svn: 4948
2002-12-06 21:17:10 +00:00
Vikram S. Adve
0d5559fdfb
Fix several related bugs in DSNode::mergeWith() caused by the
...
fact that the incoming nodes may be merged away at intermediate
steps. Use an extra level of indirection via DSNodeHandles
to track the nodes being merged. All this now happens in a
static helper function MergeNodes().
llvm-svn: 4947
2002-12-06 21:15:21 +00:00
Brian Gaeke
9cf5718665
Implement a lot of cast functionality (no FP or 64)
...
llvm-svn: 4944
2002-12-06 10:49:33 +00:00
Chris Lattner
c6509f487b
Fix bug: 2002-12-05-MissedConstProp.ll pointed out by Casey Carter
...
llvm-svn: 4935
2002-12-05 22:41:53 +00:00
Vikram S. Adve
bfff743897
Cute bug fix: when moving links from N to this, some links could have
...
been missed if node *this got merged away due to recursive merging!
Also, links were not moved correctly if a node is collapsed.
llvm-svn: 4933
2002-12-05 17:17:26 +00:00
Brian Gaeke
a4a10fe88b
Target/X86/Printer.cpp: Add sizePtr function, and use it instead of
...
" <SIZE> PTR " string when emitting assembly.
Target/X86/X86InstrInfo.def: Tidy up a bit:
Squashed everything down to 118 chars wide, wrapping lines so that
comment is at the same point on each line. Rename "NoImpRegs" as
"NoIR". (most instructions have NoImpRegs twice on a line, so this
saves 10 columns).
Also, annotate various instructions with flags for size of memory operand.
(MemArg16, MemArg32, MemArg64, etc.)
Target/X86/X86InstrInfo.h: Define flags for size of memory operand.
(MemArg16, MemArg32, MemArg64, etc.)
llvm-svn: 4932
2002-12-05 08:30:40 +00:00
Misha Brukman
160a3da184
Added code generation for function prologues and epilogues.
...
llvm-svn: 4930
2002-12-04 23:58:08 +00:00
Misha Brukman
83e62f14dd
Implemented functions for emitting prologues and epilogues;
...
removed EBP from the list of callee-saved registers (it isn't one).
llvm-svn: 4929
2002-12-04 23:57:03 +00:00
Misha Brukman
ab2ffedb38
Added push and pop instructions.
...
llvm-svn: 4928
2002-12-04 23:56:26 +00:00
Chris Lattner
e21336000b
Fix handling of function calls that return void
...
llvm-svn: 4925
2002-12-04 23:50:28 +00:00
Chris Lattner
4859c65d48
Implement initial support for return values from call instructions
...
llvm-svn: 4924
2002-12-04 23:45:28 +00:00
Misha Brukman
dbb7b65bf3
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
Misha Brukman
81c7a3a84c
Adjust the stack pointer after a function call, proportional to the number of
...
arguments pushed onto the stack.
llvm-svn: 4922
2002-12-04 19:22:53 +00:00
Misha Brukman
dfa9cfa67f
Added instructions to add/subtract imm32 to/from a reg32.
...
llvm-svn: 4921
2002-12-04 19:15:22 +00:00
Chris Lattner
fb8032dc84
Fix bogus assertion failures
...
llvm-svn: 4919
2002-12-04 17:32:52 +00:00
Chris Lattner
8d79e5c9d9
Avoid bad assertion
...
llvm-svn: 4918
2002-12-04 17:28:40 +00:00
Chris Lattner
82cc643401
Remove think-o assertion
...
llvm-svn: 4917
2002-12-04 17:18:30 +00:00
Chris Lattner
ccf17c6564
Avoid crashing on Arguments, just silently miscompile
...
llvm-svn: 4916
2002-12-04 17:15:34 +00:00
Misha Brukman
1af9bebcda
storeReg2RegOffset() and loadRegOffset2Reg() now take the iterator by value
...
instead of by reference, since they return the modified iterator.
llvm-svn: 4914
2002-12-04 17:14:13 +00:00
Misha Brukman
0d28502c32
Moved buildReg2RegClassMap() into from X86RegisterInfo to MRegisterInfo, since
...
it is target-independent.
llvm-svn: 4911
2002-12-04 16:47:04 +00:00
Chris Lattner
7b1ec5ed3a
Add a "Lazy Function Resolution in Jello" section
...
Remove some todo's
llvm-svn: 4910
2002-12-04 16:12:54 +00:00
Chris Lattner
bc98081090
Fix a bug I introduced in a previous change
...
llvm-svn: 4909
2002-12-04 06:56:56 +00:00
Chris Lattner
6425a502a6
Add support for referencing global variables/functions
...
llvm-svn: 4907
2002-12-04 06:45:19 +00:00
Chris Lattner
57f055f2f2
Print out direct global references
...
llvm-svn: 4906
2002-12-04 06:44:41 +00:00
Misha Brukman
a8ad93221a
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
Misha Brukman
d9522256d3
Added support for callee- and caller-save registers.
...
llvm-svn: 4897
2002-12-03 23:11:21 +00:00
Chris Lattner
64261741c7
Fix broken ret opcode, grr...
...
llvm-svn: 4895
2002-12-03 22:50:02 +00:00
Chris Lattner
bddc6dc5ad
Checkin debug implementation of MCE
...
llvm-svn: 4893
2002-12-03 20:56:42 +00:00
Chris Lattner
645b7548bf
Fix instsel for calls
...
llvm-svn: 4891
2002-12-03 20:30:12 +00:00
Chris Lattner
5e05817565
Simplify code
...
llvm-svn: 4886
2002-12-03 19:40:16 +00:00
Chris Lattner
f4c0811faa
Fix big bug introduced with symbol table changes
...
llvm-svn: 4885
2002-12-03 18:32:30 +00:00
Chris Lattner
6a0874071b
Fix the build
...
llvm-svn: 4884
2002-12-03 18:15:59 +00:00
Brian Gaeke
b676857358
brg
...
Add support for cast ... to bool in visitCastInst (it's a start, anyways...)
llvm-svn: 4883
2002-12-03 07:36:03 +00:00
Chris Lattner
8052f8006b
Split the machine code emitter completely out of the printer
...
llvm-svn: 4882
2002-12-03 06:34:06 +00:00
Chris Lattner
0d80874f6c
* Move information about Implicit Defs/Uses into X86InstrInfo.def.
...
* Expose information about implicit defs/uses of register through the
MachineInstrInfo.h file.
llvm-svn: 4877
2002-12-03 05:42:53 +00:00