Commit Graph

3881 Commits

Author SHA1 Message Date
Chris Lattner
24c8e38455 Allow folding several instructions into casts, which can simplify a lot
of codes.  For example,
short kernel (short t1) {
  t1 >>= 8; t1 <<= 8;
  return t1;
}

became:

short %kernel(short %t1.1) {
        %tmp.3 = shr short %t1.1, ubyte 8               ; <short> [#uses=1]
        %tmp.5 = cast short %tmp.3 to int               ; <int> [#uses=1]
        %tmp.7 = shl int %tmp.5, ubyte 8                ; <int> [#uses=1]
        %tmp.8 = cast int %tmp.7 to short               ; <short> [#uses=1]
        ret short %tmp.8
}

before, now it becomes:
short %kernel(short %t1.1) {
        %tmp.3 = shr short %t1.1, ubyte 8               ; <short> [#uses=1]
        %tmp.8 = shl short %tmp.3, ubyte 8              ; <short> [#uses=1]
        ret short %tmp.8
}

which will become:
short %kernel(short %t1.1) {
        %tmp.3 = and short %t1.1, 0xFF00
        ret short %tmp.3
}

This implements cast-set.ll:test4 and test5


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7290 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 17:35:25 +00:00
Chris Lattner
8baa92ef0b Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7289 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 17:31:56 +00:00
Brian Gaeke
b3011a01b5 Constify most methods. We could have constified doInitialization and
doFinalization too except that would have made them shadow, not override,
the parent class :-P.

Allow *any* constant cast expression between pointers and longs,
or vice-versa, or any widening (not just same-size) conversion that
isLosslesslyConvertibleTo approves. This fixes oopack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7288 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 17:30:45 +00:00
Chris Lattner
1078d11854 Fix bug: FunctionResolve/2003-07-23-CPR-Reference.ll
This fixes a long time annoyance which caused prototypes for bzero, bcopy,
bcmp, fputs, and fputs_unlocked to never get deleted.  Grr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7285 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 22:03:18 +00:00
Chris Lattner
2cd9196e87 Add comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7283 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 21:41:57 +00:00
Chris Lattner
eca0c5c379 Remove explicit check for: not (not X) = X, it is already handled because xor is commutative
- InstCombine: (X & C1) ^ C2 --> (X & C1) | C2 iff (C1&C2) == 0
  - InstCombine: (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7282 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 21:37:07 +00:00
Chris Lattner
d4e8d31e40 Fix program: SingleSource/UnitTests/2003-07-09-SignedArgs with the CBE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7276 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 20:45:31 +00:00
Brian Gaeke
de420aee32 Printer.cpp: Ditch addRequired/getAnalysis, because they leave
Printer::doFinalization() out in the cold.  Now we pass in a TargetMachine
  to Printer's constructor and get the TargetData from the TargetMachine.
 Don't pass TargetMachine or MRegisterInfo objects around in the Printer.
 Constify TargetData references.
X86.h: Update comment and prototype of createX86CodePrinterPass().
X86TargetMachine.cpp: Update callers of createX86CodePrinterPass().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7275 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 20:25:08 +00:00
Chris Lattner
b6ede8aaa0 Make Module::getNamedFunction prefer non-external functions if there is more than
one function of the same name


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7274 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 20:21:30 +00:00
Chris Lattner
a84983ea72 Fix space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7273 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 20:21:06 +00:00
Chris Lattner
06782f804f InstCombine: (X ^ C1) & C2 --> (X & C2) iff (C1&C2) == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7272 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 19:36:21 +00:00
Chris Lattner
5840326ae6 - InstCombine: (X | C1) & C2 --> X & C2 iff C1 & C1 == 0
- InstCombine: (X | C) & C --> C
  - InstCombine: (X | C1) & C2 --> (X | (C1&C2)) & C2


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7269 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 19:25:52 +00:00
Brian Gaeke
92bdfe6951 Add, rewrite, and/or reformat many comments.
Stop passing ostreams around: we already have one perfectly good ostream
and we can all share it.

Stop stashing a pointer to TargetData in the Pass object, because that will
lead to a crash if there are no functions in the module (ouch!)  Instead,
use addRequired() and getAnalysis(), like we always should have done.

Move the check for ConstantExpr up before the check for isPrimitiveType,
because we need to be able to catch e.g. ubyte (cast bool false to ubyte),
whose type is primitive but which is nevertheless a ConstantExpr, by calling
our specialized handler instead of the AsmWriter. This would result in
assembler errors when we would try to output something like ".byte (cast
bool false to ubyte)".

GC some unused variable declarations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7265 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 18:37:06 +00:00
Chris Lattner
ad44ebfff0 IC: (X & C1) | C2 --> (X | C2) & (C1|C2)
IC: (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)

We are now guaranteed that all 'or's will be inside of 'and's, and all 'and's
will be inside of 'xor's, if the second operands are constants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7264 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 18:29:44 +00:00
Chris Lattner
c6a8aff3f6 IC: (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)
Minor code cleanup


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7262 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 17:57:01 +00:00
Chris Lattner
00b1a7e23e InstCombine: (X ^ 4) == 8 --> X == 12
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7260 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 17:26:36 +00:00
Chris Lattner
30780ccf15 Add support for ~ operator on constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7258 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 17:21:17 +00:00
Chris Lattner
bc5d414823 IC: (X & 5) == 13 --> false
IC: (X | 8) == 4  --> false


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7257 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 17:02:11 +00:00
Chris Lattner
832688a6d2 Remove redundant const qualifier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7254 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:30:32 +00:00
Chris Lattner
949a362802 Remove redundant const qualifiers from cast<> expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7253 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:30:06 +00:00
Chris Lattner
c07736a397 Simplify code by using ConstantInt::getRawValue instead of checking to see
whether the constant is signed or unsigned, then casting


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7252 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:22:26 +00:00
Chris Lattner
c8bf87af3e Remove unnecessary casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7250 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:17:51 +00:00
Chris Lattner
bfcdf14d83 Fit code into 80 columns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7249 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:17:01 +00:00
Chris Lattner
28a128e37a Eliminate old-style cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7248 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:16:40 +00:00
Chris Lattner
9daa8a12d3 Random cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7247 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 14:59:40 +00:00
Chris Lattner
1815383276 Remove using decl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7246 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 14:55:59 +00:00
Chris Lattner
987cb2c3da Remove explicit const qualifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7245 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 14:54:33 +00:00
Chris Lattner
00f185fbfd Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7243 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 03:32:41 +00:00
Chris Lattner
1ba5bcd1ae - InstCombine (cast (xor A, B) to bool) ==> (setne A, B)
- InstCombine (cast (and X, (1 << size(X)-1)) to bool) ==> x < 0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7241 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-22 21:46:59 +00:00
Vikram S. Adve
40c600e8f3 Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7227 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-22 12:08:58 +00:00
Chris Lattner
43234493de Simplify code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7217 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-21 19:56:49 +00:00
John Criswell
067947380c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7216 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-21 19:42:57 +00:00
Misha Brukman
8f9f9a2901 Eliminated dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7209 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-21 16:34:35 +00:00
Anand Shukla
6da69e75ec Added special consideration for instrumentation strategy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7208 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-20 15:39:30 +00:00
Anand Shukla
a235e14eaf Added check for inlinable function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7206 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18 20:55:26 +00:00
Brian Gaeke
d461505efd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7205 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18 20:23:43 +00:00
Misha Brukman
06dabfaed5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7204 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18 18:33:38 +00:00
Anand Shukla
0df7ddbd31 A pass to combine multiple backedges that go to same target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7201 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18 16:08:32 +00:00
Brian Gaeke
bfedb912cd Use getClassB for load and store; we don't want to abort when we
try to load or store through a bool*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7195 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-17 21:30:06 +00:00
Brian Gaeke
1d2ba44224 Fix typo in call to isUnresolvableFunc, which was breaking the build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7194 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-17 19:07:46 +00:00
John Criswell
a676b78791 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7193 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-17 19:06:55 +00:00
Vikram S. Adve
1da1d32fc7 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7189 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16 21:42:03 +00:00
Vikram S. Adve
03e19ddaf7 (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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7188 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16 21:40:28 +00:00
Vikram S. Adve
78bbec7fcb 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7187 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16 21:36:31 +00:00
Vikram S. Adve
2e1de5ed59 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.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7186 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16 21:25:17 +00:00
Misha Brukman
dfbfc57d78 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7185 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16 20:30:40 +00:00
Misha Brukman
cf7ec875ba The name should really be `simm11' to follow the naming convention, but this has
no change in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7184 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-16 20:27:44 +00:00
Misha Brukman
2c4fe5813c No need for a second immediate field if the class already inherits one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7182 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-15 21:27:14 +00:00
Misha Brukman
a34b619f67 Encode predict = 1 by default, because the Sparc assembler does this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7181 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-15 21:26:49 +00:00
Misha Brukman
07d4516f92 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7178 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-15 19:09:43 +00:00
Misha Brukman
859e09f06e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7177 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-15 15:58:26 +00:00
Misha Brukman
291c2c59b0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7176 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-15 15:55:32 +00:00
Misha Brukman
173e250548 * 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)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7175 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-14 23:26:03 +00:00
Misha Brukman
1ba3138cdc The word separate' only has one e'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7174 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-14 17:26:34 +00:00
Misha Brukman
bc0e998c49 The word separate' only has one e'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7173 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-14 17:20:40 +00:00
Vikram S. Adve
919fc8c367 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7169 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-11 21:57:43 +00:00
Brian Gaeke
0517c5ac92 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.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7168 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-11 21:57:01 +00:00
Brian Gaeke
1aa476edf0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7165 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-11 18:18:35 +00:00
Anand Shukla
666ff520e6 Added functionality to instrmentation pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7161 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 21:55:57 +00:00
Misha Brukman
1115e0483f Fixed grammatical error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7160 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 21:38:28 +00:00
Vikram S. Adve
951df2b1bd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7159 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 20:07:54 +00:00
Vikram S. Adve
940a3a47b0 Bug fix in creating constants: need 1U << 31, not 1 << 31.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7158 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 19:48:19 +00:00
Vikram S. Adve
ad80db6d7d Fold cast-to-bool into not. Later, this should also be folded into other
boolean operations: AND, OR, XOR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7157 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 19:47:42 +00:00
Vikram S. Adve
4d2faf6307 Values stored in CallArgsDescriptor cannot be const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7156 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 19:46:15 +00:00
Vikram S. Adve
24d0410db0 isMarkedForSpill() should be const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7155 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 19:45:28 +00:00
Vikram S. Adve
627eb31cd7 Change interface to MachineInstr::substituteValue to specify more precisely
which args can be substituted: defsOnly, defsAndUses or usesOnly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7154 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 19:45:07 +00:00
Vikram S. Adve
51bda6fccb Print out all neighbors in interference graph, not just higher-numbered ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7153 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 19:43:33 +00:00
Vikram S. Adve
3bf089227b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7152 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 19:42:55 +00:00
Vikram S. Adve
b15f8d446a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7151 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 19:42:11 +00:00
Misha Brukman
b5c520bfb6 Lowercase versions of `occurrence' need to be spelled correctly, too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7142 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 17:05:26 +00:00
Misha Brukman
dd6cb6a43b Occurrence' has no a' and the `r' is doubled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7140 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-10 16:49:51 +00:00
Misha Brukman
ac25de3bf0 Some beautification changes (tabs to spaces, removed extra blank lines);
no functionality changed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7138 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-09 17:33:50 +00:00
John Criswell
cf6d7b0353 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7125 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-08 14:52:09 +00:00
Misha Brukman
2988612f1b Elaborated assembly syntax of instructions in the comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7120 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-07 22:18:42 +00:00
Misha Brukman
35f19cc7b2 Removed unnecessary assignment (it was taken care by a superclass) and clarified
some comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7119 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-07 22:18:06 +00:00
Brian Gaeke
b44210d768 Insert workaround for GAS bug in assembling FLD/FSTP XWORD PTR [...]
instructions, by outputting them as bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7115 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-07 18:34:20 +00:00
Misha Brukman
de11f2d038 Moved RegClassIDs enum to be next to the RegTypes enum.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7114 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-07 16:52:39 +00:00
Vikram S. Adve
9c570ee129 Correction to last fix: Pointer types do not return true in Type::IsIntegral().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7113 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-06 22:50:31 +00:00
Vikram S. Adve
97539fc4b6 Choose register instead of immediate for ConstantExpr in ChooseRegOrImmed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7112 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-06 20:33:21 +00:00
Vikram S. Adve
786833ad34 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7111 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-06 20:13:59 +00:00
Vikram S. Adve
46d3f8e34c Make the RegClassID values public -- there is no other way to get them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7109 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-06 19:53:59 +00:00
Misha Brukman
9cedd433eb 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7103 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-03 18:36:47 +00:00
Chris Lattner
5bfccb9def 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7093 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-03 06:42:38 +00:00
Chris Lattner
85cfe01a5e Remove globals more aggressively from graphs.
Fix a bug where we removed nodes that were marked U.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7090 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-03 02:03:53 +00:00
Chris Lattner
7079386e02 INCLUDE_PARENT_GRAPH is required!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7088 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 23:57:05 +00:00
Chris Lattner
10c45d6cd5 Disable incorrect mustalias code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7087 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 23:56:51 +00:00
Chris Lattner
61691c5d85 Remove space at end of line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7084 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 23:44:15 +00:00
Chris Lattner
6c87461fe6 Fix how we are handling unreachable functions. This DRAMATICALLY improves efficiency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7082 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 23:42:48 +00:00
Chris Lattner
d391d70361 Keep track of how many inlinings are performed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7076 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 20:24:42 +00:00
Chris Lattner
47030f8a72 Try using trivially dead deletion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7075 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 19:49:11 +00:00
Misha Brukman
ce14ec3901 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7074 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 19:37:48 +00:00
Misha Brukman
bd272999dd The classes F4_3 and F4_4 have an `rd' operand that needs to be set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7073 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 18:27:47 +00:00
Misha Brukman
a8fcdd8d04 Properly fix instruction syntax in comments, using `imm' for instructions that
use an immediate value instead of a register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7072 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 18:15:43 +00:00
Misha Brukman
69bf93081f Fixed instruction syntax in the comments (specifies how instr is used).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7071 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 18:02:58 +00:00
Misha Brukman
82742916f3 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7070 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 17:53:19 +00:00
Vikram S. Adve
ea28dd3392 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7066 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 06:59:22 +00:00
Chris Lattner
44cfdf9b9a Remove dead Nodes list
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7065 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 06:06:34 +00:00
Chris Lattner
a8da51bf51 Complete rewrite of td pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7064 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 04:39:44 +00:00
Chris Lattner
63899fab93 Print collapsed to match the paper
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7063 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 04:39:27 +00:00
Chris Lattner
9cd0484251 Reduce amount of work we do calculating mustaliases if the arg is a global
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7062 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 04:39:13 +00:00
Chris Lattner
58f98d0bf0 Add support for ParentGraph only when building in debug mode
Minor cleanups, reenable folding of call nodes to external functions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7061 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 04:38:49 +00:00
Chris Lattner
f07804b923 Add some functions to the blacklist
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7060 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 04:38:00 +00:00
Chris Lattner
744f93996e Make the BU closure keep track of which actual calls happen
Minor cleanups


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7059 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 04:37:48 +00:00
Chris Lattner
3051419036 Make local pass print out its progress
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7058 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 04:37:26 +00:00
Vikram S. Adve
65b2f401af Minor beautification: fold a couple of lines of code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7054 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 01:24:00 +00:00
Vikram S. Adve
799ffeede1 (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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7053 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 01:23:15 +00:00
Vikram S. Adve
74d15d36f5 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*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7052 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 01:16:01 +00:00
Vikram S. Adve
784a18b8ba 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7051 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 01:13:57 +00:00
Chris Lattner
5fd60913da Fix bug: Regression/Other/2002-03-11-ExprAssertion.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7046 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-01 21:08:52 +00:00
Chris Lattner
18f07a11b9 Rework TD pass to work with the precise call graph constructed by the BU phase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7031 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-01 16:28:11 +00:00
Chris Lattner
b6734b281b Do not treat global variables as functions! (and assert failing)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7030 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-01 16:27:53 +00:00
Chris Lattner
d9dad2cf61 Dont' print scalar nodes for ConstantPointerRefs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7029 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-01 16:27:32 +00:00
Chris Lattner
5d5b6d6a5c Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7027 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-01 16:04:18 +00:00
John Criswell
7a73b80b90 Merged in autoconf branch. This provides configuration via the autoconf
system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7014 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 21:59:07 +00:00
Chris Lattner
eb093fbf6f Setjmp should always return zero if we don't implement longjmp. This avoids
leaving trash in the register, fixing anagram


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7013 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 19:35:54 +00:00
Brian Gaeke
02c26b681e Get rid of the duplicate '0x' in debug mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7012 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 18:06:20 +00:00
Chris Lattner
6681e98b13 Use the getFunctionNames method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7008 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 05:57:39 +00:00
Chris Lattner
a9d6566e36 Add new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7007 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 05:57:30 +00:00
Chris Lattner
2b4c8dfdd5 Split CallSiteIterator out into DSCallSiteIterator.h, and generalize it a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7006 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 05:27:53 +00:00
Chris Lattner
9f93055253 Be more const-correct
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7005 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 05:27:18 +00:00
Chris Lattner
7b1ceaa40b Fix bug in last checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7003 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 05:18:26 +00:00
Chris Lattner
0eea61863b Reimplement the BU closure to collapse all SCC graphs into a single graph.
Look at all of the code that gets deleted!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7001 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 05:09:58 +00:00
Chris Lattner
2cb9acd785 Handle the case where OldNodeMap == &ScalarMap correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7000 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 05:09:29 +00:00
Chris Lattner
acbc8c6768 Remove dead method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6999 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 04:53:39 +00:00
Chris Lattner
81d924d804 Do not delete the same graph multiple times when freeing memory if graphs are sharing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6998 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 04:53:27 +00:00
Chris Lattner
3d162907e3 Do not multiply delete graphs if functions are sharing graphs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6997 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 04:53:08 +00:00
Chris Lattner
8d32767da4 Move usages of explicit hash_* datastructures to use typedefs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6996 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 03:36:09 +00:00
Chris Lattner
5a54063303 Revamp DSGraphs so that they can support multiple functions in the same
DSGraph at one time


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6994 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 03:15:25 +00:00
Chris Lattner
a321b04d60 Adjust for new DSGraph API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6993 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 03:14:54 +00:00
Chris Lattner
8bc95a176a Eliminate using declarations, adjust for new DSGraph API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6992 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 03:14:44 +00:00
Chris Lattner
dea8146787 Abstract out the predicate which decides whether a function gets complete
arguments or not...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6987 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 22:37:07 +00:00
Chris Lattner
06e24c8447 Fix minor bug in previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6986 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 22:36:31 +00:00
Chris Lattner
919ffbf977 Add support for ensuring that nodes are not incomplete
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6985 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 22:36:15 +00:00
Chris Lattner
5c5b10f46a Add support for "physical subtyping", which fixes:
DSGraph/2003-06-29-NodeCollapsing2.ll & DSGraph/PhysicalSubtyping.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6982 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 20:27:45 +00:00
Chris Lattner
889fb9de96 Add print method to not get silly warning from analyze
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6981 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 20:27:16 +00:00
Chris Lattner
5100dbb9e7 New pass which is useful for writing regression tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6979 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 18:17:07 +00:00
Chris Lattner
c151e4f415 Until there is a setjmp/longjmp transformation pass, codegen setjmp as a noop
and longjmp as an abort!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6977 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 16:42:32 +00:00
Chris Lattner
5c70dc0456 Expose must alias information for global variables, implementing: DSGraph/mustalias.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6973 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 00:54:08 +00:00
Chris Lattner
aed2c6d2cb If the alias analysis algorithm we are using can provide MUST alias information,
expose it directly as value numbering information


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6972 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 00:53:34 +00:00
Chris Lattner
1842a90e0b Count operands to instructions as well as just results. This allows for global variables to be checked as well
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6970 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 00:07:11 +00:00
Chris Lattner
312edd330f Propagate globals graph from the local to bu to td globals graphs. This
fixes bug: DSGraph/buglobals.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6947 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 22:14:55 +00:00
Chris Lattner
5e459dbc52 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6946 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 22:10:58 +00:00
Chris Lattner
72d50a090f Avoid double negatives
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6945 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 21:58:28 +00:00
Chris Lattner
934fe856b5 New pass to perform DSA based optimizations. Initially we just support turning
globals into constants if we can prove it's safe


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6941 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 21:54:55 +00:00
Chris Lattner
e9a64ea38e Avoid printing out huge structures or arrays if they are just filled with zeros
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6938 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 20:08:24 +00:00
Chris Lattner
f460048771 Add support for a new zeroinitializer token which can be used to get rid of
huge arrays of zero initialized values


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6937 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 20:01:34 +00:00
Chris Lattner
2fa42a816d jmp_buf is really a pointer type that is passed around...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6935 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 19:29:34 +00:00
Chris Lattner
9bda5f52bd Add support for the Invoke instruction!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6934 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 17:53:05 +00:00
Chris Lattner
4148819f0f Preserve compatibility with non-gcc compilers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6932 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 17:15:12 +00:00
Chris Lattner
76d9f1b467 Fix bug: CBackend/2003-06-28-LinkOnceGlobalVars.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6931 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 17:08:36 +00:00
Chris Lattner
cf6bac3b56 Allow the inlining limit to be controlled from the command line!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6929 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 15:57:04 +00:00
Chris Lattner
d2a6fc397e Add support for 'unsigned' command line arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6928 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 15:47:20 +00:00
Brian Gaeke
d7908f679e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6924 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-27 00:00:48 +00:00
Brian Gaeke
5e00157c5a Number constants from constant pool as CPIf_i where f is the function index
and i is the constant pool index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6920 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 18:02:30 +00:00
Chris Lattner
b12b75365a Add support to globaldce for deleting dead function prototypes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6918 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 05:41:18 +00:00
Chris Lattner
81d4e14449 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6917 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 05:30:40 +00:00
Chris Lattner
6a2a60aaf3 Implement more aggressive folding of constant GEP instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6913 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 05:22:45 +00:00
Chris Lattner
833b8a4181 Add support for elimination of load instruction from global constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6912 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 05:06:25 +00:00
Brian Gaeke
bc601fe3e7 Integrate the C writer's name mangler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6908 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 22:00:39 +00:00
Brian Gaeke
01d79ff86d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6907 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 18:01:07 +00:00
Chris Lattner
0af1fab019 Instcombine: X * -1 -> -X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6904 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 17:09:20 +00:00
Chris Lattner
5db61fdc8a Fix bug: LevelRaise/2003-06-25-ExprAnalysis.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 17:09:03 +00:00
Chris Lattner
83c39d2edb Fix bug: Mem2Reg/2003-06-26-IterativePromote.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6901 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 14:58:56 +00:00
Joel Stanley
54f6032dae - 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6898 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 04:52:09 +00:00
Chris Lattner
9b2a14b6f1 Add argument to DAE to allow operation on non-internal functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6895 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 04:12:49 +00:00
Brian Gaeke
e99f4cf4ac It seems likely that floats would need a cast too, because they are
ordinarily promoted to doubles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6894 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 03:05:33 +00:00
Chris Lattner
837e42ccef Fix bug: ADCE/2003-06-24-BadSuccessor.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6891 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 23:02:45 +00:00
Chris Lattner
a89ab2c355 Make assertion more descriptive
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6889 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 22:20:19 +00:00
Chris Lattner
99c91e021a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6887 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 21:49:45 +00:00
Chris Lattner
38b5ae4b48 Fix bug: SCCP/2003-06-24-OverdefinedPHIValue.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6883 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 20:29:52 +00:00
Chris Lattner
fcd74e2e31 Fix bug: TailDup/2003-06-24-Simpleloop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6881 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-24 19:48:06 +00:00
Chris Lattner
79d35b3f8b Implement new transforms:
Replace (cast (sub A, B) to bool) -> (setne A, B)
  Replace (cast (add A, B) to bool) -> (setne A, -B)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6873 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 21:59:52 +00:00
Brian Gaeke
031a112747 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6869 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 20:00:51 +00:00
Brian Gaeke
703379827f Include <cmath> instead of <math.h>
Remove isnan; it's too unportable to handle cleanly at this point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6866 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 19:41:55 +00:00
Chris Lattner
1d5fc3f416 Add support for GCC 3.3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6865 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 19:16:20 +00:00
Chris Lattner
8a334a4035 avoid dividing by zero when dealing with zero sized types (like [0 x double])
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6862 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 17:36:49 +00:00
Vikram S. Adve
80544444a3 Add the padding needed for variable-size alloca's, which should work now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6859 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 02:13:57 +00:00
Chris Lattner
037d258319 Fix bug: InstCombine/2003-06-22-ConstantExprCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6857 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 20:48:30 +00:00
Chris Lattner
066ab6ac80 Add paranoia checking
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6856 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 20:46:00 +00:00
Chris Lattner
ea635cd072 Test change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6852 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 20:25:27 +00:00
Chris Lattner
7a7bef4355 Initial checkin of Tail duplication pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6846 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 20:10:28 +00:00
Chris Lattner
7b52c036f4 Do not use the inefficient, fixed function, CBW, CDQ, ... instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6844 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 03:31:18 +00:00
Chris Lattner
3889a2cb05 Remove a ton of extraneous #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6842 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 03:08:05 +00:00
Chris Lattner
e0f4b98026 Remove support for the MultiObject flag, which was fundamentally broken
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6840 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 03:03:52 +00:00
Chris Lattner
797249bc13 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6837 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 23:12:02 +00:00
Chris Lattner
034acf0a3d Minor simplification to 64-bit instsel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6831 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 18:15:27 +00:00
Chris Lattner
0f1c461423 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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6830 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 17:16:58 +00:00
Chris Lattner
a8cb100706 Add IMULr16 & IMULr32 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6829 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 17:13:35 +00:00
Chris Lattner
f58544712b Generate code for LONG indexes to getelementptr instructions more efficiently
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6828 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 16:01:24 +00:00
Chris Lattner
c901e8bd9e Some preprocessors doen't support // comments and get confused
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6821 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-20 23:14:50 +00:00
Chris Lattner
1c6d6c996a Fix the build. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6797 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-20 14:36:52 +00:00
Vikram S. Adve
ddafa49edc RDCCR defines arg. #1, not arg. #2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6796 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-20 11:32:11 +00:00
Chris Lattner
31f612589f Changes to privatize NodeType
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6795 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 21:15:26 +00:00
Chris Lattner
bd92b73be7 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6794 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 21:15:11 +00:00
Brian Gaeke
3387e7f7a2 Fix output bug: Intel asm comment character is #, not ;.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6792 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 19:58:32 +00:00
Brian Gaeke
088fa1162d RECAPITALIZE all the names of pseudo-instructions, and add a comment explaining
the convention.

:-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6791 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 19:41:13 +00:00
Brian Gaeke
96b07e54dd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6790 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 19:34:44 +00:00
Brian Gaeke
9e474c4ec8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6789 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 19:32:32 +00:00
Chris Lattner
ed4775a3c1 Remove usage of sys/unistd.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6788 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 18:42:09 +00:00
Chris Lattner
9fe3886678 Implement the functionality of InstCombine/call.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6783 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 17:00:31 +00:00