diff options
author | Tilmann Scheller <tilmann.scheller@googlemail.com> | 2011-03-02 19:36:23 +0000 |
---|---|---|
committer | Tilmann Scheller <tilmann.scheller@googlemail.com> | 2011-03-02 19:36:23 +0000 |
commit | 454464b491307a84ba8bc4aa8a05633984d8e2f7 (patch) | |
tree | a1a4d16370d306d62580da2f540671ed077a22b8 /clang/lib/CodeGen/TargetInfo.cpp | |
parent | a3769f802179ff364e97050c3c4675ee2a503cb3 (diff) | |
download | bcm5719-llvm-454464b491307a84ba8bc4aa8a05633984d8e2f7.tar.gz bcm5719-llvm-454464b491307a84ba8bc4aa8a05633984d8e2f7.zip |
Add CC_Win64ThisCall and set it in the necessary places.
llvm-svn: 126863
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 2ffc840b9f9..14a6e0a5894 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -942,6 +942,26 @@ public: return false; } + + void SetTargetAttributes(const Decl *D, + llvm::GlobalValue *GV, + CodeGen::CodeGenModule &M) const { + if (M.getContext().Target.isWin64()) { + if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { + const CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(FD); + + if ((M && M->isInstance()) + || dyn_cast<CXXConstructorDecl>(FD) + || dyn_cast<CXXDestructorDecl>(FD)) { + // When using the MSVC Win64 ABI, methods/constructors/destructors + // use the Win64 thiscall calling convention. + llvm::Function *F = cast<llvm::Function>(GV); + F->setCallingConv(llvm::CallingConv::Win64_ThisCall); + } + } + } + } + }; } |