Commit Graph

7946 Commits

Author SHA1 Message Date
Scott Michel e4d3e3c0e7 Forward progress: crtbegin.c now compiles successfully!
Fixed CellSPU's A-form (local store) address mode, so that all globals,
externals, constant pool and jump table symbols are now wrapped within
a SPUISD::AFormAddr pseudo-instruction. This now identifies all local
store memory addresses, although it requires a bit of legerdemain during
instruction selection to properly select loads to and stores from local
store, properly generating "LQA" instructions.

Also added mul_ops.ll test harness for exercising integer multiplication.

llvm-svn: 46142
2008-01-17 20:38:41 +00:00
Chris Lattner 1ea55cf816 This commit changes:
1. Legalize now always promotes truncstore of i1 to i8. 
2. Remove patterns and gunk related to truncstore i1 from targets.
3. Rename the StoreXAction stuff to TruncStoreAction in TLI.
4. Make the TLI TruncStoreAction table a 2d table to handle from/to conversions.
5. Mark a wide variety of invalid truncstores as such in various targets, e.g.
   X86 currently doesn't support truncstore of any of its integer types.
6. Add legalize support for truncstores with invalid value input types.
7. Add a dag combine transform to turn store(truncate) into truncstore when
   safe.

The later allows us to compile CodeGen/X86/storetrunc-fp.ll to:

_foo:
	fldt	20(%esp)
	fldt	4(%esp)
	faddp	%st(1)
	movl	36(%esp), %eax
	fstps	(%eax)
	ret

instead of:

_foo:
	subl	$4, %esp
	fldt	24(%esp)
	fldt	8(%esp)
	faddp	%st(1)
	fstps	(%esp)
	movl	40(%esp), %eax
	movss	(%esp), %xmm0
	movss	%xmm0, (%eax)
	addl	$4, %esp
	ret

llvm-svn: 46140
2008-01-17 19:59:44 +00:00
Chris Lattner 72733e573b * Introduce a new SelectionDAG::getIntPtrConstant method
and switch various codegen pieces and the X86 backend over
  to using it.

* Add some comments to SelectionDAGNodes.h

* Introduce a second argument to FP_ROUND, which indicates
  whether the FP_ROUND changes the value of its input. If
  not it is safe to xform things like fp_extend(fp_round(x)) -> x.

llvm-svn: 46125
2008-01-17 07:00:52 +00:00
Duncan Sands 32b0ff6814 Trampoline support for x86-64. This looks like
it should work, but I have no machine to test
it on.  Committed because it will at least
cause no harm, and maybe someone can test it
for me!

llvm-svn: 46098
2008-01-16 22:55:25 +00:00
Chris Lattner e8bb9f2190 make it more clear that this predicate only applies to scalar FP types.
llvm-svn: 46058
2008-01-16 06:24:21 +00:00
Chris Lattner 14e616ef0b introduce a isTypeInSSEReg predicate, which allows us to simplify
some code.  No functionality change.

llvm-svn: 46055
2008-01-16 06:19:45 +00:00
Chris Lattner 8f7cec859e My previous commit had an incomplete message, it should have been:
make the 'fp return in ST(0)' optimization smart enough to
look through token factor nodes.  THis allows us to compile 
testcases like CodeGen/X86/fp-stack-retcopy.ll into:

_carg:
	subl	$12, %esp
	call	L_foo$stub
	fstpl	(%esp)
	fldl	(%esp)
	addl	$12, %esp
	ret

instead of:

_carg:
	subl	$28, %esp
	call	L_foo$stub
	fstpl	16(%esp)
	movsd	16(%esp), %xmm0
	movsd	%xmm0, 8(%esp)
	fldl	8(%esp)
	addl	$28, %esp
	ret

Still not optimal, but much better and this is a trivial patch.  Fixing 
the rest requires invasive surgery that is is not llvm 2.2 material.

llvm-svn: 46054
2008-01-16 05:56:59 +00:00
Chris Lattner ea001f1db7 make the 'fp return in ST(0)' optimization smart enough to
look through token factor

llvm-svn: 46053
2008-01-16 05:53:06 +00:00
Chris Lattner de5c74f18e various whitespace cleanups, no functionality change.
llvm-svn: 46052
2008-01-16 05:52:18 +00:00
Dale Johannesen 00dfb551cc Missed file from previous checkin.
llvm-svn: 46030
2008-01-15 23:25:27 +00:00
Dale Johannesen 59a2250b0d Fix and enable EH for x86-64 Darwin. Adds
ShortenEHDataFor64Bits as a not-very-accurate
abstraction to cover all the changes in DwarfWriter.
Some cosmetic changes to Darwin assembly code for
gcc testsuite compatibility.

