]> granicus.if.org Git - clang/commitdiff
Add a ReturnValueSlot class. Change the argument order in EmitCall to match the other...
authorAnders Carlsson <andersca@mac.com>
Thu, 24 Dec 2009 19:08:58 +0000 (19:08 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 24 Dec 2009 19:08:58 +0000 (19:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92136 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CGCXX.cpp
lib/CodeGen/CGCall.h
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h

index 98dd9ec991066c755c8c593d88e5e846b1449922..2fe11a1d07fd98f42afaaf75f0516d1d9c2218ec 100644 (file)
@@ -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);
index edc899eb57f55b05945d7cfbe7c79e92750a0127..5b13ff831a4869ace342fc3f35b7eda889b61dae 100644 (file)
@@ -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>();
index ebf801dcaad1e9f3b5f8dfebb7933bf57667eef0..041d1df0b03d071b6460c2a6e82b6dd084ff6d84 100644 (file)
@@ -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
 
index 66831c293d66e96a67eb75682bba9a9b641825e9..cda348fefb7c7331e9e064684f9a58984d673381 100644 (file)
@@ -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) {
index c2e59c01eb2842afb71a713adfa1e3b268c222e1..d28dd47ea57673148f72093cd8f587c100178e90 100644 (file)
@@ -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);