mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 07:17:36 +00:00
[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
This commit is contained in:
@@ -113,7 +113,8 @@ public:
|
|||||||
|
|
||||||
virtual unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
virtual unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
||||||
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||||
unsigned OperandNum) = 0;
|
unsigned OperandNum,
|
||||||
|
unsigned &NumMCOperands) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|||||||
@@ -265,8 +265,8 @@ public:
|
|||||||
|
|
||||||
unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
||||||
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||||
unsigned OperandNum) {
|
unsigned OperandNum, unsigned &NumMCOperands) {
|
||||||
return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum);
|
return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum, NumMCOperands);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|||||||
@@ -58,8 +58,9 @@ class MBlazeAsmParser : public MCTargetAsmParser {
|
|||||||
|
|
||||||
unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
||||||
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||||
unsigned OperandNum) {
|
unsigned OperandNum, unsigned &NumMCOperands) {
|
||||||
return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum);
|
return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum,
|
||||||
|
NumMCOperands);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class MipsAsmParser : public MCTargetAsmParser {
|
|||||||
|
|
||||||
unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
||||||
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||||
unsigned OperandNum);
|
unsigned OperandNum, unsigned &NumMCOperands);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MipsAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser)
|
MipsAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser)
|
||||||
@@ -104,11 +104,12 @@ public:
|
|||||||
unsigned MipsAsmParser::
|
unsigned MipsAsmParser::
|
||||||
GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
||||||
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||||
unsigned OperandNum) {
|
unsigned OperandNum, unsigned &NumMCOperands) {
|
||||||
assert (0 && "GetMCInstOperandNum() not supported by the Mips target.");
|
assert (0 && "GetMCInstOperandNum() not supported by the Mips target.");
|
||||||
// The Mips backend doesn't currently include the matcher implementation, so
|
// The Mips backend doesn't currently include the matcher implementation, so
|
||||||
// the GetMCInstOperandNumImpl() is undefined. This is a temporary
|
// the GetMCInstOperandNumImpl() is undefined. This is a temporary
|
||||||
// work around.
|
// work around.
|
||||||
|
NumMCOperands = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,9 @@ private:
|
|||||||
|
|
||||||
unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
unsigned GetMCInstOperandNum(unsigned Kind, MCInst &Inst,
|
||||||
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
|
||||||
unsigned OperandNum) {
|
unsigned OperandNum, unsigned &NumMCOperands) {
|
||||||
return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum);
|
return GetMCInstOperandNumImpl(Kind, Inst, Operands, OperandNum,
|
||||||
|
NumMCOperands);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isSrcOp - Returns true if operand is either (%rsi) or %ds:%(rsi)
|
/// isSrcOp - Returns true if operand is either (%rsi) or %ds:%(rsi)
|
||||||
|
|||||||
@@ -1703,8 +1703,10 @@ static void emitConvertToMCInst(CodeGenTarget &Target, StringRef ClassName,
|
|||||||
OpOS << "unsigned " << Target.getName() << ClassName << "::\n"
|
OpOS << "unsigned " << Target.getName() << ClassName << "::\n"
|
||||||
<< "GetMCInstOperandNumImpl(unsigned Kind, MCInst &Inst,\n"
|
<< "GetMCInstOperandNumImpl(unsigned Kind, MCInst &Inst,\n"
|
||||||
<< " const SmallVectorImpl<MCParsedAsmOperand*> "
|
<< " const SmallVectorImpl<MCParsedAsmOperand*> "
|
||||||
<< "&Operands,\n unsigned OperandNum) {\n"
|
<< "&Operands,\n unsigned OperandNum, unsigned "
|
||||||
|
<< "&NumMCOperands) {\n"
|
||||||
<< " assert(Kind < CVT_NUM_SIGNATURES && \"Invalid signature!\");\n"
|
<< " assert(Kind < CVT_NUM_SIGNATURES && \"Invalid signature!\");\n"
|
||||||
|
<< " NumMCOperands = 0;\n"
|
||||||
<< " unsigned MCOperandNum = 0;\n"
|
<< " unsigned MCOperandNum = 0;\n"
|
||||||
<< " uint8_t *Converter = ConversionTable[Kind];\n"
|
<< " uint8_t *Converter = ConversionTable[Kind];\n"
|
||||||
<< " for (uint8_t *p = Converter; *p; p+= 2) {\n"
|
<< " for (uint8_t *p = Converter; *p; p+= 2) {\n"
|
||||||
@@ -1712,6 +1714,10 @@ static void emitConvertToMCInst(CodeGenTarget &Target, StringRef ClassName,
|
|||||||
<< " switch (*p) {\n"
|
<< " switch (*p) {\n"
|
||||||
<< " default: llvm_unreachable(\"invalid conversion entry!\");\n"
|
<< " default: llvm_unreachable(\"invalid conversion entry!\");\n"
|
||||||
<< " case CVT_Reg:\n"
|
<< " case CVT_Reg:\n"
|
||||||
|
<< " if (*(p + 1) == OperandNum) {\n"
|
||||||
|
<< " NumMCOperands = 1;\n"
|
||||||
|
<< " break;\n"
|
||||||
|
<< " }\n"
|
||||||
<< " ++MCOperandNum;\n"
|
<< " ++MCOperandNum;\n"
|
||||||
<< " break;\n"
|
<< " break;\n"
|
||||||
<< " case CVT_Tied:\n"
|
<< " case CVT_Tied:\n"
|
||||||
@@ -1811,6 +1817,10 @@ static void emitConvertToMCInst(CodeGenTarget &Target, StringRef ClassName,
|
|||||||
|
|
||||||
// Add a handler for the operand number lookup.
|
// Add a handler for the operand number lookup.
|
||||||
OpOS << " case " << Name << ":\n"
|
OpOS << " case " << Name << ":\n"
|
||||||
|
<< " if (*(p + 1) == OperandNum) {\n"
|
||||||
|
<< " NumMCOperands = " << OpInfo.MINumOperands << ";\n"
|
||||||
|
<< " break;\n"
|
||||||
|
<< " }\n"
|
||||||
<< " MCOperandNum += " << OpInfo.MINumOperands << ";\n"
|
<< " MCOperandNum += " << OpInfo.MINumOperands << ";\n"
|
||||||
<< " break;\n";
|
<< " break;\n";
|
||||||
break;
|
break;
|
||||||
@@ -1848,6 +1858,10 @@ static void emitConvertToMCInst(CodeGenTarget &Target, StringRef ClassName,
|
|||||||
<< " break;\n";
|
<< " break;\n";
|
||||||
|
|
||||||
OpOS << " case " << Name << ":\n"
|
OpOS << " case " << Name << ":\n"
|
||||||
|
<< " if (*(p + 1) == OperandNum) {\n"
|
||||||
|
<< " NumMCOperands = 1;\n"
|
||||||
|
<< " break;\n"
|
||||||
|
<< " }\n"
|
||||||
<< " ++MCOperandNum;\n"
|
<< " ++MCOperandNum;\n"
|
||||||
<< " break;\n";
|
<< " break;\n";
|
||||||
break;
|
break;
|
||||||
@@ -1877,6 +1891,10 @@ static void emitConvertToMCInst(CodeGenTarget &Target, StringRef ClassName,
|
|||||||
<< " break;\n";
|
<< " break;\n";
|
||||||
|
|
||||||
OpOS << " case " << Name << ":\n"
|
OpOS << " case " << Name << ":\n"
|
||||||
|
<< " if (*(p + 1) == OperandNum) {\n"
|
||||||
|
<< " NumMCOperands = 1;\n"
|
||||||
|
<< " break;\n"
|
||||||
|
<< " }\n"
|
||||||
<< " ++MCOperandNum;\n"
|
<< " ++MCOperandNum;\n"
|
||||||
<< " break;\n";
|
<< " break;\n";
|
||||||
}
|
}
|
||||||
@@ -2583,7 +2601,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
OS << " unsigned GetMCInstOperandNumImpl(unsigned Kind, MCInst &Inst,\n "
|
OS << " unsigned GetMCInstOperandNumImpl(unsigned Kind, MCInst &Inst,\n "
|
||||||
<< " const "
|
<< " const "
|
||||||
<< "SmallVectorImpl<MCParsedAsmOperand*> &Operands,\n "
|
<< "SmallVectorImpl<MCParsedAsmOperand*> &Operands,\n "
|
||||||
<< " unsigned OperandNum);\n";
|
<< " unsigned OperandNum, unsigned &NumMCOperands);\n";
|
||||||
OS << " bool MnemonicIsValid(StringRef Mnemonic);\n";
|
OS << " bool MnemonicIsValid(StringRef Mnemonic);\n";
|
||||||
OS << " unsigned MatchInstructionImpl(\n"
|
OS << " unsigned MatchInstructionImpl(\n"
|
||||||
<< " const SmallVectorImpl<MCParsedAsmOperand*> &Operands,\n"
|
<< " const SmallVectorImpl<MCParsedAsmOperand*> &Operands,\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user