[PATCH] D20676: [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 05:44:40 PDT 2016

rafael added inline comments.

Comment at: include/llvm/MC/MCAsmInfo.h:57
@@ +56,3 @@
+enum class DebugCompressionType {
+  DCT_Unknown, // unknown compression type
+  DCT_None,    // no compression
You shouldn't need the Unknown bit. See the comment about the option in llvm-mc.

Comment at: lib/CodeGen/LLVMTargetMachine.cpp:74
@@ -73,3 +73,3 @@
   if (Options.CompressDebugSections)
-    TmpAsmInfo->setCompressDebugSections(true);
+    TmpAsmInfo->setCompressDebugSections(DebugCompressionType::DCT_Zlib);
I think in the first patch you will have to default to zlib-gnu. The reason is that right now there would be no way for someone using clang to set which one to use.

Once this patch is in with zlib-gnu as the default, we can teach TargetMachine and clang about the two types and change the default.

Comment at: tools/llvm-mc/llvm-mc.cpp:412
@@ -409,2 +411,3 @@
-  if (CompressDebugSections) {
+  DebugCompressionType Compression;
+  if (CompressDebugSections == "" || CompressDebugSections == "zlib" ||
llvm-mc doesn't need to be command line compatible with as, so please simplify this.
The option can be a cl::opt over an enum  with just 3 values: none, zlib, zlib-gnu.

See FileType for a similar option.


More information about the llvm-commits mailing list