summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXXABI.h
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-03-16 00:11:09 +0000
committerManman Ren <mren@apple.com>2013-03-16 00:11:09 +0000
commit58dd990c112ada1d37813f95fe4a929dee46a476 (patch)
tree324603211c02df299940f38a52e59c6f269f0631 /clang/lib/CodeGen/CGCXXABI.h
parent63bff2eb395671debc517b0d1599f99324f4e124 (diff)
downloadbcm5719-llvm-58dd990c112ada1d37813f95fe4a929dee46a476.tar.gz
bcm5719-llvm-58dd990c112ada1d37813f95fe4a929dee46a476.zip
Exploit this-return of a callsite in a this-return function.
For constructors/desctructors that return 'this', if there exists a callsite that returns 'this' and is immediately before the return instruction, make sure we are using the return value from the callsite. We don't need to keep 'this' alive through the callsite. It also enables optimizations in the backend, such as tail call optimization. rdar://12818789 llvm-svn: 177211
Diffstat (limited to 'clang/lib/CodeGen/CGCXXABI.h')
-rw-r--r--clang/lib/CodeGen/CGCXXABI.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCXXABI.h b/clang/lib/CodeGen/CGCXXABI.h
index cdc87b70e55..d0384ecc128 100644
--- a/clang/lib/CodeGen/CGCXXABI.h
+++ b/clang/lib/CodeGen/CGCXXABI.h
@@ -91,6 +91,10 @@ public:
return *MangleCtx;
}
+ /// Returns true if the given instance method is one of the
+ /// kinds that the ABI says returns 'this'.
+ virtual bool HasThisReturn(GlobalDecl GD) const { return false; }
+
/// Find the LLVM type used to represent the given member pointer
/// type.
virtual llvm::Type *
@@ -209,7 +213,8 @@ public:
/// Emit the ABI-specific prolog for the function.
virtual void EmitInstanceFunctionProlog(CodeGenFunction &CGF) = 0;
- virtual void EmitConstructorCall(CodeGenFunction &CGF,
+ /// Emit the constructor call. Return the function that is called.
+ virtual llvm::Value *EmitConstructorCall(CodeGenFunction &CGF,
const CXXConstructorDecl *D,
CXXCtorType Type, bool ForVirtualBase,
bool Delegating,
OpenPOWER on IntegriCloud