aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Sparc/SparcV8ISelSimple.cpp
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2004-03-04 04:37:45 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2004-03-04 04:37:45 +0000
commit775158d62abbe2548875b46dcbecf8b234930dd4 (patch)
tree1705a84d46e98ed7eebde63ea261c22f537ced28 /lib/Target/Sparc/SparcV8ISelSimple.cpp
parente7173b7e8ec1ac1bc4843dad84b0d84c3ad3e720 (diff)
downloadexternal_llvm-775158d62abbe2548875b46dcbecf8b234930dd4.zip
external_llvm-775158d62abbe2548875b46dcbecf8b234930dd4.tar.gz
external_llvm-775158d62abbe2548875b46dcbecf8b234930dd4.tar.bz2
Subtract instructions; minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc/SparcV8ISelSimple.cpp')
-rw-r--r--lib/Target/Sparc/SparcV8ISelSimple.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp
index 95ff31e..5c145cb 100644
--- a/lib/Target/Sparc/SparcV8ISelSimple.cpp
+++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp
@@ -165,9 +165,8 @@ static TypeClass getClass (const Type *T) {
void V8ISel::copyConstantToRegister(MachineBasicBlock *MBB,
MachineBasicBlock::iterator IP,
Constant *C, unsigned R) {
- if (C->getType()->isIntegral()) {
+ if (ConstantInt *CI = dyn_cast<ConstantInt> (C)) {
unsigned Class = getClass(C->getType());
- ConstantInt *CI = cast<ConstantInt>(C);
switch (Class) {
case cByte:
BuildMI (*MBB, IP, V8::ORri, 2, R).addReg (V8::G0).addImm ((uint8_t) CI->getRawValue ());
@@ -185,12 +184,12 @@ void V8ISel::copyConstantToRegister(MachineBasicBlock *MBB,
return;
}
default:
- assert (0 && "Can't move this kind of constant");
+ assert (0 && "Can't copy this kind of constant into register yet");
return;
}
}
- assert (0 && "Can't copy constants into registers yet");
+ assert (0 && "Can't copy this kind of constant into register yet");
}
bool V8ISel::runOnFunction(Function &Fn) {
@@ -246,6 +245,9 @@ void V8ISel::visitBinaryOperator (BinaryOperator &I) {
case Instruction::Add:
BuildMI (BB, V8::ADDrr, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
break;
+ case Instruction::Sub:
+ BuildMI (BB, V8::SUBrr, 2, ResultReg).addReg (Op0Reg).addReg (Op1Reg);
+ break;
default:
visitInstruction (I);
return;