mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
[PM] Port CrossDSOCFI to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274962 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d0506b50b4
commit
0dd611bd69
28
include/llvm/Transforms/IPO/CrossDSOCFI.h
Normal file
28
include/llvm/Transforms/IPO/CrossDSOCFI.h
Normal file
@ -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
|
||||
|
@ -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"
|
||||
|
@ -38,6 +38,7 @@ MODULE_ALIAS_ANALYSIS("globals-aa", GlobalsAA())
|
||||
#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())
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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:.*]] [
|
||||
|
Loading…
Reference in New Issue
Block a user