llvm-svn: 46029
2008-01-15 23:24:56 +00:00
Chris Lattner 8e07533f20 If someone wants to implement ppc TRAP, they can go for it :)
llvm-svn: 46019
2008-01-15 22:15:02 +00:00
Chris Lattner 9a249b0ce5 rename SDTRet -> SDTNone.
Move definition of 'trap' sdnode up from x86 instrinfo to targetselectiondag.td.

llvm-svn: 46017
2008-01-15 22:02:54 +00:00
Owen Anderson 1ba66e0cec Remove DefInst from LiveVariables::VarInfo. Use the facilities on MachineRegisterInfo instead.
llvm-svn: 46016
2008-01-15 22:02:46 +00:00
Chris Lattner 3c3fefde06 no need to expand ISD::TRAP to X86ISD::TRAP, just match ISD::TRAP.
llvm-svn: 46015
2008-01-15 21:58:22 +00:00
Anton Korobeynikov 59e6d533bd Fix JIT encoding of trap/ud2 instruction
llvm-svn: 46012
2008-01-15 21:40:02 +00:00
Anton Korobeynikov 6bbbc4cbfa For PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
as well as PPC codegen

llvm-svn: 46001
2008-01-15 07:02:33 +00:00
Evan Cheng 4d70ba3134 Rename CCIfStruct to CCIfByVal and CCStructAssign to CCPassByVal. Remove unused parameters of CCStructAssign and add size and alignment requirement info.
llvm-svn: 45997
2008-01-15 03:34:58 +00:00
Evan Cheng 48bdfe63e2 Both x86-32 and x86-64 handle byval parameter attributes.
llvm-svn: 45996
2008-01-15 03:15:41 +00:00
Chris Lattner 3c43efc9d1 Improve the FP stackifier to decide all on its own whether
an instruction kills a register or not.  This is cheap and 
easy to do now that instructions record this on their flags,
and this eliminates the second pass of LiveVariables from the
x86 backend.  This speeds up a release llc by ~2.5%.

llvm-svn: 45955
2008-01-14 06:41:29 +00:00
Duncan Sands 51fe7bbcf5 Whitespace tweak.
llvm-svn: 45940
2008-01-13 21:20:29 +00:00
Chris Lattner ca7faf6faa improve cygwin compatibility, patch by Sam Bishop
llvm-svn: 45917
2008-01-12 22:54:07 +00:00
Chris Lattner afb514a7b4 clarify a note
llvm-svn: 45914
2008-01-12 18:58:46 +00:00
Evan Cheng f755ff7be3 Indirect call with byval parameter requires a cast first.
llvm-svn: 45911
2008-01-12 18:53:07 +00:00
Chris Lattner 459dc52df4 Add support for NetBSD, patch by Krister Walfridsson!
llvm-svn: 45902
2008-01-12 06:46:09 +00:00
Evan Cheng 7411b510b2 Code clean up.
llvm-svn: 45898
2008-01-12 01:08:07 +00:00
Chris Lattner 18df33d0c8 fix a wordo that gordon noticed :)
llvm-svn: 45896
2008-01-12 00:53:16 +00:00
Chris Lattner 6da61c2515 Any x86 instruction that reads from an invariant location is invariant.
This allows us to sink things like:
	cvtsi2sd	32(%esp), %xmm1
when reading from the argument area, for example.

llvm-svn: 45895
2008-01-12 00:35:08 +00:00
Evan Cheng b51d228e79 More cbe byval fixes.
llvm-svn: 45891
2008-01-11 23:10:11 +00:00
Scott Michel a8f67e04bd More CellSPU refinements:
- struct_2.ll: Completely unaligned load/store testing

- call_indirect.ll, struct_1.ll: Add test lines to exercise
   X-form [$reg($reg)] addressing

At this point, loads and stores should be under control (he says
in an optimistic tone of voice.)

