Commit Graph

21673 Commits

Author SHA1 Message Date
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
Jeff Cohen 7c89bdd5a0 Get bugpoint building with VC++ again.
llvm-svn: 24977
2005-12-23 05:00:38 +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 9babd861b2 improve comment: mention vectors
llvm-svn: 24971
2005-12-23 00:46:10 +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
Chris Lattner bc1be55abc add a new node
llvm-svn: 24969
2005-12-23 00:15:59 +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 7b8aac84bd remove a dead node
llvm-svn: 24966
2005-12-22 21:16:35 +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
Chris Lattner d834d495b2 silence some bogus gcc warnings
llvm-svn: 24962
2005-12-22 20:37:36 +00:00
Reid Spencer 842118ce95 For PR351:
Generally, remove use of fork/exec from bugpoint in favor of the portable
sys::Program::ExecuteAndWait method. This change requires two new options
to bugpoint to tell it that it is running in "child" mode. In this mode,
it reads its input and runs the passes. The result code signals to the
parent instance of bugpoint what happened (success, fail, crash).

This change should make bugpoint usable on Win32 systems.

llvm-svn: 24961
2005-12-22 20:02:55 +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 7d05269769 Fix test/Regression/Other/2002-01-31-CallGraph.ll after the recent callgraph
rework.

llvm-svn: 24959
2005-12-22 19:26:06 +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 94cdb0b2f4 i need to do this to take over the earth
when I take over the earth, sabre will be happy because i'll stop asking
him silly questions!!!!!!

llvm-svn: 24949
2005-12-22 07:02: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 f933bb5dcf credit where credit is due
llvm-svn: 24945
2005-12-22 06:09:08 +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
Reid Spencer f87e739e41 Fix documentation for the AlarmSetup function.
llvm-svn: 24940
2005-12-22 03:57:15 +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 a87d743912 Attempt to fix a crash on WIN32.
llvm-svn: 24936
2005-12-22 02:35:21 +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
Evan Cheng 991bc6d6ba * Added support for FLAG - a special nameless flag register. Can be used as
either an operand or a result.
* Fixed some more flag / chain bugs.

llvm-svn: 24933
2005-12-22 02:24:50 +00:00
Reid Spencer d347c01087 For PR678:
* Make it possible to pass a fourth argument to the CHECK_PROGRAM_SANITY
  macro that controls whether a non-sane program generates an error or
  a warning.

llvm-svn: 24931
2005-12-22 02:08:30 +00:00
Reid Spencer f984b68181 Implement PR679:
* Changed the -rpath option from cl::opt to cl::list
* Changed the interface to GenerateNative to take a std::vector<std::string>
  instead of just a std::string
* Changed GenerateNative to generate multiple -Wl,-rpath, options to be
  passed to gcc.

llvm-svn: 24930
2005-12-22 01:50:56 +00:00
Jeff Cohen 23d7a0b641 Add new files to Visual Studio.
llvm-svn: 24929
2005-12-22 01:50:11 +00:00
Jeff Cohen 191ef1f007 Oh oh... Unix is case sensitive.
llvm-svn: 24928
2005-12-22 01:46:59 +00:00
Jeff Cohen 57546aab90 Make it compile with VC++.
llvm-svn: 24927
2005-12-22 01:44:51 +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
Reid Spencer bdd2bbf0d9 Add an eol at the end to shut gcc up.
llvm-svn: 24925
2005-12-22 01:40:06 +00:00
Reid Spencer c49a8637c3 Some simple cleanups:
1. When srcdir == objdir have "spotless" say that it isn't supported in
   that mode rather than just let make say "no such target"
2. Minor doc cleanups
3. Fix the double rebuild problem with yacc files. A missing dependency
   caused parallel builds to skip building the .cpp file after the .cpp
   file was regenerated by bison.

llvm-svn: 24924
2005-12-21 23:17:06 +00:00
Evan Cheng f4300e361f Added TargetLowering::isMaskedValueZeroForTargetNode() declaration.
llvm-svn: 24923
2005-12-21 23:15:41 +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
Jim Laskey 67ff29c095 Sync up the project with my tweaks.
llvm-svn: 24918
2005-12-21 20:47:34 +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
Evan Cheng f646926ecf Allows instructions which no explicit operands. e.g. X86 RET which has but
an implicit flag operand.

