[GlobalISel] Introduce initializer method to support start/stop-after features.

llvm-svn: 262896
This commit is contained in:
Quentin Colombet 2016-03-08 01:38:55 +00:00
parent c8976d58fe
commit 39293d3aaa
5 changed files with 37 additions and 25 deletions

View File

@ -56,6 +56,9 @@ void initializeAnalysis(PassRegistry&);
/// initializeCodeGen - Initialize all passes linked into the CodeGen library.
void initializeCodeGen(PassRegistry&);
/// Initialize all passes linked into the GlobalISel library.
void initializeGlobalISel(PassRegistry &Registry);
/// initializeCodeGen - Initialize all passes linked into the CodeGen library.
void initializeTarget(PassRegistry&);
@ -151,6 +154,7 @@ void initializeInstCountPass(PassRegistry&);
void initializeInstNamerPass(PassRegistry&);
void initializeInternalizePassPass(PassRegistry&);
void initializeIntervalPartitionPass(PassRegistry&);
void initializeIRTranslatorPass(PassRegistry &);
void initializeJumpThreadingPass(PassRegistry&);
void initializeLCSSAPass(PassRegistry&);
void initializeLICMPass(PassRegistry&);

View File

@ -18,7 +18,7 @@ endif()
# not ask for it.
add_llvm_library(LLVMGlobalISel
${GLOBAL_ISEL_BUILD_FILES}
EmptyFile.cpp
GlobalISel.cpp
)
add_dependencies(LLVMGlobalISel intrinsics_gen)

View File

@ -1,24 +0,0 @@
//===-- llvm/CodeGen/GlobalISel/EmptyFile.cpp ------ EmptyFile ---*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file
/// The purpose of this file is to please cmake by not creating an
/// empty library when we do not build GlobalISel.
/// \todo This file should be removed when GlobalISel is not optional anymore.
//===----------------------------------------------------------------------===//
#include "llvm/Support/Compiler.h"
namespace llvm {
// Export a global symbol so that ranlib does not complain
// about the TOC being empty for the global-isel library when
// we do not build global-isel.
LLVM_ATTRIBUTE_UNUSED void DummyFunctionToSilenceRanlib(void) {
}
}

View File

@ -0,0 +1,29 @@
//===-- llvm/CodeGen/GlobalISel/GlobalIsel.cpp --- GlobalISel ----*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file
// This file implements the common initialization routines for the
// GlobalISel library.
//===----------------------------------------------------------------------===//
#include "llvm/InitializePasses.h"
#include "llvm/PassRegistry.h"
using namespace llvm;
#ifndef LLVM_BUILD_GLOBAL_ISEL
void llvm::initializeGlobalISel(PassRegistry &Registry) {
}
#else
void llvm::initializeGlobalISel(PassRegistry &Registry) {
initializeIRTranslatorPass(Registry);
}
#endif // LLVM_BUILD_GLOBAL_ISEL

View File

@ -27,8 +27,11 @@
using namespace llvm;
char IRTranslator::ID = 0;
INITIALIZE_PASS(IRTranslator, "irtranslator", "IRTranslator LLVM IR -> MI",
false, false);
IRTranslator::IRTranslator() : MachineFunctionPass(ID), MRI(nullptr) {
initializeIRTranslatorPass(*PassRegistry::getPassRegistry());
}
unsigned IRTranslator::getOrCreateVReg(const Value *Val) {