mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Wire up the ARM MCInst printer, for llvm-mc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84600 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
07adb85cb7
commit
2685a29a8d
@ -387,6 +387,15 @@ namespace llvm {
|
|||||||
T.MCDisassemblerCtorFn = Fn;
|
T.MCDisassemblerCtorFn = Fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// RegisterMCInstPrinter - Register a MCInstPrinter implementation for the
|
||||||
|
/// given target.
|
||||||
|
///
|
||||||
|
/// Clients are responsible for ensuring that registration doesn't occur
|
||||||
|
/// while another thread is attempting to access the registry. Typically
|
||||||
|
/// this is done by initializing all targets at program startup.
|
||||||
|
///
|
||||||
|
/// @param T - The target being registered.
|
||||||
|
/// @param Fn - A function to construct an MCInstPrinter for the target.
|
||||||
static void RegisterMCInstPrinter(Target &T,
|
static void RegisterMCInstPrinter(Target &T,
|
||||||
Target::MCInstPrinterCtorTy Fn) {
|
Target::MCInstPrinterCtorTy Fn) {
|
||||||
if (!T.MCInstPrinterCtorFn)
|
if (!T.MCInstPrinterCtorFn)
|
||||||
|
@ -534,8 +534,17 @@ bool ARMAsmParser::MatchInstruction(SmallVectorImpl<ARMOperand> &Operands,
|
|||||||
Mnemonic == "bl" ||
|
Mnemonic == "bl" ||
|
||||||
Mnemonic == "push" ||
|
Mnemonic == "push" ||
|
||||||
Mnemonic == "blx" ||
|
Mnemonic == "blx" ||
|
||||||
Mnemonic == "pop")
|
Mnemonic == "pop") {
|
||||||
|
// Hard-coded to a valid instruction, till we have a real matcher.
|
||||||
|
Inst = MCInst();
|
||||||
|
Inst.setOpcode(ARM::MOVr);
|
||||||
|
Inst.addOperand(MCOperand::CreateReg(2));
|
||||||
|
Inst.addOperand(MCOperand::CreateReg(2));
|
||||||
|
Inst.addOperand(MCOperand::CreateImm(0));
|
||||||
|
Inst.addOperand(MCOperand::CreateImm(0));
|
||||||
|
Inst.addOperand(MCOperand::CreateReg(0));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1301,13 +1301,6 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force static initialization.
|
|
||||||
extern "C" void LLVMInitializeARMAsmPrinter() {
|
|
||||||
RegisterAsmPrinter<ARMAsmPrinter> X(TheARMTarget);
|
|
||||||
RegisterAsmPrinter<ARMAsmPrinter> Y(TheThumbTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
|
void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
|
||||||
@ -1457,3 +1450,26 @@ void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
|
|||||||
|
|
||||||
printMCInst(&TmpInst);
|
printMCInst(&TmpInst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// Target Registry Stuff
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
static MCInstPrinter *createARMMCInstPrinter(const Target &T,
|
||||||
|
unsigned SyntaxVariant,
|
||||||
|
const MCAsmInfo &MAI,
|
||||||
|
raw_ostream &O) {
|
||||||
|
if (SyntaxVariant == 0)
|
||||||
|
return new ARMInstPrinter(O, MAI, false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force static initialization.
|
||||||
|
extern "C" void LLVMInitializeARMAsmPrinter() {
|
||||||
|
RegisterAsmPrinter<ARMAsmPrinter> X(TheARMTarget);
|
||||||
|
RegisterAsmPrinter<ARMAsmPrinter> Y(TheThumbTarget);
|
||||||
|
|
||||||
|
TargetRegistry::RegisterMCInstPrinter(TheARMTarget, createARMMCInstPrinter);
|
||||||
|
TargetRegistry::RegisterMCInstPrinter(TheThumbTarget, createARMMCInstPrinter);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user