llvm-svn: 24916
2005-12-21 20:20:49 +00:00
Chris Lattner 3a9fc42d20 add dwarfwriter to the xcode project
llvm-svn: 24915
2005-12-21 19:51:24 +00:00
Jim Laskey 7b52a923b8 Start of Dwarf framework.
llvm-svn: 24914
2005-12-21 19:48:16 +00:00
Jim Laskey ab4e455f69 Oops llvm namespace.
llvm-svn: 24913
2005-12-21 19:46:32 +00:00
Jim Laskey 5130c534bb Start of Dwarf framework code.
llvm-svn: 24912
2005-12-21 19:44:40 +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 e5cdb4e6f2 new testcase
llvm-svn: 24902
2005-12-21 17:52:42 +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 812a56e888 Eliminate some GCC warnings from the generated code
llvm-svn: 24897
2005-12-21 05:31:05 +00:00
Chris Lattner 72575d882b remove dead code
llvm-svn: 24896
2005-12-21 05:27:51 +00:00
Reid Spencer b1f01ac2fb Document the new -post-link-opts option.
llvm-svn: 24895
2005-12-21 05:13:06 +00:00
Chris Lattner c6b578da26 new testcase, fails on X86 and probably others
llvm-svn: 24894
2005-12-21 05:09:57 +00:00
Reid Spencer 41e1b6fed0 Implement PR512:
This patch adds a -post-link-opts option to llvm-ld which allows an arbitrary
program to optimize bytecode after linking. The program is passed two file
names. The first is the input (linked bytecode) the second is where it must
place its output (presumably after optimizing). If the output file is bytecode,
it is used as a substitute for the input. This will allow things like poolalloc
to be written as a separate program instead of a loadable module or built into
LLVM.

llvm-svn: 24893
2005-12-21 05:03:23 +00:00
Reid Spencer 294adbb5cf Document the new --enable-debug-runtime configure option.
llvm-svn: 24892
2005-12-21 03:46:45 +00:00
Reid Spencer 3f31cc4dcd Implement fix for PR471:
* Add --enable-debug-runtime option, defaults to disabled
* Pass the new config var, DEBUG_RUNTIME, to Makefiles
* Don't use -Wa,-strip-debug if debug-runtime is enabled

llvm-svn: 24891
2005-12-21 03:31:53 +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
Evan Cheng 4bf64a8ba4 Fix the semantic of Requires<[cond]> to mean if (!cond) goto PXXFail;
llvm-svn: 24883
2005-12-20 20:08:01 +00:00
Chris Lattner 777bb6eb45 This ugly patch works around a GCC bug where it is compiling SelectCode to
use too much stack space, overflowing the stack for large functions.  Instead
of emitting new SDOperands in each match block, we emit some common ones at
the top of SelectCode then reuse them when possible.

This reduces the stack size of SelectCode from 28K to 21K.  Note that GCC
compiles it to 512 bytes :-/

I've filed GCC PR 25505 to track this.

llvm-svn: 24882
2005-12-20 19:41:03 +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 9696f63d3e Now support instructions with implicit write to non-flag registers.
llvm-svn: 24878
2005-12-20 07:37:41 +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
Patrick Meredith 2dd7e06d8e Added a break that I meant to include originally, for efficiency. Basically
it keeps it from trying to add the same node to the node set
over and over if it matches multiple given patterns.  Also in cases where there
are a lot of patterns to be matched, and it matches an early one, this
will make the script run slightly faster.  It's more there because it logically
should be, than anything else, I mean, Python is never going to be fast ;-)

llvm-svn: 24876
2005-12-20 02:03:23 +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
Evan Cheng fe90b604a4 Lefted out a fix in the previous check in.
llvm-svn: 24873
2005-12-20 00:06:17 +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 19b9f15377 Fix another bug related to chain / flag.
llvm-svn: 24868
2005-12-19 22:40:04 +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 7671a5b844 Added the llvm-kernel project to the list of automatically configured
projects.

llvm-svn: 24865
2005-12-19 20:27:24 +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
Evan Cheng 9bd85c2f19 Fixes for a number of bugs: save flag results in CodeGenMap, folded chains
may not all have ResNo == 0.

