mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-02 16:21:36 +00:00
Use StringRef instead of raw pointer in ExecutionEngine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283016 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
825f7d897c
commit
d1fa61bdee
@ -205,12 +205,12 @@ public:
|
||||
/// FindFunctionNamed - Search all of the active modules to find the function that
|
||||
/// defines FnName. This is very slow operation and shouldn't be used for
|
||||
/// general code.
|
||||
virtual Function *FindFunctionNamed(const char *FnName);
|
||||
virtual Function *FindFunctionNamed(StringRef FnName);
|
||||
|
||||
/// FindGlobalVariableNamed - Search all of the active modules to find the global variable
|
||||
/// that defines Name. This is very slow operation and shouldn't be used for
|
||||
/// general code.
|
||||
virtual GlobalVariable *FindGlobalVariableNamed(const char *Name, bool AllowInternal = false);
|
||||
virtual GlobalVariable *FindGlobalVariableNamed(StringRef Name, bool AllowInternal = false);
|
||||
|
||||
/// runFunction - Execute the specified function with the specified arguments,
|
||||
/// and return the result.
|
||||
|
@ -155,7 +155,7 @@ bool ExecutionEngine::removeModule(Module *M) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Function *ExecutionEngine::FindFunctionNamed(const char *FnName) {
|
||||
Function *ExecutionEngine::FindFunctionNamed(StringRef FnName) {
|
||||
for (unsigned i = 0, e = Modules.size(); i != e; ++i) {
|
||||
Function *F = Modules[i]->getFunction(FnName);
|
||||
if (F && !F->isDeclaration())
|
||||
@ -164,7 +164,7 @@ Function *ExecutionEngine::FindFunctionNamed(const char *FnName) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GlobalVariable *ExecutionEngine::FindGlobalVariableNamed(const char *Name, bool AllowInternal) {
|
||||
GlobalVariable *ExecutionEngine::FindGlobalVariableNamed(StringRef Name, bool AllowInternal) {
|
||||
for (unsigned i = 0, e = Modules.size(); i != e; ++i) {
|
||||
GlobalVariable *GV = Modules[i]->getGlobalVariable(Name,AllowInternal);
|
||||
if (GV && !GV->isDeclaration())
|
||||
@ -370,7 +370,7 @@ void *ArgvArray::reset(LLVMContext &C, ExecutionEngine *EE,
|
||||
|
||||
void ExecutionEngine::runStaticConstructorsDestructors(Module &module,
|
||||
bool isDtors) {
|
||||
const char *Name = isDtors ? "llvm.global_dtors" : "llvm.global_ctors";
|
||||
StringRef Name(isDtors ? "llvm.global_dtors" : "llvm.global_ctors");
|
||||
GlobalVariable *GV = module.getNamedGlobal(Name);
|
||||
|
||||
// If this global has internal linkage, or if it has a use, then it must be
|
||||
|
@ -187,7 +187,7 @@ LLVMBool LLVMCreateMCJITCompilerForModule(
|
||||
// NoFramePointerElim.
|
||||
for (auto &F : *Mod) {
|
||||
auto Attrs = F.getAttributes();
|
||||
auto Value = options.NoFramePointerElim ? "true" : "false";
|
||||
StringRef Value(options.NoFramePointerElim ? "true" : "false");
|
||||
Attrs = Attrs.addAttribute(F.getContext(), AttributeSet::FunctionIndex,
|
||||
"no-frame-pointer-elim", Value);
|
||||
F.setAttributes(Attrs);
|
||||
|
@ -446,7 +446,7 @@ void MCJIT::runStaticConstructorsDestructors(bool isDtors) {
|
||||
isDtors, OwnedModules.begin_finalized(), OwnedModules.end_finalized());
|
||||
}
|
||||
|
||||
Function *MCJIT::FindFunctionNamedInModulePtrSet(const char *FnName,
|
||||
Function *MCJIT::FindFunctionNamedInModulePtrSet(StringRef FnName,
|
||||
ModulePtrSet::iterator I,
|
||||
ModulePtrSet::iterator E) {
|
||||
for (; I != E; ++I) {
|
||||
@ -457,7 +457,7 @@ Function *MCJIT::FindFunctionNamedInModulePtrSet(const char *FnName,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GlobalVariable *MCJIT::FindGlobalVariableNamedInModulePtrSet(const char *Name,
|
||||
GlobalVariable *MCJIT::FindGlobalVariableNamedInModulePtrSet(StringRef Name,
|
||||
bool AllowInternal,
|
||||
ModulePtrSet::iterator I,
|
||||
ModulePtrSet::iterator E) {
|
||||
@ -470,7 +470,7 @@ GlobalVariable *MCJIT::FindGlobalVariableNamedInModulePtrSet(const char *Name,
|
||||
}
|
||||
|
||||
|
||||
Function *MCJIT::FindFunctionNamed(const char *FnName) {
|
||||
Function *MCJIT::FindFunctionNamed(StringRef FnName) {
|
||||
Function *F = FindFunctionNamedInModulePtrSet(
|
||||
FnName, OwnedModules.begin_added(), OwnedModules.end_added());
|
||||
if (!F)
|
||||
@ -482,7 +482,7 @@ Function *MCJIT::FindFunctionNamed(const char *FnName) {
|
||||
return F;
|
||||
}
|
||||
|
||||
GlobalVariable *MCJIT::FindGlobalVariableNamed(const char *Name, bool AllowInternal) {
|
||||
GlobalVariable *MCJIT::FindGlobalVariableNamed(StringRef Name, bool AllowInternal) {
|
||||
GlobalVariable *GV = FindGlobalVariableNamedInModulePtrSet(
|
||||
Name, AllowInternal, OwnedModules.begin_added(), OwnedModules.end_added());
|
||||
if (!GV)
|
||||
|
@ -194,11 +194,11 @@ class MCJIT : public ExecutionEngine {
|
||||
// perform lookup of pre-compiled code to avoid re-compilation.
|
||||
ObjectCache *ObjCache;
|
||||
|
||||
Function *FindFunctionNamedInModulePtrSet(const char *FnName,
|
||||
Function *FindFunctionNamedInModulePtrSet(StringRef FnName,
|
||||
ModulePtrSet::iterator I,
|
||||
ModulePtrSet::iterator E);
|
||||
|
||||
GlobalVariable *FindGlobalVariableNamedInModulePtrSet(const char *Name,
|
||||
GlobalVariable *FindGlobalVariableNamedInModulePtrSet(StringRef Name,
|
||||
bool AllowInternal,
|
||||
ModulePtrSet::iterator I,
|
||||
ModulePtrSet::iterator E);
|
||||
@ -221,12 +221,12 @@ public:
|
||||
/// FindFunctionNamed - Search all of the active modules to find the function that
|
||||
/// defines FnName. This is very slow operation and shouldn't be used for
|
||||
/// general code.
|
||||
Function *FindFunctionNamed(const char *FnName) override;
|
||||
Function *FindFunctionNamed(StringRef FnName) override;
|
||||
|
||||
/// FindGlobalVariableNamed - Search all of the active modules to find the
|
||||
/// global variable that defines Name. This is very slow operation and
|
||||
/// shouldn't be used for general code.
|
||||
GlobalVariable *FindGlobalVariableNamed(const char *Name,
|
||||
GlobalVariable *FindGlobalVariableNamed(StringRef Name,
|
||||
bool AllowInternal = false) override;
|
||||
|
||||
/// Sets the object manager that MCJIT should use to avoid compilation.
|
||||
|
Loading…
x
Reference in New Issue
Block a user