1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
Commit Graph

3826 Commits

Author SHA1 Message Date
Chris Lattner
74a266d229 Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
llvm-svn: 7243
2003-07-23 03:32:41 +00:00
Chris Lattner
7594fa7280 - InstCombine (cast (xor A, B) to bool) ==> (setne A, B)
- InstCombine (cast (and X, (1 << size(X)-1)) to bool) ==> x < 0

llvm-svn: 7241
2003-07-22 21:46:59 +00:00
Vikram S. Adve
420ec0bb0f Fix comment.
llvm-svn: 7227
2003-07-22 12:08:58 +00:00
Chris Lattner
9f501f98c8 Simplify code a bit
llvm-svn: 7217
2003-07-21 19:56:49 +00:00
John Criswell
98946bac5b Added code that checks to see if a global variable is external before replacing
a load of the global variable with the variable's constant value.

llvm-svn: 7216
2003-07-21 19:42:57 +00:00
Misha Brukman
f7ca33f163 Eliminated dead code.
llvm-svn: 7209
2003-07-21 16:34:35 +00:00
Anand Shukla
351c0f6342 Added special consideration for instrumentation strategy
llvm-svn: 7208
2003-07-20 15:39:30 +00:00
Anand Shukla
d02a20b947 Added check for inlinable function
llvm-svn: 7206
2003-07-18 20:55:26 +00:00
Brian Gaeke
bf46d75365 Please, save your applause^H^H^H^H^H^H^H^Hflames for the end...
Avoid a fall-through in the (stubby) treatment of the longjmp intrinsic
call which causes llc & lli to core-dump.

Add a sort-of treatment of cast double to ulong. I am not really sure
what a user should expect to see upon casting a negative FP value to
unsigned long long. But with what is given here, I was able to write
a program that could cast -123.456 to ulong and back and get -123.0,
which seems like a step in the right direction.  GCC seems to give you
0. I don't know if I'd consider that useful.

These cases were coming up in GNU coreutils-5.0.

llvm-svn: 7205
2003-07-18 20:23:43 +00:00
Misha Brukman
755aa86ca3 Cleaned up the code which chooses the appropriate value for the file descriptor
to pass to dlsym() -- Linux/x86 wants 0 while Sparc/Solaris wants RTLD_SELF,
which is not zero. Thanks to Chris for the suggestion.

llvm-svn: 7204
2003-07-18 18:33:38 +00:00
Anand Shukla
bb730173d6 A pass to combine multiple backedges that go to same target
llvm-svn: 7201
2003-07-18 16:08:32 +00:00
Brian Gaeke
638e6ef31c Use getClassB for load and store; we don't want to abort when we
try to load or store through a bool*.

llvm-svn: 7195
2003-07-17 21:30:06 +00:00
Brian Gaeke
026c333f07 Fix typo in call to isUnresolvableFunc, which was breaking the build.
llvm-svn: 7194
2003-07-17 19:07:46 +00:00
John Criswell
dbaf5f719c Dinakar and I fixed a bug where we were trying to get the initializer of
an external constant.  Since external constants don't have initializers, we
were failing on an assert() call in llvm/GlobalVariable.h.

llvm-svn: 7193
2003-07-17 19:06:55 +00:00
Vikram S. Adve
96abba3e01 Rematerialize nodes from the globals graph into the current graph
after all callees are inlined into the current graph.

NOTE: There's also a major bug fix for the BU pass in DataStructure.cpp,
which ensures that resolvable indirect calls are not moved out to the
globals graph, so that they are eventually inlined (if possible).

llvm-svn: 7189
2003-07-16 21:42:03 +00:00
Vikram S. Adve
e2993f34ed (1) Rematerialize nodes from the globals graph into the current graph
after all callers are inlined into the current graph.
(2) Optimize the way a graph is inlined into its callees in the TD phase:
    (a) Use DSGraph::cloneReachableSubgraph to clone only a subgraph at
        each call site, for faster inlining.
    (b) Clone separately for the same callee at different call sites,
        since only the reachable subgraph is being cloned, not the entire
        caller graph.

llvm-svn: 7188
2003-07-16 21:40:28 +00:00
Vikram S. Adve
d1a85b7860 Implement 2 important changes: (1) rematerialization from the globals graph,
and (2) faster inlining by cloning only reachable nodes.  In particular:
(1) Added DSGraph::cloneReachableSubgraph and DSGraph::cloneReachableNodes
    to clone the subgraph reachable from a set of root nodes, into the
    current graph, merging the global nodes into thos in the current graph.
    The TD pass now uses this for faster inlining, and so does the
    next function.
(2) Added DSGraph::updateFromGlobalGraph() to rematerialize nodes from the
    globals graph into the current graph in both BU and TD passes.
(3) `I' flags are removed from all nodes in the globals graph, because they
    are difficult to maintain correctly and are not needed anyway.
(4) Aux. function calls are only removed to the globals graph if they
    will never be resovled.  (This is what fixed gap.)  The immediate
    reason is that if we took these out of a function (and moved them to
    the globals graph) we would need to rematerialize these nodes into the
    function graph for every function in the BU pass.  The longer term
    problem is that we would need to find a way to remove them from the
    globals graph iff they have been resolved on all paths through the
    call graph.

llvm-svn: 7187
2003-07-16 21:36:31 +00:00
Vikram S. Adve
0ce80bfa82 Factor out the test for unresolvable external functions into
isUnresolvableFunc() (I thought I needed this externally.
I don't, but it's still nicer this way.)

llvm-svn: 7186
2003-07-16 21:25:17 +00:00
Misha Brukman
8c9be85d5d Fixed the number translation scheme for the integer condition code registers: it
now works in instructions which require a 2-bit or 3-bit INTcc code.

Incidentally, that means that the representation of INTcc registers is now the
same in both integer and FP instructions. Thus, code became much simpler and
cleaner.

llvm-svn: 7185
2003-07-16 20:30:40 +00:00
Misha Brukman
5a52ebed46 The name should really be `simm11' to follow the naming convention, but this has
no change in functionality.