llvm-svn: 24858
2005-12-19 07:18:51 +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
Patrick Meredith 136f465fa2 This is a script to extract nodes and edges associated with those nodes
from a dot file that is the output of DSA.  Nodes to extract
are specified by giving the name of the node seen in the graphical
representation, i.e. in the .ps if the node is specified %xyz
asking for just x, xy, or xyz will retain it in the output file.
Because it operates on substrings underspecifying may result
in additional unexpected nodes.  Be as specific as possible.
Obviously, however, if you ask for %xyz and there is a
getelementptr of %xyz you will get both nodes.  Some manual
editing may still be necessary because of this, but this script
can pare down 10,000 line files to 20 line files, making like easier.

llvm-svn: 24851
2005-12-19 01:23:31 +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
Chris Lattner c70ed7721b Add support for undef
llvm-svn: 24839
2005-12-18 23:10:57 +00:00
Chris Lattner 4c3c3ac218 Add support for calls to external symbols
llvm-svn: 24838
2005-12-18 23:07:11 +00:00
Chris Lattner 388f3043b0 we have no memcpy
llvm-svn: 24837
2005-12-18 23:00:27 +00:00
Chris Lattner c65cd5a03e Fix a crash on a call with no arguments
llvm-svn: 24836
2005-12-18 22:57:47 +00:00
Jeff Cohen c7cb351aac Keep VC++ happy.
llvm-svn: 24835
2005-12-18 22:20:05 +00:00
Chris Lattner 2f5fb6a720 This is handled by the autogen'd code
llvm-svn: 24834
2005-12-18 21:06:11 +00:00
Chris Lattner f7ae0a95fe Handle basic block nodes
llvm-svn: 24833
2005-12-18 21:05:44 +00:00
Chris Lattner 1958690ff2 Change return lowering so that we can autogen the matching code.
llvm-svn: 24832
2005-12-18 21:03:04 +00:00
Chris Lattner 1febcd672c Add an accessor
llvm-svn: 24831
2005-12-18 21:00:53 +00:00
Chris Lattner 02e9904ee5 Implement Calls for V8. This would be completely autogenerated except for
a small bug in tblgen.  When that is fixed, we can remove the ISD::Call case
in Select.

llvm-svn: 24830
2005-12-18 15:55:15 +00:00
Chris Lattner abb11cc83e More fixes for Selection of copyto/fromreg with a flag
llvm-svn: 24829
2005-12-18 15:45:51 +00:00
Chris Lattner ebcfa0c210 More corrections for flagged copyto/from reg
llvm-svn: 24828
2005-12-18 15:36:21 +00:00
Chris Lattner fc3d4f8fd8 Select copytoreg and copyfromreg nodes that have flag operands correctly.
llvm-svn: 24827
2005-12-18 15:28:25 +00:00
Chris Lattner e3c67e97c7 legalize copytoreg and copyfromreg nodes that have flag operands correctly.
llvm-svn: 24826
2005-12-18 15:27:43 +00:00
Chris Lattner a0be18c9a4 Implement the full V8 ABI for incoming arguments.
llvm-svn: 24825
2005-12-18 13:33:06 +00:00
Chris Lattner 8d1db078cb Push ops list, asm string, and pattern all the way up to InstV8. Move the
InstV8 class to the InstrFormats file where it belongs.

llvm-svn: 24824
2005-12-18 08:21:00 +00:00
Chris Lattner 7cee2c9a5b Give V8 select_cc, in the spirit of the PPC backend
llvm-svn: 24823
2005-12-18 08:13:54 +00:00
Chris Lattner 9de2958138 remove some unused instructions
llvm-svn: 24822
2005-12-18 07:15:17 +00:00
Chris Lattner a9f0d108b1 V8 doesn't have FP extload
llvm-svn: 24821
2005-12-18 07:13:32 +00:00
Chris Lattner d6806875d0 simplifications, fix typo
llvm-svn: 24820
2005-12-18 07:09:06 +00:00
Chris Lattner c5609aab11 add a node, for completeness
llvm-svn: 24819
2005-12-18 07:05:21 +00:00
Chris Lattner 4492b1b7a0 Add frameindex support
Add support for copying (e.g. returning) doubles
Add support for F<->I instructions

