Commit Graph

11781 Commits

Author SHA1 Message Date
Chris Lattner ff9362a8da Add SCCP support for constant folding calls, implementing:
test/Regression/Transforms/SCCP/calltest.ll

llvm-svn: 12921
2004-04-13 19:43:54 +00:00
Chris Lattner 9d42084081 New testcase
llvm-svn: 12920
2004-04-13 19:43:33 +00:00
Chris Lattner ca52d0468e Add a simple call constant propagation interface.
llvm-svn: 12919
2004-04-13 19:28:52 +00:00
Chris Lattner 7dacdb6f13 Add new interfaces
llvm-svn: 12918
2004-04-13 19:28:32 +00:00
Chris Lattner d0dc6d5295 Constant propagation should remove the dead instructions
llvm-svn: 12917
2004-04-13 19:28:20 +00:00
Chris Lattner e3debac3cd New testcase
llvm-svn: 12916
2004-04-13 19:28:09 +00:00
Brian Gaeke 9a79ed7b89 Regenerated using autoconf-2.57.
llvm-svn: 12915
2004-04-13 19:03:49 +00:00
Brian Gaeke fca4720590 Rewrite POV-Ray check as per PR301
llvm-svn: 12914
2004-04-13 19:02:51 +00:00
Chris Lattner becf6365d6 Increase buffer size again. *sigh*
llvm-svn: 12912
2004-04-13 18:43:18 +00:00
Chris Lattner f37bd007e4 Don't index spiff. It should not count as lines of LLVM code
llvm-svn: 12911
2004-04-13 18:37:51 +00:00
Chris Lattner 763596e28d Fixed sized limits are bad... duh.
llvm-svn: 12908
2004-04-13 18:34:16 +00:00
Chris Lattner 7b9733dac2 Really spiff, don't chatter :)
llvm-svn: 12907
2004-04-13 18:33:21 +00:00
Brian Gaeke 6f6e4b9f59 I don't think we have to have 4 extra allocated (but unused) bytes on the stack.
llvm-svn: 12905
2004-04-13 18:28:37 +00:00
Brian Gaeke 969795b4ea I started working on casts, but I don't have anything compilable yet.
llvm-svn: 12903
2004-04-13 18:27:46 +00:00
Brian Gaeke bacab88d42 Don't underline diffs
llvm-svn: 12902
2004-04-13 18:24:01 +00:00
Chris Lattner c71b096672 Emit the immediate form of in/out when possible.
Fix several bugs in the intrinsics:
  1. Make sure to copy the input registers before the instructions that use them
  2. Make sure to copy the value returned by 'in' out of EAX into the register
     it is supposed to be in.

This fixes assertions when using in/out and linear scan.

llvm-svn: 12896
2004-04-13 17:20:37 +00:00
Chris Lattner a340febe52 Add immediate forms of in/out. Use let to shorten lines
llvm-svn: 12895
2004-04-13 17:19:31 +00:00
Chris Lattner eaa28a29ae Add support for new instruction type
llvm-svn: 12894
2004-04-13 17:18:51 +00:00
Chris Lattner 27b2e2cdc0 Add support for the printImplicitDefsBefore flag
llvm-svn: 12893
2004-04-13 17:18:39 +00:00
Chris Lattner e342a8ef49 Make the testcase more challenging
llvm-svn: 12892
2004-04-13 17:18:07 +00:00
Chris Lattner 34fba8eb00 Reenable library now that the loopsimplify bug is fixed
llvm-svn: 12891
2004-04-13 16:24:53 +00:00
Chris Lattner 89e959bb1f Fix LoopSimplify/2004-04-13-LoopSimplifyUpdateDomFrontier.ll
LoopSimplify was not updating dominator frontiers correctly in some cases.

llvm-svn: 12890
2004-04-13 16:23:25 +00:00
Chris Lattner a7aeb506dd New testcase where loop simplify is not updating domfrontiers correctly
llvm-svn: 12889
2004-04-13 16:22:04 +00:00
Chris Lattner a6e22814ab Refactor code a bit to make it simpler and eliminate the goto
llvm-svn: 12888
2004-04-13 15:21:18 +00:00
Chris Lattner 54dcea809f Add notes about some of the code quality improvements that have gone in
llvm-svn: 12887
2004-04-13 14:43:35 +00:00
Chris Lattner 277f7e6ebc Temporary hack to get the nightly tester running
llvm-svn: 12886
2004-04-13 13:57:29 +00:00
John Criswell ed868e14ff Added Spiff.
llvm-svn: 12885
2004-04-13 13:42:38 +00:00
Chris Lattner 8417052938 This patch addresses PR35: Loop simplify should reconstruct nested loops.
This is fairly straight-forward, but was a real nightmare to get just
perfect.  aarg.  :)

llvm-svn: 12884
2004-04-13 05:05:33 +00:00
Brian Gaeke ff27406cf9 Clean up the Spiff code so that it emits fewer warnings. This
consists mostly of changing sloppy K&R C code to slightly more
disciplined K&R C code, and doing the usual things to shut gcc up.

llvm-svn: 12877
2004-04-13 03:24:45 +00:00
Brian Gaeke 2ec7dfc278 Build Spiff directory
llvm-svn: 12876
2004-04-12 22:53:51 +00:00
Brian Gaeke 4ae2642fd4 Add the Spiff fp-aware diff utility from Bellcore
llvm-svn: 12875
2004-04-12 22:53:24 +00:00
Brian Gaeke bb0f2db881 We don't need to insert TargetData into the PassManager here.
llvm-svn: 12874
2004-04-12 21:46:31 +00:00
Chris Lattner 176b4c2439 new testcase
llvm-svn: 12873
2004-04-12 20:59:07 +00:00
Alkis Evlogimenos 8f2df3aa3c Fix bug introduced in previous commit.
llvm-svn: 12872
2004-04-12 20:26:39 +00:00
Chris Lattner 55b7ef5a81 Add some methods that are useful for updating loop information.
llvm-svn: 12871
2004-04-12 20:26:17 +00:00
Alkis Evlogimenos 7ab640fdcb Update testcase to illustrate the coalescing problem. The previous one did not work because of a fix in the x86 instruction selector.
llvm-svn: 12870
2004-04-12 19:04:22 +00:00
Alkis Evlogimenos 0ede7ec4f8 Correctly compute spill weights
llvm-svn: 12869
2004-04-12 17:39:20 +00:00
John Criswell b7147b33a0 Added testcase for the llvm.readport and llvm.writeport intrinsics.
llvm-svn: 12868
2004-04-12 16:42:43 +00:00
John Criswell 7a57647f97 Corrected the descriptions of the llvm.writeport and llvm.writeio
intrinsics.

Modified llvm.readio and llvm.writeio to use pointers to memory instead
of integers.  This should take care of problems such as different pointer
sizes, casting integers to pointers, weird architectural pointer types, etc.

Re-worded the description of llvm.readio and llvm.writeio so that it should
be more clear as to why they should be used over regular loads/stores for
I/O.

llvm-svn: 12867
2004-04-12 16:33:19 +00:00
Alkis Evlogimenos b753c8c9c5 Print def lists a bit more compactly
llvm-svn: 12866
2004-04-12 15:57:58 +00:00
Alkis Evlogimenos 70bbce62b1 Add same value coalescing testcase
llvm-svn: 12865
2004-04-12 15:40:25 +00:00
John Criswell a450122ebf Added initial design for the llvm.readio and llvm.writeio intrinsics.
llvm-svn: 12864
2004-04-12 15:02:16 +00:00
Chris Lattner a2b279e89c Add a couple more IPO's
llvm-svn: 12863
2004-04-12 05:38:15 +00:00
Chris Lattner 0a7526470b finegrainify namespacification
llvm-svn: 12862
2004-04-12 05:38:01 +00:00
Chris Lattner be43544429 Actually update the call graph as the inliner changes it. This allows us to
execute other CallGraphSCCPasses after the inliner without crashing.

