代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/pin-server 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。