[PATCH] D30898: Add new -fverbose-asm that enables source interleaving

Hal Finkel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 14 13:01:56 PDT 2017


hfinkel added a comment.

> Note that in contrast to the original suggestion -fsource-asm here we use the preferred -fverbose-asm. Basically explicitly saying -fverbose-asm in the command line enables a minimum amount of debugging, so in AsmPrinter we can use it to print the source code.

-fverbose-asm seems like a good name to me, but that's taken already. This feature should imply -fverbose-asm (that's where the value-add is over having objdump do this). But we don't always want this when we enable -fverbose-asm. How about -fsource-interleaved-asm for this feature?

> This patch introduces a -masm-source flag for cc1 that maps to the AsmSource value in the llvm code generation.

I see no reason to use a different flag name for cc1. Just use the same flag (tag it with `Flags<[CC1Option]` in the .td file).



================
Comment at: lib/Driver/ToolChains/Clang.cpp:2754
+  // assembler output with debug directives.
+  if (Args.hasArg(options::OPT_fverbose_asm)) {
+    CmdArgs.push_back("-masm-source");
----------------
I think that we should factor this out a bit. This feature is not the only one with this problem. The optimization reporting features also have this property (they need to enable debug info for some reason other than an actual desire to embed debug info in the resulting binaries). I think that we should add some separate feature, which this can toggle, but that optimization reporting can also use, to avoid actually generating debug info when only needed by these features.


================
Comment at: lib/Frontend/CompilerInvocation.cpp:855
     NeedLocTracking = true;
 
   if (Arg *A = Args.getLastArg(OPT_Rpass_EQ)) {
----------------
This is where you'd enable debug line-table info when needed by this feature.


https://reviews.llvm.org/D30898





More information about the cfe-commits mailing list