aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/CodeGenTarget.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-19 01:07:44 +0000
committerChris Lattner <sabre@nondot.org>2010-03-19 01:07:44 +0000
commit1802b17b6570a71af889b258f1d7bce3648710b9 (patch)
treeaa3f67dc6a14e39c544bfea1b5a9859caf58f86f /llvm/utils/TableGen/CodeGenTarget.h
parent4763dbeaf6df50ade250e37ded535a791551489d (diff)
downloadllvm-1802b17b6570a71af889b258f1d7bce3648710b9.zip
llvm-1802b17b6570a71af889b258f1d7bce3648710b9.tar.gz
llvm-1802b17b6570a71af889b258f1d7bce3648710b9.tar.bz2
Finally change the instruction looking map to be a densemap from
record* -> instrinfo instead of std::string -> instrinfo. This speeds up tblgen on cellcpu from 7.28 -> 5.98s with a debug build (20%). llvm-svn: 98916
Diffstat (limited to 'llvm/utils/TableGen/CodeGenTarget.h')
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.h27
1 files changed, 11 insertions, 16 deletions
diff --git a/llvm/utils/TableGen/CodeGenTarget.h b/llvm/utils/TableGen/CodeGenTarget.h
index a0e631e..f5952bc 100644
--- a/llvm/utils/TableGen/CodeGenTarget.h
+++ b/llvm/utils/TableGen/CodeGenTarget.h
@@ -17,11 +17,11 @@
#ifndef CODEGEN_TARGET_H
#define CODEGEN_TARGET_H
-#include "llvm/Support/raw_ostream.h"
#include "CodeGenRegisters.h"
#include "CodeGenInstruction.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/DenseMap.h"
#include <algorithm>
-#include <map>
namespace llvm {
@@ -62,7 +62,7 @@ std::string getQualifiedName(const Record *R);
class CodeGenTarget {
Record *TargetRec;
- mutable std::map<std::string, CodeGenInstruction> Instructions;
+ mutable DenseMap<const Record*, CodeGenInstruction*> Instructions;
mutable std::vector<CodeGenRegister> Registers;
mutable std::vector<CodeGenRegisterClass> RegisterClasses;
mutable std::vector<MVT::SimpleValueType> LegalValueTypes;
@@ -185,25 +185,20 @@ public:
return false;
}
- /// getInstructions - Return all of the instructions defined for this target.
- ///
private:
- const std::map<std::string, CodeGenInstruction> &getInstructions() const {
+ DenseMap<const Record*, CodeGenInstruction*> &getInstructions() const {
if (Instructions.empty()) ReadInstructions();
return Instructions;
}
- std::map<std::string, CodeGenInstruction> &getInstructions() {
- if (Instructions.empty()) ReadInstructions();
- return Instructions;
- }
- 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;
+ CodeGenInstruction &getInstruction(const Record *InstRec) const {
+ if (Instructions.empty()) ReadInstructions();
+ DenseMap<const Record*, CodeGenInstruction*>::iterator I =
+ Instructions.find(InstRec);
+ assert(I != Instructions.end() && "Not an instruction");
+ return *I->second;
+ }
/// getInstructionsByEnumValue - Return all of the instructions defined by the
/// target, ordered by their enum value.