mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[GlobalSplit] Port to the new pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
//===- GlobalSplit.h - global variable splitter -----------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This pass uses inrange annotations on GEP indices to split globals where
|
||||
// beneficial. Clang currently attaches these annotations to references to
|
||||
// virtual table globals under the Itanium ABI for the benefit of the
|
||||
// whole-program virtual call optimization and control flow integrity passes.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
|
||||
#define LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
|
||||
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/PassManager.h"
|
||||
|
||||
namespace llvm {
|
||||
/// Pass to perform split of global variables.
|
||||
class GlobalSplitPass : public PassInfoMixin<GlobalSplitPass> {
|
||||
public:
|
||||
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
|
||||
};
|
||||
}
|
||||
#endif // LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
|
||||
@@ -70,6 +70,7 @@
|
||||
#include "llvm/Transforms/IPO/FunctionImport.h"
|
||||
#include "llvm/Transforms/IPO/GlobalDCE.h"
|
||||
#include "llvm/Transforms/IPO/GlobalOpt.h"
|
||||
#include "llvm/Transforms/IPO/GlobalSplit.h"
|
||||
#include "llvm/Transforms/IPO/InferFunctionAttrs.h"
|
||||
#include "llvm/Transforms/IPO/Internalize.h"
|
||||
#include "llvm/Transforms/IPO/LowerTypeTests.h"
|
||||
|
||||
@@ -47,6 +47,7 @@ MODULE_PASS("forceattrs", ForceFunctionAttrsPass())
|
||||
MODULE_PASS("function-import", FunctionImportPass())
|
||||
MODULE_PASS("globaldce", GlobalDCEPass())
|
||||
MODULE_PASS("globalopt", GlobalOptPass())
|
||||
MODULE_PASS("globalsplit", GlobalSplitPass())
|
||||
MODULE_PASS("inferattrs", InferFunctionAttrsPass())
|
||||
MODULE_PASS("insert-gcov-profiling", GCOVProfilerPass())
|
||||
MODULE_PASS("instrprof", InstrProfiling())
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Transforms/IPO.h"
|
||||
#include "llvm/Transforms/IPO/GlobalSplit.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
@@ -162,3 +163,9 @@ char GlobalSplit::ID = 0;
|
||||
ModulePass *llvm::createGlobalSplitPass() {
|
||||
return new GlobalSplit;
|
||||
}
|
||||
|
||||
PreservedAnalyses GlobalSplitPass::run(Module &M, ModuleAnalysisManager &AM) {
|
||||
if (!splitGlobals(M))
|
||||
return PreservedAnalyses::all();
|
||||
return PreservedAnalyses::none();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
; RUN: opt -S -globalsplit %s | FileCheck %s
|
||||
; RUN: opt -S -passes=globalsplit %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
Reference in New Issue
Block a user