llvm-svn: 24818
2005-12-18 06:59:57 +00:00
Chris Lattner 9dcfe37e76 Tighten up some checks
llvm-svn: 24817
2005-12-18 06:40:34 +00:00
Jim Laskey c97b7d0be9 Fix a bug Sabre was having where the DAG root was a group. The group dominator
needed to be added to the ordering list, not the first member of the group.

llvm-svn: 24816
2005-12-18 04:40:52 +00:00
Jim Laskey e220821deb Groups were not emitted if the dominator node and the node in the ordering list
were not the same node.  Ultimately the test was bogus.

llvm-svn: 24815
2005-12-18 03:59:21 +00:00
Nate Begeman 53c1f75090 Since extload can also be used by FP, split STDIntExtLoad into two parts,
one for use with extload, one for use with sextload and zextload, which
are integer only.

llvm-svn: 24814
2005-12-18 02:48:48 +00:00
Chris Lattner 5580e69df6 Add constant pool support, including folding into addresses.
Pretty print addresses a bit, to not print [%r1+%g0]: just print [%r1]

llvm-svn: 24813
2005-12-18 02:37:35 +00:00
Chris Lattner 726075fdf8 Teach the addressing mode stuff to fold "%lo" into 'ri' addressing modes,
allowing us to compile this:

to this:

%G1 = external global int
%G2 = external global int
void %test() {
        %X = load int* %G1
        store int %X, int* %G2
        ret void
}

test:
        save -96, %sp, %sp
        sethi %hi(G1), %l0
        ld [%l0+%lo(G1)], %l0
        sethi %hi(G2), %l1
        st %l0, [%l1+%lo(G2)]
        restore %g0, %g0, %g0
        retl
        nop

instead of this:

test:
        save -96, %sp, %sp
        sethi %hi(G1), %l0
        or %g0, %lo(G1), %l1
        ld [%l1+%l0], %l0
        sethi %hi(G2), %l1
        or %g0, %lo(G2), %l2
        st %l0, [%l2+%l1]
        restore %g0, %g0, %g0
        retl
        nop

llvm-svn: 24812
2005-12-18 02:27:00 +00:00
Chris Lattner a983c3df1c Add initial support for global variables, and fix a bug in addr mode selection
where we didn't select the operands.

llvm-svn: 24811
2005-12-18 02:10:39 +00:00
Chris Lattner a49b652a62 Claiming that branch targets are registers is not very wholesome. Change them
to be basic blocks.  Also, add uncond branches.

llvm-svn: 24810
2005-12-18 01:46:58 +00:00
Chris Lattner b29957500e Add unordered comparisons
llvm-svn: 24809
2005-12-18 01:41:39 +00:00
Chris Lattner e58481be36 Add patterns to the rest of the int condbranches and some of the fp branches
llvm-svn: 24808
2005-12-18 01:38:19 +00:00
Chris Lattner 9cf4bb2867 Add initial conditional branch support. This doesn't actually work yet due
to a bug in the scheduler.

llvm-svn: 24807
2005-12-18 01:20:35 +00:00
Chris Lattner cf12118965 Simplify code
llvm-svn: 24806
2005-12-18 01:03:46 +00:00
Chris Lattner 00759eac78 Eliminate CMPri, which is a synonym for SUBCCri
llvm-svn: 24805
2005-12-17 23:52:08 +00:00
Chris Lattner bf0bd99e03 allow custom expansion of BR_CC
llvm-svn: 24804
2005-12-17 23:46:46 +00:00
Chris Lattner 5a6b03c1b8 add fneg,fabs,fsqrt instructions
llvm-svn: 24803
2005-12-17 23:20:27 +00:00
Chris Lattner 32f19262d5 Add patterns for fround/fextend and the funny fsmuld instruction
llvm-svn: 24802
2005-12-17 23:14:30 +00:00
Chris Lattner 06952dfced Add FP +,-,*,/
llvm-svn: 24801
2005-12-17 23:10:46 +00:00
Chris Lattner 89078880f2 Give patterns to F3_3 instructions
llvm-svn: 24800
2005-12-17 23:05:35 +00:00
Chris Lattner 829572cdca Implement 64-bit add/sub, make sure to receive and return 64-bit args with
the right halves in the right regs

