9 Star 0 Fork 13

src-openEuler/pin-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0014-Pin-server-Fix-AWC-pass-can-complice-can-compile-a-c.patch 3.86 KB
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/pin-server.git
git@gitee.com:src-openeuler/pin-server.git
src-openeuler
pin-server
pin-server
master

搜索帮助