aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenDAGPatterns.h
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-07-11 18:25:51 +0000
committerDavid Greene <greened@obbligato.org>2011-07-11 18:25:51 +0000
commitd4a9066c93da9a5aab47ca228d82e796fdec70c0 (patch)
treef4533e3a9fe75aa310bd4682b254a053af0bfd73 /utils/TableGen/CodeGenDAGPatterns.h
parent7ae0df41422193e65231a0f9526bfe66067c6532 (diff)
[AVX] Make Inits Foldable
Manage Inits in a FoldingSet. This provides several benefits: - Memory for Inits is properly managed - Duplicate Inits are folded into Flyweights, saving memory - It enforces const-correctness, protecting against certain classes of bugs The above benefits allow Inits to be used in more contexts, which in turn provides more dynamism to TableGen. This enhanced capability will be used by the AVX code generator to a fold common patterns together. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenDAGPatterns.h')
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/utils/TableGen/CodeGenDAGPatterns.h b/utils/TableGen/CodeGenDAGPatterns.h
index e4e8574bbc..f517219ee7 100644
--- a/utils/TableGen/CodeGenDAGPatterns.h
+++ b/utils/TableGen/CodeGenDAGPatterns.h
@@ -306,7 +306,7 @@ class TreePatternNode {
/// Val - The init value (e.g. the "GPRC" record, or "7") for a leaf.
///
- Init *Val;
+ const Init *Val;
/// Name - The name given to this node with the :$foo notation.
///
@@ -327,7 +327,7 @@ public:
: Operator(Op), Val(0), TransformFn(0), Children(Ch) {
Types.resize(NumResults);
}
- TreePatternNode(Init *val, unsigned NumResults) // leaf ctor
+ TreePatternNode(const Init *val, unsigned NumResults) // leaf ctor
: Operator(0), Val(val), TransformFn(0) {
Types.resize(NumResults);
}
@@ -358,7 +358,7 @@ public:
return Types[ResNo].isDynamicallyResolved();
}
- Init *getLeafValue() const { assert(isLeaf()); return Val; }
+ const Init *getLeafValue() const { assert(isLeaf()); return Val; }
Record *getOperator() const { assert(!isLeaf()); return Operator; }
unsigned getNumChildren() const { return Children.size(); }
@@ -517,9 +517,9 @@ public:
/// TreePattern constructor - Parse the specified DagInits into the
/// current record.
- TreePattern(Record *TheRec, ListInit *RawPat, bool isInput,
+ TreePattern(Record *TheRec, const ListInit *RawPat, bool isInput,
CodeGenDAGPatterns &ise);
- TreePattern(Record *TheRec, DagInit *Pat, bool isInput,
+ TreePattern(Record *TheRec, const DagInit *Pat, bool isInput,
CodeGenDAGPatterns &ise);
TreePattern(Record *TheRec, TreePatternNode *Pat, bool isInput,
CodeGenDAGPatterns &ise);
@@ -576,7 +576,7 @@ public:
void dump() const;
private:
- TreePatternNode *ParseTreePattern(Init *DI, StringRef OpName);
+ TreePatternNode *ParseTreePattern(const Init *DI, StringRef OpName);
void ComputeNamedNodes();
void ComputeNamedNodes(TreePatternNode *N);
};
@@ -631,7 +631,7 @@ public:
/// processed to produce isel.
class PatternToMatch {
public:
- PatternToMatch(Record *srcrecord, ListInit *preds,
+ PatternToMatch(Record *srcrecord, const ListInit *preds,
TreePatternNode *src, TreePatternNode *dst,
const std::vector<Record*> &dstregs,
unsigned complexity, unsigned uid)
@@ -639,7 +639,7 @@ public:
Dstregs(dstregs), AddedComplexity(complexity), ID(uid) {}
Record *SrcRecord; // Originating Record for the pattern.
- ListInit *Predicates; // Top level predicate conditions to match.
+ const ListInit *Predicates; // Top level predicate conditions to match.
TreePatternNode *SrcPattern; // Source pattern to match.
TreePatternNode *DstPattern; // Resulting pattern.
std::vector<Record*> Dstregs; // Physical register defs being matched.
@@ -647,7 +647,7 @@ public:
unsigned ID; // Unique ID for the record.
Record *getSrcRecord() const { return SrcRecord; }
- ListInit *getPredicates() const { return Predicates; }
+ const ListInit *getPredicates() const { return Predicates; }
TreePatternNode *getSrcPattern() const { return SrcPattern; }
TreePatternNode *getDstPattern() const { return DstPattern; }
const std::vector<Record*> &getDstRegs() const { return Dstregs; }