parent
75e719901c
commit
3e341b8334
@ -0,0 +1,116 @@
|
||||
diff -rup annobin.orig/clang-plugin/annobin.cpp annobin-11.08/clang-plugin/annobin.cpp
|
||||
--- annobin.orig/clang-plugin/annobin.cpp 2023-06-08 10:05:52.228680839 +0100
|
||||
+++ annobin-11.08/clang-plugin/annobin.cpp 2023-06-08 10:06:36.706698862 +0100
|
||||
@@ -111,7 +111,11 @@ private:
|
||||
{
|
||||
static char buf [6400]; // FIXME: Use a dynmically allocated buffer.
|
||||
|
||||
+#if CLANG_VERSION_MAJOR > 15
|
||||
+ is_32bit = Context.getTargetInfo().getPointerWidth(LangAS::Default) == 32;
|
||||
+#else
|
||||
is_32bit = Context.getTargetInfo().getPointerWidth(0) == 32;
|
||||
+#endif
|
||||
|
||||
SourceManager & src = Context.getSourceManager ();
|
||||
std::string filename = src.getFilename (src.getLocForStartOfFile (src.getMainFileID ())).str ().c_str ();
|
||||
diff -rup annobin.orig/llvm-plugin/annobin.cpp annobin-11.08/llvm-plugin/annobin.cpp
|
||||
--- annobin.orig/llvm-plugin/annobin.cpp 2023-06-08 10:05:52.226680839 +0100
|
||||
+++ annobin-11.08/llvm-plugin/annobin.cpp 2023-06-08 10:13:00.610773144 +0100
|
||||
@@ -590,41 +590,48 @@ char AnnobinModulePassLegacy::ID = 0;
|
||||
char AnnobinModulePass::ID = 0;
|
||||
#endif
|
||||
|
||||
+// NB. The choice of when to run the passes is critical. Using
|
||||
+// EP_EarlyAsPossible for example will run all the passes as Function passes,
|
||||
+// even if they are Module passes. Whist using EP_ModuleOptimizerEarly will
|
||||
+// not run the pass at -O0. Hence we use three different pass levels.
|
||||
+
|
||||
+#if __clang_major__ > 15
|
||||
+
|
||||
+// Nothing to do here. :-)
|
||||
+
|
||||
+#elif __clang_major__ > 12
|
||||
+
|
||||
static void
|
||||
-#if __clang_major__ > 12
|
||||
registerAnnobinModulePassLegacy (const PassManagerBuilder & PMB,
|
||||
legacy::PassManagerBase & PM)
|
||||
-#else
|
||||
-registerAnnobinModulePass (const PassManagerBuilder & PMB,
|
||||
- legacy::PassManagerBase & PM)
|
||||
-#endif
|
||||
{
|
||||
-#if __clang_major__ > 12
|
||||
static RegisterPass<AnnobinModulePassLegacy> X("annobin", "Annobin Module Pass");
|
||||
PM.add (createAnnobinModulePassLegacy ((int) PMB.OptLevel));
|
||||
-#else
|
||||
- static RegisterPass<AnnobinModulePass> X("annobin", "Annobin Module Pass");
|
||||
- PM.add (createAnnobinModulePass ((int) PMB.OptLevel));
|
||||
-#endif
|
||||
}
|
||||
|
||||
-// NB. The choice of when to run the passes is critical. Using
|
||||
-// EP_EarlyAsPossible for example will run all the passes as Function passes,
|
||||
-// even if they are Module passes. Whist using EP_ModuleOptimizerEarly will
|
||||
-// not run the pass at -O0. Hence we use three different pass levels.
|
||||
-#if __clang_major__ > 12
|
||||
static RegisterStandardPasses
|
||||
RegisterMyPass2 (PassManagerBuilder::EP_EnabledOnOptLevel0, registerAnnobinModulePassLegacy);
|
||||
|
||||
static RegisterStandardPasses
|
||||
RegisterMyPass3 (PassManagerBuilder::EP_ModuleOptimizerEarly, registerAnnobinModulePassLegacy);
|
||||
-#else
|
||||
+
|
||||
+#else /* __clang_major__ < 13 */
|
||||
+
|
||||
+static void
|
||||
+registerAnnobinModulePass (const PassManagerBuilder & PMB,
|
||||
+ legacy::PassManagerBase & PM)
|
||||
+{
|
||||
+ static RegisterPass<AnnobinModulePass> X("annobin", "Annobin Module Pass");
|
||||
+ PM.add (createAnnobinModulePass ((int) PMB.OptLevel));
|
||||
+}
|
||||
+
|
||||
static RegisterStandardPasses
|
||||
RegisterMyPass2 (PassManagerBuilder::EP_EnabledOnOptLevel0, registerAnnobinModulePass);
|
||||
|
||||
static RegisterStandardPasses
|
||||
RegisterMyPass3 (PassManagerBuilder::EP_ModuleOptimizerEarly, registerAnnobinModulePass);
|
||||
-#endif
|
||||
+
|
||||
+#endif /* Static pass registering. */
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
// Function Pass
|
||||
@@ -657,6 +664,13 @@ namespace
|
||||
|
||||
char AnnobinFunctionPass::ID = 0;
|
||||
|
||||
+#if __clang_major__ > 15
|
||||
+
|
||||
+static RegisterPass<AnnobinFunctionPass>
|
||||
+X ("annobin", "Annobin Function Pass", false /* Does not modify the CFG */, false /* Analysis pass */);
|
||||
+
|
||||
+#else
|
||||
+
|
||||
static void
|
||||
registerAnnobinFunctionPass (const PassManagerBuilder & PMB,
|
||||
legacy::PassManagerBase & PM)
|
||||
@@ -666,3 +680,5 @@ registerAnnobinFunctionPass (const PassM
|
||||
|
||||
static RegisterStandardPasses
|
||||
RegisterMyPass1 (PassManagerBuilder::EP_EarlyAsPossible, registerAnnobinFunctionPass);
|
||||
+
|
||||
+#endif
|
||||
--- annobin.orig/llvm-plugin/annobin.cpp 2023-06-29 11:07:13.216090636 +0100
|
||||
+++ annobin-11.08/llvm-plugin/annobin.cpp 2023-06-29 11:09:12.981140807 +0100
|
||||
@@ -641,8 +641,8 @@ namespace
|
||||
{
|
||||
class AnnobinFunctionPass : public FunctionPass
|
||||
{
|
||||
- static char ID;
|
||||
public:
|
||||
+ static char ID;
|
||||
AnnobinFunctionPass() : FunctionPass (ID) {}
|
||||
|
||||
virtual bool
|
Loading…
Reference in new issue