llvm-svn: 12861
2004-04-12 05:37:29 +00:00
Chris Lattner 8b6db18ac3 Change the call graph class to have TWO external nodes, making call graph
SCC passes much more useful.  In particular, this should fix the incredibly
stupid missed inlining opportunities that the inliner suffered from.

llvm-svn: 12860
2004-04-12 05:36:32 +00:00
Chris Lattner c9e37d7cc9 Hrm, operator new and new[] do not belong here. We should not CSE them! :)
llvm-svn: 12859
2004-04-12 05:16:42 +00:00
Chris Lattner 494a685449 Add support for removing invoke instructions
llvm-svn: 12858
2004-04-12 05:15:13 +00:00
Chris Lattner 08f201bee5 Stop printing Function*
llvm-svn: 12857
2004-04-12 04:06:56 +00:00
Chris Lattner d041dcd92f Simplify code a bit, and be sure to mark the external node as potentially throwing
llvm-svn: 12856
2004-04-12 04:06:38 +00:00
Chris Lattner a24f986333 Fix issues that the local allocator has dealing with instructions that implicitly use ST(0)
llvm-svn: 12855
2004-04-12 03:02:48 +00:00
Chris Lattner 2e2b0ceab9 No really, fix printing for LLC. I gotta get a way for CVS to whine at me if
I have unsaved emacs buffers, geeze...

llvm-svn: 12854
2004-04-12 01:52:04 +00:00
Chris Lattner ba1038e0f3 Correct printing for LLC and the encoding for the JIT
llvm-svn: 12853
2004-04-12 01:50:04 +00:00
Chris Lattner e407dbe9ff Use the fucomi[p] instructions to perform floating point comparisons instead
of the fucom[p][p] instructions.  This allows us to code generate this function

bool %test(double %X, double %Y) {
        %C = setlt double %Y, %X
        ret bool %C
}

... into:

test:
        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [%ESP + 12]
        fucomip %ST(1)
        fstp %ST(0)
        setb %AL
        movsx %EAX, %AL
        ret

where before we generated:

test:
        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [%ESP + 12]
        fucompp
**      fnstsw
**      sahf
        setb %AL
        movsx %EAX, %AL
        ret

The two marked instructions (which are the ones eliminated) are very bad,
because they serialize execution of the processor.  These instructions are
available on the PPRO and later, but since we already use cmov's we aren't
losing any portability.

I retained the old code for the day when we decide we want to support back
to the 386.

llvm-svn: 12852
2004-04-12 01:43:36 +00:00
Chris Lattner d1c7545322 Add support for the FUCOMIr instruction
llvm-svn: 12851
2004-04-12 01:39:15 +00:00
Chris Lattner 6c84d4ca44 Add two new instructions
llvm-svn: 12850
2004-04-12 01:38:55 +00:00
Chris Lattner 0fe57da8fa Fix a bug in my load/cast folding patch.
llvm-svn: 12849
2004-04-12 00:23:04 +00:00
Chris Lattner dc0105467a Adjust some comments, fix a bug in my previous patch
llvm-svn: 12848
2004-04-12 00:12:04 +00:00
Chris Lattner dfbb1d1cfe Disambiguate symbols after loop extraction so that we can diagnose a code
generator bug if multiple loops are extracted from a function.

llvm-svn: 12847
2004-04-11 23:52:35 +00:00
Chris Lattner 07c1c11511 On X86, casting an integer to floating point requires going through memory.
If the source of the cast is a load, we can just use the source memory location,
without having to create a temporary stack slot entry.

Before we code generated this:

double %int(int* %P) {
        %V = load int* %P
        %V2 = cast int %V to double
        ret double %V2
}

into:

int:
        sub %ESP, 4
        mov %EAX, DWORD PTR [%ESP + 8]
        mov %EAX, DWORD PTR [%EAX]
        mov DWORD PTR [%ESP], %EAX
        fild DWORD PTR [%ESP]
        add %ESP, 4
        ret

Now we produce this:

int:
        mov %EAX, DWORD PTR [%ESP + 4]
        fild DWORD PTR [%EAX]
        ret

... which is nicer.

llvm-svn: 12846
2004-04-11 23:21:26 +00:00
Chris Lattner 14243fb3b8 New testcase
llvm-svn: 12845
2004-04-11 23:18:30 +00:00
Chris Lattner d4af820aad Implement folding of loads into floating point operations. This implements:
test/Regression/CodeGen/X86/fp_load_fold.llx

llvm-svn: 12844
2004-04-11 22:05:45 +00:00
Chris Lattner fe94f0bf93 New testcase
llvm-svn: 12843
2004-04-11 22:05:16 +00:00
Chris Lattner dcb750f015 Unify all of the code for floating point +,-,*,/ into one function
llvm-svn: 12842
2004-04-11 21:23:56 +00:00
Chris Lattner 80ba401602 This implements folding of constant operands into floating point operations
for mul and div.

Instead of generating this:

test_divr:
        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [.CPItest_divr_0]
        fdivrp %ST(1)
        ret

We now generate this:

test_divr:
        fld QWORD PTR [%ESP + 4]
        fdivr QWORD PTR [.CPItest_divr_0]
        ret

This code desperately needs refactoring, which will come in the next
patch.

llvm-svn: 12841
2004-04-11 21:09:14 +00:00
Chris Lattner e1efbc7c6c Restructure the mul/div/rem handling code to follow the pattern the other
instructions use.  This doesn't change any functionality except that long
constant expressions of these operations will now magically start working.

llvm-svn: 12840
2004-04-11 20:56:28 +00:00
Chris Lattner f7ed7df539 Codegen FP adds and subtracts with a constant more efficiently, generating:
fld QWORD PTR [%ESP + 4]
        fadd QWORD PTR [.CPItest_add_0]

instead of:

        fld QWORD PTR [%ESP + 4]
        fld QWORD PTR [.CPItest_add_0]
        faddp %ST(1)

I also intend to do this for mul & div, but it appears that I have to
refactor a bit of code before I can do so.

This is tested by: test/Regression/CodeGen/X86/fp_constant_op.llx

llvm-svn: 12839
2004-04-11 20:26:20 +00:00
Chris Lattner b6e0b58fbc Add some new instructions
llvm-svn: 12838
2004-04-11 20:24:15 +00:00
Chris Lattner 9affe3e7df New testcase
llvm-svn: 12837
2004-04-11 20:24:01 +00:00
Chris Lattner 5b44472200 Relax assertion to make this function work with a broader class of instructions
llvm-svn: 12836
2004-04-11 20:21:06 +00:00
Chris Lattner 3f912a6f43 Two changes:
1. If an incoming argument is dead, don't load it from the stack
  2. Do not code gen noop copies at all (ie, cast int -> uint), not even to
     a move.  This should reduce register pressure for allocators that are
     unable to coallesce away these copies in some cases.