llvm-svn: 45882
2008-01-11 21:01:19 +00:00
Chris Lattner 596875118c rename MachineInstr::setInstrDescriptor -> setDesc
llvm-svn: 45871
2008-01-11 18:10:50 +00:00
Chris Lattner 806dd0e2ac remove xchg and shift-reg-by-1 instructions, which are dead.
llvm-svn: 45870
2008-01-11 18:00:50 +00:00
Chris Lattner ff5998e66b add a note, remove a done deed.
llvm-svn: 45869
2008-01-11 18:00:13 +00:00
Arnold Schwaighofer 06da9e2d43 hrm - correct spelling.
Actually were not riding any arguments. Sadly there is no semantic spell checker that is going to safe you from such a mistake.

llvm-svn: 45868
2008-01-11 17:10:15 +00:00
Arnold Schwaighofer 6cf72fbbaf Improve tail call optimized call's argument lowering. Before this
commit all arguments where moved to the stack slot where they would
reside on a normal function call before the lowering to the tail call
stack slot. This was done to prevent arguments overwriting each other.
Now only arguments sourcing from a FORMAL_ARGUMENTS node or a
CopyFromReg node with virtual register (could also be a caller's
argument) are lowered indirectly.

 --This line, and those below, will be ignored--

M    X86/X86ISelLowering.cpp
M    X86/README.txt

llvm-svn: 45867
2008-01-11 16:49:42 +00:00
Arnold Schwaighofer bf1816ea7b Correct a copy and paste error.
llvm-svn: 45865
2008-01-11 14:34:56 +00:00
Evan Cheng ef5285ef88 Some C backend ByVal parameter attribute support. Not yet complete.
llvm-svn: 45864
2008-01-11 09:12:49 +00:00
Evan Cheng 8c51394e01 Rename Int_CVTSI642SSr* to Int_CVTSI2SS64r* for naming consistency and remove unused instructions.
llvm-svn: 45861
2008-01-11 07:37:44 +00:00
Chris Lattner 9283173061 more flags set right
llvm-svn: 45860
2008-01-11 07:18:17 +00:00
Chris Lattner f4b0c99d63 add some missing flags.
llvm-svn: 45859
2008-01-11 06:59:07 +00:00
Chris Lattner 87b0c13104 add some notes.
llvm-svn: 45854
2008-01-11 06:17:47 +00:00
Evan Cheng aaef8ce856 A couple of obvious off-by-one bugs.
llvm-svn: 45852
2008-01-11 03:07:46 +00:00
Scott Michel 8d5841ae3c More CellSPU refinement and progress:
- Cleaned up custom load/store logic, common code is now shared [see note
  below], cleaned up address modes

- More test cases: various intrinsics, structure element access (load/store
  test), updated target data strings, indirect function calls.

Note: This patch contains a refactoring of the LoadSDNode and StoreSDNode
structures: they now share a common base class, LSBaseSDNode, that
provides an interface to their common functionality. There is some hackery
to access the proper operand depending on the derived class; otherwise,
to do a proper job would require finding and rearranging the SDOperands
sent to StoreSDNode's constructor. The current refactor errs on the
side of being conservatively and backwardly compatible while providing
functionality that reduces redundant code for targets where loads and
stores are custom-lowered.

llvm-svn: 45851
2008-01-11 02:53:15 +00:00
Dale Johannesen 193daf0698 Weak zeroes don't go in bss on Darwin.
llvm-svn: 45849
2008-01-11 01:59:45 +00:00
Dale Johannesen 2ff66f08f2 Weak things initialized to 0 don't go in bss on Darwin.
Cosmetic changes to spacing to match gcc (some dejagnu
tests actually care).

llvm-svn: 45848
2008-01-11 00:54:37 +00:00
Chris Lattner c8226f32e9 Simplify the side effect stuff a bit more and make licm/sinking
both work right according to the new flags.

This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad. 

It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags.  Now the clients
can decide everything they need.

I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.

llvm-svn: 45843
2008-01-10 23:08:24 +00:00
Chris Lattner 8e60f2c996 IMPLICIT_USE and IMPLICIT_DEF are dead, remove them.
llvm-svn: 45838
2008-01-10 19:27:54 +00:00
Chris Lattner 1d07b65add add a note
llvm-svn: 45837
2008-01-10 18:25:41 +00:00
Duncan Sands 53c954fa86 Output sinl for a long double FSIN node, not sin.
Likewise fix up a bunch of other libcalls.  While
there I remove NEG_F32 and NEG_F64 since they are
not used anywhere.  This fixes 9 Ada ACATS failures.

llvm-svn: 45833
2008-01-10 10:28:30 +00:00
Chris Lattner 317332fc2a Start inferring side effect information more aggressively, and fix many bugs in the
x86 backend where instructions were not marked maystore/mayload, and perf issues where
instructions were not marked neverHasSideEffects.  It would be really nice if we could
write patterns for copy instructions.