llvm-svn: 7184
2003-07-16 20:27:44 +00:00
Misha Brukman
10a63e248c No need for a second immediate field if the class already inherits one.
llvm-svn: 7182
2003-07-15 21:27:14 +00:00
Misha Brukman
250280cf79 Encode predict = 1 by default, because the Sparc assembler does this.
llvm-svn: 7181
2003-07-15 21:26:49 +00:00
Misha Brukman
8cd8690ad5 Correctly handle calls to functions which are further away than 2**32 bits will
allow, i.e. make a sequence of instructions to enable an indirect call using
jump-and-link and 2 temporary registers (which we save and ultimately restore).

Warning: if the delay slot of a function call is used to do meaningful work and
not just a NOP, this behavior is incorrect. However, the Sparc backend does not
yet utilize the delay slots effectively, so it is not necessary to make an
overly complicated algorithm for something that's not used.

llvm-svn: 7178
2003-07-15 19:09:43 +00:00
Misha Brukman
45dc28808e Clean up my last checkin: code is easier to read and explains the differences in
usage of the special file handle RTLD_SELF on Sparc/Solaris vs. 0 on Linux/x86.

llvm-svn: 7177
2003-07-15 15:58:26 +00:00
Misha Brukman
6a087a3a2f On Sparc/Solaris, the special handle RTLD_SELF is used as a handle referring to
the program's executing image, not 0 as it is on Linux/x86 and possibly other
systems.

llvm-svn: 7176
2003-07-15 15:55:32 +00:00
Misha Brukman
d594e21afa * Added support for the %ccr register
* FP double registers are now coded correctly
* Removed function which converted registers based on register types, it was
  broken (because regTypes are broken)

