[llvm] r213298 - TableGen: Add 'static' to a large array to avoid a huge stack allocation

Reid Kleckner reid at kleckner.net
Thu Jul 17 12:43:40 PDT 2014


Author: rnk
Date: Thu Jul 17 14:43:40 2014
New Revision: 213298

URL: http://llvm.org/viewvc/llvm-project?rev=213298&view=rev
Log:
TableGen: Add 'static' to a large array to avoid a huge stack allocation

Speculative fix for a -Wframe-larger-than warning from gcc.  Clang will
implicitly promote such constant arrays to globals, so in theory it
won't hit this.

Modified:
    llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp

Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=213298&r1=213297&r2=213298&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Thu Jul 17 14:43:40 2014
@@ -424,7 +424,7 @@ void AsmWriterEmitter::EmitPrintInstruct
   }
 
   // Emit the string itself.
-  O << "  const char AsmStrs[] = {\n";
+  O << "  static const char AsmStrs[] = {\n";
   StringTable.emit(O, printChar);
   O << "  };\n\n";
 





More information about the llvm-commits mailing list