I have audited all the x86 instructions down to MOVDQAmr.  The flags on others and on
other targets are probably not right in all cases, but no clients currently use this
info that are enabled by default.

llvm-svn: 45829
2008-01-10 07:59:24 +00:00
Chris Lattner 2e38f2458c rename X86InstrX86-64.td -> X86Instr64bit.td
llvm-svn: 45826
2008-01-10 05:50:42 +00:00
Chris Lattner 520d4adad3 add SDNPSideEffect node property declaration
llvm-svn: 45825
2008-01-10 05:48:23 +00:00
Chris Lattner aca7ca3730 remove explicit sets of 'neverHasSideEffects' that can now be
inferred from the instr patterns.

llvm-svn: 45824
2008-01-10 05:45:39 +00:00
Chris Lattner 94de7bc3aa get def use info more correct.
llvm-svn: 45821
2008-01-10 05:12:37 +00:00
Chris Lattner c72335878d add SDNPMayLoad to the 'load' sdnode definition. This is enough to get all the x86
instructions (with patterns) that load memory marked, for example.

llvm-svn: 45818
2008-01-10 04:44:32 +00:00
Chris Lattner f171482a66 verify that the frame index is immutable before remat'ing (still disabled)
or being side-effect free.

llvm-svn: 45816
2008-01-10 04:16:31 +00:00
Evan Cheng a26552493b Mark byval parameter stack objects mutable for now.
llvm-svn: 45813
2008-01-10 02:24:25 +00:00
Dale Johannesen 7ecb3b79c7 Emit unused EH frames for weak definitions on Darwin,
because assembler/linker can't cope with weak absolutes.
PR 1880.

llvm-svn: 45811
2008-01-10 02:03:30 +00:00
Evan Cheng fead113fe0 Do not use the stack pointer directly, issue a copyfromreg instead. Otherwise we can end up with something like ADD32ri %esp, x which two-address pass won't like.
llvm-svn: 45798
2008-01-10 00:37:26 +00:00
Chris Lattner ec79bba97f Fix PR1845 and rdar://5676945. Generic vectors smaller
than hardware supported type will be scalarized, so we
can infer their alignment from that info.

We now codegen pr1845 into:

_boolVectorSelect:
	lbz r2, 0(r3)
	stb r2, -16(r1)
	blr 

llvm-svn: 45796
2008-01-10 00:30:57 +00:00
Evan Cheng 73d1017871 Remove comments that do not correspond to anything after recent refactoring.
llvm-svn: 45792
2008-01-10 00:09:10 +00:00
Chris Lattner 9129f51f9b add a testcase
llvm-svn: 45768
2008-01-09 00:37:18 +00:00
Chris Lattner 45e5032b1d add a note
llvm-svn: 45766
2008-01-09 00:17:57 +00:00
Duncan Sands bb956ca730 Use size_t to store Pos, avoid truncating value
on 64-bit builds.  Analysis and original patch
by Török Edwin.  Code audit found another place
with the same problem, also fixed here.

llvm-svn: 45746
2008-01-08 10:06:15 +00:00
Chris Lattner 89f36e6b21 Finally implement correct ordered comparisons for PPC, even though
the code generated is not wonderful.  This turns a miscompilation into
a code quality bug (noted in the ppc readme).  This fixes PR642, which
is over 2 years old (!).  Nate, please review this.

