Add support for the bswap instruction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5114 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-12-23 23:46:00 +00:00
parent e500864619
commit facc9fb9ba
4 changed files with 14 additions and 8 deletions

View File

@ -238,7 +238,8 @@ void Emitter::emitInstruction(MachineInstr &MI) {
break;
case X86II::AddRegFrm:
MCE.emitByte(BaseOpcode + getX86RegNum(MI.getOperand(0).getReg()));
if (MI.getNumOperands() == 2) {
if (MI.getNumOperands() == 2 && (MI.getOperand(1).isImmediate() ||
MI.getOperand(1).getVRegValueOrNull())) {
unsigned Size = sizeOfPtr(Desc);
if (Value *V = MI.getOperand(1).getVRegValueOrNull()) {
assert(Size == 4 && "Don't know how to emit non-pointer values!");

View File

@ -196,20 +196,22 @@ void X86InstrInfo::print(const MachineInstr *MI, std::ostream &O,
// or it takes a register and an immediate of the same size as the register
// (move immediate f.e.). Note that this immediate value might be stored as
// an LLVM value, to represent, for example, loading the address of a global
// into a register.
// into a register. The initial register might be duplicated if this is a
// M_2_ADDR_REG instruction
//
assert(MI->getOperand(0).isRegister() &&
(MI->getNumOperands() == 1 ||
(MI->getNumOperands() == 2 &&
(MI->getOperand(1).getVRegValueOrNull() ||
MI->getOperand(1).isImmediate()))) &&
MI->getOperand(1).isImmediate() ||
MI->getOperand(1).isRegister()))) &&
"Illegal form for AddRegFrm instruction!");
unsigned Reg = MI->getOperand(0).getReg();
O << getName(MI->getOpCode()) << " ";
printOp(O, MI->getOperand(0), RI);
if (MI->getNumOperands() == 2) {
if (MI->getNumOperands() == 2 && !MI->getOperand(1).isRegister()) {
O << ", ";
printOp(O, MI->getOperand(1), RI);
}

View File

@ -196,20 +196,22 @@ void X86InstrInfo::print(const MachineInstr *MI, std::ostream &O,
// or it takes a register and an immediate of the same size as the register
// (move immediate f.e.). Note that this immediate value might be stored as
// an LLVM value, to represent, for example, loading the address of a global
// into a register.
// into a register. The initial register might be duplicated if this is a
// M_2_ADDR_REG instruction
//
assert(MI->getOperand(0).isRegister() &&
(MI->getNumOperands() == 1 ||
(MI->getNumOperands() == 2 &&
(MI->getOperand(1).getVRegValueOrNull() ||
MI->getOperand(1).isImmediate()))) &&
MI->getOperand(1).isImmediate() ||
MI->getOperand(1).isRegister()))) &&
"Illegal form for AddRegFrm instruction!");
unsigned Reg = MI->getOperand(0).getReg();
O << getName(MI->getOpCode()) << " ";
printOp(O, MI->getOperand(0), RI);
if (MI->getNumOperands() == 2) {
if (MI->getNumOperands() == 2 && !MI->getOperand(1).isRegister()) {
O << ", ";
printOp(O, MI->getOperand(1), RI);
}

View File

@ -238,7 +238,8 @@ void Emitter::emitInstruction(MachineInstr &MI) {
break;
case X86II::AddRegFrm:
MCE.emitByte(BaseOpcode + getX86RegNum(MI.getOperand(0).getReg()));
if (MI.getNumOperands() == 2) {
if (MI.getNumOperands() == 2 && (MI.getOperand(1).isImmediate() ||
MI.getOperand(1).getVRegValueOrNull())) {
unsigned Size = sizeOfPtr(Desc);
if (Value *V = MI.getOperand(1).getVRegValueOrNull()) {
assert(Size == 4 && "Don't know how to emit non-pointer values!");