Commit Graph

12030 Commits

Author SHA1 Message Date
Evan Cheng 31d15fa093 Allow custom lowering of LOAD, EXTLOAD, ZEXTLOAD, STORE, and TRUNCSTORE. Not
currently used.

llvm-svn: 24988
2005-12-23 07:29:34 +00:00
Chris Lattner 55823ae03f fix something-o
llvm-svn: 24987
2005-12-23 07:08:39 +00:00
Chris Lattner 5427aab5f8 implement vaarg. Varargs now should work.
llvm-svn: 24986
2005-12-23 06:37:38 +00:00
Chris Lattner 5ee896aad9 implement vastart. The dag isel compiles this:
void test3(va_list Y);
void test2(int F, ...) {
  va_list X;
  va_start(X, F);
  test3(X);
}

into this:

test2:
        save -104, %o6, %o6
        st %i5, [%i6+88]
        st %i4, [%i6+84]
        st %i3, [%i6+80]
        st %i2, [%i6+76]
        st %i1, [%i6+72]
        add %i6, 72, %o0
        st %o0, [%i6+-4]
        call test3
        nop
        restore %g0, %g0, %g0
        retl
        nop

The simple isel emits:

test2:
        save -96, %o6, %o6
        st %i0, [%i6+68]
        st %i1, [%i6+72]
        st %i2, [%i6+76]
        st %i3, [%i6+80]
        st %i4, [%i6+84]
        st %i5, [%i6+88]
        or %g0, 1, %l0
        or %g0, 4, %l1
        umul %l0, %l1, %l0
        add %l0, 7, %l0
        and %l0, -8, %l0
        sub %o6, %l0, %o6
        add %o6, 96, %l0
        add %i6, 72, %l1
        st %l1, [%l0]
        ld [%l0], %o0
        call test3
        nop
        restore %g0, %g0, %g0
        retl
        nop

llvm-svn: 24985
2005-12-23 06:24:04 +00:00
Chris Lattner 6e6d5a1fa1 remove benchmark list, remove issues addressed by the dag-dag isel
llvm-svn: 24984
2005-12-23 06:09:30 +00:00
Chris Lattner 26943b9691 Simplify store(bitconv(x)) to store(x). This allows us to compile this:
void bar(double Y, double *X) {
  *X = Y;
}

to this:

bar:
        save -96, %o6, %o6
        st %i1, [%i2+4]
        st %i0, [%i2]
        restore %g0, %g0, %g0
        retl
        nop

instead of this:

bar:
        save -104, %o6, %o6
        st %i1, [%i6+-4]
        st %i0, [%i6+-8]
        ldd [%i6+-8], %f0
        std  %f0, [%i2]
        restore %g0, %g0, %g0
        retl
        nop

on sparcv8.

llvm-svn: 24983
2005-12-23 05:48:07 +00:00
Chris Lattner 54560f6887 fold (conv (load x)) -> (load (conv*)x).
This allows us to compile this:
void foo(double);
void bar(double *X) { foo(*X); }

To this:

bar:
        save -96, %o6, %o6
        ld [%i0+4], %o1
        ld [%i0], %o0
        call foo
        nop
        restore %g0, %g0, %g0
        retl
        nop

instead of this:

bar:
        save -104, %o6, %o6
        ldd [%i0], %f0
        std %f0, [%i6+-8]
        ld [%i6+-4], %o1
        ld [%i6+-8], %o0
        call foo
        nop
        restore %g0, %g0, %g0
        retl
        nop

on SparcV8.

llvm-svn: 24982
2005-12-23 05:44:41 +00:00
Chris Lattner efbbedbf4a Fold bitconv(bitconv(x)) -> x. We now compile this:
void foo(double);
void bar(double X) { foo(X); }

to this:

bar:
        save -96, %o6, %o6
        or %g0, %i0, %o0
        or %g0, %i1, %o1
        call foo
        nop
        restore %g0, %g0, %g0
        retl
        nop

instead of this:

