52 lines
1.3 KiB
Diff
52 lines
1.3 KiB
Diff
|
|
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
|
||
|
|
|