llvm-svn: 12835
2004-04-11 19:21:59 +00:00
Chris Lattner 5ec93a8678 Add another variant of the testcase
llvm-svn: 12834
2004-04-11 19:01:35 +00:00
Chris Lattner 403abb824f operator new & operator new[] do not kill any legal memory locations.
llvm-svn: 12833
2004-04-11 18:16:34 +00:00
Chris Lattner 74e5c31746 new testcase
llvm-svn: 12832
2004-04-11 16:47:15 +00:00
Chris Lattner c5fad355f8 Allow clients to be more efficient.
llvm-svn: 12831
2004-04-11 16:43:07 +00:00
Chris Lattner 9120ff3488 Make comments above APIs reflect what they should do.
llvm-svn: 12830
2004-04-11 16:42:50 +00:00
Chris Lattner a55bf865ea New method to allow more efficient clients
llvm-svn: 12829
2004-04-11 16:35:30 +00:00
Chris Lattner 24cf0200c7 Fix a bug in my select transformation
llvm-svn: 12826
2004-04-11 01:39:19 +00:00
Chris Lattner 192e326cd3 Add a missing break, which caused a crash in an obscure situation
llvm-svn: 12825
2004-04-11 01:29:30 +00:00
Chris Lattner f16fe7206c Update the value numbering interface.
llvm-svn: 12824
2004-04-10 22:33:34 +00:00
Chris Lattner ffdfe64ced Note to self: SAVE FILES!
llvm-svn: 12823
2004-04-10 22:32:47 +00:00
Chris Lattner 8e096ddeaf Add an interface to update value numbering
llvm-svn: 12822
2004-04-10 22:32:09 +00:00
Chris Lattner 623fba1107 Implement InstCombine/select.ll:test13*
llvm-svn: 12821
2004-04-10 22:21:27 +00:00
Chris Lattner 1f99df6d27 New testcases
llvm-svn: 12820
2004-04-10 22:21:14 +00:00
Chris Lattner cf4a996cba Implement InstCombine/add.ll:test20
Canonicalize add of sign bit constant into a xor

llvm-svn: 12819
2004-04-10 22:01:55 +00:00
Chris Lattner 825a00195d New testcase
llvm-svn: 12818
2004-04-10 22:01:27 +00:00
Chris Lattner 69c4900512 Rewrite the GCSE pass to be *substantially* simpler, a bit more efficient,
and a bit more powerful

llvm-svn: 12817
2004-04-10 21:11:11 +00:00
Chris Lattner f9d9665138 Fix spurious warning in release mode
llvm-svn: 12816
2004-04-10 19:15:56 +00:00
Chris Lattner d450df05ba Silence a spurious warning
llvm-svn: 12815
2004-04-10 18:32:01 +00:00
Chris Lattner d95ef7eff0 Simplify code a bit, and fix a bug that was breaking perlbmk
llvm-svn: 12814
2004-04-10 18:06:21 +00:00
Chris Lattner 7ebfe61dc1 Fix a bug in my checkin last night that was breaking programs using invoke.
llvm-svn: 12813
2004-04-10 16:53:29 +00:00
Chris Lattner 5093213c40 Fix previous patch
llvm-svn: 12811
2004-04-10 07:27:48 +00:00
Chris Lattner 6149ac8991 Correctly update counters
llvm-svn: 12810
2004-04-10 07:02:02 +00:00
Chris Lattner 027ccc1200 Add note
llvm-svn: 12809
2004-04-10 06:56:53 +00:00
Chris Lattner 4a1b03c773 Add a couple of more functions that cannot access memory (the intrinsics) and
don't write to memory

llvm-svn: 12808
2004-04-10 06:55:27 +00:00
Chris Lattner cfa1adcdb8 Simplify code a bit, and use alias analysis to allow us to delete unused
call and invoke instructions that are known to not write to memory.

llvm-svn: 12807
2004-04-10 06:53:09 +00:00
Chris Lattner 56471868e2 New testcases
llvm-svn: 12806
2004-04-10 06:52:20 +00:00
Chris Lattner f72a30b31c Clarify interface
llvm-svn: 12805
2004-04-10 06:11:29 +00:00
Chris Lattner 5393e11318 Create the output directory if it's not already there
llvm-svn: 12804
2004-04-10 06:03:22 +00:00
Chris Lattner d777677665 Simplify cfg now eliminates all of the branches in this testcase
llvm-svn: 12803
2004-04-09 23:50:29 +00:00
Chris Lattner e4ad3e599b Another testcase
llvm-svn: 12802
2004-04-09 23:47:52 +00:00
Chris Lattner 24cd6b9371 Testcase to make sure we can apply the shift to the operands of the select,
eliminating the shifts

llvm-svn: 12801
2004-04-09 23:47:24 +00:00
Chris Lattner 56e4d3d8ad Implement select.ll:test12*
This transforms code like this:

   %C = or %A, %B
   %D = select %cond, %C, %A
into:
   %C = select %cond, %B, 0
   %D = or %A, %C

Since B is often a constant, the select can often be eliminated.  In any case,
this reduces the usage count of A, allowing subsequent optimizations to happen.

This xform applies when the operator is any of:
  add, sub, mul, or, xor, and, shl, shr

llvm-svn: 12800
2004-04-09 23:46:01 +00:00
Chris Lattner be68fd036b Add testcases for harder combining cases.
llvm-svn: 12799
2004-04-09 23:43:48 +00:00
Chris Lattner 0aa565647c Fold code like:
if (C)
    V1 |= V2;

into:
  Vx = V1 | V2;
  V1 = select C, V1, Vx

when the expression can be evaluated unconditionally and is *cheap* to
execute.  This limited form of if conversion is quite handy in lots of cases.
For example, it turns this testcase into straight-line code:

int in0 ; int in1 ; int in2 ; int in3 ;
int in4 ; int in5 ; int in6 ; int in7 ;
int in8 ; int in9 ; int in10; int in11;
int in12; int in13; int in14; int in15;
long output;

void mux(void) {
  output =
      (in0   ?  0x00000001 : 0) | (in1   ?  0x00000002 : 0) |
      (in2   ?  0x00000004 : 0) | (in3   ?  0x00000008 : 0) |
      (in4   ?  0x00000010 : 0) | (in5   ?  0x00000020 : 0) |
      (in6   ?  0x00000040 : 0) | (in7   ?  0x00000080 : 0) |
      (in8   ?  0x00000100 : 0) | (in9   ?  0x00000200 : 0) |
      (in10  ?  0x00000400 : 0) | (in11  ?  0x00000800 : 0) |
      (in12  ?  0x00001000 : 0) | (in13  ?  0x00002000 : 0) |
      (in14  ?  0x00004000 : 0) | (in15  ?  0x00008000 : 0) ;
}

llvm-svn: 12798
2004-04-09 22:50:22 +00:00
Chris Lattner 5bcb4eb13c Fix an obvious bug in the refactoring I did a few days ago
llvm-svn: 12797
2004-04-09 22:28:33 +00:00
Chris Lattner 8ffe3e0b72 Expand on adding an intrinsic. Move section to before adding an instruction
llvm-svn: 12796
2004-04-09 19:24:20 +00:00
John Criswell 2b4c96e758 Reversed the order of the llvm.writeport() operands so that the value
is listed first and the address is listed second.

llvm-svn: 12795
2004-04-09 19:09:14 +00:00
Chris Lattner 183b336a54 Fold binary operators with a constant operand into select instructions
that have a constant operand.  This implements
add.ll:test19, shift.ll:test15*, and others that are not tested

llvm-svn: 12794
2004-04-09 19:05:30 +00:00
Chris Lattner cf7baf3519 Implement select.ll:test11
llvm-svn: 12793
2004-04-09 18:19:44 +00:00
Chris Lattner 755cab25ae new testcase
llvm-svn: 12792
2004-04-09 18:19:29 +00:00
Alkis Evlogimenos 237f203ca9 Add definition list to each live interval.
llvm-svn: 12791
2004-04-09 18:07:57 +00:00
John Criswell 417228d00a Fixed some spelling.
llvm-svn: 12790
2004-04-09 16:48:45 +00:00
John Criswell aa1c3c1f23 Modified the prototypes of the llvm.readport and llvm.writeport intrinsics
so that they do not specify specific integer sizes (as those are
constrained by the code generator, not the intrinsic itself).

Also put these intrinsics into their own "Operating System" section.

llvm-svn: 12789
2004-04-09 16:43:20 +00:00
John Criswell 508b93c569 Added the llvm.readport and llvm.writeport intrinsics.
llvm-svn: 12788
2004-04-09 15:23:37 +00:00
John Criswell 2fc9983852 Changed assertions to error messages.
llvm-svn: 12787
2004-04-09 15:10:15 +00:00
John Criswell c28c3b625f Changes recommended by Chris:
InstSelectSimple.cpp:
  Change the checks for proper I/O port address size into an exit() instead
  of an assertion.  Assertions aren't used in Release builds, and handling
  this error should be graceful (not that this counts as graceful, but it's
  more graceful).

  Modified the generation of the IN/OUT instructions to have 0 arguments.