llvm-svn: 45742
2008-01-08 06:46:30 +00:00
Evan Cheng 00300ddff1 Minor fix to enable x86-64 pic jit (still fails for other reasons).
llvm-svn: 45734
2008-01-08 02:07:10 +00:00
Evan Cheng 4951da49aa Fix a x86-64 static codegen bug. This fixes a lot of x86-64 jit failures.
llvm-svn: 45733
2008-01-08 02:06:11 +00:00
Bill Wendling 3b6fe5fa8d Silence warning about loss of precision.
llvm-svn: 45731
2008-01-08 00:52:29 +00:00
Evan Cheng 7250120177 Only mark instructions that load a single value without extension as isSimpleLoad = 1.
llvm-svn: 45727
2008-01-07 23:56:57 +00:00
Chris Lattner ba734518c1 add a new bit.
llvm-svn: 45726
2008-01-07 23:16:55 +00:00
Evan Cheng 8242168ef4 Unbreak x86-64.
llvm-svn: 45725
2008-01-07 23:08:23 +00:00
Chris Lattner ef81aa75f6 add a note that is important for some fp apps.
llvm-svn: 45723
2008-01-07 21:59:58 +00:00
Chris Lattner 730d088be1 possible switch lowering improvement.
llvm-svn: 45720
2008-01-07 21:38:14 +00:00
Duncan Sands d19a6f4836 Add missing newline at EOF.
llvm-svn: 45712
2008-01-07 19:13:36 +00:00
Duncan Sands d8d4170f84 Unbreak x86-32 darwin long double!
llvm-svn: 45703
2008-01-07 16:36:38 +00:00
Duncan Sands 28bf7ac219 Fix long double support on x86-32 linux.
llvm-svn: 45701
2008-01-07 13:44:22 +00:00
Bill Wendling a3bdad153f Operand 1 should be a register. We don't care if it's a preg, vreg, or 0.
llvm-svn: 45699
2008-01-07 08:05:29 +00:00
Chris Lattner d7857eafd0 add a note
llvm-svn: 45698
2008-01-07 07:46:23 +00:00
Chris Lattner 03ad885039 rename TargetInstrDescriptor -> TargetInstrDesc.
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.

llvm-svn: 45695
2008-01-07 07:27:27 +00:00
Chris Lattner e99a6caee4 Rename all the M_* flags to be namespace qualified enums, and switch
all clients over to using predicates instead of these flags directly.
These are now private values which are only to be used to statically
initialize the tables.

llvm-svn: 45692
2008-01-07 06:42:05 +00:00
Chris Lattner d004f54155 use predicate.
llvm-svn: 45691
2008-01-07 06:37:29 +00:00
Chris Lattner f376c99ea0 rename hasVariableOperands() -> isVariadic(). Add some comments.
Evan, please review the comments I added to getNumDefs to make sure
that they are accurate, thx.

llvm-svn: 45687
2008-01-07 05:19:29 +00:00
Chris Lattner 8c69898157 remove a dead field.
llvm-svn: 45685
2008-01-07 04:57:42 +00:00
Chris Lattner 6077962101 no need to explicitly clear these fields.
llvm-svn: 45683
2008-01-07 04:55:09 +00:00
Chris Lattner b0d06b4381 Move a bunch more accessors from TargetInstrInfo to TargetInstrDescriptor
llvm-svn: 45680
2008-01-07 03:13:06 +00:00
Chris Lattner f0f438a517 remove MachineOpCode typedef.
llvm-svn: 45679
2008-01-07 02:48:55 +00:00
Chris Lattner e55e115616 Add predicates methods to TargetOperandInfo, and switch all clients
over to using them, instead of diddling Flags directly.  Change the
various flags from const variables to enums.

llvm-svn: 45677
2008-01-07 02:39:19 +00:00
Chris Lattner a98c679de0 Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
that it is cheap and efficient to get.

Move a variety of predicates from TargetInstrInfo into 
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around.  Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.

Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.

llvm-svn: 45674
2008-01-07 01:56:04 +00:00
Owen Anderson 2a3be7bb6c Move even more functionality from MRegisterInfo into TargetInstrInfo.
Some day I'll get it all moved over...

llvm-svn: 45672
2008-01-07 01:35:02 +00:00
Gordon Henriksen 5180e85675 Enabling the target-independent garbage collection infrastructure by hooking it
up to the various compiler pipelines.

This doesn't actually add support for any GC algorithms, which means it 
temporarily breaks a few tests. To be fixed shortly.

llvm-svn: 45669
2008-01-07 01:30:38 +00:00
Chris Lattner b296b0f1c1 The pic base can't be duplicated.
llvm-svn: 45668
2008-01-06 23:49:32 +00:00
Chris Lattner a4ce4f6987 rename isLoad -> isSimpleLoad due to evan's desire to have such a predicate.
llvm-svn: 45667
2008-01-06 23:38:27 +00:00
Chris Lattner 10324d0175 rename isStore -> mayStore to more accurately reflect what it captures.
llvm-svn: 45656
2008-01-06 08:36:04 +00:00
Chris Lattner a348f55ec6 Change the 'isStore' inferrer to look for 'SDNPMayStore'
instead of "ISD::STORE".  This allows us to mark target-specific dag
nodes as storing (such as ppc byteswap stores).  This allows us to remove
more explicit isStore flags from the .td files.

Finally, add a warning for when a .td file contains an explicit 
isStore and tblgen is able to infer it.

