MC/X86: Add stub AsmBackend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96763 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2010-02-21 21:54:14 +00:00
parent e7bd886cb8
commit 12783d1c3a
5 changed files with 50 additions and 3 deletions

View File

@ -18,4 +18,5 @@ add_llvm_library(LLVMMC
MCStreamer.cpp
MCSymbol.cpp
MCValue.cpp
TargetAsmBackend.cpp
)

View File

@ -15,6 +15,7 @@ tablegen(X86GenCallingConv.inc -gen-callingconv)
tablegen(X86GenSubtarget.inc -gen-subtarget)
set(sources
X86AsmBackend.cpp
X86CodeEmitter.cpp
X86COFFMachineModuleInfo.cpp
X86ELFWriterInfo.cpp

View File

@ -19,13 +19,15 @@
namespace llvm {
class X86TargetMachine;
class FunctionPass;
class MachineCodeEmitter;
class JITCodeEmitter;
class MCAssembler;
class MCCodeEmitter;
class MCContext;
class JITCodeEmitter;
class MachineCodeEmitter;
class Target;
class TargetAsmBackend;
class X86TargetMachine;
class formatted_raw_ostream;
/// createX86ISelDag - This pass converts a legalized DAG into a
@ -55,6 +57,9 @@ MCCodeEmitter *createX86_32MCCodeEmitter(const Target &, TargetMachine &TM,
MCCodeEmitter *createX86_64MCCodeEmitter(const Target &, TargetMachine &TM,
MCContext &Ctx);
TargetAsmBackend *createX86_32AsmBackend(const Target &, MCAssembler &);
TargetAsmBackend *createX86_64AsmBackend(const Target &, MCAssembler &);
/// createX86EmitCodeToMemory - Returns a pass that converts a register
/// allocated function into raw machine code in a dynamically
/// allocated chunk of memory.

View File

@ -0,0 +1,34 @@
//===-- X86AsmBackend.cpp - X86 Assembler Backend -------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/Target/TargetAsmBackend.h"
#include "X86.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetAsmBackend.h"
using namespace llvm;
namespace {
class X86AsmBackend : public TargetAsmBackend {
public:
X86AsmBackend(const Target &T, MCAssembler &A)
: TargetAsmBackend(T) {}
};
}
TargetAsmBackend *llvm::createX86_32AsmBackend(const Target &T,
MCAssembler &A) {
return new X86AsmBackend(T, A);
}
TargetAsmBackend *llvm::createX86_64AsmBackend(const Target &T,
MCAssembler &A) {
return new X86AsmBackend(T, A);
}

View File

@ -51,6 +51,12 @@ extern "C" void LLVMInitializeX86Target() {
createX86_32MCCodeEmitter);
TargetRegistry::RegisterCodeEmitter(TheX86_64Target,
createX86_64MCCodeEmitter);
// Register the asm backend.
TargetRegistry::RegisterAsmBackend(TheX86_32Target,
createX86_32AsmBackend);
TargetRegistry::RegisterAsmBackend(TheX86_64Target,
createX86_64AsmBackend);
}