llvm.org GIT mirror llvm / 8316a97
Refactoring in AsmWriterEmitter::EmitPrintAliasInstruction() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210527 91177308-0d34-0410-b5e6-96231b3b80d8 Artyom Skrobov 5 years ago
1 changed file(s) with 6 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
831831
832832 unsigned MIOpNum = 0;
833833 for (unsigned i = 0, e = LastOpNo; i != e; ++i) {
834 std::string Op = "MI->getOperand(" + llvm::utostr(MIOpNum) + ")";
835
834836 const CodeGenInstAlias::ResultOperand &RO = CGA->ResultOperands[i];
835837
836838 switch (RO.Kind) {
857859 if (Rec->isSubClassOf("RegisterOperand"))
858860 Rec = Rec->getValueAsDef("RegClass");
859861 if (Rec->isSubClassOf("RegisterClass")) {
860 Cond = std::string("MI->getOperand(") + llvm::utostr(MIOpNum) +
861 ").isReg()";
862 IAP->addCond(Cond);
862 IAP->addCond(Op + ".isReg()");
863863
864864 if (!IAP->isOpMapped(ROName)) {
865865 IAP->addOperand(ROName, MIOpNum, PrintMethodIdx);
868868 R = R->getValueAsDef("RegClass");
869869 Cond = std::string("MRI.getRegClass(") + Target.getName() + "::" +
870870 R->getName() + "RegClassID)"
871 ".contains(MI->getOperand(" +
872 llvm::utostr(MIOpNum) + ").getReg())";
871 ".contains(" + Op + ".getReg())";
873872 IAP->addCond(Cond);
874873 } else {
875 Cond = std::string("MI->getOperand(") +
876 llvm::utostr(MIOpNum) + ").getReg() == MI->getOperand(" +
874 Cond = Op + ".getReg() == MI->getOperand(" +
877875 llvm::utostr(IAP->getOpIndex(ROName)) + ").getReg()";
878876 IAP->addCond(Cond);
879877 }
886884 break;
887885 }
888886 case CodeGenInstAlias::ResultOperand::K_Imm: {
889 std::string Op = "MI->getOperand(" + llvm::utostr(MIOpNum) + ")";
890
891887 // Just because the alias has an immediate result, doesn't mean the
892888 // MCInst will. An MCExpr could be present, for example.
893889 IAP->addCond(Op + ".isImm()");
905901 break;
906902 }
907903
908 Cond = std::string("MI->getOperand(") +
909 llvm::utostr(MIOpNum) + ").getReg() == " + Target.getName() +
904 Cond = Op + ".getReg() == " + Target.getName() +
910905 "::" + CGA->ResultOperands[i].getRegister()->getName();
911906 IAP->addCond(Cond);
912907 break;