From f2831419f5ceb28e1bc0cbf67cada012bccfb843 Mon Sep 17 00:00:00 2001 From: vanhauser-thc Date: Thu, 3 Mar 2022 08:55:05 +0100 Subject: ported cmplog-instructions-pass --- instrumentation/cmplog-switches-pass.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'instrumentation/cmplog-switches-pass.cc') diff --git a/instrumentation/cmplog-switches-pass.cc b/instrumentation/cmplog-switches-pass.cc index 068650ce..7c591e13 100644 --- a/instrumentation/cmplog-switches-pass.cc +++ b/instrumentation/cmplog-switches-pass.cc @@ -84,7 +84,28 @@ class CmpLogInstructions : public ModulePass { } // namespace +#if LLVM_MAJOR >= 11 && 1 == 0 +llvmGetPassPluginInfo() { + + return {LLVM_PLUGIN_API_VERSION, "cmplogswitches", "v0.1", + /* lambda to insert our pass into the pass pipeline. */ + [](PassBuilder &PB) { + +#if LLVM_VERSION_MAJOR <= 13 + using OptimizationLevel = typename PassBuilder::OptimizationLevel; +#endif + PB.registerOptimizerLastEPCallback( + [](ModulePassManager &MPM, OptimizationLevel OL) { + + MPM.addPass(SplitComparesTransform()); + + }); + }}; + +} +#else char CmpLogInstructions::ID = 0; +#endif template Iterator Unique(Iterator first, Iterator last) { -- cgit 1.4.1