[llvm-commits] [llvm] r98906 - in /llvm/trunk/utils/TableGen: AsmMatcherEmitter.cpp CodeGenDAGPatterns.cpp CodeGenTarget.h
Chris Lattner
sabre at nondot.org
Thu Mar 18 17:18:23 PDT 2010
Author: lattner
Date: Thu Mar 18 19:18:23 2010
New Revision: 98906
URL: http://llvm.org/viewvc/llvm-project?rev=98906&view=rev
Log:
don't go through getInstructions().
Modified:
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/trunk/utils/TableGen/CodeGenTarget.h
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=98906&r1=98905&r2=98906&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Thu Mar 18 19:18:23 2010
@@ -844,19 +844,20 @@
// Parse the instructions; we need to do this first so that we can gather the
// singleton register classes.
std::set<std::string> SingletonRegisterNames;
- for (std::map<std::string, CodeGenInstruction>::const_iterator
- it = Target.getInstructions().begin(),
- ie = Target.getInstructions().end();
- it != ie; ++it) {
- const CodeGenInstruction &CGI = it->second;
+
+ std::vector<const CodeGenInstruction*> InstrList;
+ Target.getInstructionsByEnumValue(InstrList);
+
+ for (unsigned i = 0, e = InstrList.size(); i != e; ++i) {
+ const CodeGenInstruction &CGI = *InstrList[i];
- if (!StringRef(it->first).startswith(MatchPrefix))
+ if (!StringRef(CGI.TheDef->getName()).startswith(MatchPrefix))
continue;
- OwningPtr<InstructionInfo> II(new InstructionInfo);
+ OwningPtr<InstructionInfo> II(new InstructionInfo());
- II->InstrName = it->first;
- II->Instr = &it->second;
+ II->InstrName = CGI.TheDef->getName();
+ II->Instr = &CGI;
II->AsmString = FlattenVariants(CGI.AsmString, 0);
// Remove comments from the asm string.
@@ -869,7 +870,7 @@
TokenizeAsmString(II->AsmString, II->Tokens);
// Ignore instructions which shouldn't be matched.
- if (!IsAssemblerInstruction(it->first, CGI, II->Tokens))
+ if (!IsAssemblerInstruction(CGI.TheDef->getName(), CGI, II->Tokens))
continue;
// Collect singleton registers, if used.
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=98906&r1=98905&r2=98906&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Thu Mar 18 19:18:23 2010
@@ -2362,11 +2362,11 @@
void CodeGenDAGPatterns::InferInstructionFlags() {
- std::map<std::string, CodeGenInstruction> &InstrDescs =
- Target.getInstructions();
- for (std::map<std::string, CodeGenInstruction>::iterator
- II = InstrDescs.begin(), E = InstrDescs.end(); II != E; ++II) {
- CodeGenInstruction &InstInfo = II->second;
+ std::vector<const CodeGenInstruction*> Instructions;
+ Target.getInstructionsByEnumValue(Instructions);
+ for (unsigned i = 0, e = Instructions.size(); i != e; ++i) {
+ CodeGenInstruction &InstInfo =
+ const_cast<CodeGenInstruction &>(*Instructions[i]);
// Determine properties of the instruction from its pattern.
bool MayStore, MayLoad, HasSideEffects;
InferFromPattern(InstInfo, MayStore, MayLoad, HasSideEffects, *this);
Modified: llvm/trunk/utils/TableGen/CodeGenTarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.h?rev=98906&r1=98905&r2=98906&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.h Thu Mar 18 19:18:23 2010
@@ -185,6 +185,7 @@
/// getInstructions - Return all of the instructions defined for this target.
///
+private:
const std::map<std::string, CodeGenInstruction> &getInstructions() const {
if (Instructions.empty()) ReadInstructions();
return Instructions;
@@ -193,7 +194,6 @@
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!");
More information about the llvm-commits
mailing list