Commit Graph

57 Commits

Author SHA1 Message Date
Chris Lattner
d14d5b4223 Add support for unreachable and undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17074 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 02:42:42 +00:00
Brian Gaeke
8b6c1ff677 Rewrite emitCastOperation, refactoring parts of it into emitIntegerCast, and
adding emitFPToIntegerCast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16995 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-14 19:39:34 +00:00
Brian Gaeke
299b39d356 Fix assertion failure when calling or returning from a function which
returns 'bool' type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16884 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 20:34:17 +00:00
Brian Gaeke
50094edf96 Fix whitespace and wrap some long lines.
Deal with allocating stack space for outgoing args and copying them into the
correct stack slots (at least, we can copy <=32-bit int args).
We now correctly generate ADJCALLSTACK* instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16881 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 19:57:18 +00:00
Brian Gaeke
6672f86a4d I think this will handle double args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16618 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-30 19:44:32 +00:00
Brian Gaeke
1df468ea9b Simplify copyConstantToRegister() for longs, using a pair of recursive calls.
Copy constant-pool entries' addresses into registers before loading out of them,
to avoid errors from the assembler.
Handle loading call args past the 6th one off the stack.
Add IMPLICIT_DEF pseudo-instrs for double and long arguments passed in register
pairs.
Use FpMOVD to copy doubles around instead of the horrible store-load thing we
were doing before.
Handle 'ret double' and 'ret long'.
Fix a bug in handling 'and/or/xor long'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16577 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:34:41 +00:00
Brian Gaeke
f539ffe1b6 This file does not need <iostream>, I think.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16245 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-08 04:10:52 +00:00
Brian Gaeke
74dfcf1200 Back to compiling land for v8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16138 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-02 02:37:43 +00:00
Chris Lattner
7330248482 CPR fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14960 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 07:26:17 +00:00
Brian Gaeke
812c488f0a Do IMPLICIT_DEFs on incoming args' hard regs, to avoid confusing the regalloc.
Support single-fp incoming args.
Support single-fp outgoing args ('call' operands).
Support double-fp return values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14880 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 10:31:25 +00:00
Brian Gaeke
3a0858957a Support setcc on fp values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14687 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 09:08:35 +00:00
Brian Gaeke
ccdd70a5c0 Fix bug involving bool arguments to binary operators.
Fix typo in comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14684 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 08:08:10 +00:00
Brian Gaeke
2a9f539168 Fix bug in copying long constants to register pairs. We were getting
the top and bottom halves backwards...how embarrassing.
Support 'cast long to long' and other similar no-op casts to long.
Support 'ret long'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14683 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 07:52:13 +00:00
Brian Gaeke
f9a75460ee Support 'ret float'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14681 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 07:22:27 +00:00
Chris Lattner
38343f6cfe Add #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14625 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 17:19:21 +00:00
Misha Brukman
d2d5df207a Fix indentation to be 2 spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14512 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-30 22:11:03 +00:00
Misha Brukman
ea09126414 visitSetCondInst() takes a parameter of type `SetCondInst'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14508 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-30 21:47:40 +00:00
Brian Gaeke
ec3227fe39 Trim whitespace.
Support cast of ints (and narrower) to float and double.
Support cast double to double (using load and store).
Abort if we see a CallInst or SetCondInst with long/fp args, instead
of producing bad code.
Support add, sub, mul, div of float and double.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14440 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-27 22:47:33 +00:00
Brian Gaeke
495a0974f4 Support cast float to float, cast double to float, and cast float to double.
(It's not yet clear how to copy doubles from register to register.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14371 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 21:22:08 +00:00
Brian Gaeke
13dc433df3 Fix a dyn_cast in copyConstantToRegister which should have been a cast.
Compactify the code that emits copies of constant ints into registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14365 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 09:17:47 +00:00
Brian Gaeke
c7fd0f4675 Use correct add*Imm form in more BuildMI calls.
Fix bug in emitGEPOperation where we weren't passing MBB, IP to getReg.
(hey, wouldn't a constant expression lowering pass be cool? huh huhuhuh)
Fix bug in emitGEPOperation where we might try to OR a constant into a
register which was too big to fit in the immediate field.
Support and, or, xor of longs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14363 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 08:55:09 +00:00
Brian Gaeke
4473303453 Rename the load and store opcodes. The non-fp ones only have one
variant worth worrying about; the fp ones have two.
Stub out the case analysis of int-to-fp casts (no code yet).
I think the number of operands passed to BuildMI for loads was wrong.
Support load and store of float and double.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14360 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 07:36:48 +00:00
Brian Gaeke
7548a540f7 Strange as it may sound, we'll not use LDD/STD to store longs. For reasons of
representational consistency, we want to address the halves of each 64-bit value
separately.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14356 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 06:44:57 +00:00
Brian Gaeke
00e514ea6a Support constant cast expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14355 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 06:33:00 +00:00
Chris Lattner
3048373748 Move the IntrinsicLowering header into the CodeGen directory, as per PR346
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14266 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-20 07:49:54 +00:00
Brian Gaeke
cfaf22445c Make visitAllocaInst() look more like its X86 counterpart.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14229 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-18 08:45:52 +00:00
Brian Gaeke
9d67ea0b61 Support intrinsic calls (although no particular intrinsics are supported yet).
Support indirect calls.
Support returning a float value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14223 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-18 06:27:48 +00:00
Brian Gaeke
c93a75223d Support alloca instructions.
Support copying floating-point constants to registers.
Add assertion to visitCallInst to abort if we hit a NULL calledFunction, for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14216 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-18 05:19:16 +00:00
Brian Gaeke
6c868a4c17 Support generating machine instructions for Phi nodes (based on x86, but with
modifications for 1 LLVM BB --> many MBBs).
Fix store operand order: make it always be Base, Offset, SrcReg (think
"[ Base + Offset ] = SrcReg").
Rewrite visitBranchInst() to be even dumber (but working) -- give up on
the branch fallthrough trick, for the time being.
Make visitSetCondInst() work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14208 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-17 22:34:08 +00:00
Brian Gaeke
09c1309814 Use addGlobalAddress and addMBB for call & branch targets instead of addPCDisp.
Abort if we see a PCRelativeDisp MachineOperand, to be safe. This matches
the X86 backend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14202 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-17 19:39:23 +00:00
Chris Lattner
f70c22b019 Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-17 18:19:28 +00:00
Brian Gaeke
d6a1053745 Fix thinko in visitor... ShiftInsts should currently be delegated
to visitBinaryOperator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14182 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-15 21:09:46 +00:00
Brian Gaeke
e14e338724 Fix bug generating code for void call instructions: don't call
getReg() on void value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14178 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-15 20:06:32 +00:00
Brian Gaeke
9df92825e1 Support constant GEP expressions.
Support copying long constants to register pairs.
Support copying ConstantPointerNulls and ConstantPointerRefs to registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14175 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-15 19:16:07 +00:00
Brian Gaeke
429022bf83 Add support for widening integral casts.
Flesh out the SetCC support... which currently ends in a little bit
of unfinished code (which is probably completely hilarious) for
generating the condition value splitting the basic block up into 4
blocks, like this (clearly a better API is needed for this!):

       BB
   cond. branch
     /         /          R1=1    R2=0
     \      /
      \    /
    R=phi(R1,R2)

Other minor edits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13423 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 06:36:14 +00:00
Brian Gaeke
9f56482a43 Flesh out GEP support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13421 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 05:27:20 +00:00
Brian Gaeke
532e60c403 Add stub support for GEPs.
Add support for branches (based loosely on X86/InstSelectSimple).
Add support for not visiting phi nodes in the first pass.
Add support for loading bools.
Flesh out support for stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13418 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-08 04:21:17 +00:00
Brian Gaeke
e302a7eb43 Add support for copying bool constants to registers.
Disable the code that copies long constants to registers - it looks fishy.
Implement some simple casts: integral, smaller than longs, and equal-width
 or narrowing only.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13413 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-07 21:39:30 +00:00
Brian Gaeke
3d11e8a6d3 I started working on casts, but I don't have anything compilable yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12903 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-13 18:27:46 +00:00
Brian Gaeke
f3334ebbe3 First version of code to handle loads. Stub function for handling stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12758 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 17:29:37 +00:00
Brian Gaeke
562cb16381 Support loading arguments from %I0...%I5 into virtual registers in
function prologues, and fix an off-by-one in visitCallInst that was
putting call args into the wrong registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12757 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 17:04:09 +00:00
Brian Gaeke
d54c38b2f4 It's setting up the call args right now, but on the callee side, it's
trying to get incoming args off the stack, instead of the %i0...%i6 regs,
which is wrong.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12756 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 16:41:22 +00:00
Chris Lattner
4d0cda4d5c This is a start on handling setcc instructions. As the comment notes, we
have no good way of handling this until the code generator is improved.
We should probably just emit V9 instructions in the meantime.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12745 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 05:04:51 +00:00
Chris Lattner
0d538bbec2 Avoid emitting an extra copy on each 32-bit operation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12743 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:36:53 +00:00
Chris Lattner
4be7ca5721 Add support for shift instructions, wrap some long lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12740 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:27:16 +00:00
Chris Lattner
22ede709f6 Add a bunch more instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12737 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:06:46 +00:00
Brian Gaeke
2d4fa8faac Preliminary support for getting 64-bit integer constants into registers.
Preliminary support for division. It's gross because you have to initialize
the "Y" register, which is the top 32 bits of the thing you're dividing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12732 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:00:49 +00:00
Brian Gaeke
ea8494bb89 Deal with call return values.
Don't put NOPs in delay slots at all. We'll have a fix-up pass later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12725 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 22:09:23 +00:00
Brian Gaeke
f7e44ef8d5 Add support for call instructions (0-ary only for now).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12629 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-02 20:53:33 +00:00
Brian Gaeke
6d339f9000 Fix bug in zero-extending of shorts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12453 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-16 22:45:42 +00:00