diff options
author | Tilmann Scheller <tilmann.scheller@googlemail.com> | 2011-03-02 19:29:22 +0000 |
---|---|---|
committer | Tilmann Scheller <tilmann.scheller@googlemail.com> | 2011-03-02 19:29:22 +0000 |
commit | f1cc70ca9356b23369b689e17b89c5596d4c913f (patch) | |
tree | d6b4920eec7c5fcaf760fc47949faa3eba18970e | |
parent | 0dddbc3d1be415afafffff8c95b8e1d7a1631106 (diff) | |
download | external_llvm-f1cc70ca9356b23369b689e17b89c5596d4c913f.zip external_llvm-f1cc70ca9356b23369b689e17b89c5596d4c913f.tar.gz external_llvm-f1cc70ca9356b23369b689e17b89c5596d4c913f.tar.bz2 |
Add Win64 thiscall calling convention.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126862 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CallingConv.h | 5 | ||||
-rw-r--r-- | lib/AsmParser/LLLexer.cpp | 1 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 2 | ||||
-rw-r--r-- | lib/AsmParser/LLToken.h | 1 | ||||
-rw-r--r-- | lib/Target/X86/X86CallingConv.td | 7 | ||||
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 3 |
6 files changed, 18 insertions, 1 deletions
diff --git a/include/llvm/CallingConv.h b/include/llvm/CallingConv.h index 4c5ee62..49dcbb8 100644 --- a/include/llvm/CallingConv.h +++ b/include/llvm/CallingConv.h @@ -94,7 +94,10 @@ namespace CallingConv { /// MBLAZE_INTR - Calling convention used for MBlaze interrupt support /// routines (i.e. GCC's save_volatiles attribute). - MBLAZE_SVOL = 74 + MBLAZE_SVOL = 74, + + /// Win64_ThisCall - Calling convention used for method calls on Win64. + Win64_ThisCall = 75 }; } // End CallingConv namespace diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index 857fa1e..c8bbd05 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -549,6 +549,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(msp430_intrcc); KEYWORD(ptx_kernel); KEYWORD(ptx_device); + KEYWORD(win64_thiscallcc); KEYWORD(cc); KEYWORD(c); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index fc10c04..ed97b40 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -1087,6 +1087,7 @@ bool LLParser::ParseOptionalVisibility(unsigned &Res) { /// ::= 'msp430_intrcc' /// ::= 'ptx_kernel' /// ::= 'ptx_device' +/// ::= 'win64_thiscallcc' /// ::= 'cc' UINT /// bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) { @@ -1104,6 +1105,7 @@ bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) { case lltok::kw_msp430_intrcc: CC = CallingConv::MSP430_INTR; break; case lltok::kw_ptx_kernel: CC = CallingConv::PTX_Kernel; break; case lltok::kw_ptx_device: CC = CallingConv::PTX_Device; break; + case lltok::kw_win64_thiscallcc:CC = CallingConv::Win64_ThisCall; break; case lltok::kw_cc: { unsigned ArbitraryCC; Lex.Lex(); diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index 576da19..7f36637 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -74,6 +74,7 @@ namespace lltok { kw_arm_apcscc, kw_arm_aapcscc, kw_arm_aapcs_vfpcc, kw_msp430_intrcc, kw_ptx_kernel, kw_ptx_device, + kw_win64_thiscallcc, kw_signext, kw_zeroext, diff --git a/lib/Target/X86/X86CallingConv.td b/lib/Target/X86/X86CallingConv.td index a44fb69..ad71d8f 100644 --- a/lib/Target/X86/X86CallingConv.td +++ b/lib/Target/X86/X86CallingConv.td @@ -215,6 +215,13 @@ def CC_X86_Win64_C : CallingConv<[ // The first 4 integer arguments are passed in integer registers. CCIfType<[i32], CCAssignToRegWithShadow<[ECX , EDX , R8D , R9D ], [XMM0, XMM1, XMM2, XMM3]>>, + + // Do not pass the sret argument in RCX, the Win64 thiscall calling + // convention requires "this" to be passed in RCX. + CCIfCC<"CallingConv::Win64_ThisCall", + CCIfSRet<CCIfType<[i64], CCAssignToRegWithShadow<[RDX , R8 , R9 ], + [XMM1, XMM2, XMM3]>>>>, + CCIfType<[i64], CCAssignToRegWithShadow<[RCX , RDX , R8 , R9 ], [XMM0, XMM1, XMM2, XMM3]>>, diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index ff6084d..62c65df 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -1586,6 +1586,7 @@ void AssemblyWriter::printFunction(const Function *F) { case CallingConv::MSP430_INTR: Out << "msp430_intrcc "; break; case CallingConv::PTX_Kernel: Out << "ptx_kernel"; break; case CallingConv::PTX_Device: Out << "ptx_device"; break; + case CallingConv::Win64_ThisCall:Out << "win64_thiscallcc "; break; default: Out << "cc" << F->getCallingConv() << " "; break; } @@ -1858,6 +1859,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { case CallingConv::MSP430_INTR: Out << " msp430_intrcc "; break; case CallingConv::PTX_Kernel: Out << " ptx_kernel"; break; case CallingConv::PTX_Device: Out << " ptx_device"; break; + case CallingConv::Win64_ThisCall:Out << " win64_thiscallcc "; break; default: Out << " cc" << CI->getCallingConv(); break; } @@ -1914,6 +1916,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) { case CallingConv::MSP430_INTR: Out << " msp430_intrcc "; break; case CallingConv::PTX_Kernel: Out << " ptx_kernel"; break; case CallingConv::PTX_Device: Out << " ptx_device"; break; + case CallingConv::Win64_ThisCall:Out << " win64_thiscallcc "; break; default: Out << " cc" << II->getCallingConv(); break; } |