diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-24 19:08:58 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-24 19:08:58 +0000 |
commit | 31777a2540879051a3c643b90e02c3fd3d315243 (patch) | |
tree | 0243ab951ccd6f6c72277b0d5759d332ea6cdb6e /lib | |
parent | 5132655e4296b780672e9a96b46a740135073534 (diff) |
Add a ReturnValueSlot class. Change the argument order in EmitCall to match the other overload better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92136 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGBuiltin.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 5 | ||||
-rw-r--r-- | lib/CodeGen/CGCall.h | 18 | ||||
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 2 |
5 files changed, 25 insertions, 10 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 98dd9ec991..2fe11a1d07 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -579,9 +579,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, // that function. if (getContext().BuiltinInfo.isLibFunction(BuiltinID) || getContext().BuiltinInfo.isPredefinedLibFunction(BuiltinID)) - return EmitCall(CGM.getBuiltinLibFunction(FD, BuiltinID), - E->getCallee()->getType(), E->arg_begin(), - E->arg_end()); + return EmitCall(E->getCallee()->getType(), + CGM.getBuiltinLibFunction(FD, BuiltinID), + E->arg_begin(), E->arg_end()); // See if we have a target specific intrinsic. const char *Name = getContext().BuiltinInfo.GetName(BuiltinID); diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index edc899eb57..5b13ff831a 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -88,9 +88,8 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) { if (MD->isStatic()) { // The method is static, emit it as we would a regular call. llvm::Value *Callee = CGM.GetAddrOfFunction(MD); - return EmitCall(Callee, getContext().getPointerType(MD->getType()), - CE->arg_begin(), CE->arg_end(), 0); - + return EmitCall(getContext().getPointerType(MD->getType()), Callee, + CE->arg_begin(), CE->arg_end()); } const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>(); diff --git a/lib/CodeGen/CGCall.h b/lib/CodeGen/CGCall.h index ebf801dcaa..041d1df0b0 100644 --- a/lib/CodeGen/CGCall.h +++ b/lib/CodeGen/CGCall.h @@ -15,7 +15,8 @@ #ifndef CLANG_CODEGEN_CGCALL_H #define CLANG_CODEGEN_CGCALL_H -#include <llvm/ADT/FoldingSet.h> +#include "llvm/ADT/FoldingSet.h" +#include "llvm/Value.h" #include "clang/AST/Type.h" #include "CGValue.h" @@ -123,6 +124,21 @@ namespace CodeGen { begin->Profile(ID); } }; + + class ReturnValueSlot { + llvm::PointerIntPair<llvm::Value *, 1, bool> Value; + + public: + ReturnValueSlot() {} + ReturnValueSlot(llvm::Value *Value, bool IsVolatile) + : Value(Value, IsVolatile) {} + + bool isNull() const { return !getValue(); } + + bool isVolatile() const { return Value.getInt(); } + llvm::Value *getValue() const { return Value.getPointer(); } + }; + } // end namespace CodeGen } // end namespace clang diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 66831c293d..cda348fefb 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1551,7 +1551,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) { } llvm::Value *Callee = EmitScalarExpr(E->getCallee()); - return EmitCall(Callee, E->getCallee()->getType(), + return EmitCall(E->getCallee()->getType(), Callee, E->arg_begin(), E->arg_end(), TargetDecl); } @@ -1712,7 +1712,7 @@ LValue CodeGenFunction::EmitPointerToDataMemberLValue(const FieldDecl *Field) { return LValue::MakeAddr(V, MakeQualifiers(Field->getType())); } -RValue CodeGenFunction::EmitCall(llvm::Value *Callee, QualType CalleeType, +RValue CodeGenFunction::EmitCall(QualType CalleeType, llvm::Value *Callee, CallExpr::const_arg_iterator ArgBeg, CallExpr::const_arg_iterator ArgEnd, const Decl *TargetDecl) { diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index c2e59c01eb..d28dd47ea5 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -1039,7 +1039,7 @@ public: const CallArgList &Args, const Decl *TargetDecl = 0); - RValue EmitCall(llvm::Value *Callee, QualType FnType, + RValue EmitCall(QualType FnType, llvm::Value *Callee, CallExpr::const_arg_iterator ArgBeg, CallExpr::const_arg_iterator ArgEnd, const Decl *TargetDecl = 0); |