llvm-svn: 24799
2005-12-17 22:55:57 +00:00
Chris Lattner ebfa06a2de implement div and rem
llvm-svn: 24798
2005-12-17 22:39:19 +00:00
Chris Lattner 8eaf9f4cb3 implement MULHU/MULHS for 64-bit multiplies
llvm-svn: 24797
2005-12-17 22:30:00 +00:00
Chris Lattner 4abe9528f9 Add patterns for multiply, simplify Y register handling stuff, add RDY instruction
llvm-svn: 24796
2005-12-17 22:22:53 +00:00
Chris Lattner 2616a0b56f Make the addressing modes smarter
llvm-svn: 24795
2005-12-17 21:25:27 +00:00
Chris Lattner 19ff62dc67 remove some unused instructions
llvm-svn: 24794
2005-12-17 21:13:50 +00:00
Chris Lattner e39ab718c0 add andn/orn/xorn patterns. This allows us to compile this:
long %test(ubyte, short, long %X, long %Y) {
  %A = xor long %X, -1
  %B = and long %Y, %A
  ret long %B
}

to this:

test:
        save -96, %sp, %sp
        andn %i4, %i2, %i0
        andn %i5, %i3, %i1
        restore %g0, %g0, %g0
        retl
        nop

instead of this:

test:
        save -96, %sp, %sp
        xor %i2, -1, %l0
        xor %i3, -1, %l1
        and %i4, %l0, %i0
        and %i5, %l1, %i1
        restore %g0, %g0, %g0
        retl
        nop

The simpleisel emits:  :(

test:
        save -96, %sp, %sp
        or %g0, -1, %l0
        or %g0, -1, %l0
        or %g0, -1, %l0
        or %g0, -1, %l1
        xor %i2, %l0, %l0
        xor %i3, %l1, %l1
        and %i4, %l0, %i0
        and %i5, %l1, %i1
        restore %g0, %g0, %g0
        retl
        nop

llvm-svn: 24793
2005-12-17 21:05:49 +00:00
Chris Lattner ea752cc50a Add support for 64-bit arguments
llvm-svn: 24792
2005-12-17 20:59:06 +00:00
Chris Lattner 6be83f9959 Sparc doesn't have sext_inreg
llvm-svn: 24791
2005-12-17 20:50:42 +00:00
Chris Lattner d10995cb26 add patterns for FP stores
llvm-svn: 24790
2005-12-17 20:47:16 +00:00
Chris Lattner 490a6edf52 Add [reg+reg] integer stores
llvm-svn: 24789
2005-12-17 20:44:36 +00:00
Chris Lattner b57bb13253 Add store patterns
llvm-svn: 24788
2005-12-17 20:42:55 +00:00
Chris Lattner 233e044738 add truncstore
llvm-svn: 24787
2005-12-17 20:42:29 +00:00
Chris Lattner 7e7c355154 add fp load patterns, switch rest of loads and stores to use addrmodes
llvm-svn: 24786
2005-12-17 20:32:47 +00:00
Chris Lattner c4f3a7adea Add integer load[r+r] forms.
llvm-svn: 24785
2005-12-17 20:26:45 +00:00
Chris Lattner 1c02c45f18 Rename load/store instructions to include an RI suffix
llvm-svn: 24784
2005-12-17 20:18:49 +00:00
Chris Lattner 4fa86e1d55 Add patterns for the rest of the loads. Add 'ri' suffixes to the load and store insts
llvm-svn: 24783
2005-12-17 20:18:24 +00:00
Chris Lattner 5d15f9ed60 Add basic addressing mode support and one load.
llvm-svn: 24782
2005-12-17 20:04:49 +00:00
Chris Lattner db8e888fb5 eliminate some redundancy
llvm-svn: 24781
2005-12-17 19:47:05 +00:00
Chris Lattner 5e68639009 Use a combination of sethi and or to build arbitrary immediates.
llvm-svn: 24780
2005-12-17 19:41:43 +00:00
Chris Lattner 8546257435 Use sethi to build large immediates with zeros at the bottom
llvm-svn: 24779
2005-12-17 19:37:00 +00:00