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

107 Commits

Author SHA1 Message Date
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
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
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
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
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
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
28430ecbc6 * Convert load/store opcodes from register to immediate forms.
* Stop code from wrapping to the next line.

llvm-svn: 6566
2003-06-03 03:21:58 +00:00
Misha Brukman
6f65b13ed3 SparcInstr.def: added 'r' and 'i' versions of MOV(F)cc instructions
SparcInstrSelection.cpp:
* Fixed opcodes to return correct 'i' version since the two functions are each
  only used in one place.
* Changed name of function to have an 'i' in the name to signify that they each
  return an immediate form of the opcode.
* Added a warning if either of the functions is ever used in a context which
  requires a register-version opcode.

SparcV9_F4.td: fixed class F4_3, added F4_4 and notes that F4_{1,2} need fixing
SparcV9.td: added the MOV(F)cc instructions

llvm-svn: 6548
2003-06-02 20:55:14 +00:00
Vikram S. Adve
194a5862e0 Extensive changes to the way code generation occurs for function
call arguments and return values:
Now all copy operations before and after a call are generated during
selection instead of during register allocation.
The values are copied to virtual registers (or to the stack), but
in the former case these operands are marked with the correct physical
registers according to the calling convention.
Although this complicates scheduling and does not work well with
live range analysis, it simplifies the machine-dependent part of
register allocation.

llvm-svn: 6465
2003-05-31 07:32:01 +00:00
Vikram S. Adve
884f4c7a97 Reverting previous beautification changes.
llvm-svn: 6464
2003-05-31 07:27:17 +00:00
Misha Brukman
3fc07ad7b8 Code beautification, no functional changes.
llvm-svn: 6459
2003-05-31 06:22:37 +00:00
Misha Brukman
ce67ffb229 Moved and expanded convertOpcodeFromRegToImm() to conver more opcodes.
Code beautification for the rest of the code: changed layout to match the rest
of the code base.

llvm-svn: 6446
2003-05-30 20:11:56 +00:00
Misha Brukman
1d3512486a Added 'r' or 'i' annotations to instructions, as SparcInstr.def has changed.
Here I had to make one non-trivial change: add a function to get a version of
the opcode that takes an immediate, given an opcode that takes all registers.

This is required because sometimes it is not known at construction time which
opcode is used because opcodes are passed around between functions.

llvm-svn: 6375
2003-05-27 22:37:00 +00:00
Vikram S. Adve
66969014b2 Added special register class containing (for now) %fsr.
Fixed spilling of %fcc[0-3] which are part of %fsr.
Moved some machine-independent reg-class code to class TargetRegInfo
from SparcReg{Class,}Info.

llvm-svn: 6339
2003-05-27 00:02:22 +00:00
Vikram S. Adve
ba61ed4fc2 Bug fix: right shift for int divide-by-power-of-2 was incorrect for
negative values.  Need to add one to a negative value before right shift!

llvm-svn: 6334
2003-05-25 21:59:47 +00:00
Vikram S. Adve
5553ed755a Add support for compiling varargs functions.
llvm-svn: 6325
2003-05-25 15:59:47 +00:00
Misha Brukman
5205d6449e Cleaned up code layout, spacing, etc. for readability purposes and to be more
consistent with the style of LLVM's code base (and itself! it's inconsistent in
some places.)

No functional changes were made.

llvm-svn: 6265
2003-05-21 18:48:06 +00:00
Misha Brukman
581190c0a3 Namespacified vector' and cerr' to always use the `std::' namespace.
Eliminated `using' directives.

