llvm.org GIT mirror llvm / 2685a29
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 Daniel Dunbar 11 years ago
3 changed file(s) with 43 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
386386 T.MCDisassemblerCtorFn = Fn;
387387 }
388388
389 /// RegisterMCInstPrinter - Register a MCInstPrinter implementation for the
390 /// given target.
391 ///
392 /// Clients are responsible for ensuring that registration doesn't occur
393 /// while another thread is attempting to access the registry. Typically
394 /// this is done by initializing all targets at program startup.
395 ///
396 /// @param T - The target being registered.
397 /// @param Fn - A function to construct an MCInstPrinter for the target.
389398 static void RegisterMCInstPrinter(Target &T,
390399 Target::MCInstPrinterCtorTy Fn) {
391400 if (!T.MCInstPrinterCtorFn)
394403
395404 /// RegisterCodeEmitter - Register a MCCodeEmitter implementation for the
396405 /// given target.
397 ///
406 ///
398407 /// Clients are responsible for ensuring that registration doesn't occur
399408 /// while another thread is attempting to access the registry. Typically
400409 /// this is done by initializing all targets at program startup.
533533 Mnemonic == "bl" ||
534534 Mnemonic == "push" ||
535535 Mnemonic == "blx" ||
536 Mnemonic == "pop")
536 Mnemonic == "pop") {
537 // Hard-coded to a valid instruction, till we have a real matcher.
538 Inst = MCInst();
539 Inst.setOpcode(ARM::MOVr);
540 Inst.addOperand(MCOperand::CreateReg(2));
541 Inst.addOperand(MCOperand::CreateReg(2));
542 Inst.addOperand(MCOperand::CreateImm(0));
543 Inst.addOperand(MCOperand::CreateImm(0));
544 Inst.addOperand(MCOperand::CreateReg(0));
537545 return false;
546 }
538547
539548 return true;
540549 }
13001300 }
13011301 }
13021302
1303 // Force static initialization.
1304 extern "C" void LLVMInitializeARMAsmPrinter() {
1305 RegisterAsmPrinter X(TheARMTarget);
1306 RegisterAsmPrinter Y(TheThumbTarget);
1307 }
1308
1309
13101303 //===----------------------------------------------------------------------===//
13111304
13121305 void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) {
14561449
14571450 printMCInst(&TmpInst);
14581451 }
1452
1453 //===----------------------------------------------------------------------===//
1454 // Target Registry Stuff
1455 //===----------------------------------------------------------------------===//
1456
1457 static MCInstPrinter *createARMMCInstPrinter(const Target &T,
1458 unsigned SyntaxVariant,
1459 const MCAsmInfo &MAI,
1460 raw_ostream &O) {
1461 if (SyntaxVariant == 0)
1462 return new ARMInstPrinter(O, MAI, false);
1463 return 0;
1464 }
1465
1466 // Force static initialization.
1467 extern "C" void LLVMInitializeARMAsmPrinter() {
1468 RegisterAsmPrinter X(TheARMTarget);
1469 RegisterAsmPrinter Y(TheThumbTarget);
1470
1471 TargetRegistry::RegisterMCInstPrinter(TheARMTarget, createARMMCInstPrinter);
1472 TargetRegistry::RegisterMCInstPrinter(TheThumbTarget, createARMMCInstPrinter);
1473 }
1474