summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2014-02-22 00:07:45 +0000
committerQuentin Colombet <qcolombet@apple.com>2014-02-22 00:07:45 +0000
commita349084a91025cff528bc3c4e5582ae5e049c2fc (patch)
tree97142329696aa929a843015c56f1192d79ab50ef /llvm
parent204c3c50b9e749ce4cb6781e734b1eeb4bbc567e (diff)
downloadbcm5719-llvm-a349084a91025cff528bc3c4e5582ae5e049c2fc.tar.gz
bcm5719-llvm-a349084a91025cff528bc3c4e5582ae5e049c2fc.zip
[CodeGenPrepare] Move CodeGenPrepare into lib/CodeGen.
CodeGenPrepare uses extensively TargetLowering which is part of libLLVMCodeGen. This is a layer violation which would introduce eventually a dependence on CodeGen in ScalarOpts. Move CodeGenPrepare into libLLVMCodeGen to avoid that. Follow-up of <rdar://problem/15519855> llvm-svn: 201912
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/CodeGen/Passes.h4
-rw-r--r--llvm/include/llvm/Transforms/Scalar.h6
-rw-r--r--llvm/lib/CodeGen/CMakeLists.txt1
-rw-r--r--llvm/lib/CodeGen/CodeGen.cpp1
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp (renamed from llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp)2
-rw-r--r--llvm/lib/Transforms/Scalar/CMakeLists.txt1
-rw-r--r--llvm/lib/Transforms/Scalar/Scalar.cpp1
-rw-r--r--llvm/tools/bugpoint/CMakeLists.txt1
-rw-r--r--llvm/tools/bugpoint/LLVMBuild.txt2
-rw-r--r--llvm/tools/bugpoint/Makefile2
-rw-r--r--llvm/tools/opt/CMakeLists.txt1
-rw-r--r--llvm/tools/opt/LLVMBuild.txt2
-rw-r--r--llvm/tools/opt/Makefile2
-rw-r--r--llvm/tools/opt/opt.cpp4
14 files changed, 17 insertions, 13 deletions
diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h
index 3be21e02421..5d68f8637b7 100644
--- a/llvm/include/llvm/CodeGen/Passes.h
+++ b/llvm/include/llvm/CodeGen/Passes.h
@@ -370,6 +370,10 @@ namespace llvm {
createMachineFunctionPrinterPass(raw_ostream &OS,
const std::string &Banner ="");
+ /// createCodeGenPreparePass - Transform the code to expose more pattern
+ /// matching during instruction selection.
+ FunctionPass *createCodeGenPreparePass(const TargetMachine *TM = 0);
+
/// MachineLoopInfo - This pass is a loop analysis pass.
extern char &MachineLoopInfoID;
diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h
index e1890f68038..cacd4cb51b6 100644
--- a/llvm/include/llvm/Transforms/Scalar.h
+++ b/llvm/include/llvm/Transforms/Scalar.h
@@ -318,12 +318,6 @@ FunctionPass *createConstantHoistingPass();
//===----------------------------------------------------------------------===//
//
-// CodeGenPrepare - This pass prepares a function for instruction selection.
-//
-FunctionPass *createCodeGenPreparePass(const TargetMachine *TM = 0);
-
-//===----------------------------------------------------------------------===//
-//
// InstructionNamer - Give any unnamed non-void instructions "tmp" names.
//
FunctionPass *createInstructionNamerPass();
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 123d86f9504..8943cb11c6b 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -7,6 +7,7 @@ add_llvm_library(LLVMCodeGen
CalcSpillWeights.cpp
CallingConvLower.cpp
CodeGen.cpp
+ CodeGenPrepare.cpp
CriticalAntiDepBreaker.cpp
DFAPacketizer.cpp
DeadMachineInstructionElim.cpp
diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp
index c0db5a54b87..17402f066da 100644
--- a/llvm/lib/CodeGen/CodeGen.cpp
+++ b/llvm/lib/CodeGen/CodeGen.cpp
@@ -22,6 +22,7 @@ using namespace llvm;
void llvm::initializeCodeGen(PassRegistry &Registry) {
initializeBasicTTIPass(Registry);
initializeBranchFolderPassPass(Registry);
+ initializeCodeGenPreparePass(Registry);
initializeDeadMachineInstructionElimPass(Registry);
initializeEarlyIfConverterPass(Registry);
initializeExpandPostRAPass(Registry);
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 3c9ecce8e3e..e81a9098ef5 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -14,7 +14,7 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "codegenprepare"
-#include "llvm/Transforms/Scalar.h"
+#include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
diff --git a/llvm/lib/Transforms/Scalar/CMakeLists.txt b/llvm/lib/Transforms/Scalar/CMakeLists.txt
index 8a29b0c48cb..27434c1808a 100644
--- a/llvm/lib/Transforms/Scalar/CMakeLists.txt
+++ b/llvm/lib/Transforms/Scalar/CMakeLists.txt
@@ -1,6 +1,5 @@
add_llvm_library(LLVMScalarOpts
ADCE.cpp
- CodeGenPrepare.cpp
ConstantHoisting.cpp
ConstantProp.cpp
CorrelatedValuePropagation.cpp
diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp
index f774874cb47..e950ebacd84 100644
--- a/llvm/lib/Transforms/Scalar/Scalar.cpp
+++ b/llvm/lib/Transforms/Scalar/Scalar.cpp
@@ -29,7 +29,6 @@ using namespace llvm;
void llvm::initializeScalarOpts(PassRegistry &Registry) {
initializeADCEPass(Registry);
initializeSampleProfileLoaderPass(Registry);
- initializeCodeGenPreparePass(Registry);
initializeConstantHoistingPass(Registry);
initializeConstantPropagationPass(Registry);
initializeCorrelatedValuePropagationPass(Registry);
diff --git a/llvm/tools/bugpoint/CMakeLists.txt b/llvm/tools/bugpoint/CMakeLists.txt
index 14f5a3b004b..b537a5d237d 100644
--- a/llvm/tools/bugpoint/CMakeLists.txt
+++ b/llvm/tools/bugpoint/CMakeLists.txt
@@ -1,6 +1,7 @@
set(LLVM_LINK_COMPONENTS
Analysis
BitWriter
+ CodeGen
Core
IPA
IPO
diff --git a/llvm/tools/bugpoint/LLVMBuild.txt b/llvm/tools/bugpoint/LLVMBuild.txt
index 01643553c5b..dda8d624fc7 100644
--- a/llvm/tools/bugpoint/LLVMBuild.txt
+++ b/llvm/tools/bugpoint/LLVMBuild.txt
@@ -19,4 +19,4 @@
type = Tool
name = bugpoint
parent = Tools
-required_libraries = AsmParser BitReader BitWriter IRReader IPO Instrumentation Linker Scalar ObjCARC
+required_libraries = AsmParser BitReader BitWriter CodeGen IRReader IPO Instrumentation Linker Scalar ObjCARC
diff --git a/llvm/tools/bugpoint/Makefile b/llvm/tools/bugpoint/Makefile
index 96c0fcf519e..174f8d25161 100644
--- a/llvm/tools/bugpoint/Makefile
+++ b/llvm/tools/bugpoint/Makefile
@@ -10,7 +10,7 @@
LEVEL := ../..
TOOLNAME := bugpoint
LINK_COMPONENTS := asmparser instrumentation scalaropts ipo linker bitreader \
- bitwriter irreader vectorize objcarcopts
+ bitwriter irreader vectorize objcarcopts codegen
# Support plugins.
NO_DEAD_STRIP := 1
diff --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt
index 953815be366..1f76ab55511 100644
--- a/llvm/tools/opt/CMakeLists.txt
+++ b/llvm/tools/opt/CMakeLists.txt
@@ -2,6 +2,7 @@ set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
Analysis
BitWriter
+ CodeGen
Core
IPA
IPO
diff --git a/llvm/tools/opt/LLVMBuild.txt b/llvm/tools/opt/LLVMBuild.txt
index 77b94469edd..b3589f854ff 100644
--- a/llvm/tools/opt/LLVMBuild.txt
+++ b/llvm/tools/opt/LLVMBuild.txt
@@ -19,4 +19,4 @@
type = Tool
name = opt
parent = Tools
-required_libraries = AsmParser BitReader BitWriter IRReader IPO Instrumentation Scalar ObjCARC all-targets
+required_libraries = AsmParser BitReader BitWriter CodeGen IRReader IPO Instrumentation Scalar ObjCARC all-targets
diff --git a/llvm/tools/opt/Makefile b/llvm/tools/opt/Makefile
index fa2d0145531..cfa9c31cb95 100644
--- a/llvm/tools/opt/Makefile
+++ b/llvm/tools/opt/Makefile
@@ -9,7 +9,7 @@
LEVEL := ../..
TOOLNAME := opt
-LINK_COMPONENTS := bitreader bitwriter asmparser irreader instrumentation scalaropts objcarcopts ipo vectorize all-targets
+LINK_COMPONENTS := bitreader bitwriter asmparser irreader instrumentation scalaropts objcarcopts ipo vectorize all-targets codegen
# Support plugins.
NO_DEAD_STRIP := 1
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index fa9bc678c35..b9d3f9d6d21 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -22,6 +22,7 @@
#include "llvm/Analysis/RegionPass.h"
#include "llvm/Bitcode/BitcodeWriterPass.h"
#include "llvm/CodeGen/CommandFlags.h"
+#include "llvm/InitializePasses.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/LLVMContext.h"
@@ -340,6 +341,9 @@ int main(int argc, char **argv) {
initializeInstCombine(Registry);
initializeInstrumentation(Registry);
initializeTarget(Registry);
+ // For codegen passes, only passes that do IR to IR transformation are
+ // supported. For now, just add CodeGenPrepare.
+ initializeCodeGenPreparePass(Registry);
cl::ParseCommandLineOptions(argc, argv,
"llvm .bc -> .bc modular optimizer and analysis printer\n");
OpenPOWER on IntegriCloud