Commit Graph

2671 Commits

Author SHA1 Message Date
Chris Lattner
920536333c Insert phi code at top of block
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5015 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 11:52:34 +00:00
Brian Gaeke
992447f91b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5014 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 11:39:18 +00:00
Misha Brukman
972b03fa53 This should be more correct: invalidates physical registers that are used in
an instruction to avoid using them to allocate to other virtual registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5013 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 11:33:22 +00:00
Chris Lattner
7d25589ee1 Implement cast bool to X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5012 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 11:31:59 +00:00
Brian Gaeke
71794c0069 Rename all BMI MachineBasicBlock operands to MBB.
Try to mess around with emitGEPOperation's elementSizeReg to make it work,
again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5011 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 11:22:48 +00:00
Chris Lattner
f08ad9f817 Finish up iterator stuph
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5009 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 10:50:40 +00:00
Misha Brukman
fa18ade05b Treat longs as ints => pretend they're all 32-bit values and squeeze them into
32-bit registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5008 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 10:43:09 +00:00
Misha Brukman
59b3eedf31 Fixed bug with running out of registers. Also, reinstated namespace which
disappeared during the last checkin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5007 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 10:42:31 +00:00
Chris Lattner
333b2fa560 Code gen phi's correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5004 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 10:09:43 +00:00
Chris Lattner
3faae2dbc2 Print X86 PHI nodes in a sane manner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5003 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 09:59:26 +00:00
Misha Brukman
203b769b20 This should handle register allocating PHI nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5002 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 09:54:36 +00:00
Misha Brukman
2b46e8eccc Added moveReg2Reg() and moveImm2Reg() to accomodate moving data around due to
PHI nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5001 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 09:54:12 +00:00
Brian Gaeke
ed6902ca89 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4999 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 09:28:50 +00:00
Brian Gaeke
95780cccef 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4998 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 07:56:18 +00:00
Chris Lattner
c0812d8f39 Implement getelementptr constant exprs
Implement ConstantPointerRefs
Treat long/ulongs as if they were integers.  A hack, but an effective one


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4995 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 06:56:29 +00:00
Brian Gaeke
e48ec018a5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4994 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 06:46:31 +00:00
Chris Lattner
2067184b42 Emit the right form of mod/rm mod field
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4986 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 05:05:05 +00:00
Chris Lattner
276867de18 Nicify a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4985 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 05:04:37 +00:00
Chris Lattner
b1224f2d0b Fix encoding of CBW instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4983 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 04:41:31 +00:00
Misha Brukman
cea2245f04 Start allocating stack space at [ebp-4] to not overwrite the return address.
Also make all loads & stores 4-byte aligned for performance. ;)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4982 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 04:34:02 +00:00
Misha Brukman
07e376bd0d Moves now select correct opcode based on the data size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4981 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 04:24:53 +00:00
Chris Lattner
95b12ba775 Remove extranous #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4980 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 04:12:24 +00:00
Chris Lattner
a0f38c867c Rename MemArg* to Arg*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4979 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 03:51:55 +00:00
Chris Lattner
a6a382c5ca Make mem size an assert
Add mem size flags to all instructions using an imm


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4978 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 03:50:13 +00:00
Misha Brukman
5000e43809 This is supposed to provide correct size for datatypes. Supposedly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4977 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-13 02:13:15 +00:00
Misha Brukman
d1bedcced2 Take advantage of our knowledge of 2-address X86 instructions and
register-allocated them appropriately.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4976 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-12 23:20:31 +00:00
Misha Brukman
9f32791fe7 Added the flag to mark instructions which are really 2-address instructions in
X86, but would be 3-address in any normail architecture.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4974 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-12 23:19:11 +00:00
Brian Gaeke
20244b7e2c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4973 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-12 15:33:40 +00:00
Misha Brukman
f4445dfcb7 'graph' is spelled without a 'c'.
Also added Statistic counters for NoAlias and MayAlias.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4972 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-12 05:34:10 +00:00
Chris Lattner
3fc46450b7 Remove #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4968 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-12 03:47:27 +00:00
Vikram S. Adve
d86deb689b External routines used to identify Cilk operations inserted by the
parallelization pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4965 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-10 13:08:48 +00:00
Vikram S. Adve
83e3b6503d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4964 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-10 13:07:58 +00:00
Vikram S. Adve
e12c74c07b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4962 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-10 00:43:34 +00:00
Vikram S. Adve
0d4f76637d Iterator that enumerates the ProgramDependenceGraph (PDG) for a function,
i.e., enumerates all data and control dependences for the function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4958 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-08 14:13:19 +00:00
Vikram S. Adve
96b21c1054 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4957 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-08 13:26:29 +00:00
Chris Lattner
138b0cd7da Namespacify more
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4956 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-08 06:01:34 +00:00
Chris Lattner
bbdabce1e9 Add support to count the number of dynamic instructions executed by LLI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4955 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-08 05:51:08 +00:00
Chris Lattner
a1af8bd72b Add total instruction, bb, & function counts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4954 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-07 23:24:24 +00:00
Chris Lattner
ac8d4d9d59 Fix bug that was bugging bugpoint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4953 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-07 21:27:16 +00:00
Chris Lattner
342d1826fb Remove dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4952 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-07 18:42:13 +00:00
Vikram S. Adve
bac0622ef9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4948 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-06 21:17:10 +00:00
Vikram S. Adve
2b7a92c72f 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4947 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-06 21:15:21 +00:00
Brian Gaeke
d474e9cdce Implement a lot of cast functionality (no FP or 64)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4944 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-06 10:49:33 +00:00
Chris Lattner
c736d56562 Fix bug: 2002-12-05-MissedConstProp.ll pointed out by Casey Carter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4935 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-05 22:41:53 +00:00
Vikram S. Adve
c102cb7359 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4933 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-05 17:17:26 +00:00
Brian Gaeke
86764d778e 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.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4932 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-05 08:30:40 +00:00
Misha Brukman
dd46e2a81d Added code generation for function prologues and epilogues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4930 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 23:58:08 +00:00
Misha Brukman
2adb3959f6 Implemented functions for emitting prologues and epilogues;
removed EBP from the list of callee-saved registers (it isn't one).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4929 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 23:57:03 +00:00
Misha Brukman
1f283ef3e5 Added push and pop instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4928 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 23:56:26 +00:00
Chris Lattner
4fa1acc945 Fix handling of function calls that return void
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4925 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 23:50:28 +00:00