llvm-svn: 45654
2008-01-06 06:44:58 +00:00
Chris Lattner f4d55ec4e8 remove explicit isStore flags that are now inferrable.
llvm-svn: 45653
2008-01-06 05:55:01 +00:00
Chris Lattner e20f380fbf remove some isStore flags that are now inferred automatically.
llvm-svn: 45652
2008-01-06 05:53:26 +00:00
Bill Wendling 5fa2c64b78 Fix comment.
llvm-svn: 45638
2008-01-05 23:30:51 +00:00
Nate Begeman 22950d26f5 Remove an incorrect optimization that is performed correctly by
the target independent legalizer.

llvm-svn: 45631
2008-01-05 20:51:30 +00:00
Gordon Henriksen 9231958391 Refactoring the x86 and x86-64 calling convention implementations,
unifying the copied algorithms and saving over 500 LOC. There should
be no functionality change, but please test on your favorite x86
target.

llvm-svn: 45627
2008-01-05 16:56:59 +00:00
Bill Wendling be984cf10b Chris and Evan noticed that this check was compleatly fubared. I was
checking that there was a from a global instead of a load from the stub
for a global, which is the one that's safe to hoist.

Consider this program:

volatile char G[100];
int B(char *F, int N) {
  for (; N > 0; --N)
    F[N] = G[N];
}

In static mode, we shouldn't be hoisting the load from G:

$ llc -relocation-model=static -o - a.bc -march=x86 -machine-licm

LBB1_1: # bb.preheader
        leal    -1(%eax), %edx
        testl   %edx, %edx
        movl    $1, %edx
        cmovns  %eax, %edx
        xorl    %esi, %esi
LBB1_2: # bb
        movb    _G(%eax), %bl
        movb    %bl, (%ecx,%eax)

llvm-svn: 45626
2008-01-05 09:18:04 +00:00
Chris Lattner e0f0c4aa02 enable sinking and licm of loads from the argument area. I'd like to enable this
for remat, but can't due to an RA bug.

llvm-svn: 45623
2008-01-05 06:10:42 +00:00
Chris Lattner d4738ee8e1 simplify some code by using shorter accessors.
llvm-svn: 45622
2008-01-05 05:28:30 +00:00
Chris Lattner 86f4a2e4f2 revert my previous patch.
llvm-svn: 45621
2008-01-05 05:26:26 +00:00
Chris Lattner 69d7902cf1 factor some code better to avoid redundancy between
isReallySideEffectFree and isReallyTriviallyReMaterializable.  Why is a load from
a global considered side-effect-free but not rematable?

llvm-svn: 45620
2008-01-05 05:19:56 +00:00
Chris Lattner 9fa8ae6c6b getting the pic base has no side effects.
llvm-svn: 45618
2008-01-05 03:54:32 +00:00
Evan Cheng 880b080887 X86 JIT PIC jumptable support.
llvm-svn: 45616
2008-01-05 02:26:58 +00:00
Evan Cheng f55b7381af Combine MovePCtoStack + POP32r into one instruction MOVPC32r so it can be moved if needed.
llvm-svn: 45605
2008-01-05 00:41:47 +00:00
Owen Anderson 6bb0c52628 Move some more functionality from MRegisterInfo to TargetInstrInfo.
llvm-svn: 45603
2008-01-04 23:57:37 +00:00
Evan Cheng c1d1e54fc4 Unbreak tailcall opt in JIT.
llvm-svn: 45576
2008-01-04 10:50:28 +00:00
Evan Cheng 49ff8ecd03 X86 PIC JIT support fixes: encoding bugs, add lazy pointer stubs support.
llvm-svn: 45575
2008-01-04 10:46:51 +00:00
Evan Cheng 2e1ba07f16 Correct order of parameters.
llvm-svn: 45562
2008-01-04 02:22:21 +00:00
Gordon Henriksen f066fc477c First steps in in X86 calling convention cleanup.
llvm-svn: 45536
2008-01-03 16:47:34 +00:00
Evan Cheng 563fcc3428 Change MachineRelocation::DoesntNeedFnStub to NeedStub. This fields will be used
for non-function GV relocations that require function address stubs (e.g. Mac OS X in non-static mode).

llvm-svn: 45527
2008-01-03 02:56:28 +00:00
Evan Cheng 96334b4e3b X86 PIC JIT bug fix: relocations for constantpool and jumptable.
llvm-svn: 45515
2008-01-02 23:38:59 +00:00
Bill Wendling e1f28e7871 Machine LICM will check that operands are defined outside of the loop. Also
check that register isn't 0 before going further.

