mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Clean up code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12615 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
79ee87b1bb
commit
bee8a094af
@ -1674,18 +1674,11 @@ void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB,
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(Op0)) {
|
||||
if (CI->isNullValue()) {
|
||||
unsigned op1Reg = getReg(Op1, MBB, IP);
|
||||
switch (Class) {
|
||||
default: assert(0 && "Unknown class for this function!");
|
||||
case cByte:
|
||||
BuildMI(*MBB, IP, X86::NEG8r, 1, DestReg).addReg(op1Reg);
|
||||
return;
|
||||
case cShort:
|
||||
BuildMI(*MBB, IP, X86::NEG16r, 1, DestReg).addReg(op1Reg);
|
||||
return;
|
||||
case cInt:
|
||||
BuildMI(*MBB, IP, X86::NEG32r, 1, DestReg).addReg(op1Reg);
|
||||
return;
|
||||
}
|
||||
static unsigned const NEGTab[] = {
|
||||
X86::NEG8r, X86::NEG16r, X86::NEG32r
|
||||
};
|
||||
BuildMI(*MBB, IP, NEGTab[Class], 1, DestReg).addReg(op1Reg);
|
||||
return;
|
||||
}
|
||||
} else if (ConstantFP *CFP = dyn_cast<ConstantFP>(Op0))
|
||||
if (CFP->isExactlyValue(-0.0)) {
|
||||
@ -1716,8 +1709,8 @@ void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB,
|
||||
|
||||
// add X, 1 -> inc X
|
||||
if (OperatorClass == 0 && Op1C->equalsInt(1)) {
|
||||
static unsigned const DECTab[] = { X86::INC8r, X86::INC16r, X86::INC32r };
|
||||
BuildMI(*MBB, IP, DECTab[Class], 1, DestReg).addReg(Op0r);
|
||||
static unsigned const INCTab[] = { X86::INC8r, X86::INC16r, X86::INC32r };
|
||||
BuildMI(*MBB, IP, INCTab[Class], 1, DestReg).addReg(Op0r);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1674,18 +1674,11 @@ void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB,
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(Op0)) {
|
||||
if (CI->isNullValue()) {
|
||||
unsigned op1Reg = getReg(Op1, MBB, IP);
|
||||
switch (Class) {
|
||||
default: assert(0 && "Unknown class for this function!");
|
||||
case cByte:
|
||||
BuildMI(*MBB, IP, X86::NEG8r, 1, DestReg).addReg(op1Reg);
|
||||
return;
|
||||
case cShort:
|
||||
BuildMI(*MBB, IP, X86::NEG16r, 1, DestReg).addReg(op1Reg);
|
||||
return;
|
||||
case cInt:
|
||||
BuildMI(*MBB, IP, X86::NEG32r, 1, DestReg).addReg(op1Reg);
|
||||
return;
|
||||
}
|
||||
static unsigned const NEGTab[] = {
|
||||
X86::NEG8r, X86::NEG16r, X86::NEG32r
|
||||
};
|
||||
BuildMI(*MBB, IP, NEGTab[Class], 1, DestReg).addReg(op1Reg);
|
||||
return;
|
||||
}
|
||||
} else if (ConstantFP *CFP = dyn_cast<ConstantFP>(Op0))
|
||||
if (CFP->isExactlyValue(-0.0)) {
|
||||
@ -1716,8 +1709,8 @@ void ISel::emitSimpleBinaryOperation(MachineBasicBlock *MBB,
|
||||
|
||||
// add X, 1 -> inc X
|
||||
if (OperatorClass == 0 && Op1C->equalsInt(1)) {
|
||||
static unsigned const DECTab[] = { X86::INC8r, X86::INC16r, X86::INC32r };
|
||||
BuildMI(*MBB, IP, DECTab[Class], 1, DestReg).addReg(Op0r);
|
||||
static unsigned const INCTab[] = { X86::INC8r, X86::INC16r, X86::INC32r };
|
||||
BuildMI(*MBB, IP, INCTab[Class], 1, DestReg).addReg(Op0r);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user