Commit Graph

4811 Commits

Author SHA1 Message Date
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 eda9c79bbf Return success on success
llvm-svn: 5006
2002-12-13 10:13:45 +00:00
Chris Lattner 62ccf91463 Test more phi stuff
llvm-svn: 5005
2002-12-13 10:12:50 +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
Chris Lattner 34cd32d42a Final version of BuildMI for symmetry and because I want to use it
llvm-svn: 5000
2002-12-13 09:33:06 +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 a8d8e0d9dd Get rid of deprecated function
llvm-svn: 4997
2002-12-13 07:30:45 +00:00
Chris Lattner c93799b779 return 0 on success
llvm-svn: 4996
2002-12-13 06:57:24 +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 588806f5af getelementptr uses long instead of uint indexes
llvm-svn: 4993
2002-12-13 06:01:21 +00:00
Chris Lattner 295a415a31 Stop sucking
llvm-svn: 4992
2002-12-13 05:51:32 +00:00
Misha Brukman 999f5d6fb8 Making main() return 0 so that we know it ran successfully when it exits.
llvm-svn: 4991
2002-12-13 05:44:21 +00:00
Misha Brukman 3bbfca1401 Making main() return 0 to exit without error when no error actually occurs.
llvm-svn: 4990
2002-12-13 05:43:36 +00:00
Chris Lattner f243ce960a Fix testcase
llvm-svn: 4989
2002-12-13 05:42:57 +00:00
Chris Lattner 7ccef07786 Implement branches
llvm-svn: 4988
2002-12-13 05:40:28 +00:00
Chris Lattner 0a6e0562a3 Infinite loops, are, well, not good
llvm-svn: 4987
2002-12-13 05:28:50 +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
Misha Brukman 2a0baf1a2b This way it's easier to test: if the call to external exit(0) succeeded,
program exits with code 0, no error. If the call does not work/succeed, main
returns 1, so we notice it. The other way around doesn't work. :)

llvm-svn: 4984
2002-12-13 04:43:32 +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 eedcef4f92 Define the 2-address flag used by X86 instructions (add,sub,and,or,xor) that
need to be declared as such.

llvm-svn: 4975
2002-12-12 23:19:51 +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 c1ba0cddd6 Make a release build compile. This field is not really an enum, it's really a bitfield
llvm-svn: 4971
2002-12-12 05:31:26 +00:00
Misha Brukman 356163f48a ipa.a only needs to be mentioned once, and spaces should be used instead of
tabs for readability.

llvm-svn: 4970
2002-12-12 05:29:32 +00:00
Misha Brukman 0d19db3c34 No need to specify the class if the method is within the class declaration.
llvm-svn: 4969
2002-12-12 05:28:39 +00:00
Chris Lattner c42ada2e5e Remove #includes
llvm-svn: 4968
2002-12-12 03:47:27 +00:00
Chris Lattner 6307208258 Include tablegen
llvm-svn: 4967
2002-12-12 03:44:42 +00:00
Chris Lattner 5bd7897ac2 Fix header
llvm-svn: 4966
2002-12-12 03:43:30 +00:00