[llvm-commits] [llvm] r118190 - /llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Chris Lattner
sabre at nondot.org
Wed Nov 3 12:47:34 PDT 2010
Author: lattner
Date: Wed Nov 3 14:47:34 2010
New Revision: 118190
URL: http://llvm.org/viewvc/llvm-project?rev=118190&view=rev
Log:
rename Operand -> AsmOperand for clarity.
Modified:
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=118190&r1=118189&r2=118190&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Wed Nov 3 14:47:34 2010
@@ -63,9 +63,6 @@
// In addition, the subset relation amongst classes induces a partial order
// on such tuples, which we use to resolve ambiguities.
//
-// FIXME: What do we do if a crazy case shows up where this is the wrong
-// resolution?
-//
// 2. The input can now be treated as a tuple of classes (static tokens are
// simple singleton sets). Each such tuple should generally map to a single
// instruction (we currently ignore cases where this isn't true, whee!!!),
@@ -247,7 +244,7 @@
/// MatchableInfo - Helper class for storing the necessary information for an
/// instruction or alias which is capable of being matched.
struct MatchableInfo {
- struct Operand {
+ struct AsmOperand {
/// Token - This is the token that the operand came from.
StringRef Token;
@@ -259,7 +256,7 @@
/// list. If an operand is tied ($a=$b), this refers to source operand: $b.
const CGIOperandList::OperandInfo *OperandInfo;
- explicit Operand(StringRef T) : Token(T), Class(0), OperandInfo(0) {}
+ explicit AsmOperand(StringRef T) : Token(T), Class(0), OperandInfo(0) {}
};
/// InstrName - The target name for this instruction.
@@ -285,7 +282,7 @@
/// annotated with a class and where in the OperandList they were defined.
/// This directly corresponds to the tokenized AsmString after the mnemonic is
/// removed.
- SmallVector<Operand, 4> AsmOperands;
+ SmallVector<AsmOperand, 4> AsmOperands;
/// Predicates - The required subtarget features to match this instruction.
SmallVector<SubtargetFeatureInfo*, 4> RequiredFeatures;
@@ -477,7 +474,7 @@
errs() << InstrName << " -- " << "flattened:\"" << AsmString << "\"\n";
for (unsigned i = 0, e = AsmOperands.size(); i != e; ++i) {
- Operand &Op = AsmOperands[i];
+ AsmOperand &Op = AsmOperands[i];
errs() << " op[" << i << "] = " << Op.Class->ClassName << " - ";
if (Op.Class->Kind == ClassInfo::Token) {
errs() << '\"' << Op.Token << "\"\n";
@@ -531,22 +528,22 @@
case '\t':
case ',':
if (InTok) {
- AsmOperands.push_back(Operand(String.slice(Prev, i)));
+ AsmOperands.push_back(AsmOperand(String.slice(Prev, i)));
InTok = false;
}
if (!isspace(String[i]) && String[i] != ',')
- AsmOperands.push_back(Operand(String.substr(i, 1)));
+ AsmOperands.push_back(AsmOperand(String.substr(i, 1)));
Prev = i + 1;
break;
case '\\':
if (InTok) {
- AsmOperands.push_back(Operand(String.slice(Prev, i)));
+ AsmOperands.push_back(AsmOperand(String.slice(Prev, i)));
InTok = false;
}
++i;
assert(i != String.size() && "Invalid quoted character");
- AsmOperands.push_back(Operand(String.substr(i, 1)));
+ AsmOperands.push_back(AsmOperand(String.substr(i, 1)));
Prev = i + 1;
break;
@@ -554,7 +551,7 @@
// If this isn't "${", treat like a normal token.
if (i + 1 == String.size() || String[i + 1] != '{') {
if (InTok) {
- AsmOperands.push_back(Operand(String.slice(Prev, i)));
+ AsmOperands.push_back(AsmOperand(String.slice(Prev, i)));
InTok = false;
}
Prev = i;
@@ -562,14 +559,14 @@
}
if (InTok) {
- AsmOperands.push_back(Operand(String.slice(Prev, i)));
+ AsmOperands.push_back(AsmOperand(String.slice(Prev, i)));
InTok = false;
}
StringRef::iterator End = std::find(String.begin() + i, String.end(),'}');
assert(End != String.end() && "Missing brace in operand reference!");
size_t EndPos = End - String.begin();
- AsmOperands.push_back(Operand(String.slice(i, EndPos+1)));
+ AsmOperands.push_back(AsmOperand(String.slice(i, EndPos+1)));
Prev = EndPos + 1;
i = EndPos;
break;
@@ -577,7 +574,7 @@
case '.':
if (InTok)
- AsmOperands.push_back(Operand(String.slice(Prev, i)));
+ AsmOperands.push_back(AsmOperand(String.slice(Prev, i)));
Prev = i;
InTok = true;
break;
@@ -587,7 +584,7 @@
}
}
if (InTok && Prev != String.size())
- AsmOperands.push_back(Operand(String.substr(Prev)));
+ AsmOperands.push_back(AsmOperand(String.substr(Prev)));
// The first token of the instruction is the mnemonic, which must be a
// simple string, not a $foo variable or a singleton register.
@@ -1033,7 +1030,7 @@
// Parse the tokens after the mnemonic.
for (unsigned i = 0, e = II->AsmOperands.size(); i != e; ++i) {
- MatchableInfo::Operand &Op = II->AsmOperands[i];
+ MatchableInfo::AsmOperand &Op = II->AsmOperands[i];
StringRef Token = Op.Token;
// Check for singleton registers.
@@ -1133,7 +1130,7 @@
// Order the (class) operands by the order to convert them into an MCInst.
for (unsigned i = 0, e = II.AsmOperands.size(); i != e; ++i) {
- MatchableInfo::Operand &Op = II.AsmOperands[i];
+ MatchableInfo::AsmOperand &Op = II.AsmOperands[i];
if (!Op.OperandInfo) continue;
unsigned LogicalOpNum = Op.OperandInfo - &II.OperandList[0];
@@ -1155,13 +1152,10 @@
int SrcOperand = OperandMap[i];
if (SrcOperand != -1) {
// Otherwise, this comes from something we parsed.
- MatchableInfo::Operand &Op = II.AsmOperands[SrcOperand];
+ MatchableInfo::AsmOperand &Op = II.AsmOperands[SrcOperand];
// Registers are always converted the same, don't duplicate the
// conversion function based on them.
- //
- // FIXME: We could generalize this based on the render method, if it
- // mattered.
Signature += "__";
if (Op.Class->isRegisterClass())
Signature += "Reg";
@@ -1706,7 +1700,7 @@
<< ", \"" << II.Mnemonic << "\""
<< ", " << II.ConversionFnKind << ", { ";
for (unsigned i = 0, e = II.AsmOperands.size(); i != e; ++i) {
- MatchableInfo::Operand &Op = II.AsmOperands[i];
+ MatchableInfo::AsmOperand &Op = II.AsmOperands[i];
if (i) OS << ", ";
OS << Op.Class->Name;
More information about the llvm-commits
mailing list