summaryrefslogtreecommitdiff
path: root/utils/TableGen/CallingConvEmitter.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/CallingConvEmitter.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/CallingConvEmitter.cpp')
-rw-r--r--utils/TableGen/CallingConvEmitter.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/TableGen/CallingConvEmitter.cpp b/utils/TableGen/CallingConvEmitter.cpp
index c51afd82a3..37758bc1cf 100644
--- a/utils/TableGen/CallingConvEmitter.cpp
+++ b/utils/TableGen/CallingConvEmitter.cpp
@@ -40,7 +40,7 @@ void CallingConvEmitter::run(raw_ostream &O) {
void CallingConvEmitter::EmitCallingConv(Record *CC, raw_ostream &O) {
- ListInit *CCActions = CC->getValueAsListInit("Actions");
+ const ListInit *CCActions = CC->getValueAsListInit("Actions");
Counter = 0;
O << "\n\nstatic bool " << CC->getName()
@@ -67,7 +67,7 @@ void CallingConvEmitter::EmitAction(Record *Action,
O << IndentStr << "if (";
if (Action->isSubClassOf("CCIfType")) {
- ListInit *VTs = Action->getValueAsListInit("VTs");
+ const ListInit *VTs = Action->getValueAsListInit("VTs");
for (unsigned i = 0, e = VTs->getSize(); i != e; ++i) {
Record *VT = VTs->getElementAsRecord(i);
if (i != 0) O << " ||\n " << IndentStr;
@@ -91,7 +91,7 @@ void CallingConvEmitter::EmitAction(Record *Action,
<< "(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))\n"
<< IndentStr << " return false;\n";
} else if (Action->isSubClassOf("CCAssignToReg")) {
- ListInit *RegList = Action->getValueAsListInit("RegList");
+ const ListInit *RegList = Action->getValueAsListInit("RegList");
if (RegList->getSize() == 1) {
O << IndentStr << "if (unsigned Reg = State.AllocateReg(";
O << getQualifiedName(RegList->getElementAsRecord(0)) << ")) {\n";
@@ -112,8 +112,8 @@ void CallingConvEmitter::EmitAction(Record *Action,
O << IndentStr << " return false;\n";
O << IndentStr << "}\n";
} else if (Action->isSubClassOf("CCAssignToRegWithShadow")) {
- ListInit *RegList = Action->getValueAsListInit("RegList");
- ListInit *ShadowRegList = Action->getValueAsListInit("ShadowRegList");
+ const ListInit *RegList = Action->getValueAsListInit("RegList");
+ const ListInit *ShadowRegList = Action->getValueAsListInit("ShadowRegList");
if (ShadowRegList->getSize() >0 &&
ShadowRegList->getSize() != RegList->getSize())
throw "Invalid length of list of shadowed registers";