[llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp CodeGenTarget.h
Chris Lattner
lattner at cs.uiuc.edu
Thu Jan 26 17:45:18 PST 2006
Changes in directory llvm/utils/TableGen:
CodeGenTarget.cpp updated: 1.53 -> 1.54
CodeGenTarget.h updated: 1.23 -> 1.24
---
Log message:
PHI and INLINEASM are now builtin instructions provided by Target.td
---
Diffs of the changes: (+13 -21)
CodeGenTarget.cpp | 30 +++++++++++++-----------------
CodeGenTarget.h | 4 ----
2 files changed, 13 insertions(+), 21 deletions(-)
Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.53 llvm/utils/TableGen/CodeGenTarget.cpp:1.54
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.53 Mon Jan 9 12:27:06 2006
+++ llvm/utils/TableGen/CodeGenTarget.cpp Thu Jan 26 19:45:06 2006
@@ -205,10 +205,10 @@
void CodeGenTarget::ReadInstructions() const {
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
-
- if (Insts.empty())
+ if (Insts.size() <= 2)
throw std::string("No 'Instruction' subclasses defined!");
+ // Parse the instructions defined in the .td file.
std::string InstFormatName =
getAsmWriter()->getValueAsString("InstFormatName");
@@ -219,29 +219,25 @@
}
}
-/// getPHIInstruction - Return the designated PHI instruction.
-///
-const CodeGenInstruction &CodeGenTarget::getPHIInstruction() const {
- Record *PHI = getInstructionSet()->getValueAsDef("PHIInst");
- std::map<std::string, CodeGenInstruction>::const_iterator I =
- getInstructions().find(PHI->getName());
- if (I == Instructions.end())
- throw "Could not find PHI instruction named '" + PHI->getName() + "'!";
- return I->second;
-}
-
/// getInstructionsByEnumValue - Return all of the instructions defined by the
/// target, ordered by their enum value.
void CodeGenTarget::
getInstructionsByEnumValue(std::vector<const CodeGenInstruction*>
&NumberedInstructions) {
-
+ std::map<std::string, CodeGenInstruction>::const_iterator I;
+ I = getInstructions().find("PHI");
+ if (I == Instructions.end()) throw "Could not find 'PHI' instruction!";
+ const CodeGenInstruction *PHI = &I->second;
+
+ I = getInstructions().find("INLINEASM");
+ if (I == Instructions.end()) throw "Could not find 'INLINEASM' instruction!";
+ const CodeGenInstruction *INLINEASM = &I->second;
+
// Print out the rest of the instructions now.
- unsigned i = 0;
- const CodeGenInstruction *PHI = &getPHIInstruction();
NumberedInstructions.push_back(PHI);
+ NumberedInstructions.push_back(INLINEASM);
for (inst_iterator II = inst_begin(), E = inst_end(); II != E; ++II)
- if (&II->second != PHI)
+ if (&II->second != PHI &&&II->second != INLINEASM)
NumberedInstructions.push_back(&II->second);
}
Index: llvm/utils/TableGen/CodeGenTarget.h
diff -u llvm/utils/TableGen/CodeGenTarget.h:1.23 llvm/utils/TableGen/CodeGenTarget.h:1.24
--- llvm/utils/TableGen/CodeGenTarget.h:1.23 Wed Dec 7 20:14:08 2005
+++ llvm/utils/TableGen/CodeGenTarget.h Thu Jan 26 19:45:06 2006
@@ -148,10 +148,6 @@
&NumberedInstructions);
- /// getPHIInstruction - Return the designated PHI instruction.
- ///
- const CodeGenInstruction &getPHIInstruction() const;
-
/// isLittleEndianEncoding - are instruction bit patterns defined as [0..n]?
///
bool isLittleEndianEncoding() const;
More information about the llvm-commits
mailing list