llvm-svn: 45498
2008-01-02 21:10:40 +00:00
Chris Lattner cce79c67ca darwin9 and above support aligned common symbols.
llvm-svn: 45494
2008-01-02 19:44:55 +00:00
Chris Lattner dcbc0f3029 leopard and above support alignment for common symbols.
llvm-svn: 45493
2008-01-02 19:35:16 +00:00
Owen Anderson eee14601b1 Move some more instruction creation methods from RegisterInfo into InstrInfo.
llvm-svn: 45484
2008-01-01 21:11:32 +00:00
Chris Lattner b0fb17fd34 Fix a bug in my previous patch: refer to the impl not the pure virtual version. It's unclear why gcc would ever compile this...
llvm-svn: 45476
2008-01-01 01:05:34 +00:00
Chris Lattner 25568e4cef Fix a problem where lib/Target/TargetInstrInfo.h would include and use
a header file from libcodegen.  This violates a layering order: codegen
depends on target, not the other way around.  The fix to this is to 
split TII into two classes, TII and TargetInstrInfoImpl, which defines
stuff that depends on libcodegen.  It is defined in libcodegen, where 
the base is not.

llvm-svn: 45475
2008-01-01 01:03:04 +00:00
Owen Anderson 7a73ae9a86 Move copyRegToReg from MRegisterInfo to TargetInstrInfo. This is part of the
Machine-level API cleanup instigated by Chris.

llvm-svn: 45470
2007-12-31 06:32:00 +00:00
Chris Lattner a10fff51d9 Rename SSARegMap -> MachineRegisterInfo in keeping with the idea
that "machine" classes are used to represent the current state of
the code being compiled.  Given this expanded name, we can start 
moving other stuff into it.  For now, move the UsedPhysRegs and
LiveIn/LoveOuts vectors from MachineFunction into it.

Update all the clients to match.

This also reduces some needless #includes, such as MachineModuleInfo
from MachineFunction.

llvm-svn: 45467
2007-12-31 04:13:23 +00:00
Chris Lattner a5bb370aa4 Add new shorter predicates for testing machine operands for various types:
e.g. MO.isMBB() instead of MO.isMachineBasicBlock().  I don't plan on 
switching everything over, so new clients should just start using the 
shorter names.

Remove old long accessors, switching everything over to use the short
accessor: getMachineBasicBlock() -> getMBB(), 
getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc.

llvm-svn: 45464
2007-12-30 23:10:15 +00:00
Chris Lattner 6005589faf More cleanups for MachineOperand:
- Eliminate the static "print" method for operands, moving it
    into MachineOperand::print.
  - Change various set* methods for register flags to take a bool
    for the value to set it to.  Remove unset* methods.
  - Group methods more logically by operand flavor in MachineOperand.h

llvm-svn: 45461
2007-12-30 21:56:09 +00:00
Chris Lattner 5c4637816e Use MachineOperand::getImm instead of MachineOperand::getImmedValue. Likewise setImmedValue -> setImm
llvm-svn: 45453
2007-12-30 20:49:49 +00:00
Bill Wendling 7749a9014b If we have a load of a global address that's not modified during the
function, then go ahead and hoist it out of the loop. This is the result:

$ cat a.c
volatile int G;

int A(int N) {
  for (; N > 0; --N)
    G++;
}
$ llc -o - -relocation-model=pic
_A:
...
LBB1_2: # bb
        movl    L_G$non_lazy_ptr-"L1$pb"(%eax), %esi
        incl    (%esi)
        incl    %edx
        cmpl    %ecx, %edx
        jne     LBB1_2  # bb
...
$ llc -o - -relocation-model=pic -machine-licm
_A:
...
        movl    L_G$non_lazy_ptr-"L1$pb"(%eax), %eax
LBB1_2: # bb
        incl    (%eax)
        incl    %edx
        cmpl    %ecx, %edx
        jne     LBB1_2  # bb
...

I'm limiting this to the MOV32rm x86 instruction for now.

