summaryrefslogtreecommitdiff
path: root/utils/TableGen/FastISelEmitter.cpp
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/FastISelEmitter.cpp
parent7ae0df41422193e65231a0f9526bfe66067c6532 (diff)
downloadllvm-d4a9066c93da9a5aab47ca228d82e796fdec70c0.tar.gz
llvm-d4a9066c93da9a5aab47ca228d82e796fdec70c0.tar.bz2
llvm-d4a9066c93da9a5aab47ca228d82e796fdec70c0.tar.xz
[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/FastISelEmitter.cpp')
-rw-r--r--utils/TableGen/FastISelEmitter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/utils/TableGen/FastISelEmitter.cpp b/utils/TableGen/FastISelEmitter.cpp
index f54e8df40f..2a86b896c0 100644
--- a/utils/TableGen/FastISelEmitter.cpp
+++ b/utils/TableGen/FastISelEmitter.cpp
@@ -241,7 +241,7 @@ struct OperandsSignature {
if (Op->getType(0) != VT)
return false;
- DefInit *OpDI = dynamic_cast<DefInit*>(Op->getLeafValue());
+ const DefInit *OpDI = dynamic_cast<const DefInit*>(Op->getLeafValue());
if (!OpDI)
return false;
Record *OpLeafRec = OpDI->getDef();
@@ -401,12 +401,12 @@ static std::string PhyRegForNode(TreePatternNode *Op,
if (!Op->isLeaf())
return PhysReg;
- DefInit *OpDI = dynamic_cast<DefInit*>(Op->getLeafValue());
+ const DefInit *OpDI = dynamic_cast<const DefInit*>(Op->getLeafValue());
Record *OpLeafRec = OpDI->getDef();
if (!OpLeafRec->isSubClassOf("Register"))
return PhysReg;
- PhysReg += static_cast<StringInit*>(OpLeafRec->getValue( \
+ PhysReg += static_cast<const StringInit*>(OpLeafRec->getValue( \
"Namespace")->getValue())->getValue();
PhysReg += "::";
PhysReg += Target.getRegBank().getReg(OpLeafRec)->getName();
@@ -468,7 +468,7 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) {
// a bit too complicated for now.
if (!Dst->getChild(1)->isLeaf()) continue;
- DefInit *SR = dynamic_cast<DefInit*>(Dst->getChild(1)->getLeafValue());
+ const DefInit *SR = dynamic_cast<const DefInit*>(Dst->getChild(1)->getLeafValue());
if (SR)
SubRegNo = getQualifiedName(SR->getDef());
else