diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-19 00:34:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-19 00:34:35 +0000 |
commit | 918be520dc4da4ffbcf02c858adc243293dbdc29 (patch) | |
tree | 303f83eac68eb6742ac1448a90972dc8315b830d /llvm/utils/TableGen/CodeGenTarget.h | |
parent | 1734e47d200fc75e5d044771441470ac0174609e (diff) | |
download | llvm-918be520dc4da4ffbcf02c858adc243293dbdc29.zip llvm-918be520dc4da4ffbcf02c858adc243293dbdc29.tar.gz llvm-918be520dc4da4ffbcf02c858adc243293dbdc29.tar.bz2 |
change Target.getInstructionsByEnumValue to return a reference
to a vector that CGT stores instead of synthesizing it on every
call.
llvm-svn: 98910
Diffstat (limited to 'llvm/utils/TableGen/CodeGenTarget.h')
-rw-r--r-- | llvm/utils/TableGen/CodeGenTarget.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/CodeGenTarget.h b/llvm/utils/TableGen/CodeGenTarget.h index d48e49a..ac6574d 100644 --- a/llvm/utils/TableGen/CodeGenTarget.h +++ b/llvm/utils/TableGen/CodeGenTarget.h @@ -70,6 +70,8 @@ class CodeGenTarget { void ReadRegisterClasses() const; void ReadInstructions() const; void ReadLegalValueTypes() const; + + std::vector<const CodeGenInstruction*> InstrsByEnum; public: CodeGenTarget(); @@ -210,13 +212,18 @@ public: /// getInstructionsByEnumValue - Return all of the instructions defined by the /// target, ordered by their enum value. - void getInstructionsByEnumValue(std::vector<const CodeGenInstruction*> - &NumberedInstructions); + const std::vector<const CodeGenInstruction*> &getInstructionsByEnumValue() { + if (InstrsByEnum.empty()) ComputeInstrsByEnum(); + return InstrsByEnum; + } /// isLittleEndianEncoding - are instruction bit patterns defined as [0..n]? /// bool isLittleEndianEncoding() const; + +private: + void ComputeInstrsByEnum(); }; /// ComplexPattern - ComplexPattern info, corresponding to the ComplexPattern |