X86InstrInfo.td:
  Added the OpSize attribute to the 16 bit IN and OUT instructions.

llvm-svn: 12786
2004-04-08 22:39:13 +00:00
Chris Lattner e228ee5870 Implement InstCombine/cast-propagate.ll
llvm-svn: 12784
2004-04-08 20:39:49 +00:00
Chris Lattner 22b2166b36 New testcase
llvm-svn: 12783
2004-04-08 20:39:40 +00:00
John Criswell 10db062d41 Added the llvm.readport and llvm.writeport intrinsics for x86. These do
I/O port instructions on x86.  The specific code sequence is tailored to
the parameters and return value of the intrinsic call.
Added the ability for implicit defintions to be printed in the Instruction
Printer.
Added the ability for RawFrm instruction to print implict uses and
defintions with correct comma output.  This required adjustment to some
methods so that a leading comma would or would not be printed.

llvm-svn: 12782
2004-04-08 20:31:47 +00:00
John Criswell 5201004ef9 Added the llvm.readport and llvm.writeport intrinsics.
The Verifier ensures that their parameters are of integral types and have
the correct sign, but it does not enforce any size restrictions because
such restrictions are platform dependent.

llvm-svn: 12781
2004-04-08 20:27:38 +00:00
John Criswell 6d42651933 Added the llvm.readport and llvm.writeport intrinsics.
llvm-svn: 12780
2004-04-08 20:26:21 +00:00
Chris Lattner 3b3861d305 Implement ScalarRepl/select_promote.ll
llvm-svn: 12779
2004-04-08 19:59:34 +00:00
Chris Lattner 3b613818f6 New testcase, corresponding to phi_promote.ll
llvm-svn: 12778
2004-04-08 19:59:22 +00:00
Brian Gaeke a8d593e947 This file does not appear to be included anywhere.
llvm-svn: 12777
2004-04-08 19:36:26 +00:00
Chris Lattner d61b13c6e2 Disable strict alias analysis in the backend c compiler, as the code we
generate is not TBAA safe.

llvm-svn: 12774
2004-04-08 15:18:59 +00:00
Chris Lattner a182f5bf48 Revert previous patch, I'm a moron :)
llvm-svn: 12773
2004-04-08 15:18:03 +00:00
Chris Lattner 177fe8d82f Right, we break strict aliasing requirements. Make sure to disable strict
aliasing in the C compiler.

llvm-svn: 12772
2004-04-08 15:14:43 +00:00
Chris Lattner 4d25c86b52 Remove the "really gross hacks" that are there to deal with recursive functions.
Now we collect all of the call sites we are interested in inlining, then inline
them.  This entirely avoids issues with trying to inline a call site we got by
inlining another call site.  This also eliminates iterator invalidation issues.

llvm-svn: 12770
2004-04-08 06:34:31 +00:00
Chris Lattner 1c631e813d Implement InstCombine/select.ll:test[7-10]
llvm-svn: 12769
2004-04-08 04:43:23 +00:00
Chris Lattner ac42fd5912 Add some more cases we should combine
llvm-svn: 12768
2004-04-08 04:43:04 +00:00
Brian Gaeke 8a56f16700 This file is no longer used.
llvm-svn: 12767
2004-04-07 21:01:22 +00:00
Brian Gaeke 69ee7e1353 Don't include InstrSelectionSupport.h.
llvm-svn: 12766
2004-04-07 20:55:32 +00:00
Brian Gaeke c125664927 Move ChooseRegOrImmed() prototype here, from InstrSelectionSupport.h.
llvm-svn: 12765
2004-04-07 20:38:57 +00:00
Brian Gaeke 5c80118367 Don't include InstrSelectionSupport.h.
llvm-svn: 12764
2004-04-07 20:38:56 +00:00
Chris Lattner 2b2412d0c8 Implement test/Regression/Transforms/InstCombine/getelementptr_index.ll
llvm-svn: 12762
2004-04-07 18:38:20 +00:00
Chris Lattner dadf78d933 New testcase
llvm-svn: 12761
2004-04-07 18:38:01 +00:00
Brian Gaeke 8931345fe5 Fix insertion of SelectInsts.
llvm-svn: 12760
2004-04-07 18:31:47 +00:00
Brian Gaeke 85521d70dd Don't print [%reg + 0], just print [%reg]
llvm-svn: 12759
2004-04-07 17:33:56 +00:00
Brian Gaeke 6d62df5422 First version of code to handle loads. Stub function for handling stores.
llvm-svn: 12758
2004-04-07 17:29:37 +00:00
Brian Gaeke 989c04ab58 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.

llvm-svn: 12757
2004-04-07 17:04:09 +00:00
Brian Gaeke 7985e56cf9 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.

llvm-svn: 12756
2004-04-07 16:41:22 +00:00
Chris Lattner 13de334a4e New testcase that crashed scalarevolution on sparc
llvm-svn: 12755
2004-04-07 16:17:45 +00:00
Chris Lattner 74498e1066 Fix a bug Brian found.
llvm-svn: 12754
2004-04-07 16:16:11 +00:00
Brian Gaeke 52ad5f94e2 We have a global reg. allocator now -- thanks to Alkis.
Fix a typo.
Add a project I've always thought would be cool.

llvm-svn: 12747
2004-04-07 15:31:23 +00:00
Chris Lattner d93de7a754 New file that can be useful for hand inspection of assembly required for certain
kinds of instructions.

llvm-svn: 12746
2004-04-07 05:06:39 +00:00
Chris Lattner bd58b3fbe9 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.

llvm-svn: 12745
2004-04-07 05:04:51 +00:00
Chris Lattner bb22d5a564 andd subcc instructions which is used to create the 'cmp' pseudo instruction
llvm-svn: 12744
2004-04-07 05:04:01 +00:00
Chris Lattner f6245bc8e9 Avoid emitting an extra copy on each 32-bit operation
llvm-svn: 12743
2004-04-07 04:36:53 +00:00
Brian Gaeke 4aac81435f Make generation of stack-slot loads and copies less ugly.
llvm-svn: 12742
2004-04-07 04:29:14 +00:00
Brian Gaeke 3675c30873 Fix bug in printing loads.
llvm-svn: 12741
2004-04-07 04:29:03 +00:00
Chris Lattner 42ffd2e32c Add support for shift instructions, wrap some long lines
llvm-svn: 12740
2004-04-07 04:27:16 +00:00
Chris Lattner 8406cf3046 Fix encoding of existing shift instructions, add rr shifts
llvm-svn: 12739
2004-04-07 04:26:57 +00:00
Chris Lattner a67801f0d4 New testcase
llvm-svn: 12738
2004-04-07 04:08:21 +00:00
Chris Lattner fcdf82a19f Add a bunch more instructions
llvm-svn: 12737
2004-04-07 04:06:46 +00:00
Chris Lattner fd8212ef54 Merge my changes with brians
llvm-svn: 12736
2004-04-07 04:05:49 +00:00
Brian Gaeke 37f92b534f Add in some things I forgot, which Chris helpfully reminded me of...
llvm-svn: 12735
2004-04-07 04:05:12 +00:00
Brian Gaeke 322423181b Add support for the "Y" register, used by MUL & DIV.
llvm-svn: 12734
2004-04-07 04:01:11 +00:00
Brian Gaeke 5524d54c02 Add UDIV, SDIV, and a few variants of WR.
llvm-svn: 12733
2004-04-07 04:01:00 +00:00
Brian Gaeke cfbfb8ac57 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.

