Commit Graph

938 Commits

Author SHA1 Message Date
Vikram S. Adve
e9a567cc77 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7330 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-25 21:08:58 +00:00
Vikram S. Adve
bc001b24a1 (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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7329 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-25 21:06:09 +00:00
Vikram S. Adve
34a856749f 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7327 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-25 21:00:13 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Brian Gaeke
2e2f2dcd6a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6776 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-18 21:14:23 +00:00
Chris Lattner
c8621e6f28 These instructions really take three operands. This fixes some assertions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6765 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-18 15:09:02 +00:00
Chris Lattner
2eb9a257c8 Actually, change it to use explicit new/delete, which is more likely to be
optimized INTO an alloca


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6727 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-16 22:29:09 +00:00