forked from OSchip/llvm-project
NeXT: Update to use CreateRuntimeFunction for the routines it imports.
llvm-svn: 56902
This commit is contained in:
parent
920f6d588e
commit
fbe68a84f8
|
@ -2208,47 +2208,40 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
|
||||||
std::vector<const llvm::Type*> Params;
|
std::vector<const llvm::Type*> Params;
|
||||||
Params.push_back(ObjectPtrTy);
|
Params.push_back(ObjectPtrTy);
|
||||||
Params.push_back(SelectorPtrTy);
|
Params.push_back(SelectorPtrTy);
|
||||||
MessageSendFn = llvm::Function::Create(llvm::FunctionType::get(ObjectPtrTy,
|
MessageSendFn =
|
||||||
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
|
||||||
Params,
|
Params,
|
||||||
true),
|
true),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_msgSend");
|
||||||
"objc_msgSend",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(Int8PtrTy);
|
Params.push_back(Int8PtrTy);
|
||||||
Params.push_back(ObjectPtrTy);
|
Params.push_back(ObjectPtrTy);
|
||||||
Params.push_back(SelectorPtrTy);
|
Params.push_back(SelectorPtrTy);
|
||||||
MessageSendStretFn =
|
MessageSendStretFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::VoidTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
|
||||||
Params,
|
Params,
|
||||||
true),
|
true),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_msgSend_stret");
|
||||||
"objc_msgSend_stret",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(SuperPtrTy);
|
Params.push_back(SuperPtrTy);
|
||||||
Params.push_back(SelectorPtrTy);
|
Params.push_back(SelectorPtrTy);
|
||||||
MessageSendSuperFn =
|
MessageSendSuperFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(ObjectPtrTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
|
||||||
Params,
|
Params,
|
||||||
true),
|
true),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_msgSendSuper");
|
||||||
"objc_msgSendSuper",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(Int8PtrTy);
|
Params.push_back(Int8PtrTy);
|
||||||
Params.push_back(SuperPtrTy);
|
Params.push_back(SuperPtrTy);
|
||||||
Params.push_back(SelectorPtrTy);
|
Params.push_back(SelectorPtrTy);
|
||||||
MessageSendSuperStretFn =
|
MessageSendSuperStretFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::VoidTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
|
||||||
Params,
|
Params,
|
||||||
true),
|
true),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_msgSendSuper_stret");
|
||||||
"objc_msgSendSuper_stret",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
// Property manipulation functions.
|
// Property manipulation functions.
|
||||||
|
|
||||||
|
@ -2258,12 +2251,10 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
|
||||||
Params.push_back(LongTy);
|
Params.push_back(LongTy);
|
||||||
Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
|
Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
|
||||||
GetPropertyFn =
|
GetPropertyFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(ObjectPtrTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_getProperty");
|
||||||
"objc_getProperty",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(ObjectPtrTy);
|
Params.push_back(ObjectPtrTy);
|
||||||
|
@ -2273,24 +2264,20 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
|
||||||
Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
|
Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
|
||||||
Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
|
Params.push_back(Types.ConvertTypeForMem(Ctx.BoolTy));
|
||||||
SetPropertyFn =
|
SetPropertyFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::VoidTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_setProperty");
|
||||||
"objc_setProperty",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
// Enumeration mutation.
|
// Enumeration mutation.
|
||||||
|
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(ObjectPtrTy);
|
Params.push_back(ObjectPtrTy);
|
||||||
EnumerationMutationFn =
|
EnumerationMutationFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::VoidTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_enumerationMutation");
|
||||||
"objc_enumerationMutation",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
// FIXME: This is the size of the setjmp buffer and should be
|
// FIXME: This is the size of the setjmp buffer and should be
|
||||||
// target specific. 18 is what's used on 32-bit X86.
|
// target specific. 18 is what's used on 32-bit X86.
|
||||||
|
@ -2310,58 +2297,45 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(ObjectPtrTy);
|
Params.push_back(ObjectPtrTy);
|
||||||
ExceptionThrowFn =
|
ExceptionThrowFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::VoidTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_exception_throw");
|
||||||
"objc_exception_throw",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(llvm::PointerType::getUnqual(ExceptionDataTy));
|
Params.push_back(llvm::PointerType::getUnqual(ExceptionDataTy));
|
||||||
ExceptionTryEnterFn =
|
ExceptionTryEnterFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::VoidTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_exception_try_enter");
|
||||||
"objc_exception_try_enter",
|
|
||||||
&CGM.getModule());
|
|
||||||
ExceptionTryExitFn =
|
ExceptionTryExitFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::VoidTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_exception_try_exit");
|
||||||
"objc_exception_try_exit",
|
|
||||||
&CGM.getModule());
|
|
||||||
ExceptionExtractFn =
|
ExceptionExtractFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(ObjectPtrTy,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_exception_extract");
|
||||||
"objc_exception_extract",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(ClassPtrTy);
|
Params.push_back(ClassPtrTy);
|
||||||
Params.push_back(ObjectPtrTy);
|
Params.push_back(ObjectPtrTy);
|
||||||
ExceptionMatchFn =
|
ExceptionMatchFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::Int32Ty,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::Int32Ty,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"objc_exception_match");
|
||||||
"objc_exception_match",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
Params.clear();
|
Params.clear();
|
||||||
Params.push_back(llvm::PointerType::getUnqual(llvm::Type::Int32Ty));
|
Params.push_back(llvm::PointerType::getUnqual(llvm::Type::Int32Ty));
|
||||||
SetJmpFn =
|
SetJmpFn =
|
||||||
llvm::Function::Create(llvm::FunctionType::get(llvm::Type::Int32Ty,
|
CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::Int32Ty,
|
||||||
Params,
|
Params,
|
||||||
false),
|
false),
|
||||||
llvm::Function::ExternalLinkage,
|
"_setjmp");
|
||||||
"_setjmp",
|
|
||||||
&CGM.getModule());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCTypesHelper::~ObjCTypesHelper() {
|
ObjCTypesHelper::~ObjCTypesHelper() {
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// RUN: clang -fnext-runtime -emit-llvm -o %t %s &&
|
||||||
|
// RUN: grep -e "^de.*objc_msgSend[0-9]*(" %t | count 1 &&
|
||||||
|
// RUN: clang -DWITHDEF -fnext-runtime -emit-llvm -o %t %s &&
|
||||||
|
// RUN: grep -e "^de.*objc_msgSend[0-9]*(" %t | count 1
|
||||||
|
|
||||||
|
id objc_msgSend(int x);
|
||||||
|
|
||||||
|
@interface A @end
|
||||||
|
|
||||||
|
@implementation A
|
||||||
|
-(void) f0 {
|
||||||
|
objc_msgSend(12);
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void) hello {
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
void f0(id x) {
|
||||||
|
[x hello];
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WITHDEF
|
||||||
|
// This isn't a very good send function.
|
||||||
|
id objc_msgSend(int x) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Reference in New Issue