llvm-svn: 12732
2004-04-07 04:00:49 +00:00
Brian Gaeke 589bf05bf4 Prune unnecessary #includes
llvm-svn: 12731
2004-04-06 23:25:07 +00:00
Brian Gaeke b3deed9fae Simple delay slot filler pass.
llvm-svn: 12730
2004-04-06 23:21:45 +00:00
Brian Gaeke 610c685eb6 Add references to delay slot filler pass.
Fill in addPassesToJITCompile method.

llvm-svn: 12729
2004-04-06 23:21:24 +00:00
Brian Gaeke 4bd246aee9 First attempt at handling frame index elimination.
llvm-svn: 12728
2004-04-06 22:10:22 +00:00
Brian Gaeke 3915ad7c02 First attempt at special-casing printing of [%reg + offset] for
ld/st instructions - doesn't seem to work yet, but I think it's
just a typo or something somewhere.

llvm-svn: 12727
2004-04-06 22:10:11 +00:00
Brian Gaeke 5e624b822b Delete reference to "the Mach-O Runtime ABI".
llvm-svn: 12726
2004-04-06 22:09:59 +00:00
Brian Gaeke 2e91a3d650 Deal with call return values.
Don't put NOPs in delay slots at all. We'll have a fix-up pass later.

llvm-svn: 12725
2004-04-06 22:09:23 +00:00
John Criswell 5ecbed21be Adding kimwitu++ license.
llvm-svn: 12719
2004-04-06 20:23:45 +00:00
Chris Lattner 4e34492569 Bugs fixed new features implemented
llvm-svn: 12716
2004-04-06 19:48:42 +00:00
Jakub Staszak b8955205ce file based off InstSelectSimple.cpp, slowly being replaced by generated code from the really simple X86 instruction selector tablegen backend
llvm-svn: 12715
2004-04-06 19:35:17 +00:00
Jakub Staszak de647007d3 Tablgen files for really simple instruction selector
llvm-svn: 12714
2004-04-06 19:34:00 +00:00
Jakub Staszak 68a9025f50 Tablegen backend for really simple instruction selector
llvm-svn: 12713
2004-04-06 19:31:31 +00:00
Jakub Staszak f9bfc7f927 add tablgen backend for really simple instruction selector
llvm-svn: 12712
2004-04-06 19:30:56 +00:00
Chris Lattner 4b9361254a Fix PR313: [x86] JIT miscompiles unsigned short to floating point
llvm-svn: 12711
2004-04-06 19:29:36 +00:00
Chris Lattner ba33ae5831 Fix incorrect encoding of some ADC and SBB instuctions
llvm-svn: 12710
2004-04-06 19:20:32 +00:00
John Criswell 4db8b67a68 Added licensing information for treecc.
llvm-svn: 12703
2004-04-06 17:51:10 +00:00
Chris Lattner 19c8b13ec5 Fix a minor bug in previous checking
Enable folding of long seteq/setne comparisons into branches and select instructions
Implement unfolded long relational comparisons against a constants a bit more efficiently

Folding comparisons changes code that looks like this:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, %EAX
        or %ECX, %EDX
        sete %CL
        test %CL, %CL
        je .LBB2 # PC rel: F

into code that looks like this:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, %EAX
        or %ECX, %EDX
        jne .LBB2 # PC rel: F

This speeds up 186.crafty by 6% with llc-ls.

llvm-svn: 12702
2004-04-06 17:34:50 +00:00
Misha Brukman 827c985aae Wrap at 80 cols.
llvm-svn: 12701
2004-04-06 17:04:30 +00:00
Chris Lattner e216fc01b7 Minor cleanups
llvm-svn: 12700
2004-04-06 16:54:04 +00:00
Chris Lattner 7f601ade01 Document new option
llvm-svn: 12699
2004-04-06 16:46:12 +00:00
Chris Lattner ad733e733e Add a new gccld -native-cbe option which causes gccld to generate native code
for the application with the C backend instead of the native LLVM code generator

llvm-svn: 12698
2004-04-06 16:43:13 +00:00
Chris Lattner f2ee88eb5a Improve codegen of long == and != comparisons against constants. Before,
comparing a long against zero got us this:

        sub %ESP, 8
        mov DWORD PTR [%ESP + 4], %ESI
        mov DWORD PTR [%ESP], %EDI
        mov %EAX, DWORD PTR [%ESP + 12]
        mov %EDX, DWORD PTR [%ESP + 16]
        mov %ECX, 0
        mov %ESI, 0
        mov %EDI, %EAX
        xor %EDI, %ECX
        mov %ECX, %EDX
        xor %ECX, %ESI
        or %EDI, %ECX
        sete %CL
        test %CL, %CL
        je .LBB2 # PC rel: F

Now it gets us this:

        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, %EAX
        or %ECX, %EDX
        sete %CL
        test %CL, %CL
        je .LBB2 # PC rel: F

llvm-svn: 12696
2004-04-06 16:02:27 +00:00
Chris Lattner 3ef249c05e Update docs a bit
llvm-svn: 12695
2004-04-06 15:22:35 +00:00
Chris Lattner 80e594fa80 Remove some options that don't really have anything to do with bugpoint
llvm-svn: 12694
2004-04-06 15:14:10 +00:00
Chris Lattner 6c3bf13fce Handle various other important cases of multiplying a long constant immediate. For
example, multiplying X*(1 + (1LL << 32)) now produces:

test:
        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %EAX, %ECX
        add %EDX, %ECX
        ret

[[[Note to Alkis: why isn't linear scan generating this code??  This might be a
 problem with your intervals being too conservative:

test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        add %EDX, %EAX
        ret

end note]]]

Whereas GCC produces this:

T:
        sub     %esp, 12
        mov     %edx, DWORD PTR [%esp+16]
        mov     DWORD PTR [%esp+8], %edi
        mov     %ecx, DWORD PTR [%esp+20]
        xor     %edi, %edi
        mov     DWORD PTR [%esp], %ebx
        mov     %ebx, %edi
        mov     %eax, %edx
        mov     DWORD PTR [%esp+4], %esi
        add     %ebx, %edx
        mov     %edi, DWORD PTR [%esp+8]
        lea     %edx, [%ecx+%ebx]
        mov     %esi, DWORD PTR [%esp+4]
        mov     %ebx, DWORD PTR [%esp]
        add     %esp, 12
        ret

I'm not sure example what GCC is smoking here, but it looks like it has just
confused itself with a bunch of stack slots or something.  The intel compiler
is better, but still not good:

T:
        movl      4(%esp), %edx                                 #2.11
        movl      8(%esp), %eax                                 #2.11
        lea       (%eax,%edx), %ecx                             #3.12
        movl      $1, %eax                                      #3.12
        mull      %edx                                          #3.12
        addl      %ecx, %edx                                    #3.12
        ret                                                     #3.12

llvm-svn: 12693
2004-04-06 04:55:43 +00:00
Chris Lattner 1f6024cbbe Efficiently handle a long multiplication by a constant. For this testcase:
long %test(long %X) {
        %Y = mul long %X, 123
        ret long %Y
}

we used to generate:

test:
        sub %ESP, 12
        mov DWORD PTR [%ESP + 8], %ESI
        mov DWORD PTR [%ESP + 4], %EDI
        mov DWORD PTR [%ESP], %EBX
        mov %ECX, DWORD PTR [%ESP + 16]
        mov %ESI, DWORD PTR [%ESP + 20]
        mov %EDI, 123
        mov %EBX, 0
        mov %EAX, %ECX
        mul %EDI
        imul %ESI, %EDI
        add %ESI, %EDX
        imul %ECX, %EBX
        add %ESI, %ECX
        mov %EDX, %ESI
        mov %EBX, DWORD PTR [%ESP]
        mov %EDI, DWORD PTR [%ESP + 4]
        mov %ESI, DWORD PTR [%ESP + 8]
        add %ESP, 12
        ret