bar:
        save -112, %o6, %o6
        st %i1, [%i6+-4]
        st %i0, [%i6+-8]
        ldd [%i6+-8], %f0
        std %f0, [%i6+-16]
        ld [%i6+-12], %o1
        ld [%i6+-16], %o0
        call foo
        nop
        restore %g0, %g0, %g0
        retl
        nop

on V8.

llvm-svn: 24981
2005-12-23 05:37:50 +00:00
Chris Lattner a187460552 constant fold bits_convert in getNode and in the dag combiner for fp<->int
conversions.  This allows V8 to compiles this:

void %test() {
        call float %test2( float 1.000000e+00, float 2.000000e+00, double 3.000000e+00, double* null )
        ret void
}

into:

test:
        save -96, %o6, %o6
        sethi 0, %o3
        sethi 1049088, %o2
        sethi 1048576, %o1
        sethi 1040384, %o0
        or %g0, %o3, %o4
        call test2
        nop
        restore %g0, %g0, %g0
        retl
        nop

instead of:

test:
        save -112, %o6, %o6
        sethi 0, %o4
        sethi 1049088, %l0
        st %o4, [%i6+-12]
        st %l0, [%i6+-16]
        ld [%i6+-12], %o3
        ld [%i6+-16], %o2
        sethi 1048576, %o1
        sethi 1040384, %o0
        call test2
        nop
        restore %g0, %g0, %g0
        retl
        nop

