mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	stub out some hacky code for wiring up the new asmprinter interfaces
on X86. Not useful yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73799 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -104,7 +104,7 @@ public: | |||||||
|  |  | ||||||
|   /// getDebugLoc - Returns the debug location id of this MachineInstr. |   /// getDebugLoc - Returns the debug location id of this MachineInstr. | ||||||
|   /// |   /// | ||||||
|   const DebugLoc getDebugLoc() const { return debugLoc; } |   DebugLoc getDebugLoc() const { return debugLoc; } | ||||||
|    |    | ||||||
|   /// getDesc - Returns the target instruction descriptor of this |   /// getDesc - Returns the target instruction descriptor of this | ||||||
|   /// MachineInstr. |   /// MachineInstr. | ||||||
|   | |||||||
| @@ -19,6 +19,7 @@ | |||||||
|  |  | ||||||
| #include "llvm/ADT/SmallVector.h" | #include "llvm/ADT/SmallVector.h" | ||||||
| #include "llvm/Support/DataTypes.h" | #include "llvm/Support/DataTypes.h" | ||||||
|  | #include "llvm/Support/DebugLoc.h" | ||||||
|  |  | ||||||
| namespace llvm { | namespace llvm { | ||||||
|  |  | ||||||
| @@ -84,7 +85,10 @@ class MCInst { | |||||||
| public: | public: | ||||||
|   MCInst() : Opcode(~0U) {} |   MCInst() : Opcode(~0U) {} | ||||||
|    |    | ||||||
|  |   unsigned getOpcode() const { return Opcode; } | ||||||
|  |   DebugLoc getDebugLoc() const { return DebugLoc(); } | ||||||
|    |    | ||||||
|  |   const MCOperand &getOperand(unsigned i) const { return Operands[i]; } | ||||||
|    |    | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -769,21 +769,17 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) { | |||||||
|   ++EmittedInsts; |   ++EmittedInsts; | ||||||
|  |  | ||||||
|   if (NewAsmPrinter) { |   if (NewAsmPrinter) { | ||||||
|  |     O << "NEW: "; | ||||||
|     MCInst TmpInst; |     MCInst TmpInst; | ||||||
|     // FIXME: Convert TmpInst. |     // FIXME: Convert TmpInst. | ||||||
|     printInstruction(TmpInst); |     printInstruction(&TmpInst); | ||||||
|  |     O << "OLD: "; | ||||||
|   } |   } | ||||||
|    |    | ||||||
|   // Call the autogenerated instruction printer routines. |   // Call the autogenerated instruction printer routines. | ||||||
|   printInstruction(MI); |   printInstruction(MI); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// doInitialization |  | ||||||
| bool X86ATTAsmPrinter::doInitialization(Module &M) { |  | ||||||
|   return AsmPrinter::doInitialization(M); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { | void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { | ||||||
|   const TargetData *TD = TM.getTargetData(); |   const TargetData *TD = TM.getTargetData(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -55,7 +55,6 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { | |||||||
|     AsmPrinter::getAnalysisUsage(AU); |     AsmPrinter::getAnalysisUsage(AU); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   bool doInitialization(Module &M); |  | ||||||
|   bool doFinalization(Module &M); |   bool doFinalization(Module &M); | ||||||
|  |  | ||||||
|   /// printInstruction - This method is automatically generated by tablegen |   /// printInstruction - This method is automatically generated by tablegen | ||||||
| @@ -64,7 +63,56 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { | |||||||
|   /// returns false. |   /// returns false. | ||||||
|   bool printInstruction(const MachineInstr *MI); |   bool printInstruction(const MachineInstr *MI); | ||||||
|    |    | ||||||
|   bool printInstruction(const MCInst &TmpInst); |    | ||||||
|  |   // New MCInst printing stuff. | ||||||
|  |   bool printInstruction(const MCInst *MI); | ||||||
|  |  | ||||||
|  |   void printOperand(const MCInst *MI, unsigned OpNo, | ||||||
|  |                     const char *Modifier = 0, bool NotRIPRel = false); | ||||||
|  |   void printMemReference(const MCInst *MI, unsigned Op, | ||||||
|  |                          const char *Modifier=NULL, bool NotRIPRel = false); | ||||||
|  |   void printLeaMemReference(const MCInst *MI, unsigned Op, | ||||||
|  |                             const char *Modifier=NULL, bool NotRIPRel = false); | ||||||
|  |   void printSSECC(const MCInst *MI, unsigned Op); | ||||||
|  |   void printPICLabel(const MCInst *MI, unsigned Op); | ||||||
|  |  | ||||||
|  |   void printi8mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printi16mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printi32mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printi64mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printi128mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printf32mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printf64mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printf80mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printf128mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printlea32mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printLeaMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printlea64mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printLeaMemReference(MI, OpNo); | ||||||
|  |   } | ||||||
|  |   void printlea64_32mem(const MCInst *MI, unsigned OpNo) { | ||||||
|  |     printLeaMemReference(MI, OpNo, "subreg64"); | ||||||
|  |   } | ||||||
|  |    | ||||||
|    |    | ||||||
|  |  | ||||||
|   // These methods are used by the tablegen'erated instruction printer. |   // These methods are used by the tablegen'erated instruction printer. | ||||||
|   | |||||||
| @@ -15,8 +15,46 @@ | |||||||
| #define DEBUG_TYPE "asm-printer" | #define DEBUG_TYPE "asm-printer" | ||||||
| #include "llvm/MC/MCInst.h" | #include "llvm/MC/MCInst.h" | ||||||
| #include "X86ATTAsmPrinter.h" | #include "X86ATTAsmPrinter.h" | ||||||
|  | #include "llvm/Support/raw_ostream.h" | ||||||
| using namespace llvm; | using namespace llvm; | ||||||
|  |  | ||||||
| bool X86ATTAsmPrinter::printInstruction(const MCInst &TmpInst) { | // Include the auto-generated portion of the assembly writer. | ||||||
|   return true; | #define MachineInstr MCInst | ||||||
|  | #define NO_ASM_WRITER_BOILERPLATE | ||||||
|  | #include "X86GenAsmWriter.inc" | ||||||
|  | #undef MachineInstr | ||||||
|  |  | ||||||
|  | void X86ATTAsmPrinter::printSSECC(const MCInst *MI, unsigned Op) { | ||||||
|  |   unsigned char value = MI->getOperand(Op).getImm(); | ||||||
|  |   assert(value <= 7 && "Invalid ssecc argument!"); | ||||||
|  |   switch (value) { | ||||||
|  |     case 0: O << "eq"; break; | ||||||
|  |     case 1: O << "lt"; break; | ||||||
|  |     case 2: O << "le"; break; | ||||||
|  |     case 3: O << "unord"; break; | ||||||
|  |     case 4: O << "neq"; break; | ||||||
|  |     case 5: O << "nlt"; break; | ||||||
|  |     case 6: O << "nle"; break; | ||||||
|  |     case 7: O << "ord"; break; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void X86ATTAsmPrinter::printPICLabel(const MCInst *MI, unsigned Op) { | ||||||
|  |   assert(0 && | ||||||
|  |          "This is only used for MOVPC32r, should lower before asm printing!"); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo, | ||||||
|  |                                     const char *Modifier, bool NotRIPRel) { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op, | ||||||
|  |                                             const char *Modifier, | ||||||
|  |                                             bool NotRIPRel) { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void X86ATTAsmPrinter::printMemReference(const MCInst *MI, unsigned Op, | ||||||
|  |                                          const char *Modifier, bool NotRIPRel){ | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user