summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.h
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-02-01 00:04:45 +0000
committerReid Kleckner <reid@kleckner.net>2014-02-01 00:04:45 +0000
commit314ef7bafda9f507540f3294359f20ba7bcf7a8d (patch)
tree12c1045bd69401d2014764c56bb55a6a717913f3 /clang/lib/CodeGen/CGCall.h
parentf5b76518c9c1afd2e08a59c11f3de8fb25540b58 (diff)
downloadbcm5719-llvm-314ef7bafda9f507540f3294359f20ba7bcf7a8d.tar.gz
bcm5719-llvm-314ef7bafda9f507540f3294359f20ba7bcf7a8d.zip
[ms-cxxabi] Use inalloca on win32 when passing non-trivial C++ objects
When a non-trivial parameter is present, clang now gathers up all the parameters that lack inreg and puts them into a packed struct. MSVC always aligns each parameter to 4 bytes and no more, so this is a pretty simple struct to lay out. On win64, non-trivial records are passed indirectly. Prior to this change, clang was incorrectly using byval on win64. I'm able to self-host a working clang with this change and additional LLVM patches. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2636 llvm-svn: 200597
Diffstat (limited to 'clang/lib/CodeGen/CGCall.h')
-rw-r--r--clang/lib/CodeGen/CGCall.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index 532cb59c62e..c51f06fdcd2 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -56,6 +56,8 @@ namespace CodeGen {
class CallArgList :
public SmallVector<CallArg, 16> {
public:
+ CallArgList() : StackBase(0), StackBaseMem(0) {}
+
struct Writeback {
/// The original argument. Note that the argument l-value
/// is potentially null.
@@ -113,6 +115,14 @@ namespace CodeGen {
return CleanupsToDeactivate;
}
+ void allocateArgumentMemory(CodeGenFunction &CGF);
+ llvm::Instruction *getStackBase() const { return StackBase; }
+ void freeArgumentMemory(CodeGenFunction &CGF) const;
+
+ /// \brief Returns if we're using an inalloca struct to pass arguments in
+ /// memory.
+ bool isUsingInAlloca() const { return StackBase; }
+
private:
SmallVector<Writeback, 1> Writebacks;
@@ -120,6 +130,17 @@ namespace CodeGen {
/// is used to cleanup objects that are owned by the callee once the call
/// occurs.
SmallVector<CallArgCleanup, 1> CleanupsToDeactivate;
+
+ /// The stacksave call. It dominates all of the argument evaluation.
+ llvm::CallInst *StackBase;
+
+ /// The alloca holding the stackbase. We need it to maintain SSA form.
+ llvm::AllocaInst *StackBaseMem;
+
+ /// The iterator pointing to the stack restore cleanup. We manually run and
+ /// deactivate this cleanup after the call in the unexceptional case because
+ /// it doesn't run in the normal order.
+ EHScopeStack::stable_iterator StackCleanup;
};
/// FunctionArgList - Type for representing both the decl and type
OpenPOWER on IntegriCloud