mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[X86] Move 'int $3' -> 'int3' handling in the assembler to processInstruction.
Instead of handling before parsing, just fix it after parsing.
This commit is contained in:
parent
9d591b38c9
commit
8d1db4634f
@ -3305,18 +3305,6 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
return HadVerifyError;
|
||||
}
|
||||
|
||||
// Transforms "int $3" into "int3" as a size optimization. We can't write an
|
||||
// instalias with an immediate operand yet.
|
||||
if (Name == "int" && Operands.size() == 2) {
|
||||
X86Operand &Op1 = static_cast<X86Operand &>(*Operands[1]);
|
||||
if (Op1.isImm())
|
||||
if (auto *CE = dyn_cast<MCConstantExpr>(Op1.getImm()))
|
||||
if (CE->getValue() == 3) {
|
||||
Operands.erase(Operands.begin() + 1);
|
||||
static_cast<X86Operand &>(*Operands[0]).setTokenValue("int3");
|
||||
}
|
||||
}
|
||||
|
||||
// Transforms "xlat mem8" into "xlatb"
|
||||
if ((Name == "xlat" || Name == "xlatb") && Operands.size() == 2) {
|
||||
X86Operand &Op1 = static_cast<X86Operand &>(*Operands[1]);
|
||||
@ -3521,6 +3509,17 @@ bool X86AsmParser::processInstruction(MCInst &Inst, const OperandVector &Ops) {
|
||||
Inst = TmpInst;
|
||||
return true;
|
||||
}
|
||||
case X86::INT: {
|
||||
// Transforms "int $3" into "int3" as a size optimization. We can't write an
|
||||
// instalias with an immediate operand yet.
|
||||
if (!Inst.getOperand(0).isImm() || Inst.getOperand(0).getImm() != 3)
|
||||
return false;
|
||||
|
||||
MCInst TmpInst;
|
||||
TmpInst.setOpcode(X86::INT3);
|
||||
Inst = TmpInst;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user