1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
Commit Graph

3980 Commits

Author SHA1 Message Date
Misha Brukman
f4702ed4d1 Add in support to load shared objects (-load is provided by Support library).
llvm-svn: 7360
2003-07-28 19:06:19 +00:00
Chris Lattner
da51c38e57 Specify the value type for the register, not just the size.
llvm-svn: 7357
2003-07-28 04:25:36 +00:00
Chris Lattner
163559e702 Instead of specifying the SIZE of the register, go so far as to specify
what value type it is.

llvm-svn: 7356
2003-07-28 04:24:59 +00:00
Chris Lattner
40cc4c1392 Rename function to be more consistent with filename
llvm-svn: 7352
2003-07-26 23:49:58 +00:00
Chris Lattner
92dfc1ed32 Making this code const-correct would be a pain, so I'll hack it.
llvm-svn: 7350
2003-07-26 23:29:51 +00:00
Chris Lattner
2d6049baaf Const correctness fixes
llvm-svn: 7349
2003-07-26 23:24:56 +00:00
Chris Lattner
e39696972d Be const correct
llvm-svn: 7348
2003-07-26 23:23:41 +00:00
Chris Lattner
792286a084 Hrm, another necesary one :(
llvm-svn: 7347
2003-07-26 23:22:19 +00:00
Chris Lattner
f0df04752d We don't modify the LLVM rep, remain const correct
llvm-svn: 7345
2003-07-26 23:06:00 +00:00
Chris Lattner
b92653f037 If the pass changes _anything_ it must return true
llvm-svn: 7344
2003-07-26 23:05:37 +00:00
Chris Lattner
406d31b4c2 This code doesn't modify the LLVM structure, keep stuff const
llvm-svn: 7343
2003-07-26 23:04:00 +00:00
Chris Lattner
ecc0501a97 Remove #include
llvm-svn: 7342
2003-07-26 23:01:04 +00:00
Chris Lattner
9224631d6b Remove extraneous #includes
llvm-svn: 7341
2003-07-26 23:00:29 +00:00
Chris Lattner
36a7bf78fa Fix another minor bug
llvm-svn: 7340
2003-07-26 23:00:05 +00:00
Vikram S. Adve
48144de834 (1) Major fix to the way unused regs. are marked and found for the FP
Single and FP double reg types (which share the same reg class).
    Now all methods marking/finding unused regs consider the regType
    within the reg class, and SparcFloatRegClass specializes this code.
(2) Remove machine-specific regalloc. methods that are no longer needed.
    In particular, arguments and return value from a call do not need
    machine-specific code for allocation.
(3) Rename TargetRegInfo::getRegType variants to avoid unintentional
    overloading when an include file is omitted.

llvm-svn: 7334
2003-07-25 21:12:15 +00:00
Vikram S. Adve
a98599dc3b 1. Fix a case that was marking the invalid reg. num. (-1) as used,
causing a nasty array bound error later.
2. Fix silly typo causing logical shift of unsigned long to use
   SRL instead of SRLX.

llvm-svn: 7330
2003-07-25 21:08:58 +00:00
Vikram S. Adve
57eb4ab6bc (1) Change the way unused regs. are marked and found to consider regType
info (since multiple reg types may share the same reg class).
(2) Remove machine-specific regalloc. methods that are no longer needed.
    In particular, arguments and return value from a call do not need
    machine-specific code for allocation.
(3) Rename TargetRegInfo::getRegType variants to avoid unintentional
    overloading when an include file is omitted.

llvm-svn: 7329
2003-07-25 21:06:09 +00:00
Vikram S. Adve
714fee31fd Remove unused field. Change the way unused regs. are marked and
found to consider regType info (since multiple reg types may share
the same reg class, e.g., single and double on Sparc).

llvm-svn: 7327
2003-07-25 21:00:13 +00:00
Chris Lattner
752a4ca4c4 Dont' try to parse the colon
llvm-svn: 7323
2003-07-25 20:49:29 +00:00
Chris Lattner
915b998b3f Add a more general check-flags which can be used to ensure arbitrary flags are set
llvm-svn: 7322
2003-07-25 20:45:40 +00:00
Brian Gaeke
991f66b7e2 Include llvm/Support/Mangler.h first. Don't include <iostream>, <set>,
<string>, or llvm/Value.h.  Move up the inclusion of llvm/Support/Mangler.h.

llvm-svn: 7321
2003-07-25 20:21:20 +00:00
Brian Gaeke
11e6d7f2de Don't include llvm/SlotCalculator.h, or <set>.
Move up the inclusion of llvm/Support/Mangler.h.

llvm-svn: 7320
2003-07-25 20:21:06 +00:00
Brian Gaeke
d9979a5529 Cleanups:
Mangler.cpp: Constify parameter to makeNameProper, and use const_iterator.
 Make Count an unsigned int, and use utostr().
 Don't name parameters things that start with underscore.
Mangler.h: All of the above, and also: Add Emacs mode-line.  Include <set>.

llvm-svn: 7301
2003-07-24 21:37:57 +00:00
Brian Gaeke
e5ae59ad05 Factor out name-mangling from X86/Printer, which is derived from CWriter,
into this new support class.

llvm-svn: 7300
2003-07-24 20:20:58 +00:00
Brian Gaeke
dc07ea6681 Use unified CWriter-X86/Printer name mangler. Do not bother using
SlotCalculator in CWriter.  (Unfortunately, all this means a lot of
X86/Printer's methods have to be de-constified again.  Oh well.)

llvm-svn: 7299
2003-07-24 20:20:44 +00:00
Chris Lattner
c5b0f39c96 Instcombine: (A >> c1) << c2 for signed integers
llvm-svn: 7295
2003-07-24 18:38:56 +00:00
Chris Lattner
bf9589bf1f Reorganization of code, no functional changes.
Now it shoudl be a bit more efficient

llvm-svn: 7292
2003-07-24 17:52:58 +00:00
Brian Gaeke
77b077a109 It doesn't appear that we need to #include these.
llvm-svn: 7291
2003-07-24 17:48:53 +00:00
Chris Lattner
785e8453f0 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

llvm-svn: 7290
2003-07-24 17:35:25 +00:00
Chris Lattner
9eb9ec67f7 Minor cleanups
llvm-svn: 7289
2003-07-24 17:31:56 +00:00
Brian Gaeke
4afe7aea5f 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.

llvm-svn: 7288
2003-07-24 17:30:45 +00:00
Chris Lattner
31224cdff9 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.

llvm-svn: 7285
2003-07-23 22:03:18 +00:00
Chris Lattner
6d10220481 Add comments
llvm-svn: 7283
2003-07-23 21:41:57 +00:00
Chris Lattner
ac8a2be5e4 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

llvm-svn: 7282
2003-07-23 21:37:07 +00:00
Chris Lattner
7e3419a91c Fix program: SingleSource/UnitTests/2003-07-09-SignedArgs with the CBE
llvm-svn: 7276
2003-07-23 20:45:31 +00:00
Brian Gaeke
5674309dc1 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().

llvm-svn: 7275
2003-07-23 20:25:08 +00:00
Chris Lattner
d285263cd3 Make Module::getNamedFunction prefer non-external functions if there is more than
one function of the same name

llvm-svn: 7274
2003-07-23 20:21:30 +00:00
Chris Lattner
fc4a57d904 Fix space
llvm-svn: 7273
2003-07-23 20:21:06 +00:00
Chris Lattner
f453a39185 InstCombine: (X ^ C1) & C2 --> (X & C2) iff (C1&C2) == 0
llvm-svn: 7272
2003-07-23 19:36:21 +00:00
Chris Lattner
80d9c3a900 - InstCombine: (X | C1) & C2 --> X & C2 iff C1 & C1 == 0
- InstCombine: (X | C) & C --> C
  - InstCombine: (X | C1) & C2 --> (X | (C1&C2)) & C2

llvm-svn: 7269
2003-07-23 19:25:52 +00:00
Brian Gaeke
9de468d398 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.

llvm-svn: 7265
2003-07-23 18:37:06 +00:00
Chris Lattner
76c1da471c 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.

llvm-svn: 7264
2003-07-23 18:29:44 +00:00
Chris Lattner
4b43cd9700 IC: (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)
Minor code cleanup

llvm-svn: 7262
2003-07-23 17:57:01 +00:00
Chris Lattner
ae691a3068 InstCombine: (X ^ 4) == 8 --> X == 12
llvm-svn: 7260
2003-07-23 17:26:36 +00:00
Chris Lattner
b07de65646 IC: (X & 5) == 13 --> false
IC: (X | 8) == 4  --> false

llvm-svn: 7257
2003-07-23 17:02:11 +00:00
Chris Lattner
dd48c4b1e4 Remove redundant const qualifier
llvm-svn: 7254
2003-07-23 15:30:32 +00:00
Chris Lattner
1351c304dc Remove redundant const qualifiers from cast<> expressions
llvm-svn: 7253
2003-07-23 15:30:06 +00:00
Chris Lattner
6ad460b336 Simplify code by using ConstantInt::getRawValue instead of checking to see
whether the constant is signed or unsigned, then casting

llvm-svn: 7252
2003-07-23 15:22:26 +00:00
Chris Lattner
9c569f48a0 Remove unnecessary casts
llvm-svn: 7250
2003-07-23 15:17:51 +00:00
Chris Lattner
bfe70df7fc Fit code into 80 columns
llvm-svn: 7249
2003-07-23 15:17:01 +00:00
Chris Lattner
0fce06e40e Eliminate old-style cast
llvm-svn: 7248
2003-07-23 15:16:40 +00:00
Chris Lattner
c1049acba1 Random cleanups
llvm-svn: 7247
2003-07-23 14:59:40 +00:00
Chris Lattner
67138b2c59 Remove using decl
llvm-svn: 7246
2003-07-23 14:55:59 +00:00
Chris Lattner
63ea851f94 Remove explicit const qualifiers
llvm-svn: 7245
2003-07-23 14:54:33 +00:00
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
Chris Lattner
9fa396e6c7 Remove usage of alloca
llvm-svn: 6726
2003-06-16 22:22:11 +00:00
Chris Lattner
c32989e03a Remove two using decls
Remove usage of alloca

llvm-svn: 6725
2003-06-16 22:18:28 +00:00
Brian Gaeke
4681b27a92 Isolate machine-dependent use of <alloca.h> in "Support/Alloca.h",
so that we can easily change its use to be conditional on the result of
an autoconf test later.

llvm-svn: 6723
2003-06-16 21:54:01 +00:00
Chris Lattner
3aba55395a Rename FInfo.cpp to FunctionInfo.cpp, eliminate FInfo.h
llvm-svn: 6712
2003-06-16 15:31:52 +00:00
Chris Lattner
9958a1c5b8 move contents of include/llvm/Reoptimizer/Mapping/FInfo.h into here, it is sparc internal
llvm-svn: 6711
2003-06-16 15:31:09 +00:00
Chris Lattner
098bfd0a32 Fix typeo
llvm-svn: 6704
2003-06-16 12:21:19 +00:00
Chris Lattner
343c4d4987 Fix bug: Linker/2003-06-02-TypeResolveProblem2.ll
llvm-svn: 6699
2003-06-16 12:11:33 +00:00
Chris Lattner
64ec8f36aa Fix bug: ADCE/2003-06-11-InvalidCFG.ll
This was because we were deleting large chunks of functions without an exit block, because the post-dominance
information was not useful.  This broke crafty and twolf.

llvm-svn: 6698
2003-06-16 12:10:45 +00:00
Chris Lattner
01aacfcea8 Fix bug: CBackend/2003-06-11-HexConstant.ll
Fix bug: CBackend/2003-06-11-LiteralStringProblem.ll

llvm-svn: 6697
2003-06-16 12:09:09 +00:00
Chris Lattner
2806ac8828 Nodes get forwarded when they are collapsed currently.
llvm-svn: 6696
2003-06-16 12:08:18 +00:00
Chris Lattner
e718da0d46 Remove bogus assertion: a node with no referrers could be collapsed if field-sensitivity was disabled
llvm-svn: 6695
2003-06-16 12:07:39 +00:00
Chris Lattner
24441a15c5 Implement forwarding from stores to loads of must-aliased pointers.
This implements: GCSE/2003-06-13-LoadStoreEliminate.ll

llvm-svn: 6694
2003-06-16 12:06:41 +00:00
Chris Lattner
713b9542eb Fix invalid number of arguments problem
llvm-svn: 6692
2003-06-16 12:03:00 +00:00
John Criswell
4781723de6 Included assert.h so that the code compiles under newer versions of GCC.
llvm-svn: 6682
2003-06-11 14:01:36 +00:00
John Criswell
d3ff853628 Updated for the new projects Makefile.
llvm-svn: 6678
2003-06-11 13:49:11 +00:00
Guochun Shi
77b04a417a add some comments
add a function ModuloScheduling::dumpFinalSchedule() to print out final schedule

llvm-svn: 6677
2003-06-10 20:04:30 +00:00
Guochun Shi
36a4257c48 add an brief instruction what this pass is
llvm-svn: 6676
2003-06-10 20:03:39 +00:00
Guochun Shi
385c1556a9 a simple introduction to this pass
llvm-svn: 6675
2003-06-10 20:02:16 +00:00
Guochun Shi
8783d79b8b cleaned code
add some comments

llvm-svn: 6674
2003-06-10 19:09:00 +00:00
Guochun Shi
7868d0f43e delete useless functions
add comment

llvm-svn: 6673
2003-06-08 23:16:07 +00:00
Guochun Shi
24ac61d239 change DEBUG to DEBUG_PRINT
llvm-svn: 6672
2003-06-08 20:40:47 +00:00
Chris Lattner
66f5f27dcb Add #include for older GCC's
llvm-svn: 6670
2003-06-08 06:43:57 +00:00
Chris Lattner
326e1fb77d Fix bug: LevelRaise/2003-06-07-EmptyArrayTest.ll
llvm-svn: 6669
2003-06-07 21:45:42 +00:00
Chris Lattner
26c238c746 Fix compilation problem on GCC 2.9x
llvm-svn: 6667
2003-06-07 20:29:58 +00:00
Misha Brukman
ba5c703619 Do not hastily change the Opcode from 'r' to 'i' type if we're not actually
SETTING the operand to be an immediate or have verified that one of the operands
is really a SignExtended or Unextended immediate value already, which warrants
an 'i' opcode.

llvm-svn: 6662
2003-06-07 02:34:43 +00:00
Chris Lattner
68ee069591 Fix compilation problem with some versions of G++
llvm-svn: 6660
2003-06-06 22:13:01 +00:00
Chris Lattner
5e34712b08 Fix problem with perror
llvm-svn: 6659
2003-06-06 21:09:29 +00:00
Chris Lattner
d4e4130f0a Fix warnings on Sparc
llvm-svn: 6658
2003-06-06 18:25:33 +00:00
Misha Brukman
4f614afd11 Print address out as hex.
llvm-svn: 6657
2003-06-06 09:53:28 +00:00
Misha Brukman
2f76ce01b0 Added 'r' and 'i' versions to WRCCR.
llvm-svn: 6656
2003-06-06 09:52:58 +00:00
Misha Brukman
d61d0211ba * Changed Bcc instructions to behave like BPcc instructions
* BPA and BPN do not take a %cc register as a parameter
* SLL/SRL/SRA{r,i}5 are there for a reason - they are ONLY 32-bit instructions
* Likewise, SLL/SRL/SRAX{r,i}6 are only 64-bit
* Added WRCCR{r,i} opcodes

llvm-svn: 6655
2003-06-06 09:52:23 +00:00
Misha Brukman
a8f6be985d * Removed PreSelection pass because that is now done in the JIT
* Removed instruction scheduling as it is too slow to run in a JIT environment
* Removed other passes because they aren't necessary and can slow JIT down

llvm-svn: 6652
2003-06-06 07:11:16 +00:00
Chris Lattner
e9a9d85aee Don't output explicit initializers for globals that are zero initialized
llvm-svn: 6651
2003-06-06 07:10:24 +00:00
Misha Brukman
1a3c1a6208 ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT :::
The JIT is designed to code-generate a function at-a-time. That means that any
pass can only make local changes to its function. Period.

Because the Sparc PreSelection pass claims to be a BasicBlock pass while adding
globals to the Module, it cannot be run with the other passes, because by this
time, the globals have been output already by the JIT, and the addresses of any
globals appearing AFTER this point are not recognized.

However, the PreSelection pass is a requirement for correctness in the Sparc
codegen path, so it MUST be run.

::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT :::

llvm-svn: 6650
2003-06-06 06:59:55 +00:00
Misha Brukman
6762302093 Output function address as hex.
llvm-svn: 6649
2003-06-06 06:52:35 +00:00
Misha Brukman
960a2c69b5 Fixed a bunch of test cases in test/Regression/Jello which could not get the
address of a floating-point (allocated via ConstantPool) correctly.

llvm-svn: 6647
2003-06-06 04:41:22 +00:00
Chris Lattner
437985e52c Add statistic for # machine instrs emitted
Add GROSS HACK to get CompilationCallback to work when compiled in release mode

llvm-svn: 6646
2003-06-06 04:00:05 +00:00
Misha Brukman
4720f1af42 * If a global is not a function, just ask the MachineCodeEmitter for the addr
* Do not block a print statement with a DEBUG() guard if we're going to abort()

llvm-svn: 6645
2003-06-06 03:35:37 +00:00
Misha Brukman
9e8fd867b4 The SUB*i instructions belong to a different class than their SUB*r brethren.
llvm-svn: 6644
2003-06-06 03:34:47 +00:00
Misha Brukman
9136d8dd0d Put all debug print statements under the DEBUG() guard to make output clean so
that tests can automatically diff the output.

llvm-svn: 6642
2003-06-06 00:26:11 +00:00
Misha Brukman
999c7802ab Removed debug print statement.
llvm-svn: 6641
2003-06-06 00:00:54 +00:00
Misha Brukman
c3b2d93a5c Fixed confusion between register classes and register types.
Now %fcc registers are recognized correctly.

llvm-svn: 6640
2003-06-05 23:51:10 +00:00
Misha Brukman
f0c930a86c Added missing directive to store the instruction name.
llvm-svn: 6639
2003-06-05 23:35:11 +00:00
Misha Brukman
6026ff3361 Moved predict and annul fields to the end of each individual instruction
class, because they are currently unused.

llvm-svn: 6638
2003-06-05 23:33:15 +00:00
Misha Brukman
0c06cc4fb9 Do not preset the cc register, the instructions actually use it.
llvm-svn: 6637
2003-06-05 23:30:27 +00:00
Vikram S. Adve
9dea456cbd Minor tuning -- avoid a non-inlinable function call on every operand.
Also, reorder a couple of functions for inlining.

llvm-svn: 6635
2003-06-05 21:12:56 +00:00