diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-22 05:49:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-22 05:49:14 +0000 |
commit | 1eb1b68e3a5241591bfa18d4beb0e0cf13a48ef2 (patch) | |
tree | ea46f1ec87dc011eea1a6f8f9f0b50826a3d825d /lib | |
parent | bc57c6db4a3a1f5df4450d8dbb100e1eb6944c28 (diff) |
Fix an inconsistency in the x86 backend that led it to reject "calll foo" on
x86-32: 32-bit calls were named "call" not "calll". 64-bit calls were correctly
named "callq", so this only impacted x86-32.
This fixes rdar://8456370 - llvm-mc rejects 'calll'
This also exposes that mingw/64 is generating a 32-bit call instead of a 64-bit call,
I will file a bugzilla.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114534 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/AsmParser/X86AsmParser.cpp | 8 | ||||
-rw-r--r-- | lib/Target/X86/X86Instr64bit.td | 4 | ||||
-rw-r--r-- | lib/Target/X86/X86InstrInfo.td | 8 |
3 files changed, 15 insertions, 5 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp index 6826223fd8..bb6e05c286 100644 --- a/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1020,6 +1020,14 @@ ParseInstruction(StringRef Name, SMLoc NameLoc, NameLoc); } + // call foo is not ambiguous with callw. + if (Name == "call" && Operands.size() == 2) { + const char *NewName = Is64Bit ? "callq" : "calll"; + delete Operands[0]; + Operands[0] = X86Operand::CreateToken(NewName, NameLoc); + Name = NewName; + } + // movsd -> movsl (when no operands are specified). if (Name == "movsd" && Operands.size() == 1) { delete Operands[0]; diff --git a/lib/Target/X86/X86Instr64bit.td b/lib/Target/X86/X86Instr64bit.td index cbdd1ffbd6..1d3f6c8f08 100644 --- a/lib/Target/X86/X86Instr64bit.td +++ b/lib/Target/X86/X86Instr64bit.td @@ -148,10 +148,10 @@ let isCall = 1 in Requires<[In64BitMode, NotWin64]>; def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst, variable_ops), "call{q}\t{*}$dst", [(X86call GR64:$dst)]>, - Requires<[NotWin64]>; + Requires<[In64BitMode, NotWin64]>; def CALL64m : I<0xFF, MRM2m, (outs), (ins i64mem:$dst, variable_ops), "call{q}\t{*}$dst", [(X86call (loadi64 addr:$dst))]>, - Requires<[NotWin64]>; + Requires<[In64BitMode, NotWin64]>; def FARCALL64 : RI<0xFF, MRM3m, (outs), (ins opaque80mem:$dst), "lcall{q}\t{*}$dst", []>; diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td index fa1b8bac52..e8669070b8 100644 --- a/lib/Target/X86/X86InstrInfo.td +++ b/lib/Target/X86/X86InstrInfo.td @@ -690,11 +690,13 @@ let isCall = 1 in Uses = [ESP] in { def CALLpcrel32 : Ii32PCRel<0xE8, RawFrm, (outs), (ins i32imm_pcrel:$dst,variable_ops), - "call\t$dst", []>; + "call{l}\t$dst", []>, Requires<[In32BitMode]>; def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops), - "call\t{*}$dst", [(X86call GR32:$dst)]>; + "call{l}\t{*}$dst", [(X86call GR32:$dst)]>, + Requires<[In32BitMode]>; def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops), - "call\t{*}$dst", [(X86call (loadi32 addr:$dst))]>; + "call{l}\t{*}$dst", [(X86call (loadi32 addr:$dst))]>, + Requires<[In32BitMode]>; def FARCALL16i : Iseg16<0x9A, RawFrmImm16, (outs), (ins i16imm:$off, i16imm:$seg), |