llvm-svn: 7175
2003-07-14 23:26:03 +00:00
Misha Brukman
0b5999cca1 The word separate' only has one e'.
llvm-svn: 7174
2003-07-14 17:26:34 +00:00
Misha Brukman
5de3e14206 The word separate' only has one e'.
llvm-svn: 7173
2003-07-14 17:20:40 +00:00
Vikram S. Adve
f5914c9bca Trace loads and stores as they happen (stores were being
remembered in valuesStoredInFunction, but never traced at function return,
and that's too late to be finding the error anyway).
Stores trace both the value and the address being stored to,
but after some experience I think only values should be traced.
The pointer hash table just fills up far too quickly if every
store address were traced.

llvm-svn: 7169
2003-07-11 21:57:43 +00:00
Brian Gaeke
89ce6ca0a6 If we have a constant pointer reference to a function, we were printing
out the entire llvm disassembly for the function at global constant-output
time, which caused the assembler to barf in 164.gzip. This fixes that
particular problem (though 164.gzip has other problems with X86 llc.)

llvm-svn: 7168
2003-07-11 21:57:01 +00:00
Brian Gaeke
efd836df31 Fix some serious floating-point bugs (fixes test cases such as Oscar,
Fhourstones, McCat-vor, and many others...)

Printer.cpp: Print implicit uses for AddRegFrm instructions.  Break gas
bug workarounds up into separate stanzas of code for each bug.  Add new
workarounds for fild and fistp.

X86InstrInfo.def: Add O_ST0 implicit uses for more FP instrs where they
obviously apply. Also add PrintImplUses flags for FP instrs where they
are necessary for gas to understand the output.

llvm-svn: 7165
2003-07-11 18:18:35 +00:00
Anand Shukla
cb78ec5ada Added functionality to instrmentation pass
llvm-svn: 7161
2003-07-10 21:55:57 +00:00
Misha Brukman
74d17238cb Fixed grammatical error.
llvm-svn: 7160
2003-07-10 21:38:28 +00:00
Vikram S. Adve
83dc6ef841 Several important bug fixes:
(1) Cannot use ANDN(ot), ORN, and XORN for boolean ops, only bitwise ops.

(2) Conditional move instructions must distinguish signed and unsigned
    condition codes, e.g., MOVLE vs. MOVLEU.

(3) Conditional-move-on-register was using the cond-move-on-cc opcodes,
    which produces a valid-looking instruction with bogus registers!

(4) Here's a really cute one: dividing-by-2^k for negative numbers needs to
    add 2^k-1 before shifting, not add 1 after shifting.  Sadly, these
    are the same when k=0 so our poor test case worked fine.

(5) Casting between signed and unsigned values was not correct:
    completely reimplemented.

(6) Zero-extension on unsigned values was bogus: I was only doing the
    SRL and not the SLLX before it.  Don't know WHAT I was thinking!

(7) And the most important class of changes: Sign-extensions on signed values.
    Signed values are not sign-extended after ordinary operations,
    so they must be sign-extended before the following cases:
	-- passing to an external or unknown function
	-- returning from a function
	-- using as operand 2 of DIV or REM
	-- using as either operand of condition-code setting operation
           (currently only SUBCC), with smaller than 32-bit operands


Also, a couple of improvements:

(1) Fold cast-to-bool into Not(bool).  Need to do this for And, Or, XOR also.

(2) Convert SetCC-Const into a conditional-move-on-register (case 41)
    if the constant is 0.  This was only being done for branch-on-SetCC-Const
    when the branch is folded with the SetCC-Const.

llvm-svn: 7159
2003-07-10 20:07:54 +00:00
Vikram S. Adve
87e97308fd Bug fix in creating constants: need 1U << 31, not 1 << 31.
llvm-svn: 7158
2003-07-10 19:48:19 +00:00
Vikram S. Adve
989afdffd6 Fold cast-to-bool into not. Later, this should also be folded into other
boolean operations: AND, OR, XOR.

llvm-svn: 7157
2003-07-10 19:47:42 +00:00
Vikram S. Adve
d8b600cb85 Values stored in CallArgsDescriptor cannot be const.
llvm-svn: 7156
2003-07-10 19:46:15 +00:00
Vikram S. Adve
b1496585b6 isMarkedForSpill() should be const.
llvm-svn: 7155
2003-07-10 19:45:28 +00:00
Vikram S. Adve
6aa3abf7fa Change interface to MachineInstr::substituteValue to specify more precisely
which args can be substituted: defsOnly, defsAndUses or usesOnly.

llvm-svn: 7154
2003-07-10 19:45:07 +00:00
Vikram S. Adve
0b23c58179 Print out all neighbors in interference graph, not just higher-numbered ones.
llvm-svn: 7153
2003-07-10 19:43:33 +00:00
Vikram S. Adve
00f3778923 Several fixes to handling of int CC register:
(1) An int CC live range must be spilled if there are any interferences,
    even if no other "neighbour" in the interf. graph has been allocated
    that reg. yet.  This is actually true of any class with only one reg!

(2) SparcIntCCRegClass::colorIGNode sets the color even if the LR must
    be spilled so that the machine-independent spill code doesn't have to
    make the machine-dependent decision of which CC name to use based on
    operand type: %xcc or %icc.  (These are two halves of the same
register.)

(3) LR->isMarkedForSpill() is no longer the same as LR->hasColor().
    These should never have been the same, and this is necessary now for #2.

(4) All RDCCR and WRCCR instructions are directly generated with the
    phony number for %ccr so that EmitAssembly/EmitBinary doesn't have to
    deal with this.

llvm-svn: 7152
2003-07-10 19:42:55 +00:00
Vikram S. Adve
8d30b76da6 Several fixes to handling of int CC register:
(1) An int CC live range must be spilled if there are any interferences,
    even if no other "neighbour" in the interf. graph has been allocated
    that reg. yet.  This is actually true of any class with only one reg!

(2) SparcIntCCRegClass::colorIGNode sets the color even if the LR must
    be spilled so that the machine-independent spill code doesn't have to
    make the machine-dependent decision of which CC name to use based on
    operand type: %xcc or %icc.  (These are two halves of the same register.)

(3) LR->isMarkedForSpill() is no longer the same as LR->hasColor().
    These should never have been the same, and this is necessary now for #2.

(4) All RDCCR and WRCCR instructions are directly generated with the
    phony number for %ccr so that EmitAssembly/EmitBinary doesn't have to
    deal with this.

llvm-svn: 7151
2003-07-10 19:42:11 +00:00
Misha Brukman
c12238543a Lowercase versions of `occurrence' need to be spelled correctly, too.
llvm-svn: 7142
2003-07-10 17:05:26 +00:00
Misha Brukman
14194dcdae Occurrence' has no a' and the `r' is doubled.
llvm-svn: 7140
2003-07-10 16:49:51 +00:00
Misha Brukman
c170ac78b6 Some beautification changes (tabs to spaces, removed extra blank lines);
no functionality changed.

llvm-svn: 7138
2003-07-09 17:33:50 +00:00
John Criswell
caef76fa72 Removed size_t from the parameter list of the malloc() prototype in generated C
code.  This prevents a compiler warning on Sparc that causes the tests to fail.

llvm-svn: 7125
2003-07-08 14:52:09 +00:00
Misha Brukman
32080d455d Elaborated assembly syntax of instructions in the comments.
llvm-svn: 7120
2003-07-07 22:18:42 +00:00
Misha Brukman
1e37572950 Removed unnecessary assignment (it was taken care by a superclass) and clarified
some comments.

llvm-svn: 7119
2003-07-07 22:18:06 +00:00
Brian Gaeke
028985aa27 Insert workaround for GAS bug in assembling FLD/FSTP XWORD PTR [...]
instructions, by outputting them as bytes.

llvm-svn: 7115
2003-07-07 18:34:20 +00:00
Misha Brukman
5fe7702056 Moved RegClassIDs enum to be next to the RegTypes enum.
llvm-svn: 7114
2003-07-07 16:52:39 +00:00
Vikram S. Adve
ee1e9ea019 Correction to last fix: Pointer types do not return true in Type::IsIntegral().
llvm-svn: 7113
2003-07-06 22:50:31 +00:00
Vikram S. Adve
d7b18ee501 Choose register instead of immediate for ConstantExpr in ChooseRegOrImmed.
llvm-svn: 7112
2003-07-06 20:33:21 +00:00
Vikram S. Adve
1ddf684f4c Major bug fix though it happened rarely (only on a compare after an
integer overflow):
We need to use %icc and not %xcc for comparisons on 32-bit or smaller
integer values.

llvm-svn: 7111
2003-07-06 20:13:59 +00:00
Vikram S. Adve
0ab951d2ab Make the RegClassID values public -- there is no other way to get them.
llvm-svn: 7109
2003-07-06 19:53:59 +00:00
Misha Brukman
20fcdbc808 Apparently, the "regType" and "regClass" used in the Sparc backend are not both
correct: empirically, "regType" is wrong for a number of registers. Thus, one
can only rely on the "regClass" to figure out what kind of register one is
dealing with.

This change switches to using only "regClass" and adds a few extra DEBUG() print
statements and a few clean-ups in comments and code, mostly minor.

llvm-svn: 7103
2003-07-03 18:36:47 +00:00
Chris Lattner
b93ef28cef Reuse the values if they are constants: this is important so that we index into the right structure field
This fixes bug: BasicAA/2003-07-03-BasicAACrash.ll

llvm-svn: 7093
2003-07-03 06:42:38 +00:00
Chris Lattner
2a6504c799 Remove globals more aggressively from graphs.
Fix a bug where we removed nodes that were marked U.

llvm-svn: 7090
2003-07-03 02:03:53 +00:00
Chris Lattner
492b7eeb06 INCLUDE_PARENT_GRAPH is required!
llvm-svn: 7088
2003-07-02 23:57:05 +00:00
Chris Lattner
86c8f822ec Disable incorrect mustalias code
llvm-svn: 7087
2003-07-02 23:56:51 +00:00
Chris Lattner
478e42b621 Remove space at end of line
llvm-svn: 7084
2003-07-02 23:44:15 +00:00
Chris Lattner
b64aff94fd Fix how we are handling unreachable functions. This DRAMATICALLY improves efficiency
llvm-svn: 7082
2003-07-02 23:42:48 +00:00
Chris Lattner
083398eff5 Keep track of how many inlinings are performed
llvm-svn: 7076
2003-07-02 20:24:42 +00:00
Chris Lattner
59bb44723a Try using trivially dead deletion
llvm-svn: 7075
2003-07-02 19:49:11 +00:00
Misha Brukman
8dd0e2fb27 * Force all "don't care" bits to 0 so that there are absolutely no unset bits in
the TableGen descriptions; all unset bits are thus errors.
* As a result, found and fixed instructions where some operands were not
  actually assigned into the right portion of the instruction.

llvm-svn: 7074
2003-07-02 19:37:48 +00:00
Misha Brukman
4eeef8986f The classes F4_3 and F4_4 have an `rd' operand that needs to be set.
llvm-svn: 7073
2003-07-02 18:27:47 +00:00
Misha Brukman
e0abbee864 Properly fix instruction syntax in comments, using `imm' for instructions that
use an immediate value instead of a register.

llvm-svn: 7072
2003-07-02 18:15:43 +00:00
Misha Brukman
b53b013355 Fixed instruction syntax in the comments (specifies how instr is used).
llvm-svn: 7071
2003-07-02 18:02:58 +00:00
Misha Brukman
009e42dd43 * If compiling on X86 or Sparc, automagically enable the JIT for that arch
* Setting ENABLE_X86_JIT or ENABLE_SPARC_JIT on the `make' command-line will
  force the inclusion of that JIT on a different architecture
* If neither JIT is enabled (e.g., compiling on a different architecture), the
  -march option will not be available to LLI.
* As a side effect of the $ARCH variable, the Sparc LLI can now link just a bit
  faster by not including the x86 library.

llvm-svn: 7070
2003-07-02 17:53:19 +00:00
Vikram S. Adve
84f4ef26b8 Force fixed-size but large alloca objects to the dynamically allocated
area to avoid using up precious stack space within the 4095 offset limit
from %fp.  Such objects that would themselves live at a large offset
were being put there already so this is a simple change.

llvm-svn: 7066
2003-07-02 06:59:22 +00:00
Chris Lattner
c1f922d61e Remove dead Nodes list
llvm-svn: 7065
2003-07-02 06:06:34 +00:00
Chris Lattner
56585a82d9 Complete rewrite of td pass
llvm-svn: 7064
2003-07-02 04:39:44 +00:00
Chris Lattner
a85502303e Print collapsed to match the paper
llvm-svn: 7063
2003-07-02 04:39:27 +00:00
Chris Lattner
95c5313776 Reduce amount of work we do calculating mustaliases if the arg is a global
llvm-svn: 7062
2003-07-02 04:39:13 +00:00
Chris Lattner
f4a221c87c Add support for ParentGraph only when building in debug mode
Minor cleanups, reenable folding of call nodes to external functions

llvm-svn: 7061
2003-07-02 04:38:49 +00:00
Chris Lattner
d49611837b Add some functions to the blacklist
llvm-svn: 7060
2003-07-02 04:38:00 +00:00
Chris Lattner
64ea02737e Make the BU closure keep track of which actual calls happen
Minor cleanups

llvm-svn: 7059
2003-07-02 04:37:48 +00:00
Chris Lattner
60652f41c4 Make local pass print out its progress
llvm-svn: 7058
2003-07-02 04:37:26 +00:00
Vikram S. Adve
293af7edb6 Minor beautification: fold a couple of lines of code.
llvm-svn: 7054
2003-07-02 01:24:00 +00:00
Vikram S. Adve
5ce2683cd2 (1) Major bug fix: DecomposeArrayRef() replaces its argument instr. and
deletes it, but we were merrily trying to fix the operands of that
    instruction anyway!  Instead, fix the replacement instruction.

(2) An Improvement: Check for and extract global values in all operands,
    not just in known pointer operands.  For example, they can occur in
    call arguments, and probably other unforeseeable places as well.
    This also eliminates the special-case handling of Load and Store.

llvm-svn: 7053
2003-07-02 01:23:15 +00:00
Vikram S. Adve
daa346c89a A def. operand of a machine instruction may be an ordinary Value*,
not just an Instruction*, at least in one unfortunate case:
the first operand to the va_arg instruction.
Modify ValueToDefVecMap to map from Value*, not Instruction*.

llvm-svn: 7052
2003-07-02 01:16:01 +00:00
Vikram S. Adve
42e2aac9ed Bug/case fixes:
(1) select: Ok to convert a pointer to a float or double.
(2) regalloc: Some MachineInstr* for caller-saving code before a call
    were being inserted before and after the call!
(3) Don't insert the caller-saving instructions in the
    MachineCodeForInstruction for the Call instruction.
    *All* instructions generated by register allocation need to be
    recorded in those maps, but it needs to be done uniformly.

llvm-svn: 7051
2003-07-02 01:13:57 +00:00
Chris Lattner
f3cfe71797 Fix bug: Regression/Other/2002-03-11-ExprAssertion.ll
llvm-svn: 7046
2003-07-01 21:08:52 +00:00
Chris Lattner
5ddec0f02d Rework TD pass to work with the precise call graph constructed by the BU phase
llvm-svn: 7031
2003-07-01 16:28:11 +00:00
Chris Lattner
3536455262 Do not treat global variables as functions! (and assert failing)
llvm-svn: 7030
2003-07-01 16:27:53 +00:00
Chris Lattner
7ab30a179b Dont' print scalar nodes for ConstantPointerRefs
llvm-svn: 7029
2003-07-01 16:27:32 +00:00
Chris Lattner
599287e3c3 Minor cleanups
llvm-svn: 7027
2003-07-01 16:04:18 +00:00
John Criswell
258dfc0319 Merged in autoconf branch. This provides configuration via the autoconf
system.

llvm-svn: 7014
2003-06-30 21:59:07 +00:00
Chris Lattner
d212141d9e Setjmp should always return zero if we don't implement longjmp. This avoids
leaving trash in the register, fixing anagram

llvm-svn: 7013
2003-06-30 19:35:54 +00:00
Brian Gaeke
a00e8c6732 Get rid of the duplicate '0x' in debug mode.
llvm-svn: 7012
2003-06-30 18:06:20 +00:00
Chris Lattner
33fce4d868 Use the getFunctionNames method
llvm-svn: 7008
2003-06-30 05:57:39 +00:00
Chris Lattner
cb32be085b Add new method
llvm-svn: 7007
2003-06-30 05:57:30 +00:00
Chris Lattner
851b6382b6 Split CallSiteIterator out into DSCallSiteIterator.h, and generalize it a bit
llvm-svn: 7006
2003-06-30 05:27:53 +00:00
Chris Lattner
e40d871120 Be more const-correct
llvm-svn: 7005
2003-06-30 05:27:18 +00:00
Chris Lattner
fb9f50ee23 Fix bug in last checkin
llvm-svn: 7003
2003-06-30 05:18:26 +00:00
Chris Lattner
9954cfc9bf Reimplement the BU closure to collapse all SCC graphs into a single graph.
Look at all of the code that gets deleted!

llvm-svn: 7001
2003-06-30 05:09:58 +00:00
Chris Lattner
60b2516889 Handle the case where OldNodeMap == &ScalarMap correctly
llvm-svn: 7000
2003-06-30 05:09:29 +00:00
Chris Lattner
20d3019fa6 Remove dead method
llvm-svn: 6999
2003-06-30 04:53:39 +00:00
Chris Lattner
37d7a580b2 Do not delete the same graph multiple times when freeing memory if graphs are sharing
llvm-svn: 6998
2003-06-30 04:53:27 +00:00
Chris Lattner
64008895c8 Do not multiply delete graphs if functions are sharing graphs
llvm-svn: 6997
2003-06-30 04:53:08 +00:00
Chris Lattner
8574358e8a Move usages of explicit hash_* datastructures to use typedefs
llvm-svn: 6996
2003-06-30 03:36:09 +00:00
Chris Lattner
203826c2e1 Revamp DSGraphs so that they can support multiple functions in the same
DSGraph at one time

llvm-svn: 6994
2003-06-30 03:15:25 +00:00
Chris Lattner
2ce6424601 Adjust for new DSGraph API
llvm-svn: 6993
2003-06-30 03:14:54 +00:00
Chris Lattner
a824a1ab66 Eliminate using declarations, adjust for new DSGraph API
llvm-svn: 6992
2003-06-30 03:14:44 +00:00
Chris Lattner
762a057a22 Abstract out the predicate which decides whether a function gets complete
arguments or not...

llvm-svn: 6987
2003-06-29 22:37:07 +00:00
Chris Lattner
9cb6f34b81 Fix minor bug in previous checkin
llvm-svn: 6986
2003-06-29 22:36:31 +00:00
Chris Lattner
9229da84be Add support for ensuring that nodes are not incomplete
llvm-svn: 6985
2003-06-29 22:36:15 +00:00
Chris Lattner
94b29bf96d Add support for "physical subtyping", which fixes:
DSGraph/2003-06-29-NodeCollapsing2.ll & DSGraph/PhysicalSubtyping.ll

llvm-svn: 6982
2003-06-29 20:27:45 +00:00
Chris Lattner
ed9302c854 Add print method to not get silly warning from analyze
llvm-svn: 6981
2003-06-29 20:27:16 +00:00
Chris Lattner
55099822d5 New pass which is useful for writing regression tests
llvm-svn: 6979
2003-06-29 18:17:07 +00:00
Chris Lattner
6b31a873ee Until there is a setjmp/longjmp transformation pass, codegen setjmp as a noop
and longjmp as an abort!

llvm-svn: 6977
2003-06-29 16:42:32 +00:00
Chris Lattner
b932c794ee Expose must alias information for global variables, implementing: DSGraph/mustalias.ll
llvm-svn: 6973
2003-06-29 00:54:08 +00:00
Chris Lattner
d1ca41db68 If the alias analysis algorithm we are using can provide MUST alias information,
expose it directly as value numbering information

llvm-svn: 6972
2003-06-29 00:53:34 +00:00
Chris Lattner
7b5077de46 Count operands to instructions as well as just results. This allows for global variables to be checked as well
llvm-svn: 6970
2003-06-29 00:07:11 +00:00
Chris Lattner
1352a50cbb Propagate globals graph from the local to bu to td globals graphs. This
fixes bug: DSGraph/buglobals.ll

llvm-svn: 6947
2003-06-28 22:14:55 +00:00
Chris Lattner
801e22514d Drop references to globals who do exist in the globals graph, but are never
read or written to.  Keep track of how many times this happens.  This should
be good for deleting things like references to type information in C++ classes

llvm-svn: 6946
2003-06-28 22:10:58 +00:00
Chris Lattner
5f90382628 Avoid double negatives
llvm-svn: 6945
2003-06-28 21:58:28 +00:00
Chris Lattner
cf6df3ef6b New pass to perform DSA based optimizations. Initially we just support turning
globals into constants if we can prove it's safe

llvm-svn: 6941
2003-06-28 21:54:55 +00:00
Chris Lattner
b94fc3e392 Avoid printing out huge structures or arrays if they are just filled with zeros
llvm-svn: 6938
2003-06-28 20:08:24 +00:00
Chris Lattner
1b9f2fdb0b Add support for a new zeroinitializer token which can be used to get rid of
huge arrays of zero initialized values

llvm-svn: 6937
2003-06-28 20:01:34 +00:00
Chris Lattner
d77130be67 jmp_buf is really a pointer type that is passed around...
llvm-svn: 6935
2003-06-28 19:29:34 +00:00
Chris Lattner
c502341595 Add support for the Invoke instruction!
llvm-svn: 6934
2003-06-28 17:53:05 +00:00
Chris Lattner
0f66e1a23a Preserve compatibility with non-gcc compilers
llvm-svn: 6932
2003-06-28 17:15:12 +00:00
Chris Lattner
769795ef2f Fix bug: CBackend/2003-06-28-LinkOnceGlobalVars.llx
llvm-svn: 6931
2003-06-28 17:08:36 +00:00
Chris Lattner
17ea08b804 Allow the inlining limit to be controlled from the command line!
llvm-svn: 6929
2003-06-28 15:57:04 +00:00
Chris Lattner
4d3ee0f3b1 Add support for 'unsigned' command line arguments
llvm-svn: 6928
2003-06-28 15:47:20 +00:00
Brian Gaeke
6f2c46cd52 Nice tasty llc fixes. These should fix LLC for x86 for everything in
SingleSource except oopack and Oscar.  (Sorry, Oscar.)

include/llvm/Target/TargetInstrInfo.h: Remove virtual print method. Add
 accessors for ImplicitUses/Defs.
lib/Target/TargetInstrInfo.cpp: Remove virtual print method. If you
 really wanted this, just use MI->print(O, TM); instead...
lib/Target/X86:
FloatingPoint.cpp: ...like this.
X86InstrInfo.h: Remove virtual print method. Define the PrintImplUses
 target-specific flag bit.
X86InstrInfo.def: Add the PrintImplUses flag to all the instructions
 which implicitly use CL, because the assembler needs to see the CL in
 order to generate the right instruction.
Printer.cpp: Ditch fnIndex at Chris's request. Now we use CurrentFnName
  to name constants in the constant pool for each function instead. This
  avoids keeping state between runOnMachineFunction() invocations, which
  is a no-no. Having MangledGlobals be global is a bogon I'd like to get
  rid of too, but making it a static member of Printer causes link errors
  (why???).
 Make NumberForBB into a member of Printer instead of a global, too.
 Make printOp and printMemReference into methods of Printer.
 X86InstrInfo::print is now Printer::printMachineInstruction, because
  TargetInstrInfo::print is history. (Because of this, we have to qualify
  the names of some TargetInstrInfo methods we call.)
 Print out the ImplicitUses field of any instruction we print that has
  the PrintImplUses bit set.

llvm-svn: 6924
2003-06-27 00:00:48 +00:00
Brian Gaeke
7f1a3ef833 Number constants from constant pool as CPIf_i where f is the function index
and i is the constant pool index.

llvm-svn: 6920
2003-06-26 18:02:30 +00:00
Chris Lattner
6b54665aa9 Add support to globaldce for deleting dead function prototypes
llvm-svn: 6918
2003-06-26 05:41:18 +00:00
Chris Lattner
3dc8d444ff When internalizing global ctor/dtor list, also mark it constant. This is gross, but
until DSA is working all of the time and is totally reliable, we do this.

llvm-svn: 6917
2003-06-26 05:30:40 +00:00
Chris Lattner
44730af626 Implement more aggressive folding of constant GEP instructions
llvm-svn: 6913
2003-06-26 05:22:45 +00:00
Chris Lattner
0cc143577c Add support for elimination of load instruction from global constants
llvm-svn: 6912
2003-06-26 05:06:25 +00:00
Brian Gaeke
ff614a8a0c Integrate the C writer's name mangler.
llvm-svn: 6908
2003-06-25 22:00:39 +00:00
Brian Gaeke
065bf4bab2 First draft of X86 LLC backend. This should be OK for small programs like
Shootout, but it has some issues with bigger programs. Work in progress.

llvm-svn: 6907
2003-06-25 18:01:07 +00:00
Chris Lattner
ebbc28f553 Instcombine: X * -1 -> -X
llvm-svn: 6904
2003-06-25 17:09:20 +00:00
Chris Lattner
7aa690403b Fix bug: LevelRaise/2003-06-25-ExprAnalysis.ll
llvm-svn: 6903
2003-06-25 17:09:03 +00:00
Chris Lattner
0903331006 Fix bug: Mem2Reg/2003-06-26-IterativePromote.ll
llvm-svn: 6901
2003-06-25 14:58:56 +00:00
Joel Stanley
0a940fa30a - Fixed name mangling conditions to handle 'linkonce' linkage type. In
particular, name mangling for GlobalValues only occurs when the linkage type is
internal or when the name must be mangled to avoid a collision.  See comments in
CWriter::getValueName for more information.

- 'inline' keyword is now emitted for functions with 'linkonce' linkage type.

- Fixed typos.

llvm-svn: 6898
2003-06-25 04:52:09 +00:00
Chris Lattner
e3d0b99978 Add argument to DAE to allow operation on non-internal functions
llvm-svn: 6895
2003-06-25 04:12:49 +00:00
Brian Gaeke
6c5d67b96f It seems likely that floats would need a cast too, because they are
ordinarily promoted to doubles.

llvm-svn: 6894
2003-06-25 03:05:33 +00:00
Chris Lattner
2cd94ee470 Fix bug: ADCE/2003-06-24-BadSuccessor.ll
llvm-svn: 6891
2003-06-24 23:02:45 +00:00
Chris Lattner
ade75cea50 Make assertion more descriptive
llvm-svn: 6889
2003-06-24 22:20:19 +00:00
Chris Lattner
aac87d1e58 Do not mark ALL terminators live if any instruciton in the block is live. We only
want to mark it live if it is an unconditional branch.  This fixes bug:
ADCE/2002-05-28-Crash.ll and makes this pass _much_ more useful.

llvm-svn: 6887
2003-06-24 21:49:45 +00:00
Chris Lattner
867b7661cb Fix bug: SCCP/2003-06-24-OverdefinedPHIValue.ll
llvm-svn: 6883
2003-06-24 20:29:52 +00:00
Chris Lattner
e1051d9fcf Fix bug: TailDup/2003-06-24-Simpleloop.ll
llvm-svn: 6881
2003-06-24 19:48:06 +00:00
Chris Lattner
e1f9e715c6 Implement new transforms:
Replace (cast (sub A, B) to bool) -> (setne A, B)
  Replace (cast (add A, B) to bool) -> (setne A, -B)

llvm-svn: 6873
2003-06-23 21:59:52 +00:00
Brian Gaeke
62947dbf9e Fix 2003-06-23-PromotedExprs.llx -- if we are adding two bytes we better
explicitly cast the result to be a byte, or C will gleefully promote it
to int.

llvm-svn: 6869
2003-06-23 20:00:51 +00:00
Brian Gaeke
af128adb0a Include <cmath> instead of <math.h>
Remove isnan; it's too unportable to handle cleanly at this point.

llvm-svn: 6866
2003-06-23 19:41:55 +00:00
Chris Lattner
afa7d2f7ec Add support for GCC 3.3
llvm-svn: 6865
2003-06-23 19:16:20 +00:00
Chris Lattner
1586e054a6 avoid dividing by zero when dealing with zero sized types (like [0 x double])
llvm-svn: 6862
2003-06-23 17:36:49 +00:00
Vikram S. Adve
d013d87cc4 Add the padding needed for variable-size alloca's, which should work now.
llvm-svn: 6859
2003-06-23 02:13:57 +00:00
Chris Lattner
b40f50e3d1 Fix bug: InstCombine/2003-06-22-ConstantExprCrash.ll
llvm-svn: 6857
2003-06-22 20:48:30 +00:00
Chris Lattner
a98d464fd6 Add paranoia checking
llvm-svn: 6856
2003-06-22 20:46:00 +00:00
Chris Lattner
99633d8cd2 Test change
llvm-svn: 6852
2003-06-22 20:25:27 +00:00
Chris Lattner
6d372c7450 Initial checkin of Tail duplication pass.
llvm-svn: 6846
2003-06-22 20:10:28 +00:00
Chris Lattner
38b7729915 Do not use the inefficient, fixed function, CBW, CDQ, ... instructions
llvm-svn: 6844
2003-06-22 03:31:18 +00:00
Chris Lattner
6c12776232 Remove a ton of extraneous #includes
llvm-svn: 6842
2003-06-22 03:08:05 +00:00
Chris Lattner
0a0266865a Remove support for the MultiObject flag, which was fundamentally broken
llvm-svn: 6840
2003-06-22 03:03:52 +00:00
Chris Lattner
9a0da3e531 Instcombine cast (getelementptr Ptr, 0, 0, 0) to ... into: cast Ptr to ...
This fixes type safety problems in a variety of benchmarks that were confusing
DSA.

llvm-svn: 6837
2003-06-21 23:12:02 +00:00
Chris Lattner
7fb273d416 Minor simplification to 64-bit instsel
llvm-svn: 6831
2003-06-21 18:15:27 +00:00
Chris Lattner
2840a1b4ee For 16 and 32-bit multiplies, use the IMUL instruction instead of the MUL instruction.
This allows us to not force the use of the EAX/AX registers!

llvm-svn: 6830
2003-06-21 17:16:58 +00:00
Chris Lattner
2b10fcccd0 Add IMULr16 & IMULr32 instructions
llvm-svn: 6829
2003-06-21 17:13:35 +00:00
Chris Lattner
4a8d96567f Generate code for LONG indexes to getelementptr instructions more efficiently
llvm-svn: 6828
2003-06-21 16:01:24 +00:00
Chris Lattner
4114fb4b01 Some preprocessors doen't support // comments and get confused
llvm-svn: 6821
2003-06-20 23:14:50 +00:00
Chris Lattner
95bf937b5a Fix the build. :(
llvm-svn: 6797
2003-06-20 14:36:52 +00:00
Vikram S. Adve
872916514d RDCCR defines arg. #1, not arg. #2.
llvm-svn: 6796
2003-06-20 11:32:11 +00:00
Chris Lattner
3a8e92a30b Changes to privatize NodeType
llvm-svn: 6795
2003-06-19 21:15:26 +00:00
Chris Lattner
365e583866 * Changes to make NodeType be private to DSNode.
* Add new MultiObject flag to DSNode which keeps track of whether or not
  multiple objects have been merged into the node, allowing must-alias info
  to be tracked.

llvm-svn: 6794
2003-06-19 21:15:11 +00:00
Brian Gaeke
a45dda3054 Fix output bug: Intel asm comment character is #, not ;.
llvm-svn: 6792
2003-06-19 19:58:32 +00:00
Brian Gaeke
9a1a7c9671 RECAPITALIZE all the names of pseudo-instructions, and add a comment explaining
the convention.

:-)

llvm-svn: 6791
2003-06-19 19:41:13 +00:00
Brian Gaeke
a734842f8a Rename many instructions to their Intel asm-compatible names. This
involves removing the [bwl] suffixes from instruction names, as well
as some other distinguishing marks (32/64/80 on fp insns, _i suffixes, etc.)

Lowercase all instr. names as well for consistency's sake.

llvm-svn: 6790
2003-06-19 19:34:44 +00:00
Brian Gaeke
beb320af87 Add Initialization and Finalization methods for the Printer pass,
to print various things on a module-by-module basis (currently, only the
former is used).

Don't print < > around names. The assembler can't take it.

Print pseudoinstructions only as comments. The poor little assembler can't
take that, either.

llvm-svn: 6789
2003-06-19 19:32:32 +00:00
Chris Lattner
ef97ca721a Remove usage of sys/unistd.h
llvm-svn: 6788
2003-06-19 18:42:09 +00:00
Chris Lattner
29e8adc038 Implement the functionality of InstCombine/call.ll
llvm-svn: 6783
2003-06-19 17:00:31 +00:00
Chris Lattner
cee19b1ace Remove a bunch of complicated code. The functionality is implemented in instcombine instead
llvm-svn: 6782
2003-06-19 16:59:19 +00:00
Brian Gaeke
7d145b44cc lib/Target/X86/X86TargetMachine.{cpp,h}: Add initial version
(non-working) of llc guts for X86, and add a prototype for it.

llvm-svn: 6779
2003-06-18 21:43:21 +00:00
Brian Gaeke
19420e8daf lib/Target/Sparc/Sparc.cpp:
Move LowerAllocations, PrintFunction, and SymbolStripping passes, and
  the corresponding -disable-strip and -d options, over here to the SPARC
  target-specific bits of llc. Rename -d to -dump-asm.

tools/llc/Makefile:
 Reindent. Add x86 library so that llc compiles again.

tools/llc/llc.cpp:
 Remove support for running arbitrary optimization passes. Use opt instead.
 Remove LowerAllocations, PrintFunction, and SymbolStripping passes, as noted
  above.
 Allow user to select a backend (x86 or SPARC); default to guessing from
  the endianness/pointer size of the input bytecode file.
 Fix typos.
 Delete empty .s file and exit with error status if target does not support
  static compilation.

llvm-svn: 6776
2003-06-18 21:14:23 +00:00
Chris Lattner
75e1e892a6 Detemplatize the PATypeHandle class, which was only really instantiated on 'Type'.
llvm-svn: 6774
2003-06-18 19:22:36 +00:00
Chris Lattner
d176218b2d Handle arguments passed in through the va_arg area
llvm-svn: 6769
2003-06-18 16:25:51 +00:00
Chris Lattner
1bcf06834c These instructions really take three operands. This fixes some assertions
llvm-svn: 6765
2003-06-18 15:09:02 +00:00
Brian Gaeke
d51afb3000 lib/CWriter/Writer.cpp: Copy AsmWriter's ConstantFP checking code here
into a new function FPCSafeToPrint(), and use it in printConstant()
and printFunction() to decide whether we should output ConstantFPs as
floating-point constants or as references to stack-allocated variables.

lib/VMCore/AsmWriter.cpp: Fix an apparent typo in the code mentioned above.

llvm-svn: 6762
2003-06-17 23:55:35 +00:00
Brian Gaeke
04d082abe5 Add #ifdef hack for MAP_ANONYMOUS being spelled MAP_ANON on some platforms.
(We're already talking about autoconf'ing this, so I'm assuming this hack
will be short-lived...I just don't want it to get lost in my working files.)

llvm-svn: 6761
2003-06-17 23:14:06 +00:00
Chris Lattner
911e2c331c Initial checkin of DAE pass
llvm-svn: 6759
2003-06-17 22:21:05 +00:00
Brian Gaeke
17f041ba98 Use $(PLATFORMLIBDL) to selectively bring in -ldl only on those platforms where
it is needed.

llvm-svn: 6753
2003-06-17 20:09:18 +00:00
Brian Gaeke
db4d9c9bd8 Use std::isnan instead of isnan. Brought back to you from the
future, by the reconciliation of the C++ and C99 standards. Someday.

llvm-svn: 6751
2003-06-17 19:59:17 +00:00
Brian Gaeke
f35ca29abc Put ifdefs around use of malloc.h/mallinfo, which isn't available on FreeBSD.
llvm-svn: 6750
2003-06-17 19:54:00 +00:00
Chris Lattner
6d0553444b Life is too short. Link in too much stuff on Linux to make building on sun easier
llvm-svn: 6748
2003-06-17 19:14:59 +00:00
Chris Lattner
0fc18257a9 The never-ending odyssey trying to get sparc to link
llvm-svn: 6747
2003-06-17 18:19:52 +00:00
Chris Lattner
85f1b38638 Make sure to get the value of ARCH before we use it
llvm-svn: 6746
2003-06-17 17:53:35 +00:00
Chris Lattner
0c7e4fdfa2 Do not link in the Sparc JIT when building on X86. Eventually the sparc will not
link in the X86 JIT either, but this makes testing easier.

For some reason, the sparc JIT was breaking the X86 JIT when it was linked in. :(

llvm-svn: 6745
2003-06-17 15:54:52 +00:00
Chris Lattner
0aa503a72d Apparently "sparc" is a macro on sparcs. Ugh. :)
llvm-svn: 6744
2003-06-17 15:54:02 +00:00
Chris Lattner
ed38cd7aa9 Whoops, didn't mean to check that in :(
llvm-svn: 6743
2003-06-17 15:46:34 +00:00
Chris Lattner
1afd194a33 Use more structured command line option processing
llvm-svn: 6742
2003-06-17 15:43:13 +00:00
Chris Lattner
1f384965af #ifdef out code that only applies when the HOSTARCH = sparc
llvm-svn: 6741
2003-06-17 15:32:38 +00:00
Chris Lattner
5083d8846b Implement handling of constantexprs for disambiguation. This implements
BasicAA/featuretest.ll:constexpr_test

llvm-svn: 6740
2003-06-17 15:25:37 +00:00
Chris Lattner
07452f836a Avoid divide by zero errors
llvm-svn: 6738
2003-06-17 15:07:20 +00:00
Chris Lattner
23450e834e Fix bug: Assembler/2003-06-17-InvokeDisassemble.llx
"yes, invoke instructions can have just three arguments"

llvm-svn: 6736
2003-06-17 13:31:10 +00:00
Chris Lattner
44689264b2 Fairly major change: emit fixed sized allocas in the entry block as a variable,
instead of a variable pointer and an alloca.  All accesses to the variable then
use the address-of operator to access it.  This plays better with the internal
GCC code generation phases, which bail early on functions which contain allocas.
It also makes the code a bit easier to read.

llvm-svn: 6734
2003-06-17 04:39:14 +00:00
Chris Lattner
2b01ee820e Don't corrupt memory when removing an instruction from the program, but
not the worklist

llvm-svn: 6733
2003-06-17 03:57:18 +00:00
Brian Gaeke
66d086cc1e Don't include alloca.h on FreeBSD.
llvm-svn: 6728
2003-06-16 23:57:13 +00:00
Chris Lattner
493103ea3b Actually, change it to use explicit new/delete, which is more likely to be
optimized INTO an alloca

llvm-svn: 6727
2003-06-16 22:29:09 +00:00