[cfe-commits] r92136 - in /cfe/trunk/lib/CodeGen: CGBuiltin.cpp CGCXX.cpp CGCall.h CGExpr.cpp CodeGenFunction.h

Anders Carlsson andersca at mac.com
Thu Dec 24 11:08:58 PST 2009


Author: andersca
Date: Thu Dec 24 13:08:58 2009
New Revision: 92136

URL: http://llvm.org/viewvc/llvm-project?rev=92136&view=rev
Log:
Add a ReturnValueSlot class. Change the argument order in EmitCall to match the other overload better.

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp
    cfe/trunk/lib/CodeGen/CGCXX.cpp
    cfe/trunk/lib/CodeGen/CGCall.h
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=92136&r1=92135&r2=92136&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Dec 24 13:08:58 2009
@@ -579,9 +579,9 @@
   // 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);

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=92136&r1=92135&r2=92136&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Thu Dec 24 13:08:58 2009
@@ -88,9 +88,8 @@
   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>();

Modified: cfe/trunk/lib/CodeGen/CGCall.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.h?rev=92136&r1=92135&r2=92136&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.h (original)
+++ cfe/trunk/lib/CodeGen/CGCall.h Thu Dec 24 13:08:58 2009
@@ -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 @@
         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
 

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=92136&r1=92135&r2=92136&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu Dec 24 13:08:58 2009
@@ -1551,7 +1551,7 @@
   }
 
   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 @@
   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) {

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=92136&r1=92135&r2=92136&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Dec 24 13:08:58 2009
@@ -1039,7 +1039,7 @@
                   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);





More information about the cfe-commits mailing list