mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-04 09:37:20 +00:00
fix rdar://8735979 - "int 3" doesn't match to "int3". Unfortunately,
InstAlias doesn't allow matching immediate operands, so we have to write C++ code to do this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129223 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
008c93e884
commit
15f8951799
@ -929,6 +929,18 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
|
||||
}
|
||||
}
|
||||
|
||||
// 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() && isa<MCConstantExpr>(Op1->getImm()) &&
|
||||
cast<MCConstantExpr>(Op1->getImm())->getValue() == 3) {
|
||||
delete Operands[1];
|
||||
Operands.erase(Operands.begin() + 1);
|
||||
static_cast<X86Operand*>(Operands[0])->setTokenValue("int3");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -34,9 +34,16 @@ let Uses = [EFLAGS] in
|
||||
def INTO : I<0xce, RawFrm, (outs), (ins), "into", []>;
|
||||
def INT3 : I<0xcc, RawFrm, (outs), (ins), "int3",
|
||||
[(int_x86_int (i8 3))]>;
|
||||
|
||||
// The long form of "int $3" turns into int3 as a size optimization.
|
||||
// FIXME: This doesn't work because InstAlias can't match immediate constants.
|
||||
//def : InstAlias<"int\t$3", (INT3)>;
|
||||
|
||||
|
||||
def INT : Ii8<0xcd, RawFrm, (outs), (ins i8imm:$trap), "int\t$trap",
|
||||
[(int_x86_int imm:$trap)]>;
|
||||
|
||||
|
||||
def SYSCALL : I<0x05, RawFrm, (outs), (ins), "syscall", []>, TB;
|
||||
def SYSRETL : I<0x07, RawFrm, (outs), (ins), "sysretl", []>, TB;
|
||||
def SYSRETQ :RI<0x07, RawFrm, (outs), (ins), "sysretq", []>, TB,
|
||||
|
@ -190,6 +190,10 @@ fadd %st(7)
|
||||
// CHECK: int3
|
||||
INT3
|
||||
|
||||
// rdar://8735979 - int $3 -> int3
|
||||
// CHECK: int3
|
||||
int $3
|
||||
|
||||
|
||||
// Allow scale factor without index register.
|
||||
// CHECK: movaps %xmm3, (%esi)
|
||||
|
Loading…
x
Reference in New Issue
Block a user