llvm-svn: 45444
2007-12-30 03:18:58 +00:00
Chris Lattner b3fd2d7b63 use simplified operand addition methods.
llvm-svn: 45437
2007-12-30 01:01:54 +00:00
Chris Lattner 4b762496a9 Shrinkify the machine operand creation method names.
llvm-svn: 45433
2007-12-30 00:45:46 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner a087a8d2ce remove attribution from lib Makefiles.
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Chris Lattner 4e6cbb2fe2 this is done.
llvm-svn: 45408
2007-12-29 19:38:02 +00:00
Chris Lattner d2b8a36f0e One readme entry is done, one is really easy (Evan, want to investigate
eliminating the llvm.x86.sse2.loadl.pd intrinsic?), one shuffle optzn
may be done (if shufps is better than pinsw, Evan, please review), and
we already know about LICM of simple instructions.

llvm-svn: 45407
2007-12-29 19:31:47 +00:00
Chris Lattner 3b6a82118b Fold comparisons against a constant nan, and optimize ORD/UNORD
comparisons with a constant.  This allows us to compile isnan to:

_foo:
	fcmpu cr7, f1, f1
	mfcr r2
	rlwinm r3, r2, 0, 31, 31
	blr 

instead of:

LCPI1_0:					;  float
	.space	4
_foo:
	lis r2, ha16(LCPI1_0)
	lfs f0, lo16(LCPI1_0)(r2)
	fcmpu cr7, f1, f0
	mfcr r2
	rlwinm r3, r2, 0, 31, 31
	blr 

llvm-svn: 45405
2007-12-29 08:37:08 +00:00
Chris Lattner 33de0c6e92 this xform is implemented.
llvm-svn: 45404
2007-12-29 08:19:39 +00:00
Chris Lattner 07ccbfa64a Codegen:
as:

_bar:
	pushl	%esi
	subl	$8, %esp
	movl	16(%esp), %esi
	call	L_foo$stub
	fstps	(%esi)
	addl	$8, %esp
	popl	%esi
	#FP_REG_KILL
	ret

instead of:

_bar:
	pushl	%esi
	subl	$8, %esp
	movl	16(%esp), %esi
	call	L_foo$stub
	fstpl	(%esi)
	cvtsd2ss	(%esi), %xmm0
	movss	%xmm0, (%esi)
	addl	$8, %esp
	popl	%esi
	#FP_REG_KILL
	ret

llvm-svn: 45401
2007-12-29 06:57:38 +00:00
Chris Lattner 8013bd339b avoid going through a stack slot to convert from fpstack to xmm reg
if we are just going to store it back anyway.  This improves things 
like:
double foo();
void bar(double *P) { *P = foo(); }

llvm-svn: 45399
2007-12-29 06:41:28 +00:00
Chris Lattner 62ba67c0f7 add a note
llvm-svn: 45397
2007-12-29 05:51:58 +00:00
Chris Lattner 7cafd92aa9 expand note.
llvm-svn: 45393
2007-12-29 01:05:01 +00:00
Chris Lattner 9d53b611d1 add a note.
llvm-svn: 45388
2007-12-28 22:30:05 +00:00
Chris Lattner d798002401 add a note.
llvm-svn: 45387
2007-12-28 21:50:40 +00:00
Chris Lattner 180f0e9044 add a note
llvm-svn: 45377
2007-12-28 04:42:05 +00:00
Chris Lattner 6c234bf58f add a simple hack
llvm-svn: 45343
2007-12-24 19:27:46 +00:00
Gordon Henriksen 84c7325ca1 Setting GlobalDirective in TargetAsmInfo by default rather than
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.

llvm-svn: 45338
2007-12-23 20:58:16 +00:00
Chris Lattner 00602f6105 fix some warnings. This code needs to be de-tabified :(
llvm-svn: 45325
2007-12-22 22:47:03 +00:00
Chris Lattner 91f3379660 fix strict-aliasing violation
llvm-svn: 45324
2007-12-22 22:45:38 +00:00
Anton Korobeynikov 1b1250770c Erm, really disable :)
llvm-svn: 45319
2007-12-22 20:46:24 +00:00
Anton Korobeynikov d34112a4ee Disable, until we'll really need it
llvm-svn: 45318
2007-12-22 20:41:12 +00:00
Evan Cheng 345a00ba05 Preliminary PIC JIT support for X86 (32-bit) / Darwin.
llvm-svn: 45313
2007-12-22 09:40:20 +00:00
Evan Cheng db33a0211b Oops.
llvm-svn: 45312
2007-12-22 09:14:34 +00:00
Evan Cheng f4f52dbc8c Fix JIT code emission of X86::MovePCtoStack.
llvm-svn: 45307
2007-12-22 02:26:46 +00:00