[cfe-commits] r56039 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGObjCMac.cpp CodeGenFunction.h CodeGenModule.cpp CodeGenModule.h
Daniel Dunbar
daniel at zuster.org
Tue Sep 9 17:41:16 PDT 2008
Author: ddunbar
Date: Tue Sep 9 19:41:16 2008
New Revision: 56039
URL: http://llvm.org/viewvc/llvm-project?rev=56039&view=rev
Log:
Tweak CGCall functions again:
- Realized these functions will eventually need access to more data,
moved to CodeGenModule. Eventually they should probably live
together in some other helper class.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=56039&r1=56038&r2=56039&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Sep 9 19:41:16 2008
@@ -14,6 +14,7 @@
#include "CGCall.h"
#include "CodeGenFunction.h"
+#include "CodeGenModule.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
@@ -75,11 +76,11 @@
/***/
-bool CodeGenFunction::ReturnTypeUsesSret(QualType RetTy) {
- return hasAggregateLLVMType(RetTy);
+bool CodeGenModule::ReturnTypeUsesSret(QualType RetTy) {
+ return CodeGenFunction::hasAggregateLLVMType(RetTy);
}
-void CodeGenFunction::ConstructParamAttrList(const Decl *TargetDecl,
+void CodeGenModule::ConstructParamAttrList(const Decl *TargetDecl,
ArgTypeIterator begin,
ArgTypeIterator end,
ParamAttrListType &PAL) {
@@ -94,7 +95,7 @@
QualType ResTy = *begin;
unsigned Index = 1;
- if (CodeGenFunction::hasAggregateLLVMType(ResTy)) {
+ if (ReturnTypeUsesSret(ResTy)) {
PAL.push_back(llvm::ParamAttrsWithIndex::get(Index,
llvm::ParamAttr::StructRet));
++Index;
@@ -203,8 +204,9 @@
// FIXME: Provide TargetDecl so nounwind, noreturn, etc, etc get set.
CodeGen::ParamAttrListType ParamAttrList;
- ConstructParamAttrList(0, CallInfo.argtypes_begin(), CallInfo.argtypes_end(),
- ParamAttrList);
+ CGM.ConstructParamAttrList(0,
+ CallInfo.argtypes_begin(), CallInfo.argtypes_end(),
+ ParamAttrList);
CI->setParamAttrs(llvm::PAListPtr::get(ParamAttrList.begin(),
ParamAttrList.size()));
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=56039&r1=56038&r2=56039&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Sep 9 19:41:16 2008
@@ -531,7 +531,7 @@
llvm::Value *Fn =
ObjCTypes.getMessageSendFn(IsSuper,
- CGF.ReturnTypeUsesSret(ResultType),
+ CGM.ReturnTypeUsesSret(ResultType),
CGM.getTypes().ConvertType(ResultType));
return CGF.EmitCall(Fn, ResultType, ActualArgs);
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=56039&r1=56038&r2=56039&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Sep 9 19:41:16 2008
@@ -138,15 +138,6 @@
const FunctionArgList &Args);
void FinishFunction(SourceLocation EndLoc=SourceLocation());
- /// ReturnTypeUsesSret - Return true iff the given type uses 'sret'
- /// when used as a return type.
- static bool ReturnTypeUsesSret(QualType RetTy);
-
- static void ConstructParamAttrList(const Decl *TargetDecl,
- const ArgTypeIterator begin,
- const ArgTypeIterator end,
- ParamAttrListType &PAL);
-
/// EmitFunctionProlog - Emit the target specific LLVM code to load
/// the arguments for the given function. This is also responsible
/// for naming the LLVM function arguments.
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=56039&r1=56038&r2=56039&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Sep 9 19:41:16 2008
@@ -212,12 +212,12 @@
}
}
-static void SetFunctionParamAttrs(const CGFunctionInfo &Info, llvm::Function *F) {
+void CodeGenModule::SetFunctionParamAttrs(const CGFunctionInfo &Info,
+ llvm::Function *F) {
ParamAttrListType ParamAttrList;
- CodeGenFunction::ConstructParamAttrList(Info.getDecl(),
- Info.argtypes_begin(),
- Info.argtypes_end(),
- ParamAttrList);
+ ConstructParamAttrList(Info.getDecl(),
+ Info.argtypes_begin(), Info.argtypes_end(),
+ ParamAttrList);
F->setParamAttrs(llvm::PAListPtr::get(ParamAttrList.begin(),
ParamAttrList.size()));
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=56039&r1=56038&r2=56039&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Tue Sep 9 19:41:16 2008
@@ -19,6 +19,8 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
+#include "CGCall.h"
+
namespace llvm {
class Module;
class Constant;
@@ -215,6 +217,18 @@
void SetMethodAttributes(const ObjCMethodDecl *MD,
llvm::Function *F);
+ void SetFunctionParamAttrs(const CGFunctionInfo &Info,
+ llvm::Function *F);
+
+ /// ReturnTypeUsesSret - Return true iff the given type uses 'sret'
+ /// when used as a return type.
+ bool ReturnTypeUsesSret(QualType RetTy);
+
+ void ConstructParamAttrList(const Decl *TargetDecl,
+ const ArgTypeIterator begin,
+ const ArgTypeIterator end,
+ ParamAttrListType &PAL);
+
private:
/// SetFunctionAttributesForDefinition - Set function attributes
/// specific to a function definition.
More information about the cfe-commits
mailing list