[Hexagon] Remove unused functions from HexagonInstPrinter, NFC

llvm-svn: 340081
This commit is contained in:
Krzysztof Parzyszek 2018-08-17 21:12:37 +00:00
parent 59320fc9d7
commit 9937e205e8
2 changed files with 9 additions and 125 deletions

View File

@ -28,26 +28,8 @@ using namespace llvm;
#define GET_INSTRUCTION_NAME
#include "HexagonGenAsmWriter.inc"
HexagonInstPrinter::HexagonInstPrinter(MCAsmInfo const &MAI,
MCInstrInfo const &MII,
MCRegisterInfo const &MRI)
: MCInstPrinter(MAI, MII, MRI), MII(MII), HasExtender(false) {
}
StringRef HexagonInstPrinter::getOpcodeName(unsigned Opcode) const {
return MII.getName(Opcode);
}
void HexagonInstPrinter::printRegName(raw_ostream &O, unsigned RegNo) const {
O << getRegName(RegNo);
}
StringRef HexagonInstPrinter::getRegName(unsigned RegNo) const {
return getRegisterName(RegNo);
}
void HexagonInstPrinter::setExtender(MCInst const &MCI) {
HasExtender = HexagonMCInstrInfo::isImmext(MCI);
O << getRegisterName(RegNo);
}
void HexagonInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
@ -65,7 +47,7 @@ void HexagonInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
printInstruction(MCI.getOperand(0).getInst(), OS);
} else
printInstruction(&MCI, OS);
setExtender(MCI);
HasExtender = HexagonMCInstrInfo::isImmext(MCI);
OS << "\n";
}
@ -97,72 +79,6 @@ void HexagonInstPrinter::printOperand(MCInst const *MI, unsigned OpNo,
}
}
void HexagonInstPrinter::printExtOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {
printOperand(MI, OpNo, O);
}
void HexagonInstPrinter::printUnsignedImmOperand(MCInst const *MI,
unsigned OpNo,
raw_ostream &O) const {
O << MI->getOperand(OpNo).getImm();
}
void HexagonInstPrinter::printNegImmOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {
O << -MI->getOperand(OpNo).getImm();
}
void HexagonInstPrinter::printNOneImmOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {
O << -1;
}
void HexagonInstPrinter::printGlobalOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {
printOperand(MI, OpNo, O);
}
void HexagonInstPrinter::printJumpTable(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {
assert(MI->getOperand(OpNo).isExpr() && "Expecting expression");
printOperand(MI, OpNo, O);
}
void HexagonInstPrinter::printConstantPool(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {
assert(MI->getOperand(OpNo).isExpr() && "Expecting expression");
printOperand(MI, OpNo, O);
}
void HexagonInstPrinter::printBranchOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {
// Branches can take an immediate operand. This is used by the branch
// selection pass to print $+8, an eight byte displacement from the PC.
llvm_unreachable("Unknown branch operand.");
}
void HexagonInstPrinter::printCallOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {}
void HexagonInstPrinter::printAbsAddrOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {}
void HexagonInstPrinter::printPredicateOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {}
void HexagonInstPrinter::printSymbol(MCInst const *MI, unsigned OpNo,
raw_ostream &O, bool hi) const {
assert(MI->getOperand(OpNo).isImm() && "Unknown symbol operand");
O << '#' << (hi ? "HI" : "LO") << '(';
O << '#';
printOperand(MI, OpNo, O);
O << ')';
}
void HexagonInstPrinter::printBrtarget(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const {
MCOperand const &MO = MI->getOperand(OpNo);

View File

@ -26,57 +26,25 @@ namespace llvm {
class HexagonInstPrinter : public MCInstPrinter {
public:
explicit HexagonInstPrinter(MCAsmInfo const &MAI, MCInstrInfo const &MII,
MCRegisterInfo const &MRI);
MCRegisterInfo const &MRI)
: MCInstPrinter(MAI, MII, MRI), MII(MII) {}
void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot,
const MCSubtargetInfo &STI) override;
virtual StringRef getOpcodeName(unsigned Opcode) const;
void printInstruction(MCInst const *MI, raw_ostream &O);
StringRef getRegName(unsigned RegNo) const;
static char const *getRegisterName(unsigned RegNo);
void printRegName(raw_ostream &O, unsigned RegNo) const override;
static char const *getRegisterName(unsigned RegNo);
void printInstruction(MCInst const *MI, raw_ostream &O);
void printOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
void printExtOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
void printUnsignedImmOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const;
void printNegImmOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const;
void printNOneImmOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const;
void printBranchOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const;
void printCallOperand(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
void printAbsAddrOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const;
void printPredicateOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const;
void printGlobalOperand(MCInst const *MI, unsigned OpNo,
raw_ostream &O) const;
void printJumpTable(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
void printBrtarget(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
void printConstantPool(MCInst const *MI, unsigned OpNo, raw_ostream &O) const;
void printSymbolHi(MCInst const *MI, unsigned OpNo, raw_ostream &O) const {
printSymbol(MI, OpNo, O, true);
}
void printSymbolLo(MCInst const *MI, unsigned OpNo, raw_ostream &O) const {
printSymbol(MI, OpNo, O, false);
}
MCAsmInfo const &getMAI() const { return MAI; }
MCInstrInfo const &getMII() const { return MII; }
protected:
void printSymbol(MCInst const *MI, unsigned OpNo, raw_ostream &O,
bool hi) const;
private:
MCInstrInfo const &MII;
bool HasExtender;
void setExtender(MCInst const &MCI);
bool HasExtender = false;
};
} // end namespace llvm