Commit Graph

2657 Commits

Author SHA1 Message Date
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
Chris Lattner
a324364f04 Implement initial support for return values from call instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4924 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 23:45:28 +00:00
Misha Brukman
06f8aecc88 Fun arithmetic with iterators aimed at fixing a bug: inserting instructions
after the *current* instruction while keeping the iterator in the same
'logical' place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4923 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 19:24:45 +00:00
Misha Brukman
0d2cf3a533 Adjust the stack pointer after a function call, proportional to the number of
arguments pushed onto the stack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4922 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 19:22:53 +00:00
Misha Brukman
a17a2ac727 Added instructions to add/subtract imm32 to/from a reg32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4921 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 19:15:22 +00:00
Chris Lattner
ac573f61b4 Fix bogus assertion failures
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4919 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 17:32:52 +00:00
Chris Lattner
6d66944388 Avoid bad assertion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4918 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 17:28:40 +00:00
Chris Lattner
93689114a5 Remove think-o assertion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4917 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 17:18:30 +00:00
Chris Lattner
d6c4cfab54 Avoid crashing on Arguments, just silently miscompile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4916 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 17:15:34 +00:00
Misha Brukman
a361c8417b storeReg2RegOffset() and loadRegOffset2Reg() now take the iterator by value
instead of by reference, since they return the modified iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4914 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 17:14:13 +00:00
Misha Brukman
0af0d5bd3e Moved buildReg2RegClassMap() into from X86RegisterInfo to MRegisterInfo, since
it is target-independent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4911 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 16:47:04 +00:00
Chris Lattner
504c411e81 Add a "Lazy Function Resolution in Jello" section
Remove some todo's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4910 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 16:12:54 +00:00
Chris Lattner
33ced56edb Fix a bug I introduced in a previous change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4909 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 06:56:56 +00:00
Chris Lattner
dbf30f7b02 Add support for referencing global variables/functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4907 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 06:45:19 +00:00
Chris Lattner
b72d221d61 Print out direct global references
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4906 91177308-0d34-0410-b5e6-96231b3b80d8
2002-12-04 06:44:41 +00:00