[WebAssembly] Remove unused arguments, unused functions. NFC.

llvm-svn: 257125
This commit is contained in:
Dan Gohman 2016-01-08 00:43:54 +00:00
parent d2fb0f68f4
commit cceedf79b4
4 changed files with 33 additions and 50 deletions

View File

@ -95,9 +95,6 @@ WebAssemblyAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {
}
} // end anonymous namespace
MCAsmBackend *llvm::createWebAssemblyAsmBackend(const Target &T,
const MCRegisterInfo &MRI,
const Triple &TT,
StringRef CPU) {
MCAsmBackend *llvm::createWebAssemblyAsmBackend(const Triple &TT) {
return new WebAssemblyAsmBackend(TT.isArch64Bit());
}

View File

@ -28,12 +28,8 @@ using namespace llvm;
namespace {
class WebAssemblyMCCodeEmitter final : public MCCodeEmitter {
const MCRegisterInfo &MRI;
public:
WebAssemblyMCCodeEmitter(const MCInstrInfo &, const MCRegisterInfo &mri,
MCContext &)
: MRI(mri) {}
WebAssemblyMCCodeEmitter(const MCInstrInfo &, MCContext &) {}
~WebAssemblyMCCodeEmitter() override {}
@ -60,26 +56,8 @@ public:
} // end anonymous namespace
MCCodeEmitter *llvm::createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII,
const MCRegisterInfo &MRI,
MCContext &Ctx) {
return new WebAssemblyMCCodeEmitter(MCII, MRI, Ctx);
}
unsigned WebAssemblyMCCodeEmitter::getMachineOpValue(
const MCInst &MI, const MCOperand &MO, SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
if (MO.isReg())
return MRI.getEncodingValue(MO.getReg());
if (MO.isImm())
return static_cast<unsigned>(MO.getImm());
assert(MO.isExpr());
assert(MO.getExpr()->getKind() == MCExpr::SymbolRef);
assert(false && "FIXME: not implemented yet");
return 0;
return new WebAssemblyMCCodeEmitter(MCII, Ctx);
}
void WebAssemblyMCCodeEmitter::encodeInstruction(

View File

@ -35,52 +35,63 @@ using namespace llvm;
#define GET_REGINFO_MC_DESC
#include "WebAssemblyGenRegisterInfo.inc"
static MCAsmInfo *createWebAssemblyMCAsmInfo(const MCRegisterInfo & /*MRI*/,
const Triple &TT) {
static MCAsmInfo *createMCAsmInfo(const MCRegisterInfo & /*MRI*/,
const Triple &TT) {
return new WebAssemblyMCAsmInfo(TT);
}
static MCInstrInfo *createWebAssemblyMCInstrInfo() {
static MCInstrInfo *createMCInstrInfo() {
MCInstrInfo *X = new MCInstrInfo();
InitWebAssemblyMCInstrInfo(X);
return X;
}
static MCStreamer *createWebAssemblyMCStreamer(const Triple &T, MCContext &Ctx,
MCAsmBackend &MAB,
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter,
bool RelaxAll) {
static MCStreamer *createMCStreamer(const Triple & /*T*/, MCContext &Ctx,
MCAsmBackend &MAB, raw_pwrite_stream &OS,
MCCodeEmitter *Emitter, bool RelaxAll) {
return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
}
static MCInstPrinter *
createWebAssemblyMCInstPrinter(const Triple & /*T*/, unsigned SyntaxVariant,
const MCAsmInfo &MAI, const MCInstrInfo &MII,
const MCRegisterInfo &MRI) {
static MCInstPrinter *createMCInstPrinter(const Triple & /*T*/,
unsigned SyntaxVariant,
const MCAsmInfo &MAI,
const MCInstrInfo &MII,
const MCRegisterInfo &MRI) {
assert(SyntaxVariant == 0);
return new WebAssemblyInstPrinter(MAI, MII, MRI);
}
static MCCodeEmitter *createCodeEmitter(const MCInstrInfo &MCII,
const MCRegisterInfo & /*MRI*/,
MCContext &Ctx) {
return createWebAssemblyMCCodeEmitter(MCII, Ctx);
}
static MCAsmBackend *createAsmBackend(const Target & /*T*/,
const MCRegisterInfo & /*MRI*/,
const Triple &TT, StringRef /*CPU*/) {
return createWebAssemblyAsmBackend(TT);
}
// Force static initialization.
extern "C" void LLVMInitializeWebAssemblyTargetMC() {
for (Target *T : {&TheWebAssemblyTarget32, &TheWebAssemblyTarget64}) {
// Register the MC asm info.
RegisterMCAsmInfoFn X(*T, createWebAssemblyMCAsmInfo);
RegisterMCAsmInfoFn X(*T, createMCAsmInfo);
// Register the MC instruction info.
TargetRegistry::RegisterMCInstrInfo(*T, createWebAssemblyMCInstrInfo);
TargetRegistry::RegisterMCInstrInfo(*T, createMCInstrInfo);
// Register the object streamer
TargetRegistry::RegisterELFStreamer(*T, createWebAssemblyMCStreamer);
TargetRegistry::RegisterELFStreamer(*T, createMCStreamer);
// Register the MCInstPrinter.
TargetRegistry::RegisterMCInstPrinter(*T, createWebAssemblyMCInstPrinter);
TargetRegistry::RegisterMCInstPrinter(*T, createMCInstPrinter);
// Register the MC code emitter
TargetRegistry::RegisterMCCodeEmitter(*T, createWebAssemblyMCCodeEmitter);
TargetRegistry::RegisterMCCodeEmitter(*T, createCodeEmitter);
// Register the ASM Backend
TargetRegistry::RegisterMCAsmBackend(*T, createWebAssemblyAsmBackend);
TargetRegistry::RegisterMCAsmBackend(*T, createAsmBackend);
}
}

View File

@ -39,12 +39,9 @@ extern Target TheWebAssemblyTarget32;
extern Target TheWebAssemblyTarget64;
MCCodeEmitter *createWebAssemblyMCCodeEmitter(const MCInstrInfo &MCII,
const MCRegisterInfo &MRI,
MCContext &Ctx);
MCAsmBackend *createWebAssemblyAsmBackend(const Target &T,
const MCRegisterInfo &MRI,
const Triple &TT, StringRef CPU);
MCAsmBackend *createWebAssemblyAsmBackend(const Triple &TT);
MCObjectWriter *createWebAssemblyELFObjectWriter(raw_pwrite_stream &OS,
bool Is64Bit, uint8_t OSABI);