[PATCH] D46534: [MC] Update Rootfile in AsmStreamer

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 09:54:10 PDT 2018


niravd created this revision.
niravd added a reviewer: probinson.
Herald added subscribers: JDevlieghere, hiraditya.

Update TableRootFile in MCAsmStreamer allowing marginal improvement in
sharing of file information. This is has no semantic change , but
seems but it nominally reduces the differences between textual
assembly and object output paths.


Repository:
  rL LLVM

https://reviews.llvm.org/D46534

Files:
  llvm/lib/MC/MCAsmStreamer.cpp
  llvm/test/CodeGen/Generic/dwarf-md5.ll
  llvm/test/CodeGen/Generic/dwarf-source.ll


Index: llvm/test/CodeGen/Generic/dwarf-source.ll
===================================================================
--- llvm/test/CodeGen/Generic/dwarf-source.ll
+++ llvm/test/CodeGen/Generic/dwarf-source.ll
@@ -5,16 +5,19 @@
 ; XFAIL: darwin
 
 ; REQUIRES: object-emission
-; RUN: %llc_dwarf -dwarf-version 4 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM
-; RUN: %llc_dwarf -dwarf-version 5 -filetype=asm -o - %s | FileCheck %s --check-prefixes=ASM,ASM-5
+; RUN: %llc_dwarf -dwarf-version 4 -filetype=asm -o - %s | FileCheck %s --check-prefix=ASM-4
+; RUN: %llc_dwarf -dwarf-version 5 -filetype=asm -o - %s | FileCheck %s --check-prefixes=ASM-5
 ; RUN: %llc_dwarf -dwarf-version 4 -filetype=obj -o %t4.o %s
 ; RUN: llvm-dwarfdump -debug-line %t4.o | FileCheck %s --check-prefixes=OBJ,OBJ-4
 ; RUN: %llc_dwarf -dwarf-version 5 -filetype=obj -o %t5.o %s
 ; RUN: llvm-dwarfdump -debug-line %t5.o | FileCheck %s --check-prefixes=OBJ,OBJ-5
 
+; ASM-4: .file 1 "/test{{.*[/\\]}}t1.h" source "11111111111111111111111111111111"
+; ASM-4: .file 2 "/test{{.*[/\\]}}t2.h" source "22222222222222222222222222222222"
+
 ; ASM-5: .file 0 "/test{{.*[/\\]}}t.c" source "00000000000000000000000000000000"
-; ASM: .file 1 "/test{{.*[/\\]}}t1.h" source "11111111111111111111111111111111"
-; ASM: .file 2 "/test{{.*[/\\]}}t2.h" source "22222222222222222222222222222222"
+; ASM-5: .file 1 "t1.h" source "11111111111111111111111111111111"
+; ASM-5: .file 2 "t2.h" source "22222222222222222222222222222222"
 
 ; OBJ-5: file_names[ 0]:
 ; OBJ-5-NEXT: name: "t.c"
Index: llvm/test/CodeGen/Generic/dwarf-md5.ll
===================================================================
--- llvm/test/CodeGen/Generic/dwarf-md5.ll
+++ llvm/test/CodeGen/Generic/dwarf-md5.ll
@@ -14,10 +14,10 @@
 
 ; ASM-4-NOT: .file 0
 ; ASM-5: .file 0 "/scratch{{.*[/\\]}}t.c" md5 0x00000000000000000000000000000000
-; ASM: .file 1 "/scratch{{.*[/\\]}}t1.h"
+; ASM: .file 1 "{{.*}}t1.h"
 ; ASM-4-NOT:  md5
 ; ASM-5-SAME: md5 0x11111111111111111111111111111111
-; ASM: .file 2 "/scratch{{.*[/\\]}}t2.h"
+; ASM: .file 2 "{{.*}}t2.h"
 ; ASM-4-NOT:  md5
 ; ASM-5-SAME: md5 0x22222222222222222222222222222222
 
Index: llvm/lib/MC/MCAsmStreamer.cpp
===================================================================
--- llvm/lib/MC/MCAsmStreamer.cpp
+++ llvm/lib/MC/MCAsmStreamer.cpp
@@ -1161,6 +1161,9 @@
   if (getContext().getDwarfVersion() < 5)
     return;
 
+  MCStreamer::emitDwarfFile0Directive(Directory, Filename, Checksum, Source,
+                                      CUID);
+
   SmallString<128> Str;
   raw_svector_ostream OS1(Str);
   printDwarfFileDirective(0, Directory, Filename, Checksum, Source,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46534.145494.patch
Type: text/x-patch
Size: 2672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/8dadc8f9/attachment.bin>


More information about the llvm-commits mailing list