80 lines
2.9 KiB
Diff
80 lines
2.9 KiB
Diff
|
|
From 1b9a024e5195a6860b7e6a896e0d7afa9794c277 Mon Sep 17 00:00:00 2001
|
||
|
|
From: dingguangya <dingguangya1@huawei.com>
|
||
|
|
Date: Wed, 7 Dec 2022 21:49:19 +0800
|
||
|
|
Subject: [PATCH 1/4] [Pin-gcc-client] Support for new insertion points and new
|
||
|
|
Pass It supports the phiopt insertion point and provides a simple
|
||
|
|
arraywiden pass interface.
|
||
|
|
|
||
|
|
---
|
||
|
|
include/PluginClient/PluginClient.h | 1 +
|
||
|
|
lib/IRTrans/IRTransPlugin.cpp | 25 +++++++++++++++++++++++++
|
||
|
|
2 files changed, 26 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/include/PluginClient/PluginClient.h b/include/PluginClient/PluginClient.h
|
||
|
|
index e8adcb2..155705d 100644
|
||
|
|
--- a/include/PluginClient/PluginClient.h
|
||
|
|
+++ b/include/PluginClient/PluginClient.h
|
||
|
|
@@ -79,6 +79,7 @@ typedef enum {
|
||
|
|
// 参考点名称
|
||
|
|
enum RefPassName {
|
||
|
|
PASS_CFG,
|
||
|
|
+ PASS_PHIOPT,
|
||
|
|
PASS_SSA,
|
||
|
|
PASS_LOOP,
|
||
|
|
};
|
||
|
|
diff --git a/lib/IRTrans/IRTransPlugin.cpp b/lib/IRTrans/IRTransPlugin.cpp
|
||
|
|
index ccde9b5..8e5af8c 100644
|
||
|
|
--- a/lib/IRTrans/IRTransPlugin.cpp
|
||
|
|
+++ b/lib/IRTrans/IRTransPlugin.cpp
|
||
|
|
@@ -127,8 +127,28 @@ void ManagerSetupCallback(void)
|
||
|
|
std::shared_ptr<PluginClient> client = PluginClient::GetInstance();
|
||
|
|
vector<string> userFuncs = client->GetFuncNameByInject(inject);
|
||
|
|
for (auto &userFunc : userFuncs) {
|
||
|
|
+ if (client->GetUserFuncState() == STATE_TIMEOUT) {
|
||
|
|
+ break;
|
||
|
|
+ }
|
||
|
|
string value = std::to_string(inject) + ":" + userFunc;
|
||
|
|
client->ReceiveSendMsg(key, value);
|
||
|
|
+ while (1) {
|
||
|
|
+ UserFuncStateEnum state = client->GetUserFuncState();
|
||
|
|
+ /* server获取到client对应函数的执行结果后,向client回复已执行完,跳出循环执行下一个函数 */
|
||
|
|
+ if (state == STATE_END) {
|
||
|
|
+ client->SetUserFuncState(STATE_WAIT_BEGIN);
|
||
|
|
+ break;
|
||
|
|
+ } else if (state == STATE_TIMEOUT) {
|
||
|
|
+ break;
|
||
|
|
+ } else if (state == STATE_BEGIN) {
|
||
|
|
+ string funcName = client->GetPluginAPIName();
|
||
|
|
+ string param = client->GetPluginAPIParam();
|
||
|
|
+ if (funcName != "") {
|
||
|
|
+ client->SetUserFuncState(STATE_WAIT_IR);
|
||
|
|
+ client->IRTransBegin(funcName, param);
|
||
|
|
+ }
|
||
|
|
+ }
|
||
|
|
+ }
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@@ -182,6 +202,7 @@ public:
|
||
|
|
|
||
|
|
static std::map<RefPassName, string> g_refPassName {
|
||
|
|
{PASS_CFG, "cfg"},
|
||
|
|
+ {PASS_PHIOPT, "phiopt"},
|
||
|
|
{PASS_SSA, "ssa"},
|
||
|
|
{PASS_LOOP, "loop"},
|
||
|
|
};
|
||
|
|
@@ -213,6 +234,10 @@ int RegisterPassManagerSetup(InjectPoint inject, const ManagerSetupData& setupDa
|
||
|
|
passData.type = GIMPLE_PASS;
|
||
|
|
passInfo.pass = new GimplePass(passData);
|
||
|
|
break;
|
||
|
|
+ case PASS_PHIOPT:
|
||
|
|
+ passData.type = GIMPLE_PASS;
|
||
|
|
+ passInfo.pass = new GimplePass(passData);
|
||
|
|
+ break;
|
||
|
|
case PASS_SSA:
|
||
|
|
passData.type = RTL_PASS;
|
||
|
|
passInfo.pass = new RltPass(passData);
|
||
|
|
--
|
||
|
|
2.27.0.windows.1
|
||
|
|
|