llvm-svn: 24980
2005-12-23 05:30:37 +00:00
Chris Lattner 30107e65c8 make sure bit_convert's are expanded
llvm-svn: 24979
2005-12-23 05:15:23 +00:00
Chris Lattner c46fc2482c make sure bit_converts are expanded
llvm-svn: 24978
2005-12-23 05:13:35 +00:00
Chris Lattner 5ce81edbf6 fix the int<->fp instructions, which apparently take a single float register
to represent the int part (because it's always 32-bits)

llvm-svn: 24976
2005-12-23 05:00:16 +00:00
Chris Lattner c9849274bd Use BIT_CONVERT to simplify this code
llvm-svn: 24975
2005-12-23 02:31:39 +00:00
Chris Lattner f474034432 Simplify some code by using BIT_CONVERT
llvm-svn: 24974
2005-12-23 00:59:59 +00:00
Chris Lattner 884eb3adc3 Fix a pasto
llvm-svn: 24973
2005-12-23 00:52:30 +00:00
Chris Lattner 9eae8d5d03 fix a thinko in the bit_convert handling code
llvm-svn: 24972
2005-12-23 00:50:25 +00:00
Chris Lattner 36e663d6e1 add very simple support for the BIT_CONVERT node
llvm-svn: 24970
2005-12-23 00:16:34 +00:00
Reid Spencer e4ae72a4e6 Revert previous patch. Additional tests fail.
llvm-svn: 24968
2005-12-22 21:46:37 +00:00
Chris Lattner 4c141d047c clean up .td file by using evan's new FLAG thing
llvm-svn: 24967
2005-12-22 21:18:39 +00:00
Chris Lattner 177d7af5d5 remove dead code
llvm-svn: 24965
2005-12-22 21:16:08 +00:00
Chris Lattner 6b0325aa26 fix handling of weak linkage
llvm-svn: 24964
2005-12-22 21:15:17 +00:00
Reid Spencer 8f8124edaa Fix PR409:
Implement the suggested check to ensure that out-of-range float constants
don't get accepted by LLVM accidentally. Adjust the supporting test cases
as well.

llvm-svn: 24963
2005-12-22 21:07:29 +00:00
Reid Spencer ccd5b90f58 For PR351:
* Allow the ExecuteAndWait to return negative values if a signal is
  detected as the reason for the child termination. This is needed to
  support bugpoint detecting bad things in its child processes.

llvm-svn: 24960
2005-12-22 20:00:16 +00:00
Chris Lattner ffe3542726 move some random notes out of my email into someplace useful
llvm-svn: 24956
2005-12-22 17:19:28 +00:00
Duraid Madina 644e7db818 this is a hack, which may or may not hang around. In short:
whimper out of doing things the Right Way, and hack up a generic
'BRCALL' instruction, that gets generated when calls are lowered.
This gets selected by hand in the DAG isel, where it gets turned
into real (i.e. in tablegen) br.call instructions.

BUG: this dies on void calls, but seems to work otherwise?
llvm-svn: 24952
2005-12-22 13:29:14 +00:00
Duraid Madina 3692fa14b8 we can't do this directly in lowering, so we need this case
llvm-svn: 24951
2005-12-22 07:14:45 +00:00
Duraid Madina 3608ab87c0 oops, back this out
llvm-svn: 24950
2005-12-22 07:13:51 +00:00
Duraid Madina b1d57fb175 we can't all have brains now, can we
llvm-svn: 24948
2005-12-22 06:41:39 +00:00
Duraid Madina d0c146d59f this should take care of calls to varadic functions, but it doesn.,t
BUG: calling printf(string, float) will load the float into the wrong
register, completely forget about loading the string, etce

llvm-svn: 24947
2005-12-22 06:39:57 +00:00
Duraid Madina a8de8a5db4 we need to emit the getf.d instruction in lowering, so add it
to IA64ISD

llvm-svn: 24946
2005-12-22 06:38:38 +00:00
Chris Lattner be19877731 Separate the call graph implementation from its interface. This implements
the rough idea sketched out in http://nondot.org/sabre/LLVMNotes/CallGraphClass.txt,
allowing new spiffy implementations of the callgraph interface to be built.

Many thanks to Saem Ghani for contributing this!

llvm-svn: 24944
2005-12-22 06:07:52 +00:00
Chris Lattner 1408c05a8b The 81st column doesn't like code in it.
llvm-svn: 24943
2005-12-22 05:23:45 +00:00
Duraid Madina 5ccf76fed3 I shoulda done this a *long* time ago (tm): implement calls properly,
i.e. r1/r12/rp are saved/restored regardless of scheduling/luck

TODO: calls to external symbols, indirect (function descriptor) calls,
      performance (we're being paranoid right now)

BUG: the code for handling calls to vararg functions breaks if FP
args are passed (this will make printf() go haywire so a bunch of
tests will fail)

BUG: this seems to trigger some legalize nastiness
llvm-svn: 24942
2005-12-22 04:07:40 +00:00
Duraid Madina 8f6c86fe3b kill SelectCALL() in the DAG isel, we handle this in lowering now, like
SPARCv8. (we copy sparcv8's workaround for tablegen not being nice about
ISD::CALL/TAILCALL)

llvm-svn: 24941
2005-12-22 03:58:17 +00:00
Duraid Madina a743e00e7a update tablegen files - nothing to see here
llvm-svn: 24939
2005-12-22 03:56:03 +00:00
Reid Spencer 6197688c71 For PR351:
Move the system dependent portion to lib/System/*/Alarm.inc. This makes the
SlowOperationInformer platform independent.

llvm-svn: 24938
2005-12-22 03:31:26 +00:00
Reid Spencer 3493dab23b Implement a generic polled Alarm function. This merely removes the system
dependent portion of the lib/Support/SlowOperationTimer code into the
lib/System implementation where it can be ported to different platforms.

llvm-svn: 24937
2005-12-22 03:23:46 +00:00
Evan Cheng dfad8ed54e Bye bye HACKTROCITY.
llvm-svn: 24935
2005-12-22 02:26:21 +00:00
Evan Cheng 62fef13143 Added special flag node FLAG.
llvm-svn: 24934
2005-12-22 02:25:14 +00:00
Reid Spencer 2335fc2f44 Add an eol at the end to shut gcc sup.
llvm-svn: 24926
2005-12-22 01:41:00 +00:00
Evan Cheng 1872908f3b Lefted out TargetLowering::
llvm-svn: 24922
2005-12-21 23:14:54 +00:00
Evan Cheng 9cdc16c6d3 * Fix a GlobalAddress lowering bug.
* Teach DAG combiner about X86ISD::SETCC by adding a TargetLowering hook.

llvm-svn: 24921
2005-12-21 23:05:39 +00:00
Evan Cheng 02767195bb Oops. Accidentally deleted RET pattern. It's still needed for return void;
llvm-svn: 24920
2005-12-21 22:22:16 +00:00
Jim Laskey 9e296bee9a Disengage DEBUG_LOC from non-PPC targets.
llvm-svn: 24919
2005-12-21 20:51:37 +00:00
Evan Cheng c1583dbd63 * Added support for X86 RET with an additional operand to specify number of
bytes to pop off stack.
* Added support for X86 SETCC.

llvm-svn: 24917
2005-12-21 20:21:51 +00:00
Jim Laskey 7b52a923b8 Start of Dwarf framework.
llvm-svn: 24914
2005-12-21 19:48:16 +00:00
Chris Lattner 0fab459362 make sure to relegalize all cases
llvm-svn: 24911
2005-12-21 19:40:42 +00:00
Chris Lattner 44c07ed61a enable the gep isel opt
llvm-svn: 24910
2005-12-21 19:36:36 +00:00
Chris Lattner 15f5a182e1 Regenerate
llvm-svn: 24908
2005-12-21 18:31:50 +00:00
Chris Lattner a5d70e9feb allow logical operators on packed integral types
llvm-svn: 24907
2005-12-21 18:31:29 +00:00
Chris Lattner dca56cbd9a Get logical operations to like packed types, allow BinOp::getNot to create
the right vector of -1's as its operand.

llvm-svn: 24906
2005-12-21 18:22:19 +00:00
Chris Lattner ac12f68424 fix a bug I introduced that broke recursive expansion of nodes (e.g. scalarizing vectors)
llvm-svn: 24905
2005-12-21 18:02:52 +00:00
Chris Lattner a054d129ea regenerate
llvm-svn: 24904
2005-12-21 17:53:23 +00:00
Chris Lattner 8c7bda561c Implement Regression/Assembler/2005-12-21-ZeroInitVector.ll
llvm-svn: 24903
2005-12-21 17:53:02 +00:00
Chris Lattner 81f2653e45 add some nodes, forgot to commit this last night :(
llvm-svn: 24901
2005-12-21 16:22:46 +00:00
Chris Lattner 0dcdd83c0e This was meant to go in
llvm-svn: 24900
2005-12-21 07:50:26 +00:00
Chris Lattner f431ad4477 Rewrite FP stackifier support in the X86InstrInfo.td file, splitting patterns
that were overloaded to work before and after the stackifier runs.  With the
new clean world, it is possible to write patterns for these instructions: woo!

This also adds a few simple patterns here and there, though there are a lot
still missing.  These should be easy to add though. :)

See the comments under "Floating Point Stack Support" for more details on
the new world order.

This patch as absolutely no effect on the generated code, woo!

llvm-svn: 24899
2005-12-21 07:47:04 +00:00
Chris Lattner 988827a482 Wrap some long lines: no functionality change
llvm-svn: 24898
2005-12-21 05:34:58 +00:00
Chris Lattner 72575d882b remove dead code
llvm-svn: 24896
2005-12-21 05:27:51 +00:00
Chris Lattner 803a575616 Lower ConstantAggregateZero into zeros
llvm-svn: 24890
2005-12-21 02:43:26 +00:00
Evan Cheng a2f308fc3e Remove ISD::RET select code. Now tblgen'd.
llvm-svn: 24889
2005-12-21 02:41:57 +00:00
Evan Cheng a74ce62746 * Added lowering hook for external weak global address. It inserts a load
for Darwin.
* Added lowering hook for ISD::RET. It inserts CopyToRegs for the return
  value (or store / fld / copy to ST(0) for floating point value). This
  eliminate the need to write C++ code to handle RET with variable number
  of operands.

llvm-svn: 24888
2005-12-21 02:39:21 +00:00
Chris Lattner 434ffe49a9 Don't emit a null terminator, nor anything after it, to the ctor/dtor list
llvm-svn: 24887
2005-12-21 01:17:37 +00:00
Evan Cheng 5c0b4df483 SSE2 floating point load / store patterns. SSE2 fp to int conversion patterns.
llvm-svn: 24886
2005-12-20 22:59:51 +00:00
Evan Cheng 82285c55aa Flip the meaning of FPContractions to reflect Requires<[]> change.
llvm-svn: 24884
2005-12-20 20:08:53 +00:00
Chris Lattner fc94dff7dc Run lower-switch after lower-invoke.
Only run lower-allocations and lower-select for the simple isel

llvm-svn: 24881
2005-12-20 08:00:11 +00:00
Chris Lattner 10c7f67d78 Reserve G1 for frame offset stuff and use it to handle large stack frames.
For example, instead of emitting this:

test:
        save -40112, %o6, %o6   ;; imm too large
        add %i6, -40016, %o0    ;; imm too large
        call caller
        nop
        restore %g0, %g0, %g0
        retl
        nop

emit this:

test:
        sethi 4194264, %g1
        or %g1, 848, %g1
        save %o6, %g1, %o6
        sethi 4194264, %g1
        add %g1, %i6, %g1
        add %i1, 944, %o0
        call caller
        nop
        restore %g0, %g0, %g0
        retl
        nop

which doesn't cause the assembler to barf.

llvm-svn: 24880
2005-12-20 07:56:31 +00:00
Evan Cheng 5815a6e455 Added X86 readport patterns.
llvm-svn: 24879
2005-12-20 07:38:38 +00:00
Evan Cheng 6af02635a7 Added a hook to print out names of target specific DAG nodes.
llvm-svn: 24877
2005-12-20 06:22:03 +00:00
Chris Lattner 2af3ee4bdd Fix a nasty latent bug in the legalizer that was triggered by my patch
last night, breaking crafty and twolf.  Make sure that the newly found
legal nodes are themselves not re-legalized until the next iteration.

Also, since this functionality exists now, we can reduce number of legalizer
iterations by depending on this behavior instead of having to misuse 'do
another iteration' to get the same effect.

llvm-svn: 24875
2005-12-20 00:53:54 +00:00
Nate Begeman b11b8e44fa Pattern-match return. Includes gross hack!
llvm-svn: 24874
2005-12-20 00:26:01 +00:00
Nate Begeman c126397a69 Fix a couple of the FIXMEs, thanks to suggestion from Chris. This allows
us to load and store vectors directly at a pointer (offset of zero) by
using r0 as the base register.  This also requires some asm printer work
to satisfy the darwin assembler.

For
void %foo(<4 x float> * %a) {
entry:
  %tmp1 = load <4 x float> * %a;
  %tmp2 = add <4 x float> %tmp1, %tmp1
  store <4 x float> %tmp2, <4 x float> *%a
  ret void
}

We now produce:
_foo:
        lvx v0, 0, r3
        vaddfp v0, v0, v0
        stvx v0, 0, r3
        blr

Instead of:
_foo:
        li r2, 0
        lvx v0, r2, r3
        vaddfp v0, v0, v0
        stvx v0, r2, r3
        blr

llvm-svn: 24872
2005-12-19 23:40:42 +00:00
Nate Begeman 8e6a8af205 Convert load/store over to being pattern matched
llvm-svn: 24871
2005-12-19 23:25:09 +00:00
Evan Cheng 6fc31046aa X86 conditional branch support.
llvm-svn: 24870
2005-12-19 23:12:38 +00:00
Evan Cheng 9fd9541367 Print out opcode number if it's an unknown target node.
llvm-svn: 24869
2005-12-19 23:11:49 +00:00
Evan Cheng 1d9b671de0 It's essential we clear CodeGenMap after isel every basic block!
llvm-svn: 24867
2005-12-19 22:36:02 +00:00
Chris Lattner 50b2d302d5 Fix a case where the DAG Combiner would accidentally CSE flag-producing nodes,
creating graphs that cannot be scheduled.

llvm-svn: 24866
2005-12-19 22:21:21 +00:00
John Criswell 757035ead9 Prefix DSA specific options with dsa.
Make the dsa-alloc-list and dsa-free-list options hidden.

llvm-svn: 24864
2005-12-19 20:14:38 +00:00
John Criswell 45bb70d8f9 Added an option to specify the names of heap freeing functions.
llvm-svn: 24863
2005-12-19 19:54:23 +00:00
John Criswell aa0fed0148 Added a command line option that allows the user to specify a list of
functions that allocate memory.

llvm-svn: 24862
2005-12-19 17:38:39 +00:00
Jim Laskey 9b9688aeb8 Amend comment.
llvm-svn: 24861
2005-12-19 16:32:26 +00:00
Jim Laskey ce23987e6b Create a strong dependency for loads following stores. This will leave a
latency period between the two.

llvm-svn: 24860
2005-12-19 16:30:13 +00:00
Chris Lattner 7767a654b0 Fix pifft by correcting the case when a i64/f64 straddles O5 and memory:
we were storing into [FP+88] instead of [FP+92].
Improve codegen by emitting [FP+92], instead of emitting a copy of FP into
another GPR which wouldn't be coallesced because FP isn't register allocated.

llvm-svn: 24859
2005-12-19 07:57:53 +00:00
Chris Lattner 631c9df853 don't emit 'add %o6, 0, %o6' instructions
llvm-svn: 24857
2005-12-19 02:51:12 +00:00
Chris Lattner 5b9c9f9d36 Fix calls to functions returning i64
llvm-svn: 24856
2005-12-19 02:15:51 +00:00
Chris Lattner 655fac2c95 Correct bool truncstore operand order
llvm-svn: 24855
2005-12-19 02:06:50 +00:00
Chris Lattner 2c792ccc62 add the other bool zextload as well
llvm-svn: 24854
2005-12-19 01:44:58 +00:00
Chris Lattner 766170c6ee implement zextload bool
llvm-svn: 24853
2005-12-19 01:43:04 +00:00
Chris Lattner 9be456300e mark some unsupported ops as unsupported
llvm-svn: 24852
2005-12-19 01:39:40 +00:00
Chris Lattner e59941810a Fix syntax for indirect calls. This fixes Olden/mst
llvm-svn: 24850
2005-12-19 01:22:53 +00:00
Chris Lattner bead785656 Keep stack frames 8-byte aligned. This fixes olden/voronoi
llvm-svn: 24849
2005-12-19 01:15:13 +00:00
Chris Lattner 9078c84654 apparently rdy isn't actually a psuedo instruction. Use rd %y
llvm-svn: 24848
2005-12-19 00:53:02 +00:00
Chris Lattner d2e885e321 add fneg/fabs support for doubles
llvm-svn: 24847
2005-12-19 00:50:12 +00:00
Chris Lattner 14ee61ef00 Various cleanups to this pass, no functionality change
llvm-svn: 24846
2005-12-19 00:46:20 +00:00
Chris Lattner d2a07eebcd add bool truncstores
llvm-svn: 24845
2005-12-19 00:19:21 +00:00
Chris Lattner 15bd5ea92f Elimiante SP and FP, which weren't members of the IntRegs register class
llvm-svn: 24844
2005-12-19 00:06:52 +00:00
Chris Lattner c06da626b4 Make sure to relegalize new nodes
llvm-svn: 24843
2005-12-18 23:54:29 +00:00
Chris Lattner f5f80cb947 The sun assembler only supports .xword in V9 mode.
llvm-svn: 24842
2005-12-18 23:36:45 +00:00
Chris Lattner 1ac15547d6 Configure the asmwriter to allow constant pools to be printed correctly
llvm-svn: 24841
2005-12-18 23:35:05 +00:00
Chris Lattner 030672f16b add support for integer extloads
llvm-svn: 24840
2005-12-18 23:18:37 +00:00