From 5e7dcc62e4637591959f9c372f6c5258d0d263e0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 26 Jun 2008 04:44:19 +0000 Subject: [PATCH] remove the old getSelector implementation, which removes some calls to getStringValue git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52761 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGObjCGNU.cpp | 63 ++----------------------------------- lib/CodeGen/CGObjCRuntime.h | 3 -- 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 5fe182019f..5b11b3f667 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -119,9 +119,6 @@ public: virtual llvm::Value *LookupClass(llvm::IRBuilder &Builder, llvm::Value *ClassName); virtual llvm::Value *GetSelector(llvm::IRBuilder &Builder, Selector Sel); - virtual llvm::Value *GetSelector(llvm::IRBuilder &Builder, - llvm::Value *SelName, - llvm::Value *SelTypes); virtual llvm::Function *MethodPreamble( const std::string &ClassName, @@ -235,64 +232,8 @@ llvm::Value *CGObjCGNU::GetSelector(llvm::IRBuilder &Builder, Selector Sel) { } -/// Looks up the selector for the specified name / type pair. -// FIXME: Selectors should be statically cached, not looked up on every call. -llvm::Value *CGObjCGNU::GetSelector(llvm::IRBuilder &Builder, - llvm::Value *SelName, - llvm::Value *SelTypes) { - // For static selectors, we return an alias for now then store them all in a - // list that the runtime will initialise later. - if (llvm::Constant *CName = dyn_cast(SelName)) { - // Untyped selector - if (SelTypes == 0) { - // If it's already cached, return it. - llvm::GlobalAlias *&US = UntypedSelectors[getStringValue(CName)]; - if (US == 0) { - // If it isn't, cache it. - US = new llvm::GlobalAlias(llvm::PointerType::getUnqual(SelectorTy), - llvm::GlobalValue::InternalLinkage, - ".objc_untyped_selector_alias", - NULL, &TheModule); - } - return Builder.CreateLoad(US); - } - // Typed selectors - if (llvm::Constant *CTypes = dyn_cast(SelTypes)) { - TypedSelector Selector = TypedSelector(getStringValue(CName), - getStringValue(CTypes)); - // If it's already cached, return it. - llvm::GlobalAlias *&TS = TypedSelectors[Selector]; - if (TS == 0) { - // If it isn't, cache it. - TS = new llvm::GlobalAlias(llvm::PointerType::getUnqual(SelectorTy), - llvm::GlobalValue::InternalLinkage, - ".objc_typed_selector_alias", - NULL, &TheModule); - } - return Builder.CreateLoad(TS); - } - } - // Dynamically look up selectors from non-constant sources - llvm::Value *cmd; - if (SelTypes == 0) { - llvm::Constant *SelFunction = TheModule.getOrInsertFunction("sel_get_uid", - SelectorTy, - PtrToInt8Ty, - NULL); - cmd = Builder.CreateCall(SelFunction, SelName); - } - else { - llvm::Constant *SelFunction = - TheModule.getOrInsertFunction("sel_get_typed_uid", - SelectorTy, PtrToInt8Ty, PtrToInt8Ty, NULL); - cmd = Builder.CreateCall2(SelFunction, SelName, SelTypes); - } - return cmd; -} - - -llvm::Constant *CGObjCGNU::MakeConstantString(const std::string &Str, const - std::string &Name) { +llvm::Constant *CGObjCGNU::MakeConstantString(const std::string &Str, + const std::string &Name) { llvm::Constant * ConstStr = llvm::ConstantArray::get(Str); ConstStr = new llvm::GlobalVariable(ConstStr->getType(), true, llvm::GlobalValue::InternalLinkage, diff --git a/lib/CodeGen/CGObjCRuntime.h b/lib/CodeGen/CGObjCRuntime.h index f9b029736d..0dd36495d5 100644 --- a/lib/CodeGen/CGObjCRuntime.h +++ b/lib/CodeGen/CGObjCRuntime.h @@ -54,9 +54,6 @@ public: virtual llvm::Function *ModuleInitFunction() =0; /// Get a selector for the specified name and type values virtual llvm::Value *GetSelector(llvm::IRBuilder &Builder, Selector Sel) = 0; - virtual llvm::Value *GetSelector(llvm::IRBuilder &Builder, - llvm::Value *SelName, - llvm::Value *SelTypes) = 0; /// Generate a constant string object virtual llvm::Constant *GenerateConstantString(const char *String, const size_t Length) = 0; -- 2.40.0