[sync] Sync patch from openEuler/pin-server
This commit is contained in:
parent
2fbdd15a22
commit
abfcc9ab67
@ -1,8 +1,9 @@
|
|||||||
From 7ec62344dcd95cb321647f495d12303c94286ec5 Mon Sep 17 00:00:00 2001
|
From 7ec62344dcd95cb321647f495d12303c94286ec5 Mon Sep 17 00:00:00 2001
|
||||||
From: wangding16 <wangding16@huawei.com>
|
From: wangding16 <wangding16@huawei.com>
|
||||||
Date: Wed, 8 Feb 2023 15:05:33 +0800
|
Date: Wed, 8 Feb 2023 15:05:33 +0800
|
||||||
Subject: [PATCH 1/9] [Refactoring] Code refactoring of Communication Subsystem
|
Subject: [PATCH 01/23] [Refactoring] Code refactoring of Communication
|
||||||
[1/3]. Code refactoring of PluginLog and PluginServer. Add PluginJson.
|
Subsystem [1/3]. Code refactoring of PluginLog and PluginServer. Add
|
||||||
|
PluginJson.
|
||||||
|
|
||||||
|
|
||||||
diff --git a/include/user.h b/include/user.h
|
diff --git a/include/user.h b/include/user.h
|
||||||
@ -1967,5 +1968,5 @@ index 7ebc15d..05d0d3d 100644
|
|||||||
}
|
}
|
||||||
} // namespace PinServer
|
} // namespace PinServer
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
From c1301cbec8465ef4c9c4df597ee46774b6da5715 Mon Sep 17 00:00:00 2001
|
From c1301cbec8465ef4c9c4df597ee46774b6da5715 Mon Sep 17 00:00:00 2001
|
||||||
From: wangding16 <wangding16@huawei.com>
|
From: wangding16 <wangding16@huawei.com>
|
||||||
Date: Wed, 8 Feb 2023 15:13:54 +0800
|
Date: Wed, 8 Feb 2023 15:13:54 +0800
|
||||||
Subject: [PATCH 2/9] [Refactoring] Code refactoring of Communication Subsystem
|
Subject: [PATCH 02/23] [Refactoring] Code refactoring of Communication
|
||||||
[2/3]. Code refactoring of PluginServer.
|
Subsystem [2/3]. Code refactoring of PluginServer.
|
||||||
|
|
||||||
|
|
||||||
diff --git a/include/PluginServer/PluginLog.h b/include/PluginServer/PluginLog.h
|
diff --git a/include/PluginServer/PluginLog.h b/include/PluginServer/PluginLog.h
|
||||||
@ -2591,5 +2591,5 @@ index cdb0b99..a6fe555 100644
|
|||||||
+ pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::ArrayWidenPass>());
|
+ pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::ArrayWidenPass>());
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
From d395986acddf59c379a107fbe6d1b69c74ff2d3b Mon Sep 17 00:00:00 2001
|
From d395986acddf59c379a107fbe6d1b69c74ff2d3b Mon Sep 17 00:00:00 2001
|
||||||
From: wangding16 <wangding16@huawei.com>
|
From: wangding16 <wangding16@huawei.com>
|
||||||
Date: Wed, 8 Feb 2023 15:16:49 +0800
|
Date: Wed, 8 Feb 2023 15:16:49 +0800
|
||||||
Subject: [PATCH 3/9] [Refactoring] Code refactoring of Communication Subsystem
|
Subject: [PATCH 03/23] [Refactoring] Code refactoring of Communication
|
||||||
[3/3]. Code refactoring of Communication subsystem.
|
Subsystem [3/3]. Code refactoring of Communication subsystem.
|
||||||
|
|
||||||
|
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
@ -1711,5 +1711,5 @@ index 5ab27d7..523e08d 100644
|
|||||||
|
|
||||||
} // namespace Plugin_IR
|
} // namespace Plugin_IR
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From b14803116c8488a4c765799fd31966991f2031d7 Mon Sep 17 00:00:00 2001
|
From b14803116c8488a4c765799fd31966991f2031d7 Mon Sep 17 00:00:00 2001
|
||||||
From: benniaobufeijiushiji <linda7@huawei.com>
|
From: benniaobufeijiushiji <linda7@huawei.com>
|
||||||
Date: Sun, 19 Feb 2023 11:43:57 +0800
|
Date: Sun, 19 Feb 2023 11:43:57 +0800
|
||||||
Subject: [PATCH 4/9] [Pin-server] Add DebugOp
|
Subject: [PATCH 04/23] [Pin-server] Add DebugOp
|
||||||
|
|
||||||
|
|
||||||
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
||||||
@ -123,5 +123,5 @@ index a6fe555..8163cec 100644
|
|||||||
if (!getIvUpperBound(cond)) {
|
if (!getIvUpperBound(cond)) {
|
||||||
return false;
|
return false;
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From 47f1208aab2acb3e1a8442d830125ad3b54149c5 Mon Sep 17 00:00:00 2001
|
From 47f1208aab2acb3e1a8442d830125ad3b54149c5 Mon Sep 17 00:00:00 2001
|
||||||
From: benniaobufeijiushiji <linda7@huawei.com>
|
From: benniaobufeijiushiji <linda7@huawei.com>
|
||||||
Date: Sun, 19 Feb 2023 14:40:09 +0800
|
Date: Sun, 19 Feb 2023 14:40:09 +0800
|
||||||
Subject: [PATCH 5/9] [Pin-server] Add API for LTO judgement
|
Subject: [PATCH 05/23] [Pin-server] Add API for LTO judgement
|
||||||
|
|
||||||
|
|
||||||
diff --git a/include/PluginAPI/BasicPluginOpsAPI.h b/include/PluginAPI/BasicPluginOpsAPI.h
|
diff --git a/include/PluginAPI/BasicPluginOpsAPI.h b/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
@ -56,5 +56,5 @@ index 523e08d..f81a3ad 100644
|
|||||||
+
|
+
|
||||||
} // namespace Plugin_IR
|
} // namespace Plugin_IR
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
From 5be0d63fe19decadaebb012efeb03b75aa868228 Mon Sep 17 00:00:00 2001
|
From 5be0d63fe19decadaebb012efeb03b75aa868228 Mon Sep 17 00:00:00 2001
|
||||||
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
||||||
Date: Tue, 21 Feb 2023 16:52:39 +0800
|
Date: Tue, 21 Feb 2023 16:52:39 +0800
|
||||||
Subject: [PATCH 6/9] [Pin-server] Fix bug for BuildCallOp. Now we can convert
|
Subject: [PATCH 06/23] [Pin-server] Fix bug for BuildCallOp. Now we can
|
||||||
the function pointer.
|
convert the function pointer.
|
||||||
|
|
||||||
|
|
||||||
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
||||||
@ -101,5 +101,5 @@ index fac574e..333d55e 100644
|
|||||||
LogPriority priority = (LogPriority)atoi(argv[1]);
|
LogPriority priority = (LogPriority)atoi(argv[1]);
|
||||||
PluginServer server(priority, port);
|
PluginServer server(priority, port);
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From 1f800efcb93e2868f609c70584966b706ba13031 Mon Sep 17 00:00:00 2001
|
From 1f800efcb93e2868f609c70584966b706ba13031 Mon Sep 17 00:00:00 2001
|
||||||
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
||||||
Date: Tue, 21 Feb 2023 17:37:23 +0800
|
Date: Tue, 21 Feb 2023 17:37:23 +0800
|
||||||
Subject: [PATCH 7/9] [Pin-server] Refactoring array-widen-compare into a
|
Subject: [PATCH 07/23] [Pin-server] Refactoring array-widen-compare into a
|
||||||
class.
|
class.
|
||||||
|
|
||||||
|
|
||||||
@ -89,5 +89,5 @@ index 0000000..bee70bb
|
|||||||
+ pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::ArrayWidenPass>());
|
+ pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::ArrayWidenPass>());
|
||||||
+}
|
+}
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From 2942cf7b6cdbea40735d5574e21d34d9f665a1fd Mon Sep 17 00:00:00 2001
|
From 2942cf7b6cdbea40735d5574e21d34d9f665a1fd Mon Sep 17 00:00:00 2001
|
||||||
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
||||||
Date: Tue, 21 Feb 2023 17:45:30 +0800
|
Date: Tue, 21 Feb 2023 17:45:30 +0800
|
||||||
Subject: [PATCH 8/9] [Pin-server] Refactoring DEMOs into PluginOpt classes.
|
Subject: [PATCH 08/23] [Pin-server] Refactoring DEMOs into PluginOpt classes.
|
||||||
|
|
||||||
|
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
@ -438,5 +438,5 @@ index bee70bb..16f0687 100644
|
|||||||
+ // pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::ArrayWidenPass>());
|
+ // pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::ArrayWidenPass>());
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From e2a6f729f4ce40542fccec997529b43d25a6d5ae Mon Sep 17 00:00:00 2001
|
From e2a6f729f4ce40542fccec997529b43d25a6d5ae Mon Sep 17 00:00:00 2001
|
||||||
From: d00573793 <dingguangya1@huawei.com>
|
From: d00573793 <dingguangya1@huawei.com>
|
||||||
Date: Tue, 21 Feb 2023 21:53:44 +0800
|
Date: Tue, 21 Feb 2023 21:53:44 +0800
|
||||||
Subject: [PATCH 9/9] [Pin-server] Support functiontype structtype.eg.
|
Subject: [PATCH 09/23] [Pin-server] Support functiontype structtype.eg.
|
||||||
|
|
||||||
|
|
||||||
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
||||||
@ -562,5 +562,5 @@ index 4fc4985..2e157e3 100755
|
|||||||
auto decl = decls[j];
|
auto decl = decls[j];
|
||||||
string name = decl.symNameAttr().getValue().str();
|
string name = decl.symNameAttr().getValue().str();
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
From b460122fefb5d4f889c807b704f252948d488893 Mon Sep 17 00:00:00 2001
|
From b460122fefb5d4f889c807b704f252948d488893 Mon Sep 17 00:00:00 2001
|
||||||
From: huitailangzju <804544223@qq.com>
|
From: huitailangzju <804544223@qq.com>
|
||||||
Date: Wed, 22 Feb 2023 11:42:02 +0800
|
Date: Wed, 22 Feb 2023 11:42:02 +0800
|
||||||
Subject: [PATCH 1/5] =?UTF-8?q?[Pin-server]=20Add=20ComponentOp=E3=80=81Co?=
|
Subject: [PATCH 10/23] =?UTF-8?q?[Pin-server]=20Add=20ComponentOp=E3=80=81?=
|
||||||
=?UTF-8?q?nstructorOp=E3=80=81AddressOp=E3=80=81FieldDeclOp=E3=80=81VecOp?=
|
=?UTF-8?q?ConstructorOp=E3=80=81AddressOp=E3=80=81FieldDeclOp=E3=80=81Vec?=
|
||||||
=?UTF-8?q?=E3=80=81BlockOp=E3=80=81DeclBaseOp=E3=80=81ListOp=E3=80=81StrO?=
|
=?UTF-8?q?Op=E3=80=81BlockOp=E3=80=81DeclBaseOp=E3=80=81ListOp=E3=80=81St?=
|
||||||
=?UTF-8?q?p=E3=80=81ArrayOp.?=
|
=?UTF-8?q?rOp=E3=80=81ArrayOp.?=
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
@ -846,5 +846,5 @@ index 7bbf681..c5e302f 100755
|
|||||||
const string& data, vector<mlir::Operation *>& opData)
|
const string& data, vector<mlir::Operation *>& opData)
|
||||||
{
|
{
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
From 190a1e5f5278f4966eb3bcdbdcee950560092216 Mon Sep 17 00:00:00 2001
|
From 190a1e5f5278f4966eb3bcdbdcee950560092216 Mon Sep 17 00:00:00 2001
|
||||||
From: huitailangzju <804544223@qq.com>
|
From: huitailangzju <804544223@qq.com>
|
||||||
Date: Wed, 22 Feb 2023 11:54:28 +0800
|
Date: Wed, 22 Feb 2023 11:54:28 +0800
|
||||||
Subject: [PATCH 2/5] =?UTF-8?q?[Pin-server]=20Add=20NopOp=E3=80=81EHElseOp?=
|
Subject: [PATCH 11/23] =?UTF-8?q?[Pin-server]=20Add=20NopOp=E3=80=81EHElse?=
|
||||||
=?UTF-8?q?=E3=80=81AsmOp=E3=80=81SwitchOp=E3=80=81LabelOp=E3=80=81EHMntOp?=
|
=?UTF-8?q?Op=E3=80=81AsmOp=E3=80=81SwitchOp=E3=80=81LabelOp=E3=80=81EHMnt?=
|
||||||
=?UTF-8?q?=E3=80=81BindOp=E3=80=81TryOp=E3=80=81CatchOp=E3=80=81GotoOp?=
|
=?UTF-8?q?Op=E3=80=81BindOp=E3=80=81TryOp=E3=80=81CatchOp=E3=80=81GotoOp?=
|
||||||
=?UTF-8?q?=E3=80=81TransactionOp=E3=80=81ResxOp=E3=80=81EHDispatchOp.?=
|
=?UTF-8?q?=E3=80=81TransactionOp=E3=80=81ResxOp=E3=80=81EHDispatchOp.?=
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
@ -908,5 +908,5 @@ index c5e302f..b849cf9 100755
|
|||||||
} // namespace PinJson
|
} // namespace PinJson
|
||||||
\ No newline at end of file
|
\ No newline at end of file
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From 50801883d5d5e89d44026ead6e38e149caa346b2 Mon Sep 17 00:00:00 2001
|
From 50801883d5d5e89d44026ead6e38e149caa346b2 Mon Sep 17 00:00:00 2001
|
||||||
From: d00573793 <dingguangya1@huawei.com>
|
From: d00573793 <dingguangya1@huawei.com>
|
||||||
Date: Sat, 25 Feb 2023 15:31:02 +0800
|
Date: Sat, 25 Feb 2023 15:31:02 +0800
|
||||||
Subject: [PATCH 3/5] [Pin-server] Support Vectortype
|
Subject: [PATCH 12/23] [Pin-server] Support Vectortype
|
||||||
|
|
||||||
|
|
||||||
diff --git a/include/Dialect/PluginTypes.h b/include/Dialect/PluginTypes.h
|
diff --git a/include/Dialect/PluginTypes.h b/include/Dialect/PluginTypes.h
|
||||||
@ -147,5 +147,5 @@ index 2e157e3..ccee9f7 100755
|
|||||||
llvm::ArrayRef<mlir::Type> paramsType = ty.getParams();
|
llvm::ArrayRef<mlir::Type> paramsType = ty.getParams();
|
||||||
for (auto ty : ty.getParams()) {
|
for (auto ty : ty.getParams()) {
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
From 75ac9cb04537b586e77820278600544f83742df3 Mon Sep 17 00:00:00 2001
|
From 75ac9cb04537b586e77820278600544f83742df3 Mon Sep 17 00:00:00 2001
|
||||||
From: huitailangzju <804544223@qq.com>
|
From: huitailangzju <804544223@qq.com>
|
||||||
Date: Sun, 26 Feb 2023 17:09:16 +0800
|
Date: Sun, 26 Feb 2023 17:09:16 +0800
|
||||||
Subject: [PATCH 1/2] [Pin-server] Fix Definecode name
|
Subject: [PATCH 13/23] [Pin-server] Fix Definecode name
|
||||||
|
|
||||||
|
|
||||||
diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp
|
diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp
|
||||||
@ -18,5 +18,5 @@ index b849cf9..2500fe8 100755
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
From e760e64864b2c5dfb4da010bef3c97ee5575e936 Mon Sep 17 00:00:00 2001
|
From e760e64864b2c5dfb4da010bef3c97ee5575e936 Mon Sep 17 00:00:00 2001
|
||||||
From: d00573793 <dingguangya1@huawei.com>
|
From: d00573793 <dingguangya1@huawei.com>
|
||||||
Date: Sat, 25 Feb 2023 21:03:26 +0800
|
Date: Sat, 25 Feb 2023 21:03:26 +0800
|
||||||
Subject: [PATCH 2/2] [Pin-server] Fix AWC pass can complice can compile a
|
Subject: [PATCH 14/23] [Pin-server] Fix AWC pass can complice can compile a
|
||||||
complete program
|
complete program
|
||||||
|
|
||||||
|
|
||||||
@ -108,5 +108,5 @@ index 162fdc9..627e7f7 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.27.0.windows.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
From 2f7eddb9820a2b8d9946431632f27490687af521 Mon Sep 17 00:00:00 2001
|
||||||
|
From: huitailangzju <804544223@qq.com>
|
||||||
|
Date: Mon, 27 Feb 2023 10:02:43 +0800
|
||||||
|
Subject: [PATCH 15/23] [Pin-server] Bugfix for SwitchOp, change it to
|
||||||
|
terminator operation
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
||||||
|
index 52c3ceb..db7e33f 100644
|
||||||
|
--- a/include/Dialect/PluginOps.td
|
||||||
|
+++ b/include/Dialect/PluginOps.td
|
||||||
|
@@ -521,29 +521,6 @@ def AsmOp : Plugin_Op<"asm", [NoSideEffect]> {
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
-def SwitchOp : Plugin_Op<"switch", [NoSideEffect]> {
|
||||||
|
- let summary = "switch op.";
|
||||||
|
- let description = [{TODO}];
|
||||||
|
- let successors = (successor
|
||||||
|
- AnySuccessor:$defaultDestination,
|
||||||
|
- VariadicSuccessor<AnySuccessor>:$caseDestinations
|
||||||
|
- );
|
||||||
|
- let arguments = (ins UI64Attr:$id, AnyType:$index, UI64Attr:$address, AnyType:$defaultLabel, Variadic<AnyType>:$operands,
|
||||||
|
- UI64Attr:$defaultaddr, ArrayAttr:$caseaddrs);
|
||||||
|
- let results = (outs AnyType:$result);
|
||||||
|
- let builders = [
|
||||||
|
- OpBuilderDAG<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel,
|
||||||
|
- "ArrayRef<Value>":$operands, "Block*":$defaultDestination, "uint64_t":$defaultaddr,
|
||||||
|
- "ArrayRef<Block*>":$caseDestinations, "ArrayRef<uint64_t>":$caseaddrs)>
|
||||||
|
- ];
|
||||||
|
-
|
||||||
|
- let extraClassDeclaration = [{
|
||||||
|
- unsigned GetNumLabels() { return getNumOperands() - 2; };
|
||||||
|
- Block* GetDefautDest() { return defaultDestination();}
|
||||||
|
- SmallVector<mlir::Block*> GetCaseDest() { return caseDestinations(); };
|
||||||
|
- }];
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
def LabelOp : Plugin_Op<"label", [NoSideEffect]> {
|
||||||
|
let summary = "Label op.";
|
||||||
|
let description = [{TODO}];
|
||||||
|
@@ -612,6 +589,29 @@ def CatchOp : Plugin_Op<"catch", [NoSideEffect]> {
|
||||||
|
class Plugin_TerminatorOp<string mnemonic, list<OpTrait> traits = []> :
|
||||||
|
Plugin_Op<mnemonic, !listconcat(traits, [Terminator])>;
|
||||||
|
|
||||||
|
+def SwitchOp : Plugin_TerminatorOp<"switch", [NoSideEffect]> {
|
||||||
|
+ let summary = "switch op.";
|
||||||
|
+ let description = [{TODO}];
|
||||||
|
+ let successors = (successor
|
||||||
|
+ AnySuccessor:$defaultDestination,
|
||||||
|
+ VariadicSuccessor<AnySuccessor>:$caseDestinations
|
||||||
|
+ );
|
||||||
|
+ let arguments = (ins UI64Attr:$id, AnyType:$index, UI64Attr:$address, AnyType:$defaultLabel, Variadic<AnyType>:$operands,
|
||||||
|
+ UI64Attr:$defaultaddr, ArrayAttr:$caseaddrs);
|
||||||
|
+ let results = (outs AnyType:$result);
|
||||||
|
+ let builders = [
|
||||||
|
+ OpBuilderDAG<(ins "uint64_t":$id, "Value":$index, "uint64_t":$address, "Value":$defaultLabel,
|
||||||
|
+ "ArrayRef<Value>":$operands, "Block*":$defaultDestination, "uint64_t":$defaultaddr,
|
||||||
|
+ "ArrayRef<Block*>":$caseDestinations, "ArrayRef<uint64_t>":$caseaddrs)>
|
||||||
|
+ ];
|
||||||
|
+
|
||||||
|
+ let extraClassDeclaration = [{
|
||||||
|
+ unsigned GetNumLabels() { return getNumOperands() - 2; };
|
||||||
|
+ Block* GetDefautDest() { return defaultDestination();}
|
||||||
|
+ SmallVector<mlir::Block*> GetCaseDest() { return caseDestinations(); };
|
||||||
|
+ }];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
def FallThroughOp : Plugin_TerminatorOp<"fallthrough", [NoSideEffect]> {
|
||||||
|
let summary = "FallThroughOp";
|
||||||
|
let description = [{TODO}];
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
152
0016-Pin-server-Bugfix-for-GetFunctionById.patch
Normal file
152
0016-Pin-server-Bugfix-for-GetFunctionById.patch
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
From 5b2e40badcd1d32180895e09edf208d052be25bf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
||||||
|
Date: Mon, 27 Feb 2023 16:23:59 +0800
|
||||||
|
Subject: [PATCH 16/23] [Pin-server] Bugfix for GetFunctionById.
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/lib/PluginAPI/PluginServerAPI.cpp b/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
index 8ef10d1..ff9c90e 100644
|
||||||
|
--- a/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
+++ b/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
@@ -75,6 +75,7 @@ static uint64_t GetValueId(mlir::Value v)
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
int64_t PluginServerAPI::GetInjectDataAddress()
|
||||||
|
{
|
||||||
|
string funName = __func__;
|
||||||
|
@@ -173,24 +174,26 @@ mlir::Value PluginServerAPI::CreateSSAOp(mlir::Type t)
|
||||||
|
vector<FunctionOp> PluginServerAPI::GetAllFunc()
|
||||||
|
{
|
||||||
|
Json::Value root;
|
||||||
|
- string funName = __func__;
|
||||||
|
+ string funName = "GetFunctionIDs";
|
||||||
|
string params = root.toStyledString();
|
||||||
|
-
|
||||||
|
- return PluginServer::GetInstance()->GetFunctionOpResult(funName, params);
|
||||||
|
+ vector<FunctionOp> res;
|
||||||
|
+ vector<uint64_t> ids = PluginServer::GetInstance()->GetIdsResult(funName, params);
|
||||||
|
+ for (auto id : ids) {
|
||||||
|
+ res.push_back(GetFunctionOpById(id));
|
||||||
|
+ }
|
||||||
|
+ return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
FunctionOp PluginServerAPI::GetFunctionOpById(uint64_t id)
|
||||||
|
{
|
||||||
|
- vector<FunctionOp> allFunction = GetAllFunc();
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["id"] = std::to_string(id);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ vector<FunctionOp> funcOps = PluginServer::GetInstance()->GetFunctionOpResult(funName, params);
|
||||||
|
FunctionOp funOp = nullptr;
|
||||||
|
-
|
||||||
|
- for (auto &funcOp : allFunction) {
|
||||||
|
- if (funcOp.id() == id) {
|
||||||
|
- funOp = funcOp;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- assert(funOp != nullptr);
|
||||||
|
+ if (funcOps.size())
|
||||||
|
+ funOp = funcOps[0];
|
||||||
|
return funOp;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp
|
||||||
|
index ca75764..14a6ef4 100755
|
||||||
|
--- a/lib/PluginServer/PluginJson.cpp
|
||||||
|
+++ b/lib/PluginServer/PluginJson.cpp
|
||||||
|
@@ -587,7 +587,7 @@ void PluginJson::IdsJsonDeSerialize(
|
||||||
|
reader.parse(data, root);
|
||||||
|
Json::Value::Members operation = root.getMemberNames();
|
||||||
|
for (size_t iter = 0; iter < operation.size(); iter++) {
|
||||||
|
- string operationKey = "block" + std::to_string(iter);
|
||||||
|
+ string operationKey = "ID" + std::to_string(iter);
|
||||||
|
node = root[operationKey];
|
||||||
|
uint64_t id = GetID(node["id"]);
|
||||||
|
idsResult.push_back(id);
|
||||||
|
diff --git a/lib/PluginServer/PluginServer.cpp b/lib/PluginServer/PluginServer.cpp
|
||||||
|
index d2a1736..8778019 100644
|
||||||
|
--- a/lib/PluginServer/PluginServer.cpp
|
||||||
|
+++ b/lib/PluginServer/PluginServer.cpp
|
||||||
|
@@ -46,6 +46,10 @@ bool PluginServer::RegisterOpt(std::shared_ptr<PluginOptBase> optBase)
|
||||||
|
if ((inject >= HANDLE_MAX) || (optBase == nullptr)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
+ if (inject == HANDLE_MANAGER_SETUP) {
|
||||||
|
+ log->LOGE("inject HANDLE_MANAGER_SETUP should use interface RegisterPassManagerOpt!\n");
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
string name = "funcname" + std::to_string((uintptr_t)optBase.get());
|
||||||
|
userOpts[inject].push_back(RecordedOpt(name, optBase));
|
||||||
|
diff --git a/user/ArrayWidenPass.cpp b/user/ArrayWidenPass.cpp
|
||||||
|
index 627e7f7..6fb187c 100644
|
||||||
|
--- a/user/ArrayWidenPass.cpp
|
||||||
|
+++ b/user/ArrayWidenPass.cpp
|
||||||
|
@@ -44,42 +44,6 @@ mlir::OpBuilder* opBuilder = nullptr;
|
||||||
|
std::map<Block*, Value> defs_map;
|
||||||
|
std::map<uint64_t, std::string> opNameMap;
|
||||||
|
|
||||||
|
-static void UserOptimizeFunc(void)
|
||||||
|
-{
|
||||||
|
- PluginServerAPI pluginAPI;
|
||||||
|
- vector<FunctionOp> allFunction = pluginAPI.GetAllFunc();
|
||||||
|
- int count = 0;
|
||||||
|
- for (size_t i = 0; i < allFunction.size(); i++) {
|
||||||
|
- if (allFunction[i].declaredInlineAttr().getValue())
|
||||||
|
- count++;
|
||||||
|
- }
|
||||||
|
- printf("declaredInline have %d functions were declared.\n", count);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static void LocalVarSummery(void)
|
||||||
|
-{
|
||||||
|
- PluginServerAPI pluginAPI;
|
||||||
|
- vector<mlir::Plugin::FunctionOp> allFunction = pluginAPI.GetAllFunc();
|
||||||
|
- map<string, string> args = PluginServer::GetInstance()->GetArgs();
|
||||||
|
- for (size_t i = 0; i < allFunction.size(); i++) {
|
||||||
|
- uint64_t funcID = allFunction[i].idAttr().getValue().getZExtValue();
|
||||||
|
- printf("In the %ldth function:\n", i);
|
||||||
|
- vector<mlir::Plugin::LocalDeclOp> decls = pluginAPI.GetDecls(funcID);
|
||||||
|
- int64_t typeFilter = -1u;
|
||||||
|
- if (args.find("type_code") != args.end()) {
|
||||||
|
- typeFilter = (int64_t)pluginAPI.GetTypeCodeFromString(args["type_code"]);
|
||||||
|
- }
|
||||||
|
- for (size_t j = 0; j < decls.size(); j++) {
|
||||||
|
- auto decl = decls[j];
|
||||||
|
- string name = decl.symNameAttr().getValue().str();
|
||||||
|
- int64_t declTypeID = decl.typeIDAttr().getValue().getZExtValue();
|
||||||
|
- if (declTypeID == typeFilter) {
|
||||||
|
- printf("\tFind %ldth target type %s\n", j, name.c_str());
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static void PassManagerSetupFunc(void)
|
||||||
|
{
|
||||||
|
printf("PassManagerSetupFunc in\n");
|
||||||
|
@@ -1385,7 +1349,7 @@ static void create_epilogue_loop_body_bb(Block *epilogue_loop_body_bb, Block* af
|
||||||
|
|
||||||
|
Value res = g.GetLHS();
|
||||||
|
cond_stmt = opBuilder->create<CondOp>(opBuilder->getUnknownLoc(),
|
||||||
|
- llvm::dyn_cast<CondOp>(originLoop.condOp1).condCode(), res, originLoop.limit, tb, fb, (epilogue_loop_body_bb));
|
||||||
|
+ llvm::dyn_cast<CondOp>(originLoop.condOp1).condCode(), lhs2, res, tb, fb, (epilogue_loop_body_bb));
|
||||||
|
|
||||||
|
defs_map.emplace(epilogue_loop_body_bb, baseSsa.GetCurrentDef());
|
||||||
|
}
|
||||||
|
@@ -1540,6 +1504,7 @@ static void ProcessArrayWiden(uint64_t *fun)
|
||||||
|
PluginServerAPI pluginAPI;
|
||||||
|
|
||||||
|
FunctionOp funcOp = pluginAPI.GetFunctionOpById((uint64_t)fun);
|
||||||
|
+ if (funcOp == nullptr) return;
|
||||||
|
|
||||||
|
context = funcOp.getOperation()->getContext();
|
||||||
|
mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context);
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
1046
0017-Refactoring-Modify-API-parameters-to-improve-usabili.patch
Normal file
1046
0017-Refactoring-Modify-API-parameters-to-improve-usabili.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,8 @@
|
|||||||
From 3f7bcee573a1b504a151f491c12e26e752c68cea Mon Sep 17 00:00:00 2001
|
From 3f7bcee573a1b504a151f491c12e26e752c68cea Mon Sep 17 00:00:00 2001
|
||||||
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
|
||||||
Date: Mon, 6 Mar 2023 11:51:49 +0800
|
Date: Mon, 6 Mar 2023 11:51:49 +0800
|
||||||
Subject: [PATCH] [Build] Fix strip problem.
|
Subject: [PATCH 18/23] [Build] Fix strip problem.
|
||||||
|
|
||||||
---
|
|
||||||
CMakeLists.txt | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
index 1cfb776..720bac9 100644
|
index 1cfb776..720bac9 100644
|
||||||
@ -20,5 +17,5 @@ index 1cfb776..720bac9 100644
|
|||||||
|
|
||||||
# pin_server
|
# pin_server
|
||||||
--
|
--
|
||||||
Gitee
|
2.33.0
|
||||||
|
|
||||||
174
0019-Pin-server-Init-a-SimpleIPAPASS.patch
Normal file
174
0019-Pin-server-Init-a-SimpleIPAPASS.patch
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
From eb6f6bde062764538a91e35792b06124cf91f0d3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: d00573793 <dingguangya1@huawei.com>
|
||||||
|
Date: Tue, 28 Feb 2023 21:11:35 +0800
|
||||||
|
Subject: [PATCH 19/23] [Pin-server] Init a SimpleIPAPASS
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 1cfb776..59dee9f 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -83,7 +83,8 @@ target_link_libraries(plg_grpc_proto
|
||||||
|
add_subdirectory(include)
|
||||||
|
add_subdirectory(lib)
|
||||||
|
add_library(pin_user SHARED
|
||||||
|
- "user/ArrayWidenPass.cpp"
|
||||||
|
+ # "user/ArrayWidenPass.cpp"
|
||||||
|
+ "user/StructReorder.cpp"
|
||||||
|
"user/InlineFunctionPass.cpp"
|
||||||
|
"user/LocalVarSummeryPass.cpp"
|
||||||
|
"user/user.cpp")
|
||||||
|
diff --git a/include/PluginServer/ManagerSetup.h b/include/PluginServer/ManagerSetup.h
|
||||||
|
index 27ba930..e264237 100755
|
||||||
|
--- a/include/PluginServer/ManagerSetup.h
|
||||||
|
+++ b/include/PluginServer/ManagerSetup.h
|
||||||
|
@@ -28,6 +28,7 @@ enum RefPassName {
|
||||||
|
PASS_PHIOPT,
|
||||||
|
PASS_SSA,
|
||||||
|
PASS_LOOP,
|
||||||
|
+ PASS_MAC,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum PassPosition {
|
||||||
|
diff --git a/include/user/StructReorder.h b/include/user/StructReorder.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1d05e56
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/include/user/StructReorder.h
|
||||||
|
@@ -0,0 +1,45 @@
|
||||||
|
+/* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
|
||||||
|
+
|
||||||
|
+ Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
+ not use this file except in compliance with the License. You may obtain
|
||||||
|
+ a copy of the License at
|
||||||
|
+
|
||||||
|
+ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
+
|
||||||
|
+ Unless required by applicable law or agreed to in writing, software
|
||||||
|
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
+ License for the specific language governing permissions and limitations
|
||||||
|
+ under the License.
|
||||||
|
+
|
||||||
|
+ Author: Mingchuan Wu and Yancheng Li
|
||||||
|
+ Create: 2022-08-18
|
||||||
|
+ Description:
|
||||||
|
+ This file contains the declaration of the StructReorderPass class.
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+#ifndef STRUCTREORDER_PASS_H
|
||||||
|
+#define STRUCTREORDER_PASS_H
|
||||||
|
+
|
||||||
|
+#include "PluginServer/PluginOptBase.h"
|
||||||
|
+
|
||||||
|
+namespace PluginOpt {
|
||||||
|
+class StructReorderPass : public PluginOptBase {
|
||||||
|
+public:
|
||||||
|
+ StructReorderPass() : PluginOptBase(HANDLE_MANAGER_SETUP)
|
||||||
|
+ {
|
||||||
|
+ }
|
||||||
|
+ bool Gate()
|
||||||
|
+ {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ int DoOptimize()
|
||||||
|
+ {
|
||||||
|
+ uint64_t *fun = (uint64_t *)GetFuncAddr();
|
||||||
|
+ return DoOptimize(fun);
|
||||||
|
+ }
|
||||||
|
+ int DoOptimize(uint64_t *fun);
|
||||||
|
+};
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
diff --git a/user/StructReorder.cpp b/user/StructReorder.cpp
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..bdc7abb
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/user/StructReorder.cpp
|
||||||
|
@@ -0,0 +1,59 @@
|
||||||
|
+/* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
|
||||||
|
+
|
||||||
|
+ Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
+ not use this file except in compliance with the License. You may obtain
|
||||||
|
+ a copy of the License at
|
||||||
|
+
|
||||||
|
+ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
+
|
||||||
|
+ Unless required by applicable law or agreed to in writing, software
|
||||||
|
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
+ License for the specific language governing permissions and limitations
|
||||||
|
+ under the License.
|
||||||
|
+
|
||||||
|
+ Author: Mingchuan Wu and Yancheng Li
|
||||||
|
+ Create: 2022-08-18
|
||||||
|
+ Description:
|
||||||
|
+ This file contains the implementation of the ArrayWidenPass class.
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+#include <iostream>
|
||||||
|
+#include <map>
|
||||||
|
+#include <set>
|
||||||
|
+#include <vector>
|
||||||
|
+#include <string>
|
||||||
|
+#include <sstream>
|
||||||
|
+#include "PluginAPI/PluginServerAPI.h"
|
||||||
|
+#include "PluginServer/PluginLog.h"
|
||||||
|
+#include "PluginAPI/ControlFlowAPI.h"
|
||||||
|
+#include "user/StructReorder.h"
|
||||||
|
+
|
||||||
|
+namespace PluginOpt {
|
||||||
|
+using std::string;
|
||||||
|
+using std::vector;
|
||||||
|
+using std::cout;
|
||||||
|
+using namespace mlir;
|
||||||
|
+using namespace mlir::Plugin;
|
||||||
|
+using namespace PluginAPI;
|
||||||
|
+using namespace PinServer;
|
||||||
|
+using namespace std;
|
||||||
|
+
|
||||||
|
+mlir::MLIRContext *context;
|
||||||
|
+mlir::OpBuilder* opBuilder = nullptr;
|
||||||
|
+std::map<Block*, Value> defs_map;
|
||||||
|
+std::map<uint64_t, std::string> opNameMap;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void ProcessStructReorder(uint64_t *fun)
|
||||||
|
+{
|
||||||
|
+ std::cout << "Running first pass, structreoder\n";
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int StructReorderPass::DoOptimize(uint64_t *fun)
|
||||||
|
+{
|
||||||
|
+ ProcessStructReorder(fun);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/user/user.cpp b/user/user.cpp
|
||||||
|
index 16f0687..ee2031a 100644
|
||||||
|
--- a/user/user.cpp
|
||||||
|
+++ b/user/user.cpp
|
||||||
|
@@ -22,12 +22,15 @@
|
||||||
|
#include "user/ArrayWidenPass.h"
|
||||||
|
#include "user/InlineFunctionPass.h"
|
||||||
|
#include "user/LocalVarSummeryPass.h"
|
||||||
|
+#include "user/StructReorder.h"
|
||||||
|
|
||||||
|
void RegisterCallbacks(void)
|
||||||
|
{
|
||||||
|
PinServer::PluginServer *pluginServer = PinServer::PluginServer::GetInstance();
|
||||||
|
- pluginServer->RegisterOpt(std::make_shared<PluginOpt::InlineFunctionPass>(PluginOpt::HANDLE_BEFORE_IPA));
|
||||||
|
- pluginServer->RegisterOpt(std::make_shared<PluginOpt::LocalVarSummeryPass>(PluginOpt::HANDLE_BEFORE_IPA));
|
||||||
|
+ // pluginServer->RegisterOpt(std::make_shared<PluginOpt::InlineFunctionPass>(PluginOpt::HANDLE_BEFORE_IPA));
|
||||||
|
+ // pluginServer->RegisterOpt(std::make_shared<PluginOpt::LocalVarSummeryPass>(PluginOpt::HANDLE_BEFORE_IPA));
|
||||||
|
// PluginOpt::ManagerSetup setupData(PluginOpt::PASS_PHIOPT, 1, PluginOpt::PASS_INSERT_AFTER);
|
||||||
|
// pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::ArrayWidenPass>());
|
||||||
|
+ PluginOpt::ManagerSetup setupData(PluginOpt::PASS_MAC, 1, PluginOpt::PASS_INSERT_AFTER);
|
||||||
|
+ pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::StructReorderPass>());
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
325
0020-Pin-server-Add-CGnodeOp.patch
Normal file
325
0020-Pin-server-Add-CGnodeOp.patch
Normal file
@ -0,0 +1,325 @@
|
|||||||
|
From bf910a189fdbf1be97dbbb2fa8e4b7d14163d002 Mon Sep 17 00:00:00 2001
|
||||||
|
From: d00573793 <dingguangya1@huawei.com>
|
||||||
|
Date: Fri, 3 Mar 2023 10:52:13 +0800
|
||||||
|
Subject: [PATCH 20/23] [Pin-server] Add CGnodeOp
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
||||||
|
index 93ba116..9554067 100644
|
||||||
|
--- a/include/Dialect/PluginOps.td
|
||||||
|
+++ b/include/Dialect/PluginOps.td
|
||||||
|
@@ -22,6 +22,34 @@ include "PluginDialect.td"
|
||||||
|
include "mlir/Interfaces/SideEffectInterfaces.td"
|
||||||
|
include "mlir/Interfaces/CallInterfaces.td"
|
||||||
|
|
||||||
|
+def CGnodeOp : Plugin_Op<"callgraphnode", [NoSideEffect]> {
|
||||||
|
+ let summary = "callgraph node operation";
|
||||||
|
+ let description = [{
|
||||||
|
+ TODO.
|
||||||
|
+ }];
|
||||||
|
+
|
||||||
|
+ let arguments = (ins UI64Attr:$id,
|
||||||
|
+ StrAttr:$symbolName,
|
||||||
|
+ OptionalAttr<BoolAttr>:$definition,
|
||||||
|
+ UI32Attr:$order);
|
||||||
|
+ let regions = (region AnyRegion:$bodyRegion);
|
||||||
|
+
|
||||||
|
+ // Add custom build methods for the operation. These method populates
|
||||||
|
+ // the `state` that MLIR uses to create operations, i.e. these are used when
|
||||||
|
+ // using `builder.create<Op>(...)`.
|
||||||
|
+ let builders = [
|
||||||
|
+ OpBuilderDAG<(ins "uint64_t":$id,
|
||||||
|
+ "StringRef":$symbolName,
|
||||||
|
+ "bool":$definition,
|
||||||
|
+ "uint32_t":$order)>
|
||||||
|
+ ];
|
||||||
|
+
|
||||||
|
+ let extraClassDeclaration = [{
|
||||||
|
+ // Value GetDecl();
|
||||||
|
+ bool IsRealSymbol();
|
||||||
|
+ }];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
def FunctionOp : Plugin_Op<"function", [NoSideEffect]> {
|
||||||
|
let summary = "function with a region";
|
||||||
|
let description = [{
|
||||||
|
diff --git a/include/PluginAPI/BasicPluginOpsAPI.h b/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
index 923dd44..e8c0a50 100644
|
||||||
|
--- a/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
+++ b/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
@@ -45,6 +45,10 @@ public:
|
||||||
|
virtual int GetDeclSourceLine(int64_t) = 0;
|
||||||
|
virtual int GetDeclSourceColumn(int64_t) = 0;
|
||||||
|
|
||||||
|
+ // CGnodeOp
|
||||||
|
+ virtual vector<CGnodeOp> GetAllCGnode() = 0;
|
||||||
|
+ virtual CGnodeOp GetCGnodeOpById(uint64_t) = 0;
|
||||||
|
+
|
||||||
|
virtual vector<FunctionOp> GetAllFunc() = 0;
|
||||||
|
virtual FunctionOp GetFunctionOpById(uint64_t) = 0;
|
||||||
|
virtual vector<LocalDeclOp> GetDecls(uint64_t) = 0;
|
||||||
|
diff --git a/include/PluginAPI/PluginServerAPI.h b/include/PluginAPI/PluginServerAPI.h
|
||||||
|
index 3da28f5..71b59b0 100644
|
||||||
|
--- a/include/PluginAPI/PluginServerAPI.h
|
||||||
|
+++ b/include/PluginAPI/PluginServerAPI.h
|
||||||
|
@@ -36,6 +36,12 @@ public:
|
||||||
|
PluginServerAPI () = default;
|
||||||
|
~PluginServerAPI () = default;
|
||||||
|
|
||||||
|
+ // CGnodeOp
|
||||||
|
+ vector<CGnodeOp> GetAllCGnode() override;
|
||||||
|
+ CGnodeOp GetCGnodeOpById(uint64_t) override;
|
||||||
|
+ // mlir::Value GetDeclFromCGnode(uint64_t);
|
||||||
|
+ bool IsRealSymbolOfCGnode(uint64_t);
|
||||||
|
+
|
||||||
|
vector<FunctionOp> GetAllFunc() override;
|
||||||
|
FunctionOp GetFunctionOpById(uint64_t);
|
||||||
|
vector<LocalDeclOp> GetDecls(uint64_t) override;
|
||||||
|
diff --git a/include/PluginServer/PluginCom.h b/include/PluginServer/PluginCom.h
|
||||||
|
index 6535362..d507b6f 100755
|
||||||
|
--- a/include/PluginServer/PluginCom.h
|
||||||
|
+++ b/include/PluginServer/PluginCom.h
|
||||||
|
@@ -57,6 +57,7 @@ public:
|
||||||
|
string GetStringDataResult(void);
|
||||||
|
vector<mlir::Plugin::FunctionOp> GetFunctionOpResult(void);
|
||||||
|
vector<mlir::Plugin::LocalDeclOp> GetLocalDeclResult(void);
|
||||||
|
+ mlir::Plugin::CGnodeOp GetCGnodeOpResult(void);
|
||||||
|
mlir::Plugin::LoopOp LoopOpResult(void);
|
||||||
|
vector<mlir::Plugin::LoopOp> LoopOpsResult(void);
|
||||||
|
vector<std::pair<mlir::Block*, mlir::Block*> > EdgesResult(void);
|
||||||
|
@@ -73,6 +74,7 @@ private:
|
||||||
|
PluginJson json;
|
||||||
|
int64_t integerResult;
|
||||||
|
string stringResult;
|
||||||
|
+ mlir::Plugin::CGnodeOp cgnode;
|
||||||
|
vector<mlir::Plugin::FunctionOp> funcOpData;
|
||||||
|
vector<mlir::Plugin::LocalDeclOp> decls;
|
||||||
|
vector<mlir::Plugin::LoopOp> loops;
|
||||||
|
diff --git a/include/PluginServer/PluginJson.h b/include/PluginServer/PluginJson.h
|
||||||
|
index 8e00afa..eddbb2a 100755
|
||||||
|
--- a/include/PluginServer/PluginJson.h
|
||||||
|
+++ b/include/PluginServer/PluginJson.h
|
||||||
|
@@ -33,6 +33,9 @@ using std::vector;
|
||||||
|
namespace PinJson {
|
||||||
|
class PluginJson {
|
||||||
|
public:
|
||||||
|
+ // CGnodeOp
|
||||||
|
+ mlir::Plugin::CGnodeOp CGnodeOpJsonDeSerialize(const string& data);
|
||||||
|
+
|
||||||
|
void FuncOpJsonDeSerialize(const string&, vector<mlir::Plugin::FunctionOp>&);
|
||||||
|
void LocalDeclOpJsonDeSerialize(const string&,
|
||||||
|
vector<mlir::Plugin::LocalDeclOp>&);
|
||||||
|
diff --git a/include/PluginServer/PluginServer.h b/include/PluginServer/PluginServer.h
|
||||||
|
index b651140..d993505 100644
|
||||||
|
--- a/include/PluginServer/PluginServer.h
|
||||||
|
+++ b/include/PluginServer/PluginServer.h
|
||||||
|
@@ -163,6 +163,11 @@ public:
|
||||||
|
RemoteCallClientWithAPI(funName, params);
|
||||||
|
return pluginCom.GetLocalDeclResult();
|
||||||
|
}
|
||||||
|
+ mlir::Plugin::CGnodeOp GetCGnodeOpResult(const string& funName, const string& params)
|
||||||
|
+ {
|
||||||
|
+ RemoteCallClientWithAPI(funName, params);
|
||||||
|
+ return pluginCom.GetCGnodeOpResult();
|
||||||
|
+ }
|
||||||
|
mlir::Plugin::LoopOp LoopOpResult(const string& funName, const string& params)
|
||||||
|
{
|
||||||
|
RemoteCallClientWithAPI(funName, params);
|
||||||
|
diff --git a/include/user/StructReorder.h b/include/user/StructReorder.h
|
||||||
|
index 1d05e56..3938121 100644
|
||||||
|
--- a/include/user/StructReorder.h
|
||||||
|
+++ b/include/user/StructReorder.h
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
|
||||||
|
#include "PluginServer/PluginOptBase.h"
|
||||||
|
|
||||||
|
+
|
||||||
|
namespace PluginOpt {
|
||||||
|
class StructReorderPass : public PluginOptBase {
|
||||||
|
public:
|
||||||
|
diff --git a/lib/Dialect/PluginOps.cpp b/lib/Dialect/PluginOps.cpp
|
||||||
|
index ab0e3ce..928dc53 100644
|
||||||
|
--- a/lib/Dialect/PluginOps.cpp
|
||||||
|
+++ b/lib/Dialect/PluginOps.cpp
|
||||||
|
@@ -87,6 +87,36 @@ static uint64_t getBlockAddress(mlir::Block* b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+// ===----------------------------------------------------------------------===//
|
||||||
|
+// CGnodeOp
|
||||||
|
+
|
||||||
|
+void CGnodeOp::build(OpBuilder &builder, OperationState &state,
|
||||||
|
+ uint64_t id, StringRef symbolName, bool definition,
|
||||||
|
+ uint32_t order)
|
||||||
|
+{
|
||||||
|
+ state.addRegion();
|
||||||
|
+ state.addAttribute("id", builder.getI64IntegerAttr(id));
|
||||||
|
+ state.addAttribute("symbolName", builder.getStringAttr(symbolName));
|
||||||
|
+ state.addAttribute("definition", builder.getBoolAttr(definition));
|
||||||
|
+ state.addAttribute("order", builder.getI32IntegerAttr(order));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+// Value CGnodeOp::GetDecl()
|
||||||
|
+// {
|
||||||
|
+// PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+// uint64_t nodeId = idAttr().getInt();
|
||||||
|
+// return pluginAPI.GetDeclFromCGnode(nodeId);
|
||||||
|
+// }
|
||||||
|
+
|
||||||
|
+bool CGnodeOp::IsRealSymbol()
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t nodeId = idAttr().getInt();
|
||||||
|
+ return pluginAPI.IsRealSymbolOfCGnode(nodeId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+// ===----------------------------------------------------------------------===//
|
||||||
|
+
|
||||||
|
void FunctionOp::build(OpBuilder &builder, OperationState &state,
|
||||||
|
uint64_t id, StringRef funcName, bool declaredInline, Type type)
|
||||||
|
{
|
||||||
|
diff --git a/lib/PluginAPI/PluginServerAPI.cpp b/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
index ff9c90e..5297357 100644
|
||||||
|
--- a/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
+++ b/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
@@ -171,6 +171,42 @@ mlir::Value PluginServerAPI::CreateSSAOp(mlir::Type t)
|
||||||
|
return PluginServer::GetInstance()->GetValueResult(funName, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
+// CGnodeOp ===============
|
||||||
|
+
|
||||||
|
+vector<CGnodeOp> PluginServerAPI::GetAllCGnode()
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = "GetCGnodeIDs";
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ vector<CGnodeOp> res;
|
||||||
|
+ vector<uint64_t> ids = PluginServer::GetInstance()->GetIdsResult(funName, params);
|
||||||
|
+ for (auto id : ids) {
|
||||||
|
+ res.push_back(GetCGnodeOpById(id));
|
||||||
|
+ }
|
||||||
|
+ return res;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+CGnodeOp PluginServerAPI::GetCGnodeOpById(uint64_t id)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["id"] = std::to_string(id);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ CGnodeOp cgnodeop = PluginServer::GetInstance()->GetCGnodeOpResult(funName, params);
|
||||||
|
+ return cgnodeop;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+bool PluginServerAPI::IsRealSymbolOfCGnode(uint64_t id)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["id"] = std::to_string(id);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ return PluginServer::GetInstance()->GetBoolResult(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+// ========================
|
||||||
|
+
|
||||||
|
vector<FunctionOp> PluginServerAPI::GetAllFunc()
|
||||||
|
{
|
||||||
|
Json::Value root;
|
||||||
|
diff --git a/lib/PluginServer/PluginCom.cpp b/lib/PluginServer/PluginCom.cpp
|
||||||
|
index ab171c7..ddf0605 100755
|
||||||
|
--- a/lib/PluginServer/PluginCom.cpp
|
||||||
|
+++ b/lib/PluginServer/PluginCom.cpp
|
||||||
|
@@ -59,6 +59,12 @@ vector<mlir::Plugin::LocalDeclOp> PluginCom::GetLocalDeclResult(void)
|
||||||
|
return retOps;
|
||||||
|
}
|
||||||
|
|
||||||
|
+mlir::Plugin::CGnodeOp PluginCom::GetCGnodeOpResult(void)
|
||||||
|
+{
|
||||||
|
+ mlir::Plugin::CGnodeOp retop = cgnode;
|
||||||
|
+ return retop;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
vector<mlir::Plugin::LoopOp> PluginCom::LoopOpsResult(void)
|
||||||
|
{
|
||||||
|
vector<mlir::Plugin::LoopOp> retLoops = loops;
|
||||||
|
@@ -125,6 +131,8 @@ void PluginCom::JsonDeSerialize(const string& key, const string& data)
|
||||||
|
{
|
||||||
|
if (key == "FuncOpResult") {
|
||||||
|
json.FuncOpJsonDeSerialize(data, this->funcOpData);
|
||||||
|
+ } else if (key == "CGnodeOpResult") {
|
||||||
|
+ this->cgnode = json.CGnodeOpJsonDeSerialize(data);
|
||||||
|
} else if (key == "LocalDeclOpResult") {
|
||||||
|
json.LocalDeclOpJsonDeSerialize(data, this->decls);
|
||||||
|
} else if (key == "LoopOpResult") {
|
||||||
|
diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp
|
||||||
|
index 14a6ef4..ba2136b 100755
|
||||||
|
--- a/lib/PluginServer/PluginJson.cpp
|
||||||
|
+++ b/lib/PluginServer/PluginJson.cpp
|
||||||
|
@@ -328,6 +328,25 @@ void PluginJson::StringDeSerialize(const string& data, string& result)
|
||||||
|
result = root["stringData"].asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
+CGnodeOp PluginJson::CGnodeOpJsonDeSerialize(const string& data)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ Json::Reader reader;
|
||||||
|
+ reader.parse(data, root);
|
||||||
|
+ fprintf(stderr, "dgy server cgnode json %s\n", root.toStyledString().c_str());
|
||||||
|
+
|
||||||
|
+ mlir::OpBuilder builder(PluginServer::GetInstance()->GetContext());
|
||||||
|
+ uint64_t id = GetID(root["id"]);
|
||||||
|
+ Json::Value attributes = root["attributes"];
|
||||||
|
+ uint32_t order = GetID(attributes["order"]);
|
||||||
|
+ map<string, string> nodeAttributes;
|
||||||
|
+ JsonGetAttributes(attributes, nodeAttributes);
|
||||||
|
+ bool definition = false;
|
||||||
|
+ if (nodeAttributes["definition"] == "1") definition = true;
|
||||||
|
+ auto location = builder.getUnknownLoc();
|
||||||
|
+ return builder.create<CGnodeOp>(location, id, nodeAttributes["symbolName"], definition, order);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void PluginJson::FuncOpJsonDeSerialize(
|
||||||
|
const string& data, vector<mlir::Plugin::FunctionOp>& funcOpData)
|
||||||
|
{
|
||||||
|
diff --git a/user/StructReorder.cpp b/user/StructReorder.cpp
|
||||||
|
index bdc7abb..a23d256 100644
|
||||||
|
--- a/user/StructReorder.cpp
|
||||||
|
+++ b/user/StructReorder.cpp
|
||||||
|
@@ -47,8 +47,33 @@ std::map<uint64_t, std::string> opNameMap;
|
||||||
|
|
||||||
|
static void ProcessStructReorder(uint64_t *fun)
|
||||||
|
{
|
||||||
|
- std::cout << "Running first pass, structreoder\n";
|
||||||
|
+ fprintf(stderr, "Running first pass, structreoder\n");
|
||||||
|
|
||||||
|
+ PluginServerAPI pluginAPI;
|
||||||
|
+ vector<CGnodeOp> allnodes = pluginAPI.GetAllCGnode();
|
||||||
|
+ fprintf(stderr, "allnodes size is %d\n", allnodes.size());
|
||||||
|
+ for (auto &nodeOp : allnodes) {
|
||||||
|
+ context = nodeOp.getOperation()->getContext();
|
||||||
|
+ mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context);
|
||||||
|
+ opBuilder = &opBuilder_temp;
|
||||||
|
+ string name = nodeOp.symbolNameAttr().getValue().str();
|
||||||
|
+ fprintf(stderr, "Now process symbol : %s \n", name.c_str());
|
||||||
|
+ uint32_t order = nodeOp.orderAttr().getInt();
|
||||||
|
+ fprintf(stderr, "Now process order : %d \n", order);
|
||||||
|
+ if (nodeOp.IsRealSymbol())
|
||||||
|
+ fprintf(stderr, "Now process IsRealSymbol \n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ vector<FunctionOp> allFunction = pluginAPI.GetAllFunc();
|
||||||
|
+ fprintf(stderr, "allfun size is %d\n", allFunction.size());
|
||||||
|
+ for (auto &funcOp : allFunction) {
|
||||||
|
+ context = funcOp.getOperation()->getContext();
|
||||||
|
+ mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context);
|
||||||
|
+ opBuilder = &opBuilder_temp;
|
||||||
|
+ string name = funcOp.funcNameAttr().getValue().str();
|
||||||
|
+ fprintf(stderr, "Now process func : %s \n", name.c_str());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
}
|
||||||
|
|
||||||
|
int StructReorderPass::DoOptimize(uint64_t *fun)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
From 28e8bb19d239ba0e223a980c85da41950fb97295 Mon Sep 17 00:00:00 2001
|
||||||
|
From: d00573793 <dingguangya1@huawei.com>
|
||||||
|
Date: Fri, 3 Mar 2023 11:12:44 +0800
|
||||||
|
Subject: [PATCH 21/23] [Pin-server] The lto flag is used to control the pass
|
||||||
|
execution.
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/include/user/StructReorder.h b/include/user/StructReorder.h
|
||||||
|
index 3938121..d3e4486 100644
|
||||||
|
--- a/include/user/StructReorder.h
|
||||||
|
+++ b/include/user/StructReorder.h
|
||||||
|
@@ -30,10 +30,8 @@ public:
|
||||||
|
StructReorderPass() : PluginOptBase(HANDLE_MANAGER_SETUP)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
- bool Gate()
|
||||||
|
- {
|
||||||
|
- return true;
|
||||||
|
- }
|
||||||
|
+ bool Gate();
|
||||||
|
+
|
||||||
|
int DoOptimize()
|
||||||
|
{
|
||||||
|
uint64_t *fun = (uint64_t *)GetFuncAddr();
|
||||||
|
diff --git a/user/StructReorder.cpp b/user/StructReorder.cpp
|
||||||
|
index a23d256..612a093 100644
|
||||||
|
--- a/user/StructReorder.cpp
|
||||||
|
+++ b/user/StructReorder.cpp
|
||||||
|
@@ -81,4 +81,18 @@ int StructReorderPass::DoOptimize(uint64_t *fun)
|
||||||
|
ProcessStructReorder(fun);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+bool StructReorderPass::Gate()
|
||||||
|
+{
|
||||||
|
+ PluginServerAPI pluginAPI;
|
||||||
|
+ if (pluginAPI.IsLtoOptimize()) {
|
||||||
|
+ fprintf(stderr, "\n The LTO flag is open \n");
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ if (pluginAPI.IsWholeProgram()) {
|
||||||
|
+ fprintf(stderr, "\n The whole program flag is open \n");
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
}
|
||||||
|
\ No newline at end of file
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
701
0022-Pin-server-Add-support-for-decl-and-field-SetDeclNam.patch
Normal file
701
0022-Pin-server-Add-support-for-decl-and-field-SetDeclNam.patch
Normal file
@ -0,0 +1,701 @@
|
|||||||
|
From d41c7945688f533b15c9ef1d9f41a00cbd7afbdf Mon Sep 17 00:00:00 2001
|
||||||
|
From: huitailangzju <804544223@qq.com>
|
||||||
|
Date: Mon, 6 Mar 2023 10:17:31 +0800
|
||||||
|
Subject: [PATCH 22/23] [Pin-server] Add support for decl and field:
|
||||||
|
SetDeclName,
|
||||||
|
SetDeclType,SetDeclAlign,SetUserAlign,SetSourceLocation,SetAddressable,SetNonAddressablep,SetVolatile,SetDeclContext,SetDeclChain
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/include/Dialect/PluginDialect.td b/include/Dialect/PluginDialect.td
|
||||||
|
index b618b59..56f2e4c 100644
|
||||||
|
--- a/include/Dialect/PluginDialect.td
|
||||||
|
+++ b/include/Dialect/PluginDialect.td
|
||||||
|
@@ -78,12 +78,14 @@ def IDefineCodeConstructor : I32EnumAttrCase<"Constructor", 9>;
|
||||||
|
def IDefineCodeVec : I32EnumAttrCase<"Vec", 10>;
|
||||||
|
def IDefineCodeBLOCK : I32EnumAttrCase<"BLOCK", 11>;
|
||||||
|
def IDefineCodeCOMPONENT : I32EnumAttrCase<"COMPONENT", 12>;
|
||||||
|
-def IDefineCodeUNDEF : I32EnumAttrCase<"UNDEF", 13>;
|
||||||
|
+def IDefineCodeTYPEDECL : I32EnumAttrCase<"TYPEDECL", 13>;
|
||||||
|
+def IDefineCodeUNDEF : I32EnumAttrCase<"UNDEF", 14>;
|
||||||
|
def IDefineCodeAttr : I32EnumAttr<
|
||||||
|
"IDefineCode", "plugin define code",
|
||||||
|
[IDefineCodeMemRef, IDefineCodeIntCST, IDefineCodeSSA, IDefineCodeLIST,
|
||||||
|
IDefineCodeStrCST, IDefineCodeArrayRef, IDefineCodeDecl, IDefineCodeFieldDecl, IDefineCodeAddrExp,
|
||||||
|
- IDefineCodeConstructor, IDefineCodeVec, IDefineCodeBLOCK, IDefineCodeCOMPONENT, IDefineCodeUNDEF]>{
|
||||||
|
+ IDefineCodeConstructor, IDefineCodeVec, IDefineCodeBLOCK, IDefineCodeCOMPONENT, IDefineCodeTYPEDECL,
|
||||||
|
+ IDefineCodeUNDEF]>{
|
||||||
|
let cppNamespace = "::mlir::Plugin";
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/include/Dialect/PluginOps.td b/include/Dialect/PluginOps.td
|
||||||
|
index 9554067..6c4d80f 100644
|
||||||
|
--- a/include/Dialect/PluginOps.td
|
||||||
|
+++ b/include/Dialect/PluginOps.td
|
||||||
|
@@ -375,6 +375,19 @@ def FieldDeclOp : FieldDecl<"field"> {
|
||||||
|
Optional<uint64_t> GetChain() { return chain(); }
|
||||||
|
Value GetFieldOffset() { return fieldOffset(); }
|
||||||
|
Value GetFieldBitOffset() { return fieldBitOffset(); }
|
||||||
|
+
|
||||||
|
+ void SetName(FieldDeclOp);
|
||||||
|
+ void SetType(FieldDeclOp);
|
||||||
|
+ void SetDeclAlign(FieldDeclOp);
|
||||||
|
+ void SetSourceLocation(FieldDeclOp);
|
||||||
|
+ void SetUserAlign(FieldDeclOp);
|
||||||
|
+ void SetAddressable(FieldDeclOp);
|
||||||
|
+ void SetNonAddressablep(FieldDeclOp);
|
||||||
|
+ void SetVolatile(FieldDeclOp);
|
||||||
|
+ void SetDeclContext(uint64_t);
|
||||||
|
+ void SetDeclChain(FieldDeclOp);
|
||||||
|
+
|
||||||
|
+ unsigned GetTypeSize();
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/include/PluginAPI/BasicPluginOpsAPI.h b/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
index e8c0a50..d659662 100644
|
||||||
|
--- a/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
+++ b/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
@@ -51,6 +51,28 @@ public:
|
||||||
|
|
||||||
|
virtual vector<FunctionOp> GetAllFunc() = 0;
|
||||||
|
virtual FunctionOp GetFunctionOpById(uint64_t) = 0;
|
||||||
|
+ virtual vector<mlir::Plugin::DeclBaseOp> GetFuncDecls(uint64_t) = 0;
|
||||||
|
+ virtual llvm::SmallVector<mlir::Plugin::FieldDeclOp> GetFields(uint64_t) = 0;
|
||||||
|
+ virtual mlir::Plugin::DeclBaseOp BuildDecl(IDefineCode, llvm::StringRef, PluginIR::PluginTypeBase) = 0;
|
||||||
|
+
|
||||||
|
+ virtual mlir::Plugin::FieldDeclOp MakeNode(IDefineCode) = 0;
|
||||||
|
+ virtual void SetDeclName(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void SetDeclType(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void SetDeclAlign(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void SetUserAlign(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void SetSourceLocation(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void SetAddressable(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void SetNonAddressablep(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void SetVolatile(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void SetDeclContext(uint64_t newfieldId, uint64_t declId) = 0;
|
||||||
|
+ virtual void SetDeclChain(uint64_t newfieldId, uint64_t fieldId) = 0;
|
||||||
|
+
|
||||||
|
+ virtual unsigned GetDeclTypeSize(uint64_t declId) = 0;
|
||||||
|
+
|
||||||
|
+ virtual void SetTypeFields(uint64_t declId, uint64_t fieldId) = 0;
|
||||||
|
+ virtual void LayoutType(uint64_t declId) = 0;
|
||||||
|
+ virtual void LayoutDecl(uint64_t declId) = 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 71b59b0..239dd23 100644
|
||||||
|
--- a/include/PluginAPI/PluginServerAPI.h
|
||||||
|
+++ b/include/PluginAPI/PluginServerAPI.h
|
||||||
|
@@ -44,6 +44,28 @@ public:
|
||||||
|
|
||||||
|
vector<FunctionOp> GetAllFunc() override;
|
||||||
|
FunctionOp GetFunctionOpById(uint64_t);
|
||||||
|
+ vector<mlir::Plugin::DeclBaseOp> GetFuncDecls(uint64_t) override;
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::FieldDeclOp> GetFields(uint64_t) override;
|
||||||
|
+ mlir::Plugin::DeclBaseOp BuildDecl(IDefineCode, llvm::StringRef, PluginIR::PluginTypeBase) override;
|
||||||
|
+
|
||||||
|
+ mlir::Plugin::FieldDeclOp MakeNode(IDefineCode) override;
|
||||||
|
+ void SetDeclName(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+ void SetDeclType(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+ void SetDeclAlign(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+ void SetUserAlign(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+ void SetSourceLocation(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+ void SetAddressable(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+ void SetNonAddressablep(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+ void SetVolatile(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+ void SetDeclContext(uint64_t newfieldId, uint64_t declId) override;
|
||||||
|
+ void SetDeclChain(uint64_t newfieldId, uint64_t fieldId) override;
|
||||||
|
+
|
||||||
|
+ unsigned GetDeclTypeSize(uint64_t declId) override;
|
||||||
|
+
|
||||||
|
+ void SetTypeFields(uint64_t declId, uint64_t fieldId) override;
|
||||||
|
+ void LayoutType(uint64_t declId) override;
|
||||||
|
+ void LayoutDecl(uint64_t declId) override;
|
||||||
|
+
|
||||||
|
vector<LocalDeclOp> GetDecls(uint64_t) override;
|
||||||
|
PhiOp GetPhiOp(uint64_t) override;
|
||||||
|
CallOp GetCallOp(uint64_t) override;
|
||||||
|
diff --git a/include/PluginServer/PluginCom.h b/include/PluginServer/PluginCom.h
|
||||||
|
index d507b6f..af819ad 100755
|
||||||
|
--- a/include/PluginServer/PluginCom.h
|
||||||
|
+++ b/include/PluginServer/PluginCom.h
|
||||||
|
@@ -57,6 +57,12 @@ public:
|
||||||
|
string GetStringDataResult(void);
|
||||||
|
vector<mlir::Plugin::FunctionOp> GetFunctionOpResult(void);
|
||||||
|
vector<mlir::Plugin::LocalDeclOp> GetLocalDeclResult(void);
|
||||||
|
+ vector<mlir::Plugin::DeclBaseOp> GetFuncDeclsResult(void);
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::FieldDeclOp> GetFieldsResult(void);
|
||||||
|
+ mlir::Plugin::DeclBaseOp GetBuildDeclResult(void);
|
||||||
|
+
|
||||||
|
+ mlir::Plugin::FieldDeclOp GetMakeNodeResult(void);
|
||||||
|
+
|
||||||
|
mlir::Plugin::CGnodeOp GetCGnodeOpResult(void);
|
||||||
|
mlir::Plugin::LoopOp LoopOpResult(void);
|
||||||
|
vector<mlir::Plugin::LoopOp> LoopOpsResult(void);
|
||||||
|
@@ -77,6 +83,7 @@ private:
|
||||||
|
mlir::Plugin::CGnodeOp cgnode;
|
||||||
|
vector<mlir::Plugin::FunctionOp> funcOpData;
|
||||||
|
vector<mlir::Plugin::LocalDeclOp> decls;
|
||||||
|
+ vector<mlir::Plugin::DeclBaseOp> declOps;
|
||||||
|
vector<mlir::Plugin::LoopOp> loops;
|
||||||
|
mlir::Plugin::LoopOp loop;
|
||||||
|
vector<std::pair<mlir::Block*, mlir::Block*> > edges;
|
||||||
|
@@ -86,6 +93,9 @@ private:
|
||||||
|
uint64_t idResult;
|
||||||
|
vector<uint64_t> idsResult;
|
||||||
|
mlir::Value valueResult;
|
||||||
|
+ mlir::Plugin::DeclBaseOp declOp;
|
||||||
|
+ mlir::Plugin::FieldDeclOp fielddeclOp;
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::FieldDeclOp> fieldsOps;
|
||||||
|
};
|
||||||
|
} // namespace PinCom
|
||||||
|
|
||||||
|
diff --git a/include/PluginServer/PluginJson.h b/include/PluginServer/PluginJson.h
|
||||||
|
index eddbb2a..1d4bfbc 100755
|
||||||
|
--- a/include/PluginServer/PluginJson.h
|
||||||
|
+++ b/include/PluginServer/PluginJson.h
|
||||||
|
@@ -39,6 +39,9 @@ public:
|
||||||
|
void FuncOpJsonDeSerialize(const string&, vector<mlir::Plugin::FunctionOp>&);
|
||||||
|
void LocalDeclOpJsonDeSerialize(const string&,
|
||||||
|
vector<mlir::Plugin::LocalDeclOp>&);
|
||||||
|
+ void FuncDeclsOpJsonDeSerialize(const string&,
|
||||||
|
+ vector<mlir::Plugin::DeclBaseOp>&);
|
||||||
|
+ void FieldOpsJsonDeSerialize(const string&, llvm::SmallVector<mlir::Plugin::FieldDeclOp>&);
|
||||||
|
void LoopOpsJsonDeSerialize(const string&, vector<mlir::Plugin::LoopOp>&);
|
||||||
|
void EdgesJsonDeSerialize(const string&,
|
||||||
|
vector<std::pair<mlir::Block*, mlir::Block*>>&);
|
||||||
|
diff --git a/include/PluginServer/PluginServer.h b/include/PluginServer/PluginServer.h
|
||||||
|
index d993505..29a790b 100644
|
||||||
|
--- a/include/PluginServer/PluginServer.h
|
||||||
|
+++ b/include/PluginServer/PluginServer.h
|
||||||
|
@@ -158,6 +158,31 @@ public:
|
||||||
|
RemoteCallClientWithAPI(funName, params);
|
||||||
|
return pluginCom.GetFunctionOpResult();
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ vector<mlir::Plugin::DeclBaseOp> GetFuncDeclsResult(const string& funName, const string& params)
|
||||||
|
+ {
|
||||||
|
+ RemoteCallClientWithAPI(funName, params);
|
||||||
|
+ return pluginCom.GetFuncDeclsResult();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ mlir::Plugin::FieldDeclOp GetMakeNodeResult(const string& funName, const string& params)
|
||||||
|
+ {
|
||||||
|
+ RemoteCallClientWithAPI(funName, params);
|
||||||
|
+ return pluginCom.GetMakeNodeResult();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::FieldDeclOp> GetFieldsResult(const string& funName, const string& params)
|
||||||
|
+ {
|
||||||
|
+ RemoteCallClientWithAPI(funName, params);
|
||||||
|
+ return pluginCom.GetFieldsResult();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ mlir::Plugin::DeclBaseOp GetBuildDeclResult(const string& funName, const string& params)
|
||||||
|
+ {
|
||||||
|
+ RemoteCallClientWithAPI(funName, params);
|
||||||
|
+ return pluginCom.GetBuildDeclResult();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
vector<mlir::Plugin::LocalDeclOp> GetLocalDeclResult(const string& funName, const string& params)
|
||||||
|
{
|
||||||
|
RemoteCallClientWithAPI(funName, params);
|
||||||
|
diff --git a/include/user/ArrayWidenPass.h b/include/user/ArrayWidenPass.h
|
||||||
|
index 38c692d..5528297 100755
|
||||||
|
--- a/include/user/ArrayWidenPass.h
|
||||||
|
+++ b/include/user/ArrayWidenPass.h
|
||||||
|
@@ -35,10 +35,10 @@ public:
|
||||||
|
}
|
||||||
|
int DoOptimize()
|
||||||
|
{
|
||||||
|
- uint64_t *fun = (uint64_t *)GetFuncAddr();
|
||||||
|
+ uint64_t fun = (uint64_t)GetFuncAddr();
|
||||||
|
return DoOptimize(fun);
|
||||||
|
}
|
||||||
|
- int DoOptimize(uint64_t *fun);
|
||||||
|
+ int DoOptimize(uint64_t fun);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/lib/Dialect/PluginOps.cpp b/lib/Dialect/PluginOps.cpp
|
||||||
|
index 928dc53..57b06b4 100644
|
||||||
|
--- a/lib/Dialect/PluginOps.cpp
|
||||||
|
+++ b/lib/Dialect/PluginOps.cpp
|
||||||
|
@@ -432,6 +432,82 @@ void FieldDeclOp::build(OpBuilder &builder, OperationState &state, uint64_t id,
|
||||||
|
state.addTypes(retType);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void FieldDeclOp::SetName(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ unsigned idx = 1;
|
||||||
|
+ this->setOperand(idx ,field.GetName());
|
||||||
|
+ return pluginAPI.SetDeclName(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetType(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ return pluginAPI.SetDeclType(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetDeclAlign(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ return pluginAPI.SetDeclAlign(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetUserAlign(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ return pluginAPI.SetUserAlign(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+unsigned FieldDeclOp::GetTypeSize()
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ return pluginAPI.GetDeclTypeSize(this->idAttr().getInt());
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetSourceLocation(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ return pluginAPI.SetSourceLocation(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetAddressable(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ return pluginAPI.SetAddressable(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetNonAddressablep(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ return pluginAPI.SetNonAddressablep(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetVolatile(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ return pluginAPI.SetVolatile(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetDeclContext(uint64_t declId)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ return pluginAPI.SetDeclContext(this->idAttr().getInt(), declId);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void FieldDeclOp::SetDeclChain(FieldDeclOp field)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ uint64_t fieldId = field.idAttr().getInt();
|
||||||
|
+ return pluginAPI.SetDeclChain(this->idAttr().getInt(), fieldId);
|
||||||
|
+}
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// AddressOp
|
||||||
|
|
||||||
|
diff --git a/lib/PluginAPI/PluginServerAPI.cpp b/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
index 5297357..537d389 100644
|
||||||
|
--- a/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
+++ b/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
@@ -442,6 +442,186 @@ vector<LocalDeclOp> PluginServerAPI::GetDecls(uint64_t funcID)
|
||||||
|
return PluginServer::GetInstance()->GetLocalDeclResult(funName, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
+vector<mlir::Plugin::DeclBaseOp> PluginServerAPI::GetFuncDecls(uint64_t funcID)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["funcId"] = std::to_string(funcID);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+
|
||||||
|
+ return PluginServer::GetInstance()->GetFuncDeclsResult(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+mlir::Plugin::FieldDeclOp PluginServerAPI::MakeNode(IDefineCode code)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["defCode"] = std::to_string(static_cast<int32_t>(code));
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+
|
||||||
|
+ return PluginServer::GetInstance()->GetMakeNodeResult(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+llvm::SmallVector<mlir::Plugin::FieldDeclOp> PluginServerAPI::GetFields(uint64_t declID)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["declId"] = std::to_string(declID);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+
|
||||||
|
+ return PluginServer::GetInstance()->GetFieldsResult(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetDeclName(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetDeclType(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetDeclAlign(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetUserAlign(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+unsigned PluginServerAPI::GetDeclTypeSize(uint64_t declId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["declId"] = std::to_string(declId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ return PluginServer::GetInstance()->GetIntegerDataResult(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetSourceLocation(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetAddressable(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetNonAddressablep(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetVolatile(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetDeclContext(uint64_t newfieldId, uint64_t declId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["declId"] = std::to_string(declId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetDeclChain(uint64_t newfieldId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["newfieldId"] = std::to_string(newfieldId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+mlir::Plugin::DeclBaseOp PluginServerAPI::BuildDecl(IDefineCode code, llvm::StringRef name, PluginIR::PluginTypeBase type)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["defCode"] = std::to_string(static_cast<int32_t>(code));
|
||||||
|
+ root["name"] = name.str();
|
||||||
|
+ PinJson::PluginJson json;
|
||||||
|
+ root["type"] = json.TypeJsonSerialize(type);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+
|
||||||
|
+ return PluginServer::GetInstance()->GetBuildDeclResult(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::SetTypeFields(uint64_t declId, uint64_t fieldId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["declId"] = std::to_string(declId);
|
||||||
|
+ root["fieldId"] = std::to_string(fieldId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::LayoutType(uint64_t declId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["declId"] = std::to_string(declId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginServerAPI::LayoutDecl(uint64_t declId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["declId"] = std::to_string(declId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
mlir::Block* PluginServerAPI::BlockResult(const string& funName, const string& params)
|
||||||
|
{
|
||||||
|
uint64_t blockId = PluginServer::GetInstance()->GetIdResult(funName, params);
|
||||||
|
diff --git a/lib/PluginServer/PluginCom.cpp b/lib/PluginServer/PluginCom.cpp
|
||||||
|
index ddf0605..573de13 100755
|
||||||
|
--- a/lib/PluginServer/PluginCom.cpp
|
||||||
|
+++ b/lib/PluginServer/PluginCom.cpp
|
||||||
|
@@ -65,6 +65,32 @@ mlir::Plugin::CGnodeOp PluginCom::GetCGnodeOpResult(void)
|
||||||
|
return retop;
|
||||||
|
}
|
||||||
|
|
||||||
|
+vector<mlir::Plugin::DeclBaseOp> PluginCom::GetFuncDeclsResult(void)
|
||||||
|
+{
|
||||||
|
+ vector<mlir::Plugin::DeclBaseOp> retOps = declOps;
|
||||||
|
+ declOps.clear();
|
||||||
|
+ return retOps;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+mlir::Plugin::FieldDeclOp PluginCom::GetMakeNodeResult(void)
|
||||||
|
+{
|
||||||
|
+ mlir::Plugin::FieldDeclOp retOp = fielddeclOp;
|
||||||
|
+ return retOp;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+llvm::SmallVector<mlir::Plugin::FieldDeclOp> PluginCom::GetFieldsResult(void)
|
||||||
|
+{
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::FieldDeclOp> retOps = fieldsOps;
|
||||||
|
+ fieldsOps.clear();
|
||||||
|
+ return retOps;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+mlir::Plugin::DeclBaseOp PluginCom::GetBuildDeclResult(void)
|
||||||
|
+{
|
||||||
|
+ mlir::Plugin::DeclBaseOp retOp = declOp;
|
||||||
|
+ return retOp;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
vector<mlir::Plugin::LoopOp> PluginCom::LoopOpsResult(void)
|
||||||
|
{
|
||||||
|
vector<mlir::Plugin::LoopOp> retLoops = loops;
|
||||||
|
@@ -151,6 +177,14 @@ void PluginCom::JsonDeSerialize(const string& key, const string& data)
|
||||||
|
json.IdsJsonDeSerialize(data, this->idsResult);
|
||||||
|
} else if (key == "IdResult") {
|
||||||
|
this->idResult = atol(data.c_str());
|
||||||
|
+ } else if (key == "DeclOpResult") {
|
||||||
|
+ mlir::Value decl = json.DeclBaseOpJsonDeSerialize(data);
|
||||||
|
+ this->declOp = llvm::dyn_cast<mlir::Plugin::DeclBaseOp>(decl.getDefiningOp());
|
||||||
|
+ printf("server 164 declop ----------------\n");
|
||||||
|
+ printf("server 164 declop code %d\n", this->declOp.defCodeAttr().getInt());
|
||||||
|
+ printf("server 165 declop ----------------\n");
|
||||||
|
+ } else if (key == "GetFieldsOpResult") {
|
||||||
|
+ json.FieldOpsJsonDeSerialize(data, this->fieldsOps);
|
||||||
|
} else if (key == "OpsResult") {
|
||||||
|
json.OpJsonDeSerialize(data.c_str(), this->opData);
|
||||||
|
} else if (key == "ValueResult") {
|
||||||
|
diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp
|
||||||
|
index ba2136b..7c2abbe 100755
|
||||||
|
--- a/lib/PluginServer/PluginJson.cpp
|
||||||
|
+++ b/lib/PluginServer/PluginJson.cpp
|
||||||
|
@@ -375,7 +375,7 @@ void PluginJson::FuncOpJsonDeSerialize(
|
||||||
|
mlir::Region &bodyRegion = fOp.bodyRegion();
|
||||||
|
Json::Value regionJson = node["region"];
|
||||||
|
Json::Value::Members bbMember = regionJson.getMemberNames();
|
||||||
|
- // We must create Blocks before process ops
|
||||||
|
+ // We must create Blocks before process opsG
|
||||||
|
for (size_t bbIdx = 0; bbIdx < bbMember.size(); bbIdx++) {
|
||||||
|
string blockKey = "block" + std::to_string(bbIdx);
|
||||||
|
Json::Value blockJson = regionJson[blockKey];
|
||||||
|
@@ -502,6 +502,42 @@ void PluginJson::LocalDeclOpJsonDeSerialize(
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void PluginJson::FuncDeclsOpJsonDeSerialize(const string& data,
|
||||||
|
+ vector<mlir::Plugin::DeclBaseOp>& declOps)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ Json::Reader reader;
|
||||||
|
+ Json::Value node;
|
||||||
|
+ reader.parse(data, root);
|
||||||
|
+ Json::Value::Members operation = root.getMemberNames();
|
||||||
|
+ mlir::OpBuilder opBuilder(PluginServer::GetInstance()->GetContext());
|
||||||
|
+ for (size_t iter = 0; iter < operation.size(); iter++) {
|
||||||
|
+ string operationKey = std::to_string(iter);
|
||||||
|
+ node = root[operationKey];
|
||||||
|
+ mlir::Value opValue = DeclBaseOpJsonDeSerialize(node.toStyledString()); //ValueJsonDeSerialize(node);
|
||||||
|
+ DeclBaseOp d = llvm::dyn_cast<DeclBaseOp>(opValue.getDefiningOp());
|
||||||
|
+ declOps.push_back(d);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void PluginJson::FieldOpsJsonDeSerialize(const string& data,
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::FieldDeclOp>& fieldOps)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ Json::Reader reader;
|
||||||
|
+ Json::Value node;
|
||||||
|
+ reader.parse(data, root);
|
||||||
|
+ Json::Value::Members operation = root.getMemberNames();
|
||||||
|
+ mlir::OpBuilder opBuilder(PluginServer::GetInstance()->GetContext());
|
||||||
|
+ for (size_t iter = 0; iter < operation.size(); iter++) {
|
||||||
|
+ string operationKey = std::to_string(iter);
|
||||||
|
+ node = root[operationKey];
|
||||||
|
+ mlir::Value opValue = FieldDeclOpJsonDeSerialize(node.toStyledString()); //ValueJsonDeSerialize(node);
|
||||||
|
+ FieldDeclOp d = llvm::dyn_cast<FieldDeclOp>(opValue.getDefiningOp());
|
||||||
|
+ fieldOps.push_back(d);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void PluginJson::LoopOpsJsonDeSerialize(
|
||||||
|
const string& data, vector<mlir::Plugin::LoopOp>& loops)
|
||||||
|
{
|
||||||
|
@@ -767,7 +803,7 @@ mlir::Value PluginJson::ListOpDeSerialize(const string& data)
|
||||||
|
mlir::Value opValue = ValueJsonDeSerialize(operandJson[std::to_string(opIter).c_str()]);
|
||||||
|
ops.push_back(opValue);
|
||||||
|
}
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value trrelist = opBuilder->create<ListOp>(opBuilder->getUnknownLoc(), id,
|
||||||
|
IDefineCode::LIST, readOnly, hasPurpose, ops, retType);
|
||||||
|
@@ -782,7 +818,7 @@ mlir::Value PluginJson::StrOpJsonDeSerialize(const string& data)
|
||||||
|
uint64_t id = GetID(root["id"]);
|
||||||
|
mlir::StringRef str(root["str"].asString());
|
||||||
|
bool readOnly = (bool)atoi(root["readOnly"].asString().c_str());
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value strop = opBuilder->create<StrOp>(opBuilder->getUnknownLoc(), id,
|
||||||
|
IDefineCode::StrCST, readOnly, str, retType);
|
||||||
|
@@ -797,7 +833,7 @@ mlir::Value PluginJson::ArrayOpJsonDeSerialize(const string& data)
|
||||||
|
bool readOnly = (bool)atoi(root["readOnly"].asString().c_str());
|
||||||
|
mlir::Value base = ValueJsonDeSerialize(root["base"]);
|
||||||
|
mlir::Value offset = ValueJsonDeSerialize(root["offset"]);
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value arrayref = opBuilder->create<ArrayOp>(opBuilder->getUnknownLoc(), id,
|
||||||
|
IDefineCode::ArrayRef, readOnly, base, offset, retType);
|
||||||
|
@@ -820,7 +856,8 @@ mlir::Value PluginJson::DeclBaseOpJsonDeSerialize(const string& data)
|
||||||
|
if (root["chain"]) {
|
||||||
|
chain = GetID(root["chain"]);
|
||||||
|
}
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
+ PluginIR::PluginTypeBase pluginType = retType.dyn_cast<PluginIR::PluginTypeBase>();
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value declOp = opBuilder->create<DeclBaseOp>(opBuilder->getUnknownLoc(), id,
|
||||||
|
IDefineCode::Decl, readOnly, addressable, used, uid, initial, name, chain, retType);
|
||||||
|
@@ -842,7 +879,7 @@ mlir::Value PluginJson::FieldDeclOpJsonDeSerialize(const string& data)
|
||||||
|
uint64_t chain = GetID(root["chain"]);
|
||||||
|
mlir::Value fieldOffset = ValueJsonDeSerialize(root["fieldOffset"]);
|
||||||
|
mlir::Value fieldBitOffset = ValueJsonDeSerialize(root["fieldBitOffset"]);
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value fieldOp = opBuilder->create<FieldDeclOp>(opBuilder->getUnknownLoc(), id,
|
||||||
|
IDefineCode::FieldDecl, readOnly, addressable, used, uid, initial, name, chain,
|
||||||
|
@@ -858,7 +895,7 @@ mlir::Value PluginJson::AddressOpJsonDeSerialize(const string& data)
|
||||||
|
uint64_t id = GetID(root["id"]);
|
||||||
|
bool readOnly = (bool)atoi(root["readOnly"].asString().c_str());
|
||||||
|
mlir::Value operand = ValueJsonDeSerialize(root["operand"]);
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value addrOp = opBuilder->create<AddressOp>(opBuilder->getUnknownLoc(), id,
|
||||||
|
IDefineCode::AddrExp, readOnly, operand, retType);
|
||||||
|
@@ -886,7 +923,7 @@ mlir::Value PluginJson::ConstructorOpJsonDeSerialize(const string& data)
|
||||||
|
mlir::Value opValue = ValueJsonDeSerialize(valJson[std::to_string(iter).c_str()]);
|
||||||
|
val.push_back(opValue);
|
||||||
|
}
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value constructorOp = opBuilder->create<ConstructorOp>(opBuilder->getUnknownLoc(), id,
|
||||||
|
IDefineCode::Constructor, readOnly, len, idx, val, retType);
|
||||||
|
@@ -908,7 +945,7 @@ mlir::Value PluginJson::VecOpJsonDeSerialize(const string& data)
|
||||||
|
mlir::Value opValue = ValueJsonDeSerialize(elementsJson[std::to_string(iter).c_str()]);
|
||||||
|
elements.push_back(opValue);
|
||||||
|
}
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value vecOp = opBuilder->create<VecOp>(opBuilder->getUnknownLoc(), id,
|
||||||
|
IDefineCode::Vec, readOnly, len, elements, retType);
|
||||||
|
@@ -937,7 +974,7 @@ mlir::Value PluginJson::BlockOpJsonDeSerialize(const string& data)
|
||||||
|
if (root["abstract_origin"]) {
|
||||||
|
abstract_origin = ValueJsonDeSerialize(root["abstract_origin"]);
|
||||||
|
}
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value blockOp = opBuilder->create<BlockOp>(
|
||||||
|
opBuilder->getUnknownLoc(), id, IDefineCode::BLOCK, readOnly, vars, supercontext, subblocks,
|
||||||
|
@@ -954,7 +991,7 @@ mlir::Value PluginJson::ComponentOpJsonDeSerialize(const string& data)
|
||||||
|
bool readOnly = (bool)atoi(root["readOnly"].asString().c_str());
|
||||||
|
mlir::Value component = ValueJsonDeSerialize(root["component"]);
|
||||||
|
mlir::Value field = ValueJsonDeSerialize(root["field"]);
|
||||||
|
- mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString().c_str());
|
||||||
|
+ mlir::Type retType = TypeJsonDeSerialize(root["retType"].toStyledString());
|
||||||
|
mlir::OpBuilder *opBuilder = PluginServer::GetInstance()->GetOpBuilder();
|
||||||
|
mlir::Value componentOp = opBuilder->create<ComponentOp>(
|
||||||
|
opBuilder->getUnknownLoc(), id, IDefineCode::COMPONENT, readOnly, component, field, retType);
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
382
0023-Pin-server-Add-StructReorderPASS-demo.patch
Normal file
382
0023-Pin-server-Add-StructReorderPASS-demo.patch
Normal file
@ -0,0 +1,382 @@
|
|||||||
|
From 959277b19b4a1a8991d05e2db4bdd5374e6c308e Mon Sep 17 00:00:00 2001
|
||||||
|
From: d00573793 <dingguangya1@huawei.com>
|
||||||
|
Date: Mon, 6 Mar 2023 23:01:18 +0800
|
||||||
|
Subject: [PATCH 23/23] [Pin-server] Add StructReorderPASS demo
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/include/PluginAPI/BasicPluginOpsAPI.h b/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
index d659662..d9f348d 100644
|
||||||
|
--- a/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
+++ b/include/PluginAPI/BasicPluginOpsAPI.h
|
||||||
|
@@ -72,6 +72,7 @@ public:
|
||||||
|
virtual void SetTypeFields(uint64_t declId, uint64_t fieldId) = 0;
|
||||||
|
virtual void LayoutType(uint64_t declId) = 0;
|
||||||
|
virtual void LayoutDecl(uint64_t declId) = 0;
|
||||||
|
+ virtual PluginIR::PluginTypeBase GetDeclType(uint64_t declId) = 0;
|
||||||
|
|
||||||
|
virtual vector<LocalDeclOp> GetDecls(uint64_t) = 0;
|
||||||
|
virtual LoopOp AllocateNewLoop(uint64_t) = 0;
|
||||||
|
diff --git a/include/PluginAPI/PluginServerAPI.h b/include/PluginAPI/PluginServerAPI.h
|
||||||
|
index 239dd23..c18bba9 100644
|
||||||
|
--- a/include/PluginAPI/PluginServerAPI.h
|
||||||
|
+++ b/include/PluginAPI/PluginServerAPI.h
|
||||||
|
@@ -65,6 +65,7 @@ public:
|
||||||
|
void SetTypeFields(uint64_t declId, uint64_t fieldId) override;
|
||||||
|
void LayoutType(uint64_t declId) override;
|
||||||
|
void LayoutDecl(uint64_t declId) override;
|
||||||
|
+ PluginIR::PluginTypeBase GetDeclType(uint64_t declId) override;
|
||||||
|
|
||||||
|
vector<LocalDeclOp> GetDecls(uint64_t) override;
|
||||||
|
PhiOp GetPhiOp(uint64_t) override;
|
||||||
|
diff --git a/include/PluginServer/PluginCom.h b/include/PluginServer/PluginCom.h
|
||||||
|
index af819ad..7deb615 100755
|
||||||
|
--- a/include/PluginServer/PluginCom.h
|
||||||
|
+++ b/include/PluginServer/PluginCom.h
|
||||||
|
@@ -60,6 +60,7 @@ public:
|
||||||
|
vector<mlir::Plugin::DeclBaseOp> GetFuncDeclsResult(void);
|
||||||
|
llvm::SmallVector<mlir::Plugin::FieldDeclOp> GetFieldsResult(void);
|
||||||
|
mlir::Plugin::DeclBaseOp GetBuildDeclResult(void);
|
||||||
|
+ PluginIR::PluginTypeBase GetDeclTypeResult(void);
|
||||||
|
|
||||||
|
mlir::Plugin::FieldDeclOp GetMakeNodeResult(void);
|
||||||
|
|
||||||
|
@@ -93,6 +94,7 @@ private:
|
||||||
|
uint64_t idResult;
|
||||||
|
vector<uint64_t> idsResult;
|
||||||
|
mlir::Value valueResult;
|
||||||
|
+ PluginIR::PluginTypeBase pTypeResult;
|
||||||
|
mlir::Plugin::DeclBaseOp declOp;
|
||||||
|
mlir::Plugin::FieldDeclOp fielddeclOp;
|
||||||
|
llvm::SmallVector<mlir::Plugin::FieldDeclOp> fieldsOps;
|
||||||
|
diff --git a/include/PluginServer/PluginServer.h b/include/PluginServer/PluginServer.h
|
||||||
|
index 29a790b..81f92e9 100644
|
||||||
|
--- a/include/PluginServer/PluginServer.h
|
||||||
|
+++ b/include/PluginServer/PluginServer.h
|
||||||
|
@@ -183,6 +183,12 @@ public:
|
||||||
|
return pluginCom.GetBuildDeclResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ PluginIR::PluginTypeBase GetDeclTypeResult(const string& funName, const string& params)
|
||||||
|
+ {
|
||||||
|
+ RemoteCallClientWithAPI(funName, params);
|
||||||
|
+ return pluginCom.GetDeclTypeResult();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
vector<mlir::Plugin::LocalDeclOp> GetLocalDeclResult(const string& funName, const string& params)
|
||||||
|
{
|
||||||
|
RemoteCallClientWithAPI(funName, params);
|
||||||
|
diff --git a/lib/PluginAPI/PluginServerAPI.cpp b/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
index 537d389..e8a1f4c 100644
|
||||||
|
--- a/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
+++ b/lib/PluginAPI/PluginServerAPI.cpp
|
||||||
|
@@ -613,6 +613,15 @@ void PluginServerAPI::LayoutType(uint64_t declId)
|
||||||
|
PluginServer::GetInstance()->RemoteCallClientWithAPI(funName, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
+PluginIR::PluginTypeBase PluginServerAPI::GetDeclType(uint64_t declId)
|
||||||
|
+{
|
||||||
|
+ Json::Value root;
|
||||||
|
+ string funName = __func__;
|
||||||
|
+ root["declId"] = std::to_string(declId);
|
||||||
|
+ string params = root.toStyledString();
|
||||||
|
+ return PluginServer::GetInstance()->GetDeclTypeResult(funName, params);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void PluginServerAPI::LayoutDecl(uint64_t declId)
|
||||||
|
{
|
||||||
|
Json::Value root;
|
||||||
|
diff --git a/lib/PluginServer/PluginCom.cpp b/lib/PluginServer/PluginCom.cpp
|
||||||
|
index 573de13..aaf4ba8 100755
|
||||||
|
--- a/lib/PluginServer/PluginCom.cpp
|
||||||
|
+++ b/lib/PluginServer/PluginCom.cpp
|
||||||
|
@@ -91,6 +91,12 @@ mlir::Plugin::DeclBaseOp PluginCom::GetBuildDeclResult(void)
|
||||||
|
return retOp;
|
||||||
|
}
|
||||||
|
|
||||||
|
+PluginIR::PluginTypeBase PluginCom::GetDeclTypeResult(void)
|
||||||
|
+{
|
||||||
|
+ PluginIR::PluginTypeBase retType = pTypeResult;
|
||||||
|
+ return retType;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
vector<mlir::Plugin::LoopOp> PluginCom::LoopOpsResult(void)
|
||||||
|
{
|
||||||
|
vector<mlir::Plugin::LoopOp> retLoops = loops;
|
||||||
|
@@ -161,6 +167,14 @@ void PluginCom::JsonDeSerialize(const string& key, const string& data)
|
||||||
|
this->cgnode = json.CGnodeOpJsonDeSerialize(data);
|
||||||
|
} else if (key == "LocalDeclOpResult") {
|
||||||
|
json.LocalDeclOpJsonDeSerialize(data, this->decls);
|
||||||
|
+ } else if (key == "FuncDeclsOpResult") {
|
||||||
|
+ json.FuncDeclsOpJsonDeSerialize(data, this->declOps);
|
||||||
|
+ } else if (key == "MakeNodeResult") {
|
||||||
|
+ Json::Value node;
|
||||||
|
+ Json::Reader reader;
|
||||||
|
+ reader.parse(data, node);
|
||||||
|
+ mlir::Value v = json.ValueJsonDeSerialize(node);
|
||||||
|
+ this->fielddeclOp = llvm::dyn_cast<mlir::Plugin::FieldDeclOp>(v.getDefiningOp());
|
||||||
|
} else if (key == "LoopOpResult") {
|
||||||
|
this->loop = json.LoopOpJsonDeSerialize (data);
|
||||||
|
} else if (key == "LoopOpsResult") {
|
||||||
|
@@ -180,9 +194,6 @@ void PluginCom::JsonDeSerialize(const string& key, const string& data)
|
||||||
|
} else if (key == "DeclOpResult") {
|
||||||
|
mlir::Value decl = json.DeclBaseOpJsonDeSerialize(data);
|
||||||
|
this->declOp = llvm::dyn_cast<mlir::Plugin::DeclBaseOp>(decl.getDefiningOp());
|
||||||
|
- printf("server 164 declop ----------------\n");
|
||||||
|
- printf("server 164 declop code %d\n", this->declOp.defCodeAttr().getInt());
|
||||||
|
- printf("server 165 declop ----------------\n");
|
||||||
|
} else if (key == "GetFieldsOpResult") {
|
||||||
|
json.FieldOpsJsonDeSerialize(data, this->fieldsOps);
|
||||||
|
} else if (key == "OpsResult") {
|
||||||
|
@@ -192,6 +203,8 @@ void PluginCom::JsonDeSerialize(const string& key, const string& data)
|
||||||
|
Json::Reader reader;
|
||||||
|
reader.parse(data, node);
|
||||||
|
this->valueResult = json.ValueJsonDeSerialize(node);
|
||||||
|
+ } else if (key == "PluginTypeResult") {
|
||||||
|
+ this->pTypeResult = json.TypeJsonDeSerialize(data);
|
||||||
|
} else if (key == "GetPhiOps") {
|
||||||
|
json.GetPhiOpsJsonDeSerialize(data, this->opData);
|
||||||
|
} else if (key == "IntegerResult") {
|
||||||
|
diff --git a/lib/PluginServer/PluginJson.cpp b/lib/PluginServer/PluginJson.cpp
|
||||||
|
index 7c2abbe..c7ce788 100755
|
||||||
|
--- a/lib/PluginServer/PluginJson.cpp
|
||||||
|
+++ b/lib/PluginServer/PluginJson.cpp
|
||||||
|
@@ -333,7 +333,6 @@ CGnodeOp PluginJson::CGnodeOpJsonDeSerialize(const string& data)
|
||||||
|
Json::Value root;
|
||||||
|
Json::Reader reader;
|
||||||
|
reader.parse(data, root);
|
||||||
|
- fprintf(stderr, "dgy server cgnode json %s\n", root.toStyledString().c_str());
|
||||||
|
|
||||||
|
mlir::OpBuilder builder(PluginServer::GetInstance()->GetContext());
|
||||||
|
uint64_t id = GetID(root["id"]);
|
||||||
|
diff --git a/user/InlineFunctionPass.cpp b/user/InlineFunctionPass.cpp
|
||||||
|
index d982d44..a51e6fe 100755
|
||||||
|
--- a/user/InlineFunctionPass.cpp
|
||||||
|
+++ b/user/InlineFunctionPass.cpp
|
||||||
|
@@ -33,7 +33,7 @@ static void UserOptimizeFunc(void)
|
||||||
|
if (allFunction[i].declaredInlineAttr().getValue())
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
- printf("declaredInline have %d functions were declared.\n", count);
|
||||||
|
+ fprintf(stderr, "declaredInline have %d functions were declared.\n", count);
|
||||||
|
}
|
||||||
|
|
||||||
|
int InlineFunctionPass::DoOptimize()
|
||||||
|
diff --git a/user/LocalVarSummeryPass.cpp b/user/LocalVarSummeryPass.cpp
|
||||||
|
index ccee9f7..c22bad4 100755
|
||||||
|
--- a/user/LocalVarSummeryPass.cpp
|
||||||
|
+++ b/user/LocalVarSummeryPass.cpp
|
||||||
|
@@ -51,10 +51,6 @@ static void LocalVarSummery(void)
|
||||||
|
std::string tyName = stTy.getName();
|
||||||
|
printf(" struct name is : %s\n", tyName.c_str());
|
||||||
|
|
||||||
|
- llvm::ArrayRef<mlir::Type> paramsType = stTy.getBody();
|
||||||
|
- for (auto tty :paramsType) {
|
||||||
|
- printf("\n struct arg id : %d\n", tty.dyn_cast<PluginIR::PluginTypeBase>().getPluginTypeID());
|
||||||
|
- }
|
||||||
|
llvm::ArrayRef<std::string> paramsNames = stTy.getElementNames();
|
||||||
|
for (auto name :paramsNames) {
|
||||||
|
std::string pName = name;
|
||||||
|
diff --git a/user/StructReorder.cpp b/user/StructReorder.cpp
|
||||||
|
index 612a093..f4e824e 100644
|
||||||
|
--- a/user/StructReorder.cpp
|
||||||
|
+++ b/user/StructReorder.cpp
|
||||||
|
@@ -44,6 +44,138 @@ mlir::OpBuilder* opBuilder = nullptr;
|
||||||
|
std::map<Block*, Value> defs_map;
|
||||||
|
std::map<uint64_t, std::string> opNameMap;
|
||||||
|
|
||||||
|
+static void dump_structtype(PluginIR::PluginTypeBase type)
|
||||||
|
+{
|
||||||
|
+ if (auto stTy = type.dyn_cast<PluginIR::PluginStructType>()) {
|
||||||
|
+ std::string tyName = stTy.getName();
|
||||||
|
+ fprintf(stderr, " struct name is : %s\n", tyName.c_str());
|
||||||
|
+
|
||||||
|
+ llvm::ArrayRef<std::string> paramsNames = stTy.getElementNames();
|
||||||
|
+ for (auto name :paramsNames) {
|
||||||
|
+ std::string pName = name;
|
||||||
|
+ fprintf(stderr, "\n struct argname is : %s\n", pName.c_str());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void reorder_fields(FieldDeclOp& field, FieldDeclOp& newfield)
|
||||||
|
+{
|
||||||
|
+ if (!field) {
|
||||||
|
+ field = newfield;
|
||||||
|
+ unsigned size = newfield.GetTypeSize();
|
||||||
|
+ } else {
|
||||||
|
+ FieldDeclOp tmp = field;
|
||||||
|
+ // unsigned size = tmp.getResultType().dyn_cast<PluginIR::PluginTypeBase>().getPluginTypeID();
|
||||||
|
+ unsigned size = newfield.GetTypeSize();
|
||||||
|
+ if (newfield.GetTypeSize() > tmp.GetTypeSize()) {
|
||||||
|
+ newfield.SetDeclChain(tmp);
|
||||||
|
+ field = newfield;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void create_new_fields(mlir::Plugin::DeclBaseOp& decl, llvm::SmallVector<mlir::Plugin::FieldDeclOp> recordfields)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ FieldDeclOp fd;
|
||||||
|
+ for (auto &fielddecl : recordfields) {
|
||||||
|
+ FieldDeclOp field = pluginAPI.MakeNode(IDefineCode::FieldDecl);
|
||||||
|
+ field.SetName(fielddecl);
|
||||||
|
+ field.SetType(fielddecl);
|
||||||
|
+ field.SetDeclAlign(fielddecl);
|
||||||
|
+
|
||||||
|
+ field.SetSourceLocation(fielddecl);
|
||||||
|
+ field.SetUserAlign(fielddecl);
|
||||||
|
+ field.SetAddressable(fielddecl);
|
||||||
|
+ field.SetNonAddressablep(fielddecl);
|
||||||
|
+ field.SetVolatile(fielddecl);
|
||||||
|
+ field.SetDeclContext(decl.idAttr().getInt());
|
||||||
|
+
|
||||||
|
+ reorder_fields(fd, field);
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ pluginAPI.SetTypeFields(decl.idAttr().getInt(), fd.idAttr().getInt());
|
||||||
|
+ pluginAPI.LayoutType(decl.idAttr().getInt());
|
||||||
|
+ pluginAPI.LayoutDecl(decl.idAttr().getInt());
|
||||||
|
+ fprintf(stderr, "reorder struct type after :>>>\n");
|
||||||
|
+ dump_structtype(pluginAPI.GetDeclType(decl.idAttr().getInt()));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void create_new_type(mlir::Plugin::DeclBaseOp& decl, llvm::SmallVector<mlir::Plugin::FieldDeclOp> recordfields)
|
||||||
|
+{
|
||||||
|
+ create_new_fields(decl, recordfields);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void create_new_types(llvm::SmallVector<PluginIR::PluginTypeBase> recordTypes,
|
||||||
|
+ llvm::SmallVector<DeclBaseOp> recordDecls, llvm::SmallVector<mlir::Plugin::FieldDeclOp> recordFields)
|
||||||
|
+{
|
||||||
|
+ for (int i = 0; i < recordTypes.size(); i++) {
|
||||||
|
+
|
||||||
|
+ auto type = recordTypes[i].dyn_cast<PluginIR::PluginStructType>();
|
||||||
|
+ mlir::MLIRContext m_context;
|
||||||
|
+ m_context.getOrLoadDialect<PluginDialect>();
|
||||||
|
+ PluginIR::PluginTypeBase rPluginType = PluginIR::PluginUndefType::get(&m_context);
|
||||||
|
+ StringRef name = type.getName();
|
||||||
|
+ StringRef newName = name.str() + ".reorg." + to_string(i);
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ DeclBaseOp decl = pluginAPI.BuildDecl(IDefineCode::TYPEDECL, newName, rPluginType);
|
||||||
|
+
|
||||||
|
+ create_new_type(decl, recordFields);
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void record_decl(mlir::Plugin::DeclBaseOp decl, llvm::SmallVector<mlir::Plugin::DeclBaseOp>& recordDecls)
|
||||||
|
+{
|
||||||
|
+ if (llvm::find(recordDecls, decl) == recordDecls.end())
|
||||||
|
+ {
|
||||||
|
+ recordDecls.push_back(decl);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void record_fields(DeclBaseOp decl, llvm::SmallVector<mlir::Plugin::FieldDeclOp>& recordFields)
|
||||||
|
+{
|
||||||
|
+ PluginAPI::PluginServerAPI pluginAPI;
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::FieldDeclOp> fields = pluginAPI.GetFields(decl.idAttr().getInt());
|
||||||
|
+ recordFields.insert(recordFields.end(), fields.begin(), fields.end());
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static PluginIR::PluginTypeBase record_type(PluginIR::PluginTypeBase type, llvm::SmallVector<PluginIR::PluginTypeBase>& recordTypes,
|
||||||
|
+ DeclBaseOp decl, llvm::SmallVector<mlir::Plugin::FieldDeclOp>& recordFields)
|
||||||
|
+{
|
||||||
|
+ if (llvm::find(recordTypes, type) == recordTypes.end())
|
||||||
|
+ {
|
||||||
|
+ recordTypes.push_back(type);
|
||||||
|
+ }
|
||||||
|
+ record_fields(decl, recordFields);
|
||||||
|
+ return type;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static PluginIR::PluginTypeBase inner_type(PluginIR::PluginTypeBase type)
|
||||||
|
+{
|
||||||
|
+ while(type.isa<PluginIR::PluginPointerType>() || type.isa<PluginIR::PluginArrayType>()) {
|
||||||
|
+ if (auto t = type.dyn_cast<PluginIR::PluginPointerType>()) {
|
||||||
|
+ type = t.getElementType().dyn_cast<PluginIR::PluginTypeBase>();
|
||||||
|
+ } else if (auto t = type.dyn_cast<PluginIR::PluginArrayType>()) {
|
||||||
|
+ type = t.getElementType().dyn_cast<PluginIR::PluginTypeBase>();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return type;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static bool handle_type(PluginIR::PluginTypeBase type)
|
||||||
|
+{
|
||||||
|
+ type = inner_type(type);
|
||||||
|
+ if (type.isa<PluginIR::PluginStructType>()) {
|
||||||
|
+ fprintf(stderr, "handle struct type :>>>\n");
|
||||||
|
+ dump_structtype(type);
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
|
||||||
|
static void ProcessStructReorder(uint64_t *fun)
|
||||||
|
{
|
||||||
|
@@ -57,14 +189,15 @@ static void ProcessStructReorder(uint64_t *fun)
|
||||||
|
mlir::OpBuilder opBuilder_temp = mlir::OpBuilder(context);
|
||||||
|
opBuilder = &opBuilder_temp;
|
||||||
|
string name = nodeOp.symbolNameAttr().getValue().str();
|
||||||
|
- fprintf(stderr, "Now process symbol : %s \n", name.c_str());
|
||||||
|
uint32_t order = nodeOp.orderAttr().getInt();
|
||||||
|
- fprintf(stderr, "Now process order : %d \n", order);
|
||||||
|
if (nodeOp.IsRealSymbol())
|
||||||
|
- fprintf(stderr, "Now process IsRealSymbol \n");
|
||||||
|
+ fprintf(stderr, "process RealSymbol : %s/%d \n", name.c_str(), order);
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<FunctionOp> allFunction = pluginAPI.GetAllFunc();
|
||||||
|
+ llvm::SmallVector<PluginIR::PluginTypeBase> recordTypes;
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::DeclBaseOp> recordDecls;
|
||||||
|
+ llvm::SmallVector<mlir::Plugin::FieldDeclOp> recordFields;
|
||||||
|
fprintf(stderr, "allfun size is %d\n", allFunction.size());
|
||||||
|
for (auto &funcOp : allFunction) {
|
||||||
|
context = funcOp.getOperation()->getContext();
|
||||||
|
@@ -72,6 +205,19 @@ static void ProcessStructReorder(uint64_t *fun)
|
||||||
|
opBuilder = &opBuilder_temp;
|
||||||
|
string name = funcOp.funcNameAttr().getValue().str();
|
||||||
|
fprintf(stderr, "Now process func : %s \n", name.c_str());
|
||||||
|
+ uint64_t funcID = funcOp.idAttr().getValue().getZExtValue();
|
||||||
|
+
|
||||||
|
+ vector<mlir::Plugin::DeclBaseOp> decls = pluginAPI.GetFuncDecls(funcID);
|
||||||
|
+
|
||||||
|
+ for (auto &decl : decls) {
|
||||||
|
+ auto type = decl.getResultType().dyn_cast<PluginIR::PluginTypeBase>();
|
||||||
|
+ if (!handle_type(type)) continue;
|
||||||
|
+ type = record_type(inner_type(type), recordTypes, decl, recordFields);
|
||||||
|
+
|
||||||
|
+ record_decl(decl, recordDecls);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ create_new_types(recordTypes, recordDecls, recordFields);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
diff --git a/user/user.cpp b/user/user.cpp
|
||||||
|
index ee2031a..6bfa524 100644
|
||||||
|
--- a/user/user.cpp
|
||||||
|
+++ b/user/user.cpp
|
||||||
|
@@ -27,10 +27,10 @@
|
||||||
|
void RegisterCallbacks(void)
|
||||||
|
{
|
||||||
|
PinServer::PluginServer *pluginServer = PinServer::PluginServer::GetInstance();
|
||||||
|
- // pluginServer->RegisterOpt(std::make_shared<PluginOpt::InlineFunctionPass>(PluginOpt::HANDLE_BEFORE_IPA));
|
||||||
|
- // pluginServer->RegisterOpt(std::make_shared<PluginOpt::LocalVarSummeryPass>(PluginOpt::HANDLE_BEFORE_IPA));
|
||||||
|
+ pluginServer->RegisterOpt(std::make_shared<PluginOpt::InlineFunctionPass>(PluginOpt::HANDLE_BEFORE_IPA));
|
||||||
|
+ pluginServer->RegisterOpt(std::make_shared<PluginOpt::LocalVarSummeryPass>(PluginOpt::HANDLE_BEFORE_IPA));
|
||||||
|
// PluginOpt::ManagerSetup setupData(PluginOpt::PASS_PHIOPT, 1, PluginOpt::PASS_INSERT_AFTER);
|
||||||
|
// pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::ArrayWidenPass>());
|
||||||
|
- PluginOpt::ManagerSetup setupData(PluginOpt::PASS_MAC, 1, PluginOpt::PASS_INSERT_AFTER);
|
||||||
|
- pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::StructReorderPass>());
|
||||||
|
+ // PluginOpt::ManagerSetup setupData(PluginOpt::PASS_MAC, 1, PluginOpt::PASS_INSERT_AFTER);
|
||||||
|
+ // pluginServer->RegisterPassManagerOpt(setupData, std::make_shared<PluginOpt::StructReorderPass>());
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: pin-server
|
Name: pin-server
|
||||||
Version: 0.4.0
|
Version: 0.4.0
|
||||||
Release: 5
|
Release: 6
|
||||||
Summary: Pin (Plug-IN framework) server provides plugin APIs for compiler optimization developers to develop optimization pass.
|
Summary: Pin (Plug-IN framework) server provides plugin APIs for compiler optimization developers to develop optimization pass.
|
||||||
License: Apache 2.0
|
License: Apache 2.0
|
||||||
URL: https://gitee.com/openeuler/pin-server
|
URL: https://gitee.com/openeuler/pin-server
|
||||||
@ -22,9 +22,17 @@ Patch9: 0009-Pin-server-Support-functiontype-structtype.eg.patch
|
|||||||
Patch10: 0010-Pin-server-Add-ComponentOp-ConstructorOp-AddressOp-F.patch
|
Patch10: 0010-Pin-server-Add-ComponentOp-ConstructorOp-AddressOp-F.patch
|
||||||
Patch11: 0011-Pin-server-Add-NopOp-EHElseOp-AsmOp-SwitchOp-LabelOp.patch
|
Patch11: 0011-Pin-server-Add-NopOp-EHElseOp-AsmOp-SwitchOp-LabelOp.patch
|
||||||
Patch12: 0012-Pin-server-Support-Vectortype.patch
|
Patch12: 0012-Pin-server-Support-Vectortype.patch
|
||||||
Patch13: 0013-Pin-server-Support-Vectortype.patch
|
Patch13: 0013-Pin-server-Fix-Definecode-name.patch
|
||||||
Patch14: 0014-Pin-server-Fix-AWC-pass-can-complice-can-compile-a-c.patch
|
Patch14: 0014-Pin-server-Fix-AWC-pass-can-complice-can-compile-a-c.patch
|
||||||
Patch15: 0015-Pin-server-Fix-strip-problem.patch
|
Patch15: 0015-Pin-server-Bugfix-for-SwitchOp-change-it-to-terminat.patch
|
||||||
|
Patch16: 0016-Pin-server-Bugfix-for-GetFunctionById.patch
|
||||||
|
Patch17: 0017-Refactoring-Modify-API-parameters-to-improve-usabili.patch
|
||||||
|
Patch18: 0018-Build-Fix-strip-problem.patch
|
||||||
|
Patch19: 0019-Pin-server-Init-a-SimpleIPAPASS.patch
|
||||||
|
Patch20: 0020-Pin-server-Add-CGnodeOp.patch
|
||||||
|
Patch21: 0021-Pin-server-The-lto-flag-is-used-to-control-the-pass-.patch
|
||||||
|
Patch22: 0022-Pin-server-Add-support-for-decl-and-field-SetDeclNam.patch
|
||||||
|
Patch23: 0023-Pin-server-Add-StructReorderPASS-demo.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Pin (Plug-IN framework) server provides plugin APIs for compiler optimization developers to develop optimization pass.
|
Pin (Plug-IN framework) server provides plugin APIs for compiler optimization developers to develop optimization pass.
|
||||||
@ -55,6 +63,14 @@ A demo for pin-server
|
|||||||
%patch13 -p1
|
%patch13 -p1
|
||||||
%patch14 -p1
|
%patch14 -p1
|
||||||
%patch15 -p1
|
%patch15 -p1
|
||||||
|
%patch16 -p1
|
||||||
|
%patch17 -p1
|
||||||
|
%patch18 -p1
|
||||||
|
%patch19 -p1
|
||||||
|
%patch20 -p1
|
||||||
|
%patch21 -p1
|
||||||
|
%patch22 -p1
|
||||||
|
%patch23 -p1
|
||||||
|
|
||||||
mkdir -p _build
|
mkdir -p _build
|
||||||
cd _build
|
cd _build
|
||||||
@ -95,6 +111,12 @@ find %{_libdir} -type f -name "libMLIRServerAPI.so" -exec strip "{}" ";"
|
|||||||
%config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf
|
%config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 07 2023 dingguangya <dingguangya1@huawei.com> - 0.4.0-6
|
||||||
|
- Type:Update
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Sync patch from openEuler/pin-server
|
||||||
|
|
||||||
* Mon Mar 6 2023 wumingchuan <wumingchuan1992@foxmail.com> - 0.4.0-5
|
* Mon Mar 6 2023 wumingchuan <wumingchuan1992@foxmail.com> - 0.4.0-5
|
||||||
- Type:Update
|
- Type:Update
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user