diff --git a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index 68ccd581f59..438716df979 100644 --- a/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -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."); diff --git a/lib/Target/NVPTX/NVPTXAsmPrinter.h b/lib/Target/NVPTX/NVPTXAsmPrinter.h index 8ed9cf7c355..43ae57ac126 100644 --- a/lib/Target/NVPTX/NVPTXAsmPrinter.h +++ b/lib/Target/NVPTX/NVPTXAsmPrinter.h @@ -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;