Now we emit:
test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        mov %EDX, 123
        mul %EDX
        imul %ECX, %ECX, 123
        add %ECX, %EDX
        mov %EDX, %ECX
        ret

Which, incidently, is substantially nicer than what GCC manages:
T:
        sub     %esp, 8
        mov     %eax, 123
        mov     DWORD PTR [%esp], %ebx
        mov     %ebx, DWORD PTR [%esp+16]
        mov     DWORD PTR [%esp+4], %esi
        mov     %esi, DWORD PTR [%esp+12]
        imul    %ecx, %ebx, 123
        mov     %ebx, DWORD PTR [%esp]
        mul     %esi
        mov     %esi, DWORD PTR [%esp+4]
        add     %esp, 8
        lea     %edx, [%ecx+%edx]
        ret

llvm-svn: 12692
2004-04-06 04:29:36 +00:00
Misha Brukman ad3e28cbc6 * Added link to newly written ExtendingLLVM.html document
* Eliminated extraneous space in the HTML

llvm-svn: 12691
2004-04-06 04:22:43 +00:00
Misha Brukman c069ca5d05 Incorporated Chris' comments.
llvm-svn: 12690
2004-04-06 04:17:51 +00:00
Misha Brukman 2282a6eb31 Added notes on extending LLVM with new instructions, intrinsics, types, etc.
llvm-svn: 12689
2004-04-06 03:53:49 +00:00
Chris Lattner 2448baea2a Improve code generation of long shifts by 32.
On this testcase:

long %test(long %X) {
        %Y = shr long %X, ubyte 32
        ret long %Y
}

instead of:
t:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%ESP + 8]
        sar %EAX, 0
        mov %EDX, 0
        ret


we now emit:
test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%ESP + 8]
        mov %EDX, 0
        ret

llvm-svn: 12688
2004-04-06 03:42:38 +00:00
Chris Lattner 7332d4c5fd Bugfixes: inc/dec don't set the carry flag!
llvm-svn: 12687
2004-04-06 03:36:57 +00:00
Chris Lattner decce5bc26 Improve code for passing constant longs as arguments to function calls.
For example, on this instruction:

        call void %test(long 1234)

Instead of this:
        mov %EAX, 1234
        mov %ECX, 0
        mov DWORD PTR [%ESP], %EAX
        mov DWORD PTR [%ESP + 4], %ECX
        call test

We now emit this:
        mov DWORD PTR [%ESP], 1234
        mov DWORD PTR [%ESP + 4], 0
        call test

llvm-svn: 12686
2004-04-06 03:23:00 +00:00
Chris Lattner 5fc6f77b60 Emit more efficient 64-bit operations when the RHS is a constant, and one
of the words of the constant is zeros.  For example:
  Y = and long X, 1234

now generates:
  Yl = and Xl, 1234
  Yh = 0

instead of:
  Yl = and Xl, 1234
  Yh = and Xh, 0

llvm-svn: 12685
2004-04-06 03:15:53 +00:00
Chris Lattner b49608afad Fix typeo
llvm-svn: 12684
2004-04-06 02:13:25 +00:00
Chris Lattner 996e667ad4 Add support for simple immediate handling to long instruction selection.
This allows us to handle code like 'add long %X, 123456789012' more efficiently.

llvm-svn: 12683
2004-04-06 02:11:49 +00:00
Chris Lattner 9366f0347d The sbb instructions really ARE sbb's, not adc's
llvm-svn: 12682
2004-04-06 02:02:11 +00:00
Chris Lattner 37ba31f740 Implement negation of longs efficiently. For this testcase:
long %test(long %X) {
        %Y = sub long 0, %X
        ret long %Y
}

We used to generate:

test:
        sub %ESP, 4
        mov DWORD PTR [%ESP], %ESI
        mov %ECX, DWORD PTR [%ESP + 8]
        mov %ESI, DWORD PTR [%ESP + 12]
        mov %EAX, 0
        mov %EDX, 0
        sub %EAX, %ECX
        sbb %EDX, %ESI
        mov %ESI, DWORD PTR [%ESP]
        add %ESP, 4
        ret

Now we generate:

test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        neg %EAX
        adc %EDX, 0
        neg %EDX
        ret

llvm-svn: 12681
2004-04-06 01:48:06 +00:00
Chris Lattner bfe74f58d9 Minor tweak to avoid an extra reg-reg copy that the register allocator has to eliminate
llvm-svn: 12680
2004-04-06 01:25:33 +00:00
Chris Lattner 464e2ea567 Two changes:
* In promote32, if we can just promote a constant value, do so instead of
    promoting a constant dynamically.
  * In visitReturn inst, actually USE the promote32 argument that takes a
    Value*

The end result of this is that we now generate this:

test:
        mov %EAX, 0
        ret

instead of...

test:
        mov %AX, 0
        movzx %EAX, %AX
        ret

for:

ushort %test() {
        ret ushort 0
}

llvm-svn: 12679
2004-04-06 01:21:00 +00:00
Chris Lattner bf791614ed Merge the code generator miscompilation code into the optimizer miscompilation
code.  This "instantly" gives us loop-extractor power to assist with the
debugment of our nasty codegen issues.  :)

llvm-svn: 12678
2004-04-05 22:58:16 +00:00
Chris Lattner 95053a9f28 Make a method public
llvm-svn: 12677
2004-04-05 22:01:48 +00:00
Chris Lattner 9af52d12d9 Minor cleanups, remove some old debug code
llvm-svn: 12676
2004-04-05 21:37:55 +00:00
Chris Lattner 0434ba3ed0 Refactor and genericize code
llvm-svn: 12675
2004-04-05 21:37:38 +00:00
Chris Lattner b0d1e9d02e lli no longer takes the -quiet option!
llvm-svn: 12674
2004-04-05 20:28:41 +00:00
Chris Lattner c97b7b2285 Do not mangle intrinsics in any way!
llvm-svn: 12673
2004-04-05 20:17:53 +00:00
Chris Lattner 0f1df36bdd Make full use of the Mangler interface to simplify code
llvm-svn: 12671
2004-04-05 19:31:02 +00:00
Chris Lattner d4f78f270b Sparc don't got not "sqrtl", bum bum bum
llvm-svn: 12670
2004-04-05 19:05:15 +00:00
Misha Brukman 5ebc25c818 Kill warnings during an optimized compile where assert() disappears.
llvm-svn: 12669
2004-04-05 19:00:46 +00:00
Chris Lattner 29153fc2e5 Fix PR312 and IndVarsSimplify/2004-04-05-InvokeCastCrash.llx
llvm-svn: 12668
2004-04-05 18:46:55 +00:00
Chris Lattner 6f4fea937b New testcase for PR312
llvm-svn: 12667
2004-04-05 18:46:33 +00:00
Chris Lattner 4d1fcf1dcd Fix a bug in yesterdays checkins which broke siod. siod is a great testcase! :)
llvm-svn: 12659
2004-04-05 16:02:41 +00:00
Chris Lattner 8953b90aaa Fix InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll
llvm-svn: 12658
2004-04-05 02:10:19 +00:00
Chris Lattner e79fd5c766 New testcase that crashes the instcombine pass. Dominance properties have
no meaning if the code is not reachable.

llvm-svn: 12657
2004-04-05 02:01:32 +00:00
Chris Lattner 677202b49e PR82 is finally fixed!
llvm-svn: 12656
2004-04-05 01:43:08 +00:00
Chris Lattner 6087034f3a Minor change
llvm-svn: 12655
2004-04-05 01:31:50 +00:00
Chris Lattner 33fd702590 Update getelementptr instruction description
llvm-svn: 12654
2004-04-05 01:30:49 +00:00
Chris Lattner 69193f93b6 Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

llvm-svn: 12653
2004-04-05 01:30:19 +00:00
Chris Lattner fd9fbe187d Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

