llvm.org GIT mirror llvm / 2cc97de
[ms-inline asm] Asm operands can map to one or more MCOperands. Therefore, add the NumMCOperands argument to the GetMCInstOperandNum() function that is set to the number of MCOperands this asm operand mapped to. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163124 91177308-0d34-0410-b5e6-96231b3b80d8 Chad Rosier 7 years ago
6 changed file(s) with 33 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
112112
113113 virtual unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
114114 const SmallVectorImpl &Operands,
115 unsigned OperandNum) = 0;
115 unsigned OperandNum,
116 unsigned &NumMCOperands) = 0;
116117 };
117118
118119 } // End llvm namespace
264264
265265 unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
266266 const SmallVectorImpl &Operands,
267 unsigned OperandNum) {
268 return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum);
267 unsigned OperandNum, unsigned &NumMCOperands) {
268 return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum, NumMCOperands);
269269 }
270270 };
271271 } // end anonymous namespace
5757
5858 unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
5959 const SmallVectorImpl &Operands,
60 unsigned OperandNum) {
61 return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum);
60 unsigned OperandNum, unsigned &NumMCOperands) {
61 return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum,
62 NumMCOperands);
6263 }
6364
6465 public:
3939
4040 unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
4141 const SmallVectorImpl &Operands,
42 unsigned OperandNum);
42 unsigned OperandNum, unsigned &NumMCOperands);
4343
4444 public:
4545 MipsAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser)
103103 unsigned MipsAsmParser::
104104 GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
105105 const SmallVectorImpl &Operands,
106 unsigned OperandNum) {
106 unsigned OperandNum, unsigned &NumMCOperands) {
107107 assert (0 && "GetMCInstOperandNum() not supported by the Mips target.");
108108 // The Mips backend doesn't currently include the matcher implementation, so
109109 // the GetMCInstOperandNumImpl() is undefined. This is a temporary
110110 // work around.
111 NumMCOperands = 0;
111112 return 0;
112113 }
113114
7474
7575 unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
7676 const SmallVectorImpl &Operands,
77 unsigned OperandNum) {
78 return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum);
77 unsigned OperandNum, unsigned &NumMCOperands) {
78 return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum,
79 NumMCOperands);
7980 }
8081
8182 /// isSrcOp - Returns true if operand is either (%rsi) or %ds:%(rsi)
17021702 OpOS << "unsigned " << Target.getName() << ClassName << "::\n"
17031703 << "GetMCInstOperandNumImpl(unsigned Kind, MCInst &Inst,\n"
17041704 << " const SmallVectorImpl "
1705 << "&Operands,\n unsigned OperandNum) {\n"
1705 << "&Operands,\n unsigned OperandNum, unsigned "
1706 << "&NumMCOperands) {\n"
17061707 << " assert(Kind < CVT_NUM_SIGNATURES && \"Invalid signature!\");\n"
1708 << " NumMCOperands = 0;\n"
17071709 << " unsigned MCOperandNum = 0;\n"
17081710 << " uint8_t *Converter = ConversionTable[Kind];\n"
17091711 << " for (uint8_t *p = Converter; *p; p+= 2) {\n"
17111713 << " switch (*p) {\n"
17121714 << " default: llvm_unreachable(\"invalid conversion entry!\");\n"
17131715 << " case CVT_Reg:\n"
1716 << " if (*(p + 1) == OperandNum) {\n"
1717 << " NumMCOperands = 1;\n"
1718 << " break;\n"
1719 << " }\n"
17141720 << " ++MCOperandNum;\n"
17151721 << " break;\n"
17161722 << " case CVT_Tied:\n"
18101816
18111817 // Add a handler for the operand number lookup.
18121818 OpOS << " case " << Name << ":\n"
1819 << " if (*(p + 1) == OperandNum) {\n"
1820 << " NumMCOperands = " << OpInfo.MINumOperands << ";\n"
1821 << " break;\n"
1822 << " }\n"
18131823 << " MCOperandNum += " << OpInfo.MINumOperands << ";\n"
18141824 << " break;\n";
18151825 break;
18471857 << " break;\n";
18481858
18491859 OpOS << " case " << Name << ":\n"
1860 << " if (*(p + 1) == OperandNum) {\n"
1861 << " NumMCOperands = 1;\n"
1862 << " break;\n"
1863 << " }\n"
18501864 << " ++MCOperandNum;\n"
18511865 << " break;\n";
18521866 break;
18761890 << " break;\n";
18771891
18781892 OpOS << " case " << Name << ":\n"
1893 << " if (*(p + 1) == OperandNum) {\n"
1894 << " NumMCOperands = 1;\n"
1895 << " break;\n"
1896 << " }\n"
18791897 << " ++MCOperandNum;\n"
18801898 << " break;\n";
18811899 }
25822600 OS << " unsigned GetMCInstOperandNumImpl(unsigned Kind, MCInst &Inst,\n "
25832601 << " const "
25842602 << "SmallVectorImpl &Operands,\n "
2585 << " unsigned OperandNum);\n";
2603 << " unsigned OperandNum, unsigned &NumMCOperands);\n";
25862604 OS << " bool MnemonicIsValid(StringRef Mnemonic);\n";
25872605 OS << " unsigned MatchInstructionImpl(\n"
25882606 << " const SmallVectorImpl &Operands,\n"