llvm-mc: Tweak MCCodeEmitter skeleton.

llvm-svn: 80193
This commit is contained in:
Daniel Dunbar 2009-08-27 01:34:22 +00:00
parent 1725fdd25d
commit 4316774ac1
4 changed files with 25 additions and 10 deletions

View File

@ -26,7 +26,7 @@ public:
/// EncodeInstruction - Encode the given \arg Inst to bytes on the output
/// stream \arg OS.
virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS) = 0;
virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS) const = 0;
};
} // End llvm namespace

View File

@ -59,8 +59,7 @@ namespace llvm {
typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &T,
MCAsmParser &P);
typedef MCCodeEmitter *(*CodeEmitterCtorTy)(const Target &T,
TargetMachine &TM,
const MCAsmInfo &MAI);
TargetMachine &TM);
private:
/// Next - The next registered target in the linked list, maintained by the
@ -180,11 +179,10 @@ namespace llvm {
}
/// createCodeEmitter - Create a target specific code emitter.
MCCodeEmitter *createCodeEmitter(TargetMachine &TM,
const MCAsmInfo *MAI) const {
MCCodeEmitter *createCodeEmitter(TargetMachine &TM) const {
if (!CodeEmitterCtorFn)
return 0;
return CodeEmitterCtorFn(*this, TM, *MAI);
return CodeEmitterCtorFn(*this, TM);
}
/// @}
@ -493,9 +491,8 @@ namespace llvm {
}
private:
static MCCodeEmitter *Allocator(const Target &T, TargetMachine &TM,
const MCAsmInfo &MAI) {
return new CodeEmitterImpl(T, TM, MAI);
static MCCodeEmitter *Allocator(const Target &T, TargetMachine &TM) {
return new CodeEmitterImpl(T, TM);
}
};

18
lib/MC/MCCodeEmitter.cpp Normal file
View File

@ -0,0 +1,18 @@
//===-- MCCodeEmitter.cpp - Instruction Encoding --------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCCodeEmitter.h"
using namespace llvm;
MCCodeEmitter::MCCodeEmitter() {
}
MCCodeEmitter::~MCCodeEmitter() {
}

View File

@ -244,7 +244,7 @@ static int AssembleInput(const char *ProgName) {
assert(TAI && "Unable to create target asm info!");
AP.reset(TheTarget->createAsmPrinter(*Out, *TM, TAI, true));
CE.reset(TheTarget->createCodeEmitter(*TM, TAI));
CE.reset(TheTarget->createCodeEmitter(*TM));
Str.reset(createAsmStreamer(Ctx, *Out, *TAI, AP.get(), CE.get()));
} else {
assert(FileType == OFT_ObjectFile && "Invalid file type!");