mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-05 10:17:36 +00:00
57907269da
so we can stop using DW_OP_bit_piece with the wrong semantics. The entire back story can be found here: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20161114/405934.html The gist is that in LLVM we've been misinterpreting DW_OP_bit_piece's offset field to mean the offset into the source variable rather than the offset into the location at the top the DWARF expression stack. In order to be able to fix this in a subsequent patch, this patch introduces a dedicated DW_OP_LLVM_fragment operation with the semantics that we used to apply to DW_OP_bit_piece, which is what we actually need while inside of LLVM. This patch is complete with a bitcode upgrade for expressions using the old format. It does not yet fix the DWARF backend to use DW_OP_bit_piece correctly. Implementation note: We discussed several options for implementing this, including reserving a dedicated field in DIExpression for the fragment size and offset, but using an custom operator at the end of the expression works just fine and is more efficient because we then only pay for it when we need it. Differential Revision: https://reviews.llvm.org/D27361 rdar://problem/29335809 llvm-svn: 288683
21 lines
877 B
LLVM
21 lines
877 B
LLVM
; RUN: llvm-dis -o - %s.bc | FileCheck %s
|
|
|
|
@g = common global i32 0, align 4, !dbg !0
|
|
|
|
!llvm.dbg.cu = !{!1}
|
|
!llvm.module.flags = !{!7, !8}
|
|
|
|
!0 = distinct !DIGlobalVariable(name: "g", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true, expr: !6)
|
|
!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang (llvm/trunk 288154)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)
|
|
!2 = !DIFile(filename: "a.c", directory: "/")
|
|
!3 = !{}
|
|
!4 = !{!0}
|
|
!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
; Old-style DIExpression bitcode records using DW_OP_bit_piece should be
|
|
; upgraded to DW_OP_LLVM_fragment.
|
|
;
|
|
; CHECK: !DIExpression(DW_OP_LLVM_fragment, 8, 32)
|
|
!6 = !DIExpression(DW_OP_bit_piece, 8, 32)
|
|
!7 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!8 = !{i32 2, !"Debug Info Version", i32 3}
|