diff options
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp')
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp index f51190e0c82c..f3b7c9dd3edc 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp @@ -22,9 +22,8 @@ #include "lldb/Utility/Log.h" using namespace lldb_private; -namespace { -bool isRSAPICall(llvm::Module &module, llvm::CallInst *call_inst) { +static bool isRSAPICall(llvm::Module &module, llvm::CallInst *call_inst) { // TODO get the list of renderscript modules from lldb and check if // this llvm::Module calls into any of them. (void)module; @@ -38,7 +37,8 @@ bool isRSAPICall(llvm::Module &module, llvm::CallInst *call_inst) { return true; } -bool isRSLargeReturnCall(llvm::Module &module, llvm::CallInst *call_inst) { +static bool isRSLargeReturnCall(llvm::Module &module, + llvm::CallInst *call_inst) { // i686 and x86_64 returns for large vectors in the RenderScript API are not // handled as normal register pairs, but as a hidden sret type. This is not // reflected in the debug info or mangled symbol name, and the android ABI @@ -58,7 +58,7 @@ bool isRSLargeReturnCall(llvm::Module &module, llvm::CallInst *call_inst) { ->getPrimitiveSizeInBits() > 128; } -bool isRSAllocationPtrTy(const llvm::Type *type) { +static bool isRSAllocationPtrTy(const llvm::Type *type) { if (!type->isPointerTy()) return false; auto ptr_type = type->getPointerElementType(); @@ -67,7 +67,8 @@ bool isRSAllocationPtrTy(const llvm::Type *type) { ptr_type->getStructName().startswith("struct.rs_allocation"); } -bool isRSAllocationTyCallSite(llvm::Module &module, llvm::CallInst *call_inst) { +static bool isRSAllocationTyCallSite(llvm::Module &module, + llvm::CallInst *call_inst) { (void)module; if (!call_inst->hasByValArgument()) return false; @@ -77,7 +78,7 @@ bool isRSAllocationTyCallSite(llvm::Module &module, llvm::CallInst *call_inst) { return false; } -llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) { +static llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) { // on x86 StructReturn functions return a pointer to the return value, rather // than the return value itself // [ref](http://www.agner.org/optimize/calling_conventions.pdf section 6). We @@ -122,9 +123,9 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) { orig->isVarArg()); } -bool findRSCallSites(llvm::Module &module, - std::set<llvm::CallInst *> &rs_callsites, - bool (*predicate)(llvm::Module &, llvm::CallInst *)) { +static bool +findRSCallSites(llvm::Module &module, std::set<llvm::CallInst *> &rs_callsites, + bool (*predicate)(llvm::Module &, llvm::CallInst *)) { bool found = false; for (auto &func : module.getFunctionList()) @@ -143,7 +144,7 @@ bool findRSCallSites(llvm::Module &module, return found; } -bool fixupX86StructRetCalls(llvm::Module &module) { +static bool fixupX86StructRetCalls(llvm::Module &module) { bool changed = false; // changing a basic block while iterating over it seems to have some // undefined behaviour going on so we find all RS callsites first, then fix @@ -207,7 +208,7 @@ bool fixupX86StructRetCalls(llvm::Module &module) { return changed; } -bool fixupRSAllocationStructByValCalls(llvm::Module &module) { +static bool fixupRSAllocationStructByValCalls(llvm::Module &module) { // On x86_64, calls to functions in the RS runtime that take an // `rs_allocation` type argument are actually handled as by-ref params by // bcc, but appear to be passed by value by lldb (the callsite all use @@ -237,12 +238,11 @@ bool fixupRSAllocationStructByValCalls(llvm::Module &module) { llvm::AttributeList call_attribs = call_inst->getAttributes(); // iterate over the argument attributes - for (unsigned I = call_attribs.index_begin(); I != call_attribs.index_end(); - I++) { + for (unsigned I : call_attribs.indexes()) { // if this argument is passed by val - if (call_attribs.hasAttribute(I, llvm::Attribute::ByVal)) { + if (call_attribs.hasAttributeAtIndex(I, llvm::Attribute::ByVal)) { // strip away the byval attribute - call_inst->removeAttribute(I, llvm::Attribute::ByVal); + call_inst->removeAttributeAtIndex(I, llvm::Attribute::ByVal); changed = true; } } @@ -260,7 +260,6 @@ bool fixupRSAllocationStructByValCalls(llvm::Module &module) { } return changed; } -} // end anonymous namespace namespace lldb_private { namespace lldb_renderscript { |