[llvm] r274962 - [PM] Port CrossDSOCFI to the new pass manager.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 8 20:25:35 PDT 2016
Author: davide
Date: Fri Jul 8 22:25:35 2016
New Revision: 274962
URL: http://llvm.org/viewvc/llvm-project?rev=274962&view=rev
Log:
[PM] Port CrossDSOCFI to the new pass manager.
Added:
llvm/trunk/include/llvm/Transforms/IPO/CrossDSOCFI.h
Modified:
llvm/trunk/lib/Passes/PassBuilder.cpp
llvm/trunk/lib/Passes/PassRegistry.def
llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp
llvm/trunk/test/Transforms/CrossDSOCFI/basic.ll
Added: llvm/trunk/include/llvm/Transforms/IPO/CrossDSOCFI.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/CrossDSOCFI.h?rev=274962&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/CrossDSOCFI.h (added)
+++ llvm/trunk/include/llvm/Transforms/IPO/CrossDSOCFI.h Fri Jul 8 22:25:35 2016
@@ -0,0 +1,28 @@
+//===-- CrossDSOCFI.cpp - Externalize this module's CFI checks --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This pass exports all llvm.bitset's found in the module in the form of a
+// __cfi_check function, which can be used to verify cross-DSO call targets.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_IPO_CROSSDSOCFI_H
+#define LLVM_TRANSFORMS_IPO_CROSSDSOCFI_H
+
+#include "llvm/IR/Module.h"
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+class CrossDSOCFIPass : public PassInfoMixin<CrossDSOCFIPass> {
+public:
+ PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
+};
+}
+#endif // LLVM_TRANSFORMS_IPO_CROSSDSOCFI_H
+
Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=274962&r1=274961&r2=274962&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Fri Jul 8 22:25:35 2016
@@ -57,6 +57,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/GCOVProfiler.h"
#include "llvm/Transforms/IPO/ConstantMerge.h"
+#include "llvm/Transforms/IPO/CrossDSOCFI.h"
#include "llvm/Transforms/IPO/DeadArgumentElimination.h"
#include "llvm/Transforms/IPO/ElimAvailExtern.h"
#include "llvm/Transforms/IPO/ForceFunctionAttrs.h"
Modified: llvm/trunk/lib/Passes/PassRegistry.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=274962&r1=274961&r2=274962&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassRegistry.def (original)
+++ llvm/trunk/lib/Passes/PassRegistry.def Fri Jul 8 22:25:35 2016
@@ -38,6 +38,7 @@ MODULE_ALIAS_ANALYSIS("globals-aa", Glob
#define MODULE_PASS(NAME, CREATE_PASS)
#endif
MODULE_PASS("constmerge", ConstantMergePass())
+MODULE_PASS("cross-dso-cfi", CrossDSOCFIPass())
MODULE_PASS("deadargelim", DeadArgumentEliminationPass())
MODULE_PASS("elim-avail-extern", EliminateAvailableExternallyPass())
MODULE_PASS("forceattrs", ForceFunctionAttrsPass())
Modified: llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp?rev=274962&r1=274961&r2=274962&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/CrossDSOCFI.cpp Fri Jul 8 22:25:35 2016
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Transforms/IPO.h"
+#include "llvm/Transforms/IPO/CrossDSOCFI.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/EquivalenceClasses.h"
#include "llvm/ADT/Statistic.h"
@@ -30,6 +30,7 @@
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
using namespace llvm;
@@ -153,3 +154,11 @@ bool CrossDSOCFI::runOnModule(Module &M)
buildCFICheck(M);
return true;
}
+
+PreservedAnalyses CrossDSOCFIPass::run(Module &M, AnalysisManager<Module> &AM) {
+ CrossDSOCFI Impl;
+ bool Changed = Impl.runOnModule(M);
+ if (!Changed)
+ return PreservedAnalyses::all();
+ return PreservedAnalyses::none();
+}
Modified: llvm/trunk/test/Transforms/CrossDSOCFI/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CrossDSOCFI/basic.ll?rev=274962&r1=274961&r2=274962&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/CrossDSOCFI/basic.ll (original)
+++ llvm/trunk/test/Transforms/CrossDSOCFI/basic.ll Fri Jul 8 22:25:35 2016
@@ -1,4 +1,5 @@
; RUN: opt -S -cross-dso-cfi < %s | FileCheck %s
+; RUN: opt -S -passes=cross-dso-cfi < %s | FileCheck %s
; CHECK: define void @__cfi_check(i64 %[[TYPE:.*]], i8* %[[ADDR:.*]], i8* %[[DATA:.*]]) align 4096
; CHECK: switch i64 %[[TYPE]], label %[[FAIL:.*]] [
More information about the llvm-commits
mailing list