From: Chris Lattner Date: Sat, 6 Nov 2010 07:48:45 +0000 (+0000) Subject: move the lcall/ljmp aliases to the .td file. X-Git-Tag: android-x86-6.0-r1~1003^2~420 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8caa290a77cc6e71457fcc6b6bfac907510dc0f4;p=android-x86%2Fexternal-llvm.git 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 --- diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 9b57827a777..e3c427f8ced 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -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(Operands[1])->isImm() && - static_cast(Operands[2])->isImm()) { - const char *NewOpName = StringSwitch(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 -> fstps . Without this, we'll default to fstpl due to // suffix searching. if (Name == "fstp" && Operands.size() == 2 && diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td index fd94d22bdf0..8b3c9bca50a 100644 --- a/lib/Target/X86/X86InstrInfo.td +++ b/lib/Target/X86/X86InstrInfo.td @@ -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)>;