Skip to content

Commit

Permalink
[DPWBS-1120] feat(InstPrinter): pass subtarget to instruction printer
Browse files Browse the repository at this point in the history
This is in preparation for named CSFR operands support
  • Loading branch information
gargaroff committed Feb 6, 2020
1 parent 5102542 commit 63783c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion llvm/lib/Target/TriCore/InstPrinter/TriCoreInstPrinter.cpp
Expand Up @@ -31,7 +31,7 @@ using namespace llvm;
void TriCoreInstPrinter::printInst(const MCInst *MI, uint64_t Address,
StringRef Annot, const MCSubtargetInfo &STI,
raw_ostream &O) {
printInstruction(MI, Address, O);
printInstruction(MI, Address, STI, O);
printAnnotation(O, Annot);
}

Expand All @@ -40,6 +40,7 @@ void TriCoreInstPrinter::printRegName(raw_ostream &O, unsigned RegNo) const {
}

void TriCoreInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
const MCSubtargetInfo &STI,
raw_ostream &O, const char *Modifier) {
assert((Modifier == 0 || Modifier[0] == 0) && "No modifiers supported");
const MCOperand &MO = MI->getOperand(OpNo);
Expand Down
7 changes: 4 additions & 3 deletions llvm/lib/Target/TriCore/InstPrinter/TriCoreInstPrinter.h
Expand Up @@ -30,11 +30,12 @@ class TriCoreInstPrinter : public MCInstPrinter {
const MCSubtargetInfo &STI, raw_ostream &O) override;
void printRegName(raw_ostream &O, unsigned RegNo) const override;

void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
const char *Modifier = nullptr);
void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
raw_ostream &O, const char *Modifier = nullptr);

// Autogenerated by tblgen.
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
void printInstruction(const MCInst *MI, uint64_t Address,
const MCSubtargetInfo &STI, raw_ostream &O);

static const char *getRegisterName(unsigned RegNo);
};
Expand Down
5 changes: 5 additions & 0 deletions llvm/lib/Target/TriCore/TriCore.td
Expand Up @@ -72,7 +72,12 @@ def : Processor<"tc4xx", NoItineraries,
// Target Declaration
//===----------------------------------------------------------------------===//

def TriCoreAsmWriter : AsmWriter {
let PassSubtarget = 1;
}

def TriCore : Target {
let InstructionSet = TriCoreInstrInfo;
let AssemblyParsers = [TriCoreAsmParser];
let AssemblyWriters = [TriCoreAsmWriter];
}

0 comments on commit 63783c1

Please sign in to comment.