llvm.org GIT mirror llvm / 02ca2cb
[GlobalSplit] Port to the new pass manager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287511 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 2 years ago
5 changed file(s) with 40 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 //===- GlobalSplit.h - global variable splitter -----------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This pass uses inrange annotations on GEP indices to split globals where
10 // beneficial. Clang currently attaches these annotations to references to
11 // virtual table globals under the Itanium ABI for the benefit of the
12 // whole-program virtual call optimization and control flow integrity passes.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
17 #define LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
18
19 #include "llvm/IR/Module.h"
20 #include "llvm/IR/PassManager.h"
21
22 namespace llvm {
23 /// Pass to perform split of global variables.
24 class GlobalSplitPass : public PassInfoMixin {
25 public:
26 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
27 };
28 }
29 #endif // LLVM_TRANSFORMS_IPO_GLOBALSPLIT_H
6969 #include "llvm/Transforms/IPO/FunctionImport.h"
7070 #include "llvm/Transforms/IPO/GlobalDCE.h"
7171 #include "llvm/Transforms/IPO/GlobalOpt.h"
72 #include "llvm/Transforms/IPO/GlobalSplit.h"
7273 #include "llvm/Transforms/IPO/InferFunctionAttrs.h"
7374 #include "llvm/Transforms/IPO/Internalize.h"
7475 #include "llvm/Transforms/IPO/LowerTypeTests.h"
4646 MODULE_PASS("function-import", FunctionImportPass())
4747 MODULE_PASS("globaldce", GlobalDCEPass())
4848 MODULE_PASS("globalopt", GlobalOptPass())
49 MODULE_PASS("globalsplit", GlobalSplitPass())
4950 MODULE_PASS("inferattrs", InferFunctionAttrsPass())
5051 MODULE_PASS("insert-gcov-profiling", GCOVProfilerPass())
5152 MODULE_PASS("instrprof", InstrProfiling())
1414 //===----------------------------------------------------------------------===//
1515
1616 #include "llvm/Transforms/IPO.h"
17 #include "llvm/Transforms/IPO/GlobalSplit.h"
1718 #include "llvm/ADT/StringExtras.h"
1819 #include "llvm/IR/Constants.h"
1920 #include "llvm/IR/GlobalVariable.h"
161162 ModulePass *llvm::createGlobalSplitPass() {
162163 return new GlobalSplit;
163164 }
165
166 PreservedAnalyses GlobalSplitPass::run(Module &M, ModuleAnalysisManager &AM) {
167 if (!splitGlobals(M))
168 return PreservedAnalyses::all();
169 return PreservedAnalyses::none();
170 }
0 ; RUN: opt -S -globalsplit %s | FileCheck %s
1 ; RUN: opt -S -passes=globalsplit %s | FileCheck %s
12
23 target datalayout = "e-p:64:64"
34 target triple = "x86_64-unknown-linux-gnu"