[llvm-commits] [llvm] r98904 - in /llvm/trunk/utils/TableGen: CodeEmitterGen.cpp CodeGenDAGPatterns.cpp CodeGenTarget.cpp CodeGenTarget.h DAGISelEmitter.cpp DAGISelMatcherGen.cpp FastISelEmitter.cpp
Chris Lattner
sabre at nondot.org
Thu Mar 18 17:07:20 PDT 2010
Author: lattner
Date: Thu Mar 18 19:07:20 2010
New Revision: 98904
URL: http://llvm.org/viewvc/llvm-project?rev=98904&view=rev
Log:
look up instructions by record, not by name.
Modified:
llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/trunk/utils/TableGen/CodeGenTarget.cpp
llvm/trunk/utils/TableGen/CodeGenTarget.h
llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
llvm/trunk/utils/TableGen/FastISelEmitter.cpp
Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=98904&r1=98903&r2=98904&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Thu Mar 18 19:07:20 2010
@@ -156,7 +156,7 @@
BitsInit *BI = R->getValueAsBitsInit("Inst");
const std::vector<RecordVal> &Vals = R->getValues();
- CodeGenInstruction &CGI = Target.getInstruction(InstName);
+ CodeGenInstruction &CGI = Target.getInstruction(R);
// Loop over all of the fields in the instruction, determining which are the
// operands to the instruction.
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=98904&r1=98903&r2=98904&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Thu Mar 18 19:07:20 2010
@@ -1141,7 +1141,7 @@
"Only supports zero or one result instrs!");
CodeGenInstruction &InstInfo =
- CDP.getTargetInfo().getInstruction(getOperator()->getName());
+ CDP.getTargetInfo().getInstruction(getOperator());
EEVT::TypeSet ResultType;
@@ -2083,7 +2083,7 @@
std::vector<Record*> Results;
std::vector<Record*> Operands;
- CodeGenInstruction &InstInfo =Target.getInstruction(Instrs[i]->getName());
+ CodeGenInstruction &InstInfo = Target.getInstruction(Instrs[i]);
if (InstInfo.OperandList.size() != 0) {
if (InstInfo.NumDefs == 0) {
@@ -2150,7 +2150,7 @@
// Parse the operands list from the (ops) list, validating it.
assert(I->getArgList().empty() && "Args list should still be empty here!");
- CodeGenInstruction &CGI = Target.getInstruction(Instrs[i]->getName());
+ CodeGenInstruction &CGI = Target.getInstruction(Instrs[i]);
// Check that all of the results occur first in the list.
std::vector<Record*> Results;
Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=98904&r1=98903&r2=98904&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Thu Mar 18 19:07:20 2010
@@ -138,6 +138,12 @@
return TargetRec->getValueAsDef("InstructionSet");
}
+
+CodeGenInstruction &CodeGenTarget::getInstruction(const Record *InstRec) const {
+ return getInstruction(InstRec->getName());
+}
+
+
/// getAsmParser - Return the AssemblyParser definition for this target.
///
Record *CodeGenTarget::getAsmParser() const {
Modified: llvm/trunk/utils/TableGen/CodeGenTarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.h?rev=98904&r1=98903&r2=98904&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.h Thu Mar 18 19:07:20 2010
@@ -193,12 +193,15 @@
if (Instructions.empty()) ReadInstructions();
return Instructions;
}
-
+private:
CodeGenInstruction &getInstruction(const std::string &Name) const {
const std::map<std::string, CodeGenInstruction> &Insts = getInstructions();
assert(Insts.count(Name) && "Not an instruction!");
return const_cast<CodeGenInstruction&>(Insts.find(Name)->second);
}
+public:
+
+ CodeGenInstruction &getInstruction(const Record *InstRec) const;
typedef std::map<std::string,
CodeGenInstruction>::const_iterator inst_iterator;
Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=98904&r1=98903&r2=98904&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Thu Mar 18 19:07:20 2010
@@ -75,7 +75,7 @@
Record *Op = P->getOperator();
if (Op->isSubClassOf("Instruction")) {
Cost++;
- CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName());
+ CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op);
if (II.usesCustomInserter)
Cost += 10;
}
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=98904&r1=98903&r2=98904&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Thu Mar 18 19:07:20 2010
@@ -627,7 +627,7 @@
SmallVectorImpl<unsigned> &OutputOps) {
Record *Op = N->getOperator();
const CodeGenTarget &CGT = CGP.getTargetInfo();
- CodeGenInstruction &II = CGT.getInstruction(Op->getName());
+ CodeGenInstruction &II = CGT.getInstruction(Op);
const DAGInstruction &Inst = CGP.getInstruction(Op);
// If we can, get the pattern for the instruction we're generating. We derive
Modified: llvm/trunk/utils/TableGen/FastISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FastISelEmitter.cpp?rev=98904&r1=98903&r2=98904&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/FastISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/FastISelEmitter.cpp Thu Mar 18 19:07:20 2010
@@ -254,7 +254,7 @@
Record *Op = Dst->getOperator();
if (!Op->isSubClassOf("Instruction"))
continue;
- CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName());
+ CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op);
if (II.OperandList.empty())
continue;
More information about the llvm-commits
mailing list