aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCGNU.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-09-10 04:01:49 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-09-10 04:01:49 +0000
commit45c25ba11cbf8c9a461def5b03f6ee9481e06769 (patch)
tree2be394b3b5a29a887130e782ffc0fcac8a1f48cd /lib/CodeGen/CGObjCGNU.cpp
parent2c8e0f32b9c33686be23c70add0b97490903de9f (diff)
Move FunctionType conversion into CGCall.cpp:
- Added CodeGenTypes::GetFunctionType, taking a CGFunctionInfo. - Updated Obj-C runtimes to use this instead of rolling the llvm::FunctionType by hand. - Killed CodeGenTypes::{ConvertReturnType, DecodeArgumentTypes}. Add ABIArgInfo class to encapsulate ABI decision of how to lower types to LLVM. - Will move to target sometime soon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCGNU.cpp')
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp29
1 files changed, 2 insertions, 27 deletions
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index 2641d9d8bd..2c030e9f5a 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -921,40 +921,15 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
}
llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD) {
- const llvm::Type *ReturnTy =
- CGM.getTypes().ConvertReturnType(OMD->getResultType());
const ObjCCategoryImplDecl *OCD =
dyn_cast<ObjCCategoryImplDecl>(OMD->getMethodContext());
const std::string &CategoryName = OCD ? OCD->getName() : "";
- const llvm::Type *SelfTy = llvm::PointerType::getUnqual(llvm::Type::Int32Ty);
const std::string &ClassName = OMD->getClassInterface()->getName();
const std::string &MethodName = OMD->getSelector().getName();
- unsigned ArgC = OMD->param_size();
bool isClassMethod = !OMD->isInstance();
- bool isVarArg = OMD->isVariadic();
-
- llvm::SmallVector<const llvm::Type *, 16> ArgTy;
- for (unsigned i=0 ; i<OMD->param_size() ; i++) {
- const llvm::Type *Ty =
- CGM.getTypes().ConvertType(OMD->getParamDecl(i)->getType());
- if (Ty->isFirstClassType())
- ArgTy.push_back(Ty);
- else
- ArgTy.push_back(llvm::PointerType::getUnqual(Ty));
- }
-
- std::vector<const llvm::Type*> Args;
- if (!ReturnTy->isSingleValueType() && ReturnTy != llvm::Type::VoidTy) {
- Args.push_back(llvm::PointerType::getUnqual(ReturnTy));
- ReturnTy = llvm::Type::VoidTy;
- }
- Args.push_back(SelfTy);
- Args.push_back(SelectorTy);
- Args.insert(Args.end(), ArgTy.begin(), ArgTy.begin()+ArgC);
- llvm::FunctionType *MethodTy = llvm::FunctionType::get(ReturnTy,
- Args,
- isVarArg);
+ const llvm::FunctionType *MethodTy =
+ CGM.getTypes().GetFunctionType(CGFunctionInfo(OMD, CGM.getContext()));
std::string FunctionName = SymbolNameForMethod(ClassName, CategoryName,
MethodName, isClassMethod);