move the lcall/ljmp aliases to the .td file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118332 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-11-06 07:48:45 +00:00
parent 02ff6ba6f6
commit 8caa290a77
2 changed files with 20 additions and 33 deletions

View File

@ -940,35 +940,6 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
NameLoc, NameLoc));
}
// jmp $42,$5 -> ljmp, similarly for call.
if ((Name.startswith("call") || Name.startswith("jmp")) &&
Operands.size() == 3 &&
static_cast<X86Operand*>(Operands[1])->isImm() &&
static_cast<X86Operand*>(Operands[2])->isImm()) {
const char *NewOpName = StringSwitch<const char *>(Name)
.Case("jmp", "ljmp")
.Case("jmpw", "ljmpw")
.Case("jmpl", "ljmpl")
.Case("jmpq", "ljmpq")
.Case("call", "lcall")
.Case("callw", "lcallw")
.Case("calll", "lcalll")
.Case("callq", "lcallq")
.Default(0);
if (NewOpName) {
delete Operands[0];
Operands[0] = X86Operand::CreateToken(NewOpName, NameLoc);
Name = NewOpName;
}
}
// lcall and ljmp -> lcalll and ljmpl
if ((Name == "lcall" || Name == "ljmp") && Operands.size() == 3) {
delete Operands[0];
Operands[0] = X86Operand::CreateToken(Name == "lcall" ? "lcalll" : "ljmpl",
NameLoc);
}
// fstp <mem> -> fstps <mem>. Without this, we'll default to fstpl due to
// suffix searching.
if (Name == "fstp" && Operands.size() == 2 &&

View File

@ -1370,16 +1370,32 @@ defm : IntegerCondCodeMnemonicAlias<"cmov", "q">;
// Assembler Instruction Aliases
//===----------------------------------------------------------------------===//
// movsd with no operands (as opposed to the SSE scalar move of a double) is an
// alias for movsl. (as in rep; movsd)
def : InstAlias<"movsd", (MOVSD)>;
// clr aliases.
def : InstAlias<"clrb $reg", (XOR8rr GR8 :$reg, GR8 :$reg)>;
def : InstAlias<"clrw $reg", (XOR16rr GR16:$reg, GR16:$reg)>;
def : InstAlias<"clrl $reg", (XOR32rr GR32:$reg, GR32:$reg)>;
def : InstAlias<"clrq $reg", (XOR64rr GR64:$reg, GR64:$reg)>;
// lcall and ljmp aliases. This seems to be an odd mapping in 64-bit mode, but
// this is compatible with what GAS does.
def : InstAlias<"lcall $seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>;
def : InstAlias<"ljmp $seg, $off", (FARJMP32i i32imm:$off, i16imm:$seg)>;
def : InstAlias<"lcall *$dst", (FARCALL32m opaque48mem:$dst)>;
def : InstAlias<"ljmp *$dst", (FARJMP32m opaque48mem:$dst)>;
// jmp and call aliases for lcall and ljmp. jmp $42,$5 -> ljmp
def : InstAlias<"call $seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>;
def : InstAlias<"jmp $seg, $off", (FARJMP32i i32imm:$off, i16imm:$seg)>;
def : InstAlias<"callw $seg, $off", (FARCALL16i i16imm:$off, i16imm:$seg)>;
def : InstAlias<"jmpw $seg, $off", (FARJMP16i i16imm:$off, i16imm:$seg)>;
def : InstAlias<"calll $seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>;
def : InstAlias<"jmpl $seg, $off", (FARJMP32i i32imm:$off, i16imm:$seg)>;
// movsd with no operands (as opposed to the SSE scalar move of a double) is an
// alias for movsl. (as in rep; movsd)
def : InstAlias<"movsd", (MOVSD)>;
// movsx aliases
def : InstAlias<"movsx $src, $dst", (MOVSX16rr8W GR16:$dst, GR8:$src)>;
def : InstAlias<"movsx $src, $dst", (MOVSX16rm8W GR16:$dst, i8mem:$src)>;