Auto-upgrade .ll files that use ubytes to index into structures to use uint's.

llvm-svn: 12652
2004-04-05 01:30:04 +00:00
Chris Lattner 15701e84d1 Implement support for a new LLVM 1.3 bytecode format, which uses uint's
to index into structure types and allows arbitrary 32- and 64-bit integer
types to index into sequential types.

llvm-svn: 12651
2004-04-05 01:27:26 +00:00
Chris Lattner 60cf133a8e Be more restrictive with the index types we allow for sequential types
llvm-svn: 12650
2004-04-05 01:25:21 +00:00
Chris Lattner e916f16dbb PR305 is now fixed
llvm-svn: 12649
2004-04-05 00:40:55 +00:00
Chris Lattner dd28474610 Add ConstantExpr::get(Sign|Zero)Extend methods
llvm-svn: 12648
2004-04-04 23:20:30 +00:00
Chris Lattner dfcf8e34cf In the perhaps not-to-distant future, we might support gep instructions that
have non-long indices for sequential types.  In order to avoid trying to figure
out how the v9 backend works, we'll just hack it in the preselection pass.

llvm-svn: 12647
2004-04-04 20:44:05 +00:00
Chris Lattner ca76d11a81 Adjust to new interface
llvm-svn: 12646
2004-04-04 19:47:06 +00:00
Chris Lattner 5453b2f376 Support iteration over constant instructions
llvm-svn: 12645
2004-04-04 19:46:54 +00:00
Chris Lattner 092d260fc1 Adjust to new gep_type_iterator prototypes.
llvm-svn: 12644
2004-04-04 17:30:06 +00:00
Chris Lattner bc8ba73cf1 Remove a bunch of cruft that was used to be backwards compatible with the last
prerelease format for LLVM bytecode files.  Now we only are compatible with
LLVM 1.0+.

llvm-svn: 12643
2004-04-03 23:43:42 +00:00
Chris Lattner 476f71e30b Allow for use of arbitrary iterator types...
llvm-svn: 12642
2004-04-03 23:29:11 +00:00
Chris Lattner 8ed3c8aa13 Implement test/Regression/Transforms/GCSE/undefined_load.ll
llvm-svn: 12641
2004-04-03 00:45:16 +00:00
Chris Lattner db033fa425 New testcase
llvm-svn: 12640
2004-04-03 00:44:56 +00:00
Chris Lattner 0defaa1cbc Add a break in the default case
llvm-svn: 12639
2004-04-03 00:43:03 +00:00
Brian Gaeke 5ade501501 Add autoconf support for isStandardOutAConsole ().
llvm-svn: 12638
2004-04-02 21:26:04 +00:00
Brian Gaeke 0d372ee696 Regenerated using autoheader-2.57.
llvm-svn: 12637
2004-04-02 21:26:03 +00:00
Brian Gaeke 8bdbb3d7eb Regenerated using autoconf-2.57.
llvm-svn: 12636
2004-04-02 21:26:02 +00:00
Brian Gaeke c6dba95bbc check for isatty function
llvm-svn: 12635
2004-04-02 21:06:44 +00:00
Chris Lattner 9dcd639e5c Remove obsolete analyses
llvm-svn: 12634
2004-04-02 20:56:33 +00:00
Chris Lattner 6748cca268 Remove obsolete files
llvm-svn: 12633
2004-04-02 20:56:24 +00:00
Brian Gaeke d0bdad38f3 Add support for many of the MRegisterInfo callbacks.
Eliminating call-frame pseudo instrs and frame indices are still stubs.
Flesh out the emitPrologue method based on better ABI knowledge.

llvm-svn: 12632
2004-04-02 20:53:37 +00:00
Brian Gaeke d4869e4107 Add load, store, and NOP instructions.
Fix up comments.

llvm-svn: 12631
2004-04-02 20:53:37 +00:00
Brian Gaeke b65254a34d Add support for printing pc-relative displacements of functions (as used in
the CALL instruction).

llvm-svn: 12630
2004-04-02 20:53:35 +00:00
Brian Gaeke 2fd46b6e43 Add support for call instructions (0-ary only for now).
llvm-svn: 12629
2004-04-02 20:53:33 +00:00
Chris Lattner 6f29c89597 cleanup some long-dead code
llvm-svn: 12628
2004-04-02 20:46:26 +00:00
Chris Lattner d4f122044a Ignore configure produced files
llvm-svn: 12627
2004-04-02 20:34:30 +00:00
Chris Lattner 64cdd1ef55 Tweak libraries for scev changes
llvm-svn: 12625
2004-04-02 20:32:46 +00:00
Chris Lattner d8d803adb9 new testcase
llvm-svn: 12624
2004-04-02 20:27:47 +00:00
Chris Lattner 0916921332 Comment out debugging printouts
llvm-svn: 12623
2004-04-02 20:26:46 +00:00
Chris Lattner 76378746c5 New testcases for the indvars pass
llvm-svn: 12622
2004-04-02 20:26:04 +00:00
Chris Lattner 2c416ae11f Tweak testcase to work with new indvars pass
llvm-svn: 12621
2004-04-02 20:25:26 +00:00
Chris Lattner e61b67d7d5 Rewrite the indvars pass to use the ScalarEvolution analysis.
This also implements some new features for the indvars pass, including
linear function test replacement, exit value substitution, and it works with
a much more general class of induction variables and loops.

llvm-svn: 12620
2004-04-02 20:24:31 +00:00
Chris Lattner d934c70cf8 Add a new analysis
llvm-svn: 12619
2004-04-02 20:23:17 +00:00
Chris Lattner eed034bcd3 Fix the obvious bug in my previous checkin
llvm-svn: 12618
2004-04-02 18:15:10 +00:00
Chris Lattner 9f0db32625 Implement Transforms/SimplifyCFG/return-merge.ll
This actually causes us to turn code like:

  return C ? A : B;

into a select instruction.

llvm-svn: 12617
2004-04-02 18:13:43 +00:00
Chris Lattner 99c9b9c02f New testcase
llvm-svn: 12616
2004-04-02 18:12:49 +00:00
Alkis Evlogimenos d64e904e27 Clean up code a bit.
llvm-svn: 12615
2004-04-02 18:11:32 +00:00
Brian Gaeke 2845936a34 Only strip symbols if emitting bytecode to the assembly file.
Move lowerselect pass to come after preselection.  Move machine
code construction and stack slots pass to come right before instruction
selection. This is to help fix perlbmk.

Update comments.

Make the sequence of passes in addPassesToJITCompile look more like
the sequence of passes in addPassesToEmitAssembly, including support
for -print-machineinstrs.

llvm-svn: 12614
2004-04-02 17:52:40 +00:00
Brian Gaeke cc24411c0a Add support for constant select expressions. Clarify the assertion failure msg.
llvm-svn: 12613
2004-04-02 17:52:29 +00:00
Chris Lattner 3838243d04 Minor speedup
llvm-svn: 12612
2004-04-02 16:28:32 +00:00
Alkis Evlogimenos fe66caa9a0 Fix type in comments
llvm-svn: 12611
2004-04-02 16:02:50 +00:00
Alkis Evlogimenos 5fc4772d5e Fix type in instruction builder instantiation
llvm-svn: 12610
2004-04-02 15:51:03 +00:00
Chris Lattner a45a216ff6 Make the verifier API more complete and useful.
Patch contributed by Reid Spencer

llvm-svn: 12609
2004-04-02 15:45:08 +00:00
Chris Lattner b753dd1cb4 Make the verifier API more complete and useful
llvm-svn: 12608
2004-04-02 15:44:33 +00:00
Alkis Evlogimenos d186ed02e4 Add more ADC and SBB variants
llvm-svn: 12607
2004-04-02 07:11:10 +00:00
Chris Lattner bcf2623cab minor formatting change
llvm-svn: 12606
2004-04-02 06:32:45 +00:00
Chris Lattner a413b08580 Fix two pretty serious bugs:
1. Each time the loop extractor extracted a loop, we would leak a module.
  2. When we extracted a loop, we didn't add the new function to the list of
     miscompiled functions.  Thus if the bug was in a loop nest and we
     extracted it, we could actually *LOSE THE BUG*, which is very bad.

