[llvm] 7016a4b - llvm-tblgen -gen-dag-isel: Hoist SmallVector TmpBuf

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 25 20:41:13 PDT 2020


Author: Fangrui Song
Date: 2020-04-25T20:41:04-07:00
New Revision: 7016a4b5c34a87e2051b66259141ac7483d0f68b

URL: https://github.com/llvm/llvm-project/commit/7016a4b5c34a87e2051b66259141ac7483d0f68b
DIFF: https://github.com/llvm/llvm-project/commit/7016a4b5c34a87e2051b66259141ac7483d0f68b.diff

LOG: llvm-tblgen -gen-dag-isel: Hoist SmallVector TmpBuf

Added: 
    

Modified: 
    llvm/utils/TableGen/DAGISelMatcherEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index 1c87acbb62da..d9ec14aab8a8 100644
--- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -291,6 +291,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
     unsigned StartIdx = CurrentIdx;
 
     // Emit all of the children.
+    SmallString<128> TmpBuf;
     for (unsigned i = 0, e = SM->getNumChildren(); i != e; ++i) {
       if (i == 0) {
         OS << "OPC_Scope, ";
@@ -308,7 +309,6 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
       // string while we get the size.  Unfortunately, the offset of the
       // children depends on the VBR size of the child, so for large children we
       // have to iterate a bit.
-      SmallString<128> TmpBuf;
       unsigned ChildSize = 0;
       unsigned VBRSize = 0;
       do {
@@ -450,6 +450,7 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
     ++CurrentIdx;
 
     // For each case we emit the size, then the opcode, then the matcher.
+    SmallString<128> TmpBuf;
     for (unsigned i = 0, e = NumCases; i != e; ++i) {
       const Matcher *Child;
       unsigned IdxSize;
@@ -466,7 +467,6 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
       // string while we get the size.  Unfortunately, the offset of the
       // children depends on the VBR size of the child, so for large children we
       // have to iterate a bit.
-      SmallString<128> TmpBuf;
       unsigned ChildSize = 0;
       unsigned VBRSize = 0;
       do {


        


More information about the llvm-commits mailing list