mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[NVPTXAsmPrinter] clean up dead code. NFC
Summary: The printOperand function takes a default parameter, for which there are zero call sites that explicitly pass such a parameter. As such, there is no case to support. This means that the method printVecModifiedImmediate is purly dead code, and can be removed. The eventual goal for some of these AsmPrinter refactoring is to have printOperand be a virtual method; making it easier to print operands from the base class for more generic Asm printing. It will help if all printOperand methods have the same function signature (ie. no Modifier argument when not needed). Reviewers: echristo, tra Reviewed By: echristo Subscribers: jholewinski, hiraditya, llvm-commits, craig.topper, srhines Tags: #llvm Differential Revision: https://reviews.llvm.org/D60727 llvm-svn: 358527
This commit is contained in:
parent
1af5220084
commit
25afb52e80
@ -599,36 +599,6 @@ void NVPTXAsmPrinter::emitVirtualRegister(unsigned int vr,
|
||||
O << getVirtualRegisterName(vr);
|
||||
}
|
||||
|
||||
void NVPTXAsmPrinter::printVecModifiedImmediate(
|
||||
const MachineOperand &MO, const char *Modifier, raw_ostream &O) {
|
||||
static const char vecelem[] = { '0', '1', '2', '3', '0', '1', '2', '3' };
|
||||
int Imm = (int) MO.getImm();
|
||||
if (0 == strcmp(Modifier, "vecelem"))
|
||||
O << "_" << vecelem[Imm];
|
||||
else if (0 == strcmp(Modifier, "vecv4comm1")) {
|
||||
if ((Imm < 0) || (Imm > 3))
|
||||
O << "//";
|
||||
} else if (0 == strcmp(Modifier, "vecv4comm2")) {
|
||||
if ((Imm < 4) || (Imm > 7))
|
||||
O << "//";
|
||||
} else if (0 == strcmp(Modifier, "vecv4pos")) {
|
||||
if (Imm < 0)
|
||||
Imm = 0;
|
||||
O << "_" << vecelem[Imm % 4];
|
||||
} else if (0 == strcmp(Modifier, "vecv2comm1")) {
|
||||
if ((Imm < 0) || (Imm > 1))
|
||||
O << "//";
|
||||
} else if (0 == strcmp(Modifier, "vecv2comm2")) {
|
||||
if ((Imm < 2) || (Imm > 3))
|
||||
O << "//";
|
||||
} else if (0 == strcmp(Modifier, "vecv2pos")) {
|
||||
if (Imm < 0)
|
||||
Imm = 0;
|
||||
O << "_" << vecelem[Imm % 2];
|
||||
} else
|
||||
llvm_unreachable("Unknown Modifier on immediate operand");
|
||||
}
|
||||
|
||||
void NVPTXAsmPrinter::emitDeclaration(const Function *F, raw_ostream &O) {
|
||||
emitLinkageDirective(F, O);
|
||||
if (isKernelFunction(*F))
|
||||
@ -2237,7 +2207,7 @@ bool NVPTXAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
}
|
||||
|
||||
void NVPTXAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
|
||||
raw_ostream &O, const char *Modifier) {
|
||||
raw_ostream &O) {
|
||||
const MachineOperand &MO = MI->getOperand(opNum);
|
||||
switch (MO.getType()) {
|
||||
case MachineOperand::MO_Register:
|
||||
@ -2249,17 +2219,11 @@ void NVPTXAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
|
||||
} else {
|
||||
emitVirtualRegister(MO.getReg(), O);
|
||||
}
|
||||
return;
|
||||
break;
|
||||
|
||||
case MachineOperand::MO_Immediate:
|
||||
if (!Modifier)
|
||||
O << MO.getImm();
|
||||
else if (strstr(Modifier, "vec") == Modifier)
|
||||
printVecModifiedImmediate(MO, Modifier, O);
|
||||
else
|
||||
llvm_unreachable(
|
||||
"Don't know how to handle modifier on immediate operand");
|
||||
return;
|
||||
O << MO.getImm();
|
||||
break;
|
||||
|
||||
case MachineOperand::MO_FPImmediate:
|
||||
printFPConstant(MO.getFPImm(), O);
|
||||
@ -2271,7 +2235,7 @@ void NVPTXAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
|
||||
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MO.getMBB()->getSymbol()->print(O, MAI);
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
llvm_unreachable("Operand type not supported.");
|
||||
|
@ -212,8 +212,6 @@ private:
|
||||
MCOperand GetSymbolRef(const MCSymbol *Symbol);
|
||||
unsigned encodeVirtualRegister(unsigned Reg);
|
||||
|
||||
void printVecModifiedImmediate(const MachineOperand &MO, const char *Modifier,
|
||||
raw_ostream &O);
|
||||
void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
||||
const char *Modifier = nullptr);
|
||||
void printModuleLevelGV(const GlobalVariable *GVar, raw_ostream &O,
|
||||
@ -231,8 +229,7 @@ private:
|
||||
void printReturnValStr(const MachineFunction &MF, raw_ostream &O);
|
||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
const char *ExtraCode, raw_ostream &) override;
|
||||
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
|
||||
const char *Modifier = nullptr);
|
||||
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
const char *ExtraCode, raw_ostream &) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user