mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Move X86 assembler printers into separate directory. This allows JIT-only users not to link it in (use 'x86codegen' llvm-config arg for this)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54886 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
abb247fc03
commit
3c3bc48d33
15
lib/Target/X86/AsmPrinter/Makefile
Normal file
15
lib/Target/X86/AsmPrinter/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
##===- lib/Target/X86/Makefile -----------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
LEVEL = ../../../..
|
||||
LIBRARYNAME = LLVMX86AsmPrinter
|
||||
|
||||
# Hack: we need to include 'main' x86 target directory to grab private headers
|
||||
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
@ -33,3 +33,11 @@ FunctionPass *llvm::createX86CodePrinterPass(std::ostream &o,
|
||||
return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo());
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
static struct Register {
|
||||
Register() {
|
||||
X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass);
|
||||
}
|
||||
} Registrator;
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
LEVEL = ../../..
|
||||
LIBRARYNAME = LLVMX86
|
||||
LIBRARYNAME = LLVMX86CodeGen
|
||||
TARGET = X86
|
||||
|
||||
# Make sure that tblgen is run, first thing.
|
||||
@ -18,4 +18,6 @@ BUILT_SOURCES = X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \
|
||||
X86GenFastISel.inc \
|
||||
X86GenCallingConv.inc X86GenSubtarget.inc
|
||||
|
||||
DIRS = AsmPrinter
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
@ -35,6 +35,9 @@ X("x86", " 32-bit X86: Pentium-Pro and above");
|
||||
static RegisterTarget<X86_64TargetMachine>
|
||||
Y("x86-64", " 64-bit X86: EM64T and AMD64");
|
||||
|
||||
// No assembler printer by default
|
||||
X86TargetMachine::AsmPrinterCtorFn X86TargetMachine::AsmPrinterCtor = 0;
|
||||
|
||||
const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const {
|
||||
if (Subtarget.isFlavorIntel())
|
||||
return new X86WinTargetAsmInfo(*this);
|
||||
@ -187,7 +190,9 @@ bool X86TargetMachine::addPostRegAlloc(PassManagerBase &PM, bool Fast) {
|
||||
|
||||
bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast,
|
||||
std::ostream &Out) {
|
||||
PM.add(createX86CodePrinterPass(Out, *this));
|
||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||
if (AsmPrinterCtor)
|
||||
PM.add(AsmPrinterCtor(Out, *this));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -210,8 +215,11 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast,
|
||||
}
|
||||
|
||||
PM.add(createX86CodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createX86CodePrinterPass(*cerr.stream(), *this));
|
||||
if (DumpAsm) {
|
||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||
if (AsmPrinterCtor)
|
||||
PM.add(AsmPrinterCtor(*cerr.stream(), *this));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -219,7 +227,11 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast,
|
||||
bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM, bool Fast,
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
PM.add(createX86CodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createX86CodePrinterPass(*cerr.stream(), *this));
|
||||
if (DumpAsm) {
|
||||
assert(AsmPrinterCtor && "AsmPrinter was not linked in");
|
||||
if (AsmPrinterCtor)
|
||||
PM.add(AsmPrinterCtor(*cerr.stream(), *this));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -38,7 +38,13 @@ class X86TargetMachine : public LLVMTargetMachine {
|
||||
|
||||
protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
|
||||
// To avoid having target depend on the asmprinter stuff libraries, asmprinter
|
||||
// set this functions to ctor pointer at startup time if they are linked in.
|
||||
typedef FunctionPass *(*AsmPrinterCtorFn)(std::ostream &o,
|
||||
X86TargetMachine &tm);
|
||||
static AsmPrinterCtorFn AsmPrinterCtor;
|
||||
|
||||
public:
|
||||
X86TargetMachine(const Module &M, const std::string &FS, bool is64Bit);
|
||||
|
||||
@ -59,7 +65,11 @@ public:
|
||||
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
static unsigned getJITMatchQuality();
|
||||
|
||||
|
||||
static void registerAsmPrinter(AsmPrinterCtorFn F) {
|
||||
AsmPrinterCtor = F;
|
||||
}
|
||||
|
||||
// Set up the pass pipeline.
|
||||
virtual bool addInstSelector(PassManagerBase &PM, bool Fast);
|
||||
virtual bool addPreRegAlloc(PassManagerBase &PM, bool Fast);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
LEVEL := ../..
|
||||
TOOLNAME := lli
|
||||
LINK_COMPONENTS := jit interpreter native bitreader selectiondag
|
||||
LINK_COMPONENTS := jit interpreter nativecodegen bitreader selectiondag
|
||||
|
||||
# Enable JIT support
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
@ -326,8 +326,17 @@ sub build_name_map {
|
||||
}
|
||||
}
|
||||
|
||||
# Add target-specific entries
|
||||
foreach my $target (@TARGETS_BUILT) {
|
||||
# FIXME: Temporary, until we don't switch all targets
|
||||
if (defined $NAME_MAP{$target.'asmprinter'}) {
|
||||
$NAME_MAP{$target} = [$target.'asmprinter', $target.'codegen']
|
||||
}
|
||||
}
|
||||
|
||||
# Add virtual entries.
|
||||
$NAME_MAP{'native'} = have_native_backend() ? [$ARCH] : [];
|
||||
$NAME_MAP{'nativecodegen'} = have_native_backend() ? [$ARCH.'codegen'] : [];
|
||||
$NAME_MAP{'backend'} = have_native_backend() ? ['native'] : ['cbackend'];
|
||||
$NAME_MAP{'engine'} = find_best_engine;
|
||||
$NAME_MAP{'all'} = [name_map_entries]; # Must be last.
|
||||
|
Loading…
Reference in New Issue
Block a user