Skip to content

Commit

Permalink
fix another fixme, replacing a string with a semantic pointer.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118325 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Nov 6, 2010
1 parent 225549f commit 5abd1eb
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions utils/TableGen/AsmMatcherEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ struct MatchableInfo {
}
};

/// InstrName - The target name for this instruction.
std::string InstrName;
/// ResultInst - The result instruction generated.
const CodeGenInstruction *ResultInst;

/// TheDef - This is the definition of the instruction or InstAlias that this
/// matchable came from.
Expand Down Expand Up @@ -349,14 +349,13 @@ struct MatchableInfo {
MatchableInfo(const CodeGenInstruction &CGI)
: TheDef(CGI.TheDef), DefRec(&CGI),
TheOperandList(CGI.Operands), AsmString(CGI.AsmString) {
InstrName = TheDef->getName();
ResultInst = &CGI;
}

MatchableInfo(const CodeGenInstAlias *Alias)
: TheDef(Alias->TheDef), DefRec(Alias), TheOperandList(Alias->Operands),
AsmString(Alias->AsmString) {
// FIXME: InstrName should be a CGI.
InstrName = Alias->ResultInst->TheDef->getName();
ResultInst = Alias->ResultInst;
}

void Initialize(const AsmMatcherInfo &Info,
Expand Down Expand Up @@ -537,7 +536,7 @@ class AsmMatcherInfo {
}

void MatchableInfo::dump() {
errs() << InstrName << " -- " << "flattened:\"" << AsmString << "\"\n";
errs() << TheDef->getName() << " -- " << "flattened:\"" << AsmString <<"\"\n";

for (unsigned i = 0, e = AsmOperands.size(); i != e; ++i) {
AsmOperand &Op = AsmOperands[i];
Expand Down Expand Up @@ -708,7 +707,7 @@ bool MatchableInfo::Validate(StringRef CommentDelimiter, bool Hack) const {
// FIXME: Should reject these. The ARM backend hits this with $lane in a
// bunch of instructions. It is unclear what the right answer is.
DEBUG({
errs() << "warning: '" << InstrName << "': "
errs() << "warning: '" << TheDef->getName() << "': "
<< "ignoring instruction with tied operand '"
<< Tok.str() << "'\n";
});
Expand Down Expand Up @@ -1050,8 +1049,8 @@ void AsmMatcherInfo::BuildInfo() {
// Ignore "Int_*" and "*_Int" instructions, which are internal aliases.
//
// FIXME: This is a total hack.
if (StringRef(II->InstrName).startswith("Int_") ||
StringRef(II->InstrName).endswith("_Int"))
if (StringRef(II->TheDef->getName()).startswith("Int_") ||
StringRef(II->TheDef->getName()).endswith("_Int"))
continue;

Matchables.push_back(II.take());
Expand Down Expand Up @@ -1822,7 +1821,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
it != ie; ++it) {
MatchableInfo &II = **it;

OS << " { " << Target.getName() << "::" << II.InstrName
OS << " { " << Target.getName() << "::" << II.ResultInst->TheDef->getName()
<< ", \"" << II.Mnemonic << "\""
<< ", " << II.ConversionFnKind << ", { ";
for (unsigned i = 0, e = II.AsmOperands.size(); i != e; ++i) {
Expand Down

0 comments on commit 5abd1eb

Please sign in to comment.