Projects
Eulaceura:Factory
pin-server
_service:obs_scm:0014-Pin-server-Fix-AWC-pass-c...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0014-Pin-server-Fix-AWC-pass-can-complice-can-compile-a-c.patch of Package pin-server
From e760e64864b2c5dfb4da010bef3c97ee5575e936 Mon Sep 17 00:00:00 2001 From: d00573793 <dingguangya1@huawei.com> Date: Sat, 25 Feb 2023 21:03:26 +0800 Subject: [PATCH 14/23] [Pin-server] Fix AWC pass can complice can compile a complete program diff --git a/include/PluginAPI/BasicPluginOpsAPI.h b/include/PluginAPI/BasicPluginOpsAPI.h index f83b888..923dd44 100644 --- a/include/PluginAPI/BasicPluginOpsAPI.h +++ b/include/PluginAPI/BasicPluginOpsAPI.h @@ -46,6 +46,7 @@ public: virtual int GetDeclSourceColumn(int64_t) = 0; virtual vector<FunctionOp> GetAllFunc() = 0; + virtual FunctionOp GetFunctionOpById(uint64_t) = 0; virtual vector<LocalDeclOp> GetDecls(uint64_t) = 0; virtual LoopOp AllocateNewLoop(uint64_t) = 0; virtual vector<LoopOp> GetLoopsFromFunc(uint64_t) = 0; diff --git a/include/PluginAPI/PluginServerAPI.h b/include/PluginAPI/PluginServerAPI.h index b2f8fbf..3da28f5 100644 --- a/include/PluginAPI/PluginServerAPI.h +++ b/include/PluginAPI/PluginServerAPI.h @@ -37,6 +37,7 @@ public: ~PluginServerAPI () = default; vector<FunctionOp> GetAllFunc() override; + FunctionOp GetFunctionOpById(uint64_t); vector<LocalDeclOp> GetDecls(uint64_t) override; PhiOp GetPhiOp(uint64_t) override; CallOp GetCallOp(uint64_t) override; diff --git a/lib/PluginAPI/PluginServerAPI.cpp b/lib/PluginAPI/PluginServerAPI.cpp index 73c1a61..8ef10d1 100644 --- a/lib/PluginAPI/PluginServerAPI.cpp +++ b/lib/PluginAPI/PluginServerAPI.cpp @@ -179,6 +179,21 @@ vector<FunctionOp> PluginServerAPI::GetAllFunc() return PluginServer::GetInstance()->GetFunctionOpResult(funName, params); } +FunctionOp PluginServerAPI::GetFunctionOpById(uint64_t id) +{ + vector<FunctionOp> allFunction = GetAllFunc(); + FunctionOp funOp = nullptr; + + for (auto &funcOp : allFunction) { + if (funcOp.id() == id) { + funOp = funcOp; + break; + } + } + assert(funOp != nullptr); + return funOp; +} + PhiOp PluginServerAPI::GetPhiOp(uint64_t id) { Json::Value root; diff --git a/user/ArrayWidenPass.cpp b/user/ArrayWidenPass.cpp index 162fdc9..627e7f7 100644 --- a/user/ArrayWidenPass.cpp +++ b/user/ArrayWidenPass.cpp @@ -1533,32 +1533,31 @@ static void convertToNewLoop(LoopOp* loop, FunctionOp* funcOp) return; } -static void ProcessArrayWiden(void) +static void ProcessArrayWiden(uint64_t *fun) { std::cout << "Running first pass, awiden\n"; PluginServerAPI pluginAPI; - vector<FunctionOp> allFunction = pluginAPI.GetAllFunc(); - - for (auto &funcOp : allFunction) { - context = funcOp.getOperation()->getContext(); - mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context); - opBuilder = &opBuilder_temp; - string name = funcOp.funcNameAttr().getValue().str(); - printf("Now process func : %s \n", name.c_str()); - vector<LoopOp> allLoop = funcOp.GetAllLoops(); - for (auto &loop : allLoop) { - if (determineLoopForm(loop)) { - printf("The loop form is success matched, and the loop can be optimized.\n"); - convertToNewLoop(&loop, &funcOp); - } + + FunctionOp funcOp = pluginAPI.GetFunctionOpById((uint64_t)fun); + + context = funcOp.getOperation()->getContext(); + mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context); + opBuilder = &opBuilder_temp; + string name = funcOp.funcNameAttr().getValue().str(); + printf("Now process func : %s \n", name.c_str()); + vector<LoopOp> allLoop = funcOp.GetAllLoops(); + for (auto &loop : allLoop) { + if (determineLoopForm(loop)) { + printf("The loop form is success matched, and the loop can be optimized.\n"); + convertToNewLoop(&loop, &funcOp); } } } int ArrayWidenPass::DoOptimize(uint64_t *fun) { - ProcessArrayWiden(); + ProcessArrayWiden(fun); return 0; } } -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2