1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

30566 Commits

Author SHA1 Message Date
Reid Spencer
4610488330 Deal with error handling better.
llvm-svn: 34887
2007-03-03 18:19:18 +00:00
Reid Spencer
cdb5aa2805 Make the creation functions take an error string. This will help the
ExecutionEngine report errors on creation (like bytecode stuff) and also
help to get rid of exception handling.

llvm-svn: 34886
2007-03-03 18:18:11 +00:00
Reid Spencer
e0d00951c2 Make sure that when we store a value it is masked to its correct bit
width. This helps CBE work with non-standard integer bit widths.

llvm-svn: 34885
2007-03-03 16:33:33 +00:00
Reid Spencer
8aaa36a012 Complete the APIntification of the interpreter. All asserts for > 64 bits
have been removed and dealt with. The interpreter should now be able to
execute any LLVM program using any bit width.

llvm-svn: 34884
2007-03-03 08:38:04 +00:00
Reid Spencer
6cdbf93aae Avoid memory leakage by having caller construct the APInt for the
destination value of LoadValueFromMemory.

llvm-svn: 34883
2007-03-03 08:36:29 +00:00
Reid Spencer
e96b55e61f Require the destination GlobalValue for LoadValueFromMemory to be passed
in as a parameter instead of returned.

llvm-svn: 34882
2007-03-03 08:35:14 +00:00
Reid Spencer
e2bf55dfe8 Regularize the interface for conversion functions to/from float/double.
llvm-svn: 34881
2007-03-03 08:34:02 +00:00
Reid Spencer
6037b564a0 Fix constant folding of fp->int bitcast for vectors.
llvm-svn: 34880
2007-03-03 08:32:46 +00:00
Reid Spencer
36fb227e99 Add APIntVal as a possible GenericeValue.
llvm-svn: 34879
2007-03-03 07:36:44 +00:00
Evan Cheng
306d12a520 Only propagate IsKill if the last use is a kill.
llvm-svn: 34878
2007-03-03 06:32:37 +00:00
Reid Spencer
747e872c5b Implement APInt support for the binary operators.
Move the getConstantExpr function towards the end of the file so we don't
need a dozen forward declarations.

llvm-svn: 34877
2007-03-03 06:22:22 +00:00
Reid Spencer
11a355139c 1. Have the ExecutionContext keep track of the APInt's allocated and
ensure they are cleaned up when the stack frame exits.
2. Move a function to the Execution.cpp file where it belongs.

llvm-svn: 34876
2007-03-03 06:19:55 +00:00
Nate Begeman
7ffce4cf16 http://llvm.org/bugs/show_bug.cgi?id=1237
llvm-svn: 34875
2007-03-03 06:18:18 +00:00
Reid Spencer
df9222b66d Implement loading and storing of APInt values from memory.
llvm-svn: 34874
2007-03-03 06:18:03 +00:00
Reid Spencer
503dda5840 Make getNumWords public so that those using getRawData stand a chance of
not reading beyond the end of the buffer returned.

llvm-svn: 34873
2007-03-03 06:17:23 +00:00
Reid Spencer
47b01d6acb Add names for some of the operators. This is needed for the macros in
the Interpreter.

llvm-svn: 34872
2007-03-03 05:37:23 +00:00
Nick Lewycky
cfed5f36a1 Emit low/high immediate loads properly for Linux/PPC.
llvm-svn: 34871
2007-03-03 05:29:51 +00:00
Chris Lattner
f22da20af4 my recent change caused a failure in a bswap testcase, because it changed
the order that instcombine processed instructions in the testcase.  The end
result is that instcombine finished with:

define i16 @test1(i16 %a) {
        %tmp = zext i16 %a to i32               ; <i32> [#uses=2]
        %tmp21 = lshr i32 %tmp, 8               ; <i32> [#uses=1]
        %tmp5 = shl i32 %tmp, 8         ; <i32> [#uses=1]
        %tmp.upgrd.32 = or i32 %tmp21, %tmp5            ; <i32> [#uses=1]
        %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16           ; <i16> [#uses=1]
        ret i16 %tmp.upgrd.3
}

which can't get matched as a bswap.

This patch makes instcombine more sophisticated about removing truncating
casts, allowing it to turn this into:

define i16 @test2(i16 %a) {
        %tmp211 = lshr i16 %a, 8
        %tmp52 = shl i16 %a, 8
        %tmp.upgrd.323 = or i16 %tmp211, %tmp52
        ret i16 %tmp.upgrd.323
}

which then matches as bswap.  This fixes bswap.ll and implements
InstCombine/cast2.ll:test[12].  This also implements cast elimination of
add/sub.

llvm-svn: 34870
2007-03-03 05:27:34 +00:00
Chris Lattner
e1179e62fb new testcase: instcombine should remove all the casts.
llvm-svn: 34869
2007-03-03 05:24:06 +00:00
Nick Lewycky
a0a23a645d Translate bit operations to English.
llvm-svn: 34868
2007-03-03 03:14:40 +00:00
Chris Lattner
a167e8f27b instcombine doesn't do CSE, simplify unrelated detail
llvm-svn: 34867
2007-03-03 02:27:02 +00:00
Evan Cheng
f4e93806fe Watch out for cases like this:
entry (0x8b056f0, LLVM BB @0x8b01b30, ID#0):
Live Ins: %r0 %r1 %r2 %r3
        %reg1032 = tMOVrr %r3<kill>
        %reg1033 = tMOVri8 1
        %reg1034 = tMOVri8 0
        tCMPi8 %reg1029<kill>, 0
        tBcc mbb<entry,0x8b06a10>, 0
    Successors according to CFG: 0x8b06980 0x8b06a10

entry (0x8b06980, LLVM BB @0x8b01b30, ID#12):
    Predecessors according to CFG: 0x8b056f0
        %reg1036 = tMOVrr %reg1034<kill>
    Successors according to CFG: 0x8b06a10

entry (0x8b06a10, LLVM BB @0x8b01b30, ID#13):
    Predecessors according to CFG: 0x8b056f0 0x8b06980
        %reg1024<dead> = tMOVrr %reg1030<kill>
        ...

reg1030 and r1 have already been joined. When reg1024 and reg1030 are joined,
r1 live range from function entry to the tMOVrr instruction are dead. Eliminate
r1 from the livein set of the entry BB, not the BB where the copy is.

llvm-svn: 34866
2007-03-03 02:18:00 +00:00
Chris Lattner
892090ea95 add a top-level iteration loop to instcombine. This means that it will never
finish without combining something it is capable of.

llvm-svn: 34865
2007-03-03 02:04:50 +00:00
Reid Spencer
8c49eb7da5 APIntify this pass.
llvm-svn: 34863
2007-03-03 00:48:31 +00:00
Reid Spencer
e5244b132b Add isPositive for symmetry with isNegative.
llvm-svn: 34862
2007-03-03 00:24:39 +00:00
Reid Spencer
6f7b9afc1c Finally get this patch right :)
Replace expensive getZExtValue() == 0 calls with isZero() calls.

llvm-svn: 34861
2007-03-02 23:51:25 +00:00
Reid Spencer
438d17b5ad Dang, I've done that twice now! Undo previous commit.
llvm-svn: 34860
2007-03-02 23:37:53 +00:00
Reid Spencer
70fbfc75e8 Use more efficient test for one value in a ConstantInt.
llvm-svn: 34859
2007-03-02 23:35:28 +00:00
Reid Spencer
76f02c5848 Guard against huge loop trip counts in an APInt safe way.
llvm-svn: 34858
2007-03-02 23:31:34 +00:00
Evan Cheng
2fb461c1b5 X86-64 VACOPY needs custom expansion. va_list is a struct { i32, i32, i8*, i8* }.
llvm-svn: 34857
2007-03-02 23:16:35 +00:00
Reid Spencer
884f32fd12 Make sure debug code is not evaluated in non-debug case.
llvm-svn: 34856
2007-03-02 23:15:21 +00:00
Reid Spencer
69858df100 1. Sort switch cases using APInt safe comparison.
2. Make sure debug output of APInt values is safe for all bit widths.

llvm-svn: 34855
2007-03-02 23:05:28 +00:00
Reid Spencer
bf4956bcc4 Use APInt safe isOne() method on ConstantInt instead of getZExtValue()==1
llvm-svn: 34854
2007-03-02 23:03:17 +00:00
Reid Spencer
0f63188d6a Make sorting of ConstantInt be APInt clean through use of ult function.
llvm-svn: 34853
2007-03-02 23:01:14 +00:00
Reid Spencer
3e3980a403 Fix ashr for bitwidths > 64. This is now validated up to 1024 bits.
llvm-svn: 34852
2007-03-02 22:39:11 +00:00
Anton Korobeynikov
af46a0e4a2 Fix uninitialized use of variable. Remove tabs and fix identation.
llvm-svn: 34850
2007-03-02 22:19:41 +00:00
Anton Korobeynikov
7cec92bcd2 Simplify things
llvm-svn: 34849
2007-03-02 21:50:27 +00:00
Chris Lattner
e11cd0460a Fix a significant algorithm problem with the instcombine worklist. removing
a value from the worklist required scanning the entire worklist to remove all
entries.  We now use a combination map+vector to prevent duplicates from
happening and prevent the scan.  This speeds up instcombine on a large file
from the llvm-gcc bootstrap from 189.7s to 4.84s in a debug build and from
5.04s to 1.37s in a release build.

llvm-svn: 34848
2007-03-02 21:28:56 +00:00
Chris Lattner
fb4d1a6437 minor cleanup
llvm-svn: 34846
2007-03-02 19:59:19 +00:00
Chris Lattner
68244ce570 Fix PR1234 by working around a compiler bug.
llvm-svn: 34845
2007-03-02 18:16:29 +00:00
Evan Cheng
9dddb88209 Mark dead def as unused.
llvm-svn: 34844
2007-03-02 10:43:16 +00:00
Evan Cheng
5bd925036c Dead live-in detection bug.
llvm-svn: 34843
2007-03-02 10:41:15 +00:00
Evan Cheng
ce6c3c3004 Add a new test case.
llvm-svn: 34842
2007-03-02 10:37:19 +00:00
Evan Cheng
e2802973eb - Keep track all def and uses of stack slot available in register.
- Available value use may be deleted (e.g. noop move).

llvm-svn: 34841
2007-03-02 08:52:00 +00:00
Chris Lattner
afea22c955 testcase for PR1233
llvm-svn: 34840
2007-03-02 07:29:59 +00:00
Evan Cheng
622db28794 Invalidate last use of a reused register if the use is a deleted noop copy.
llvm-svn: 34839
2007-03-02 05:41:42 +00:00
Chris Lattner
55dcf58453 argument lowering should copy from the vreg shadows of live-in arguments
passed in registers, not directly from the pregs themselves.

llvm-svn: 34838
2007-03-02 05:12:29 +00:00
Chris Lattner
e29ef5d9cb add a note
llvm-svn: 34837
2007-03-02 05:04:52 +00:00
Owen Anderson
6d3b179de3 Fix a typo.
llvm-svn: 34836
2007-03-02 05:03:07 +00:00
Reid Spencer
6d483da6c0 Use a better algorithm for rounding sqrt results. Change the FIXME about
this to a NOTE: because pari/gp results start to get rounded incorrectly
after 192 bits of precision. APInt and pari/gp never differ by more than
1, but APInt is more accurate because it does not lose precision after 192
bits as does pari/gp.

llvm-svn: 34834
2007-03-02 04:21:55 +00:00