llvm-svn: 6261
2003-05-21 17:59:06 +00:00
Misha Brukman
80e11dcb30 Sparc instruction opcodes now all live under the `V9' namespace.
llvm-svn: 6249
2003-05-20 20:32:24 +00:00
Chris Lattner
cb8a4add15 IntegerRegSize is always 8 for sparc
llvm-svn: 5961
2003-04-26 19:44:35 +00:00
Chris Lattner
38d40c0ea9 Fix obvious type-o
llvm-svn: 5932
2003-04-25 05:23:10 +00:00
Chris Lattner
301e1307d2 Move sparc specific code into the Sparc backend
llvm-svn: 5317
2003-01-15 21:36:50 +00:00
Chris Lattner
7cc4353706 Use BuildMI more
llvm-svn: 5299
2003-01-15 19:23:34 +00:00
Chris Lattner
142533ab9a Fix bug found by regtests
llvm-svn: 5294
2003-01-15 18:11:11 +00:00
Chris Lattner
1caa00d195 Use BuildMI more, Create*Instruction less
llvm-svn: 5291
2003-01-15 17:47:49 +00:00
Chris Lattner
5af3bbf2fd * Elimiante a bunch of functions from InstrSelectionSupport.h, replacing users
of them with BUildMI calls instead.
* Fix def information in instructions generated by prologepilog inserter

llvm-svn: 5287
2003-01-15 00:03:28 +00:00
Chris Lattner
f34aa0986d * TargetData is no longer directly accessable from TM
* s/unsigned int/unsigned/

llvm-svn: 5175
2002-12-28 20:19:44 +00:00
Vikram S. Adve
fa70a60209 Bug fix: align size for dynamic allocas according to stack pointer
alignment restrictions.  This is incomplete for one case.

llvm-svn: 4397
2002-10-29 19:37:31 +00:00
Chris Lattner
51efa81c85 Fix minor bug
llvm-svn: 4355
2002-10-28 20:11:17 +00:00
Chris Lattner
e309cdbc95 Rename the redundant MachineOperand::getOperandType() to MachineOperand::getType()
llvm-svn: 4331
2002-10-28 04:45:29 +00:00
Misha Brukman
142795fd17 Changed MachineCodeForMethod' to MachineFunction'.
llvm-svn: 4301
2002-10-28 00:28:31 +00:00
Vikram S. Adve
3cb2d3379d Removed misleading const keyword.
llvm-svn: 4169
2002-10-14 16:32:24 +00:00
Vikram S. Adve
c78e160ede (1) Try to evaluate constant when multiplying 2 constants.
(2) Use intelligent multiply selection code for array allocas.
(3) Don't use cache padding for alloca'd stack slots!
(4) Bug fix in handling call arguments: was not copying sixth FP arg
    to int reg. when calling a function with no prototype.

llvm-svn: 4130
2002-10-13 00:18:57 +00:00
Vikram S. Adve
33b21ec523 Simplify Call translation slightly.
llvm-svn: 3963
2002-09-28 16:55:41 +00:00
Vikram S. Adve
940f3fa91b Overhaul integer conversions to match C++ ISO standard.
Don't allow direct FP-to-uint conversion (must be eliminated by preselection).
Address arithmetic for arrays is now entirely 64-bit so no sign-ext needed.

llvm-svn: 3961
2002-09-27 14:33:08 +00:00
Vikram S. Adve
d43591bbc5 Use ulong instead of uint for size expressions.
llvm-svn: 3744
2002-09-16 15:56:45 +00:00
Chris Lattner
cb973bf5ee - Change getelementptr instruction to use long indexes instead of uint
indexes for sequential types.

llvm-svn: 3683
2002-09-11 01:21:35 +00:00
Vikram S. Adve
1b1f2b2f5e Silly bug fix: Machine code vector could be empty for a no-op cast instruction,
e.g., cast double to double.

llvm-svn: 3633
2002-09-09 14:54:21 +00:00
Vikram S. Adve
94b41af2f3 -- Use size of pointer element type instead of pointer type in array offsets!
-- A few bug fixes in casting between floats and ints.
-- Use SRL reg, 0 instead of AND reg, 0xffffffff to clear high 32 bits.

llvm-svn: 3579
2002-09-05 18:32:13 +00:00
Chris Lattner
3ce5b343c5 - Renamed Type::isIntegral() to Type::isInteger()
- Added new method Type::isIntegral() that is the same as isInteger, but
    also accepts bool.

llvm-svn: 3574
2002-09-03 01:08:28 +00:00
Vikram S. Adve
96a4efb0a6 Sign-extend values used to index arrays (and Simplify
SetOperandsForMemInstr significantly).  Load and Store
no longer have any indices.  Eliminate spurious sign-extension
on a cast to float/double.

llvm-svn: 3498
2002-08-24 20:56:53 +00:00
Chris Lattner
9f18db8156 Eliminated the MemAccessInst class, folding contents into GEP class.
llvm-svn: 3488
2002-08-22 23:37:24 +00:00
Vikram S. Adve
39210a39ad Eliminate bool, boolreg and boolconst nonterminals, and just use
reg and Constant instead.

llvm-svn: 3441
2002-08-22 02:56:10 +00:00
Vikram S. Adve
5e22d4f669 Revise code generation for unary Not (boolean and bitwise), which is
no longer a separate instruction but is instead implemented with XOR.

llvm-svn: 3342
2002-08-15 14:17:37 +00:00
Vikram S. Adve
5f028d4787 Handle small unsigned results correctly by clearing high bits.
Bug fixes in casting to signed int values.

llvm-svn: 3297
2002-08-13 17:40:54 +00:00
Chris Lattner
8a4787495a * Removed extraneous #includes
* Fixed file headers to be consistent with the rest of LLVM
* Other minor fixes

llvm-svn: 3278
2002-08-09 20:08:06 +00:00
Vikram S. Adve
03a5ca5dcc Bug fix in SetOperandsForMemInstr: handle leading zeros correctly
when folding or not folding GEPs.

llvm-svn: 3245
2002-08-04 20:51:05 +00:00
Chris Lattner
6f818d501c Fix compilation problem. IsIndexZero doesn't exist, use IsZero instead.
llvm-svn: 3243
2002-08-03 20:57:38 +00:00
Vikram S. Adve
6316385f3e Simplified handling of array indexes in SetMemOperands_Internal.
llvm-svn: 3236
2002-08-03 13:48:21 +00:00
Vikram S. Adve
d5185db5e8 Add a missing case: converting float/double to unsigned integer types.
llvm-svn: 3188
2002-07-31 21:01:34 +00:00