aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenTarget.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-19 01:00:55 +0000
committerChris Lattner <sabre@nondot.org>2010-03-19 01:00:55 +0000
commit6a91b18e5777f39e52e93221453abfa4553b6f93 (patch)
tree070047b9095180904bfa4bf499a94a8c7cd7025d /utils/TableGen/CodeGenTarget.h
parent01dcecc214918b29cf3712420457fef309eeaad6 (diff)
make inst_begin/inst_end iterate over InstructionsByEnumValue.
Use CodeGenTarget::getInstNamespace in one place and fix it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenTarget.h')
-rw-r--r--utils/TableGen/CodeGenTarget.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/utils/TableGen/CodeGenTarget.h b/utils/TableGen/CodeGenTarget.h
index ac6574d69a..a0e631e109 100644
--- a/utils/TableGen/CodeGenTarget.h
+++ b/utils/TableGen/CodeGenTarget.h
@@ -71,7 +71,7 @@ class CodeGenTarget {
void ReadInstructions() const;
void ReadLegalValueTypes() const;
- std::vector<const CodeGenInstruction*> InstrsByEnum;
+ mutable std::vector<const CodeGenInstruction*> InstrsByEnum;
public:
CodeGenTarget();
@@ -205,25 +205,25 @@ public:
CodeGenInstruction &getInstruction(const Record *InstRec) const;
- typedef std::map<std::string,
- CodeGenInstruction>::const_iterator inst_iterator;
- inst_iterator inst_begin() const { return getInstructions().begin(); }
- inst_iterator inst_end() const { return Instructions.end(); }
-
/// getInstructionsByEnumValue - Return all of the instructions defined by the
/// target, ordered by their enum value.
- const std::vector<const CodeGenInstruction*> &getInstructionsByEnumValue() {
+ const std::vector<const CodeGenInstruction*> &
+ getInstructionsByEnumValue() const {
if (InstrsByEnum.empty()) ComputeInstrsByEnum();
return InstrsByEnum;
}
-
+ typedef std::vector<const CodeGenInstruction*>::const_iterator inst_iterator;
+ inst_iterator inst_begin() const{return getInstructionsByEnumValue().begin();}
+ inst_iterator inst_end() const { return getInstructionsByEnumValue().end(); }
+
+
/// isLittleEndianEncoding - are instruction bit patterns defined as [0..n]?
///
bool isLittleEndianEncoding() const;
private:
- void ComputeInstrsByEnum();
+ void ComputeInstrsByEnum() const;
};
/// ComplexPattern - ComplexPattern info, corresponding to the ComplexPattern