With these patches, bugpoint has successfully found a bug for me in a function
with several nested loops, and cut it down to just one of them. :) :)

llvm-svn: 12605
2004-04-02 06:32:17 +00:00
Chris Lattner af67dac7f4 Fix a fairly nasty bug that prevented bugpoint from working quite right when
hacking on programs with two functions that have the same name.

llvm-svn: 12604
2004-04-02 06:30:33 +00:00
Chris Lattner 73c141ac71 If the program returns a non-zero exit value, don't leave files laying
around

llvm-svn: 12603
2004-04-02 05:33:06 +00:00
Chris Lattner 46e18c7f87 Fix wonky header
Address PR305: LLVM tools will happily spew bytecode onto your terminal

llvm-svn: 12602
2004-04-02 05:06:57 +00:00
Chris Lattner 3af1fffd3c Add new function
llvm-svn: 12601
2004-04-02 05:04:12 +00:00
Chris Lattner 454e18317d Add new function, autoconf support required tho
llvm-svn: 12600
2004-04-02 05:04:03 +00:00
Chris Lattner fd8f46b1cd Bug fixed
llvm-svn: 12598
2004-04-01 20:31:29 +00:00
Chris Lattner c24019c825 Fix PR310 and TailDup/2004-04-01-DemoteRegToStack.llx
llvm-svn: 12597
2004-04-01 20:28:45 +00:00
Chris Lattner 914a7d0d90 New testcase for PR310
llvm-svn: 12596
2004-04-01 20:28:35 +00:00
Chris Lattner 59fdf74968 Remove some assertions that are now bogus with the last patch I put in
llvm-svn: 12595
2004-04-01 19:21:46 +00:00
Chris Lattner ff03fe3b13 Bug fixed
llvm-svn: 12593
2004-04-01 19:09:49 +00:00
Chris Lattner 146d0df5e4 Fix PR306: Loop simplify incorrectly updates dominator information
Testcase: LoopSimplify/2004-04-01-IncorrectDomUpdate.ll

llvm-svn: 12592
2004-04-01 19:06:07 +00:00
Chris Lattner f475a12626 New testcase for PR306
llvm-svn: 12591
2004-04-01 19:05:54 +00:00
Misha Brukman b78259a57d Fix grammar.
llvm-svn: 12590
2004-04-01 17:15:42 +00:00
Chris Lattner b28dd11e33 Add support for select constant expressions to the CBE, fixing SIOD
llvm-svn: 12589
2004-04-01 05:28:26 +00:00
Chris Lattner bc7e35b3b1 Simplify code by using the more powerful BuildMI forms.
Implement a small optimization.  In test/Regression/CodeGen/X86/select.ll,
we now generate this for foldSel3:

foldSel3:
        mov %AL, BYTE PTR [%ESP + 4]
        fld DWORD PTR [%ESP + 8]
        fld DWORD PTR [%ESP + 12]
        mov %EAX, DWORD PTR [%ESP + 16]
        mov %ECX, DWORD PTR [%ESP + 20]
        cmp %EAX, %ECX
        fxch %ST(1)
        fcmovae %ST(0), %ST(1)
***     fstp %ST(1)
        ret

Instead of:

foldSel3:
        mov %AL, BYTE PTR [%ESP + 4]
        fld DWORD PTR [%ESP + 8]
        fld DWORD PTR [%ESP + 12]
        mov %EAX, DWORD PTR [%ESP + 16]
        mov %ECX, DWORD PTR [%ESP + 20]
        cmp %EAX, %ECX
        fxch %ST(1)
        fcmovae %ST(0), %ST(1)
***     fxch %ST(1)
***     fstp %ST(0)
        ret

In practice, this only effects code size: performance should be basically
unaffected.

llvm-svn: 12588
2004-04-01 04:06:09 +00:00
Chris Lattner 3c8561442c Wrap at 80 cols
llvm-svn: 12587
2004-04-01 04:03:27 +00:00
Chris Lattner fb893edbe3 Allow converting a builder to an iterator
llvm-svn: 12586
2004-04-01 04:03:10 +00:00
Chris Lattner cfbc023153 Tests for fp cmov's that I forgot to check in earlier
llvm-svn: 12585
2004-04-01 03:47:56 +00:00
Chris Lattner 1a7e43c5cf Clear out all of the changes. Reset version numbers to 1.3
add note about select

llvm-svn: 12584
2004-04-01 00:41:31 +00:00
Brian Gaeke 8f177d9171 Add clear() forwarding method.
llvm-svn: 12580
2004-03-31 22:43:12 +00:00
Chris Lattner d55509c281 Generate slightly smaller code, "test R, R" instead of "cmp R, 0"
llvm-svn: 12579
2004-03-31 22:22:36 +00:00
Chris Lattner a4b15f04c6 The X86 backend no longer needs the select lowering pass.
llvm-svn: 12578
2004-03-31 22:03:46 +00:00
Chris Lattner 37a7f09d80 Codegen FP select instructions into X86 conditional moves. Annoyingly enough
the X86 does not support a full set of fp cmove instructions, so we can't always
fold the condition into the select.  :(  Yuck.

llvm-svn: 12577
2004-03-31 22:03:35 +00:00
Chris Lattner c07c95816a Add support for floating point conditional move instructions
llvm-svn: 12576
2004-03-31 22:02:36 +00:00
Chris Lattner cbb4ed9ef2 Add support for FP cmoves
llvm-svn: 12575
2004-03-31 22:02:21 +00:00
Chris Lattner 9fe1646804 Add FP conditional move instructions, which annoyingly have special properties
that require the asmwriter to be extended (printing implicit uses before the
explicit operands)

llvm-svn: 12574
2004-03-31 22:02:13 +00:00
Chris Lattner 61fab1409d Add warning
llvm-svn: 12573
2004-03-31 22:00:30 +00:00
Chris Lattner afbafb55ea MBB::remove should not modify the iterator passed in
llvm-svn: 12572
2004-03-31 21:59:59 +00:00
Chris Lattner acccf32aa3 MachineBasicBlock::remove should not modify the iterator passed in
llvm-svn: 12571
2004-03-31 21:59:29 +00:00
Chris Lattner 7c92c296ba Improve description, add warning
llvm-svn: 12570
2004-03-31 21:59:07 +00:00
Chris Lattner 49ed8ad580 MachineBasicBlock::remove should not change the iterator passed into it
llvm-svn: 12569
2004-03-31 21:58:50 +00:00
Brian Gaeke 623710bf2f Factor out getStaticStackSize from InsertPrologCode(), so that I can more
easily steal it for a separate use in the reoptimizer.

llvm-svn: 12568
2004-03-31 20:58:37 +00:00
Brian Gaeke 77e78a4531 Use the true, decoded name of the archive member in getObjectType.
In ReadArchiveBuffer, make sure that MemberName is set in the case where
getObjectType would want to return SVR4LongFilename.

llvm-svn: 12567
2004-03-31 19:51:00 +00:00
Chris Lattner c0ba90e35c Avoid TRUE and FALSE which apparently conflict with some macros on OSX
llvm-svn: 12566
2004-03-31 03:49:47 +00:00
Chris Lattner 709f03e2dd Fix linking of constant expr casts due to type resolution changes. With
this and the other patches 253.perlbmk links again.

llvm-svn: 12565
2004-03-31 02:58:28 +00:00
Chris Lattner 467cb2bc5d Add support for constant expr casts
llvm-svn: 12564
2004-03-31 02:56:11 +00:00