421 lines · plain
1# clang++ -g -gdwarf-4 -emit-llvm -S main.cpp2# llc -O0 -mtriple=x86_64-unknown-linux-gnu main.ll3# void use(int * x, int * y) {4# *x += 4;5# *y -= 2;6# }7#8# int helper(int z_, int d_);9# int x = 0;10# int y = 1;11# int main(int argc, char *argv[]) {12# x = argc;13# y = argc + 3;14# use(&x, &y);15# return helper(x, y);16# }17 18 .text19 .file "main.cpp"20 .file 1 "." "main.cpp"21 .globl _Z3usePiS_ # -- Begin function _Z3usePiS_22 .p2align 4, 0x9023 .type _Z3usePiS_,@function24_Z3usePiS_: # @_Z3usePiS_25.Lfunc_begin0:26 .loc 1 1 0 # main.cpp:1:027 .cfi_startproc28# %bb.0: # %entry29 pushq %rbp30 .cfi_def_cfa_offset 1631 .cfi_offset %rbp, -1632 movq %rsp, %rbp33 .cfi_def_cfa_register %rbp34 movq %rdi, -8(%rbp)35 movq %rsi, -16(%rbp)36.Ltmp0:37 .loc 1 2 2 prologue_end # main.cpp:2:238 movq -8(%rbp), %rax39 .loc 1 2 4 is_stmt 0 # main.cpp:2:440 movl (%rax), %ecx41 addl $4, %ecx42 movl %ecx, (%rax)43 .loc 1 3 2 is_stmt 1 # main.cpp:3:244 movq -16(%rbp), %rax45 .loc 1 3 4 is_stmt 0 # main.cpp:3:446 movl (%rax), %ecx47 subl $2, %ecx48 movl %ecx, (%rax)49 .loc 1 4 1 is_stmt 1 # main.cpp:4:150 popq %rbp51 .cfi_def_cfa %rsp, 852 retq53.Ltmp1:54.Lfunc_end0:55 .size _Z3usePiS_, .Lfunc_end0-_Z3usePiS_56 .cfi_endproc57 # -- End function58 .globl main # -- Begin function main59 .p2align 4, 0x9060 .type main,@function61main: # @main62.Lfunc_begin1:63 .loc 1 9 0 # main.cpp:9:064 .cfi_startproc65# %bb.0: # %entry66 pushq %rbp67 .cfi_def_cfa_offset 1668 .cfi_offset %rbp, -1669 movq %rsp, %rbp70 .cfi_def_cfa_register %rbp71 subq $16, %rsp72 movl $0, -4(%rbp)73 movl %edi, -8(%rbp)74 movq %rsi, -16(%rbp)75.Ltmp2:76 .loc 1 10 8 prologue_end # main.cpp:10:877 movl -8(%rbp), %eax78 .loc 1 10 6 is_stmt 0 # main.cpp:10:679 movl %eax, x80 .loc 1 11 8 is_stmt 1 # main.cpp:11:881 movl -8(%rbp), %eax82 .loc 1 11 13 is_stmt 0 # main.cpp:11:1383 addl $3, %eax84 .loc 1 11 6 # main.cpp:11:685 movl %eax, y86 .loc 1 12 4 is_stmt 1 # main.cpp:12:487 movabsq $x, %rdi88 movabsq $y, %rsi89 callq _Z3usePiS_90 .loc 1 13 18 # main.cpp:13:1891 movl x, %edi92 .loc 1 13 21 is_stmt 0 # main.cpp:13:2193 movl y, %esi94 .loc 1 13 11 # main.cpp:13:1195 callq _Z6helperii96 .loc 1 13 4 # main.cpp:13:497 addq $16, %rsp98 popq %rbp99 .cfi_def_cfa %rsp, 8100 retq101.Ltmp3:102.Lfunc_end1:103 .size main, .Lfunc_end1-main104 .cfi_endproc105 # -- End function106 .type x,@object # @x107 .bss108 .globl x109 .p2align 2110x:111 .long 0 # 0x0112 .size x, 4113 114 .type y,@object # @y115 .data116 .globl y117 .p2align 2118y:119 .long 1 # 0x1120 .size y, 4121 122 .section .debug_abbrev,"",@progbits123 .byte 1 # Abbreviation Code124 .byte 17 # DW_TAG_compile_unit125 .byte 0 # DW_CHILDREN_no126 .byte 16 # DW_AT_stmt_list127 .byte 23 # DW_FORM_sec_offset128 .byte 27 # DW_AT_comp_dir129 .byte 14 # DW_FORM_strp130 .ascii "\260B" # DW_AT_GNU_dwo_name131 .byte 14 # DW_FORM_strp132 .ascii "\261B" # DW_AT_GNU_dwo_id133 .byte 7 # DW_FORM_data8134 .byte 17 # DW_AT_low_pc135 .byte 1 # DW_FORM_addr136 .byte 18 # DW_AT_high_pc137 .byte 6 # DW_FORM_data4138 .ascii "\263B" # DW_AT_GNU_addr_base139 .byte 23 # DW_FORM_sec_offset140 .byte 0 # EOM(1)141 .byte 0 # EOM(2)142 .byte 0 # EOM(3)143 .section .debug_info,"",@progbits144.Lcu_begin0:145 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit146.Ldebug_info_start0:147 .short 4 # DWARF version number148 .long .debug_abbrev # Offset Into Abbrev. Section149 .byte 8 # Address Size (in bytes)150 .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit151 .long .Lline_table_start0 # DW_AT_stmt_list152 .long .Lskel_string0 # DW_AT_comp_dir153 .long .Lskel_string1 # DW_AT_GNU_dwo_name154 .quad 4587139501222431648 # DW_AT_GNU_dwo_id155 .quad .Lfunc_begin0 # DW_AT_low_pc156 .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc157 .long .Laddr_table_base0 # DW_AT_GNU_addr_base158.Ldebug_info_end0:159 .section .debug_str,"MS",@progbits,1160.Lskel_string0:161 .asciz "." # string offset=0162.Lskel_string1:163 .asciz "main.dwo" # string offset=2164 .section .debug_str.dwo,"eMS",@progbits,1165.Linfo_string0:166 .asciz "x" # string offset=0167.Linfo_string1:168 .asciz "int" # string offset=2169.Linfo_string2:170 .asciz "y" # string offset=6171.Linfo_string3:172 .asciz "_Z3usePiS_" # string offset=8173.Linfo_string4:174 .asciz "use" # string offset=19175.Linfo_string5:176 .asciz "main" # string offset=23177.Linfo_string6:178 .asciz "argc" # string offset=28179.Linfo_string7:180 .asciz "argv" # string offset=33181.Linfo_string8:182 .asciz "char" # string offset=38183.Linfo_string9:184 .asciz "clang version 15.0.0" # string offset=43185.Linfo_string10:186 .asciz "main.cpp" # string offset=64187.Linfo_string11:188 .asciz "main.dwo" # string offset=73189 .section .debug_str_offsets.dwo,"e",@progbits190 .long 0191 .long 2192 .long 6193 .long 8194 .long 19195 .long 23196 .long 28197 .long 33198 .long 38199 .long 43200 .long 64201 .long 73202 .section .debug_info.dwo,"e",@progbits203 .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit204.Ldebug_info_dwo_start0:205 .short 4 # DWARF version number206 .long 0 # Offset Into Abbrev. Section207 .byte 8 # Address Size (in bytes)208 .byte 1 # Abbrev [1] 0xb:0x85 DW_TAG_compile_unit209 .byte 9 # DW_AT_producer210 .short 33 # DW_AT_language211 .byte 10 # DW_AT_name212 .byte 11 # DW_AT_GNU_dwo_name213 .quad 4587139501222431648 # DW_AT_GNU_dwo_id214 .byte 2 # Abbrev [2] 0x19:0xb DW_TAG_variable215 .byte 0 # DW_AT_name216 .long 36 # DW_AT_type217 # DW_AT_external218 .byte 1 # DW_AT_decl_file219 .byte 7 # DW_AT_decl_line220 .byte 2 # DW_AT_location221 .byte 251222 .byte 0223 .byte 3 # Abbrev [3] 0x24:0x4 DW_TAG_base_type224 .byte 1 # DW_AT_name225 .byte 5 # DW_AT_encoding226 .byte 4 # DW_AT_byte_size227 .byte 2 # Abbrev [2] 0x28:0xb DW_TAG_variable228 .byte 2 # DW_AT_name229 .long 36 # DW_AT_type230 # DW_AT_external231 .byte 1 # DW_AT_decl_file232 .byte 8 # DW_AT_decl_line233 .byte 2 # DW_AT_location234 .byte 251235 .byte 1236 .byte 4 # Abbrev [4] 0x33:0x23 DW_TAG_subprogram237 .byte 2 # DW_AT_low_pc238 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc239 .byte 1 # DW_AT_frame_base240 .byte 86241 .byte 3 # DW_AT_linkage_name242 .byte 4 # DW_AT_name243 .byte 1 # DW_AT_decl_file244 .byte 1 # DW_AT_decl_line245 # DW_AT_external246 .byte 5 # Abbrev [5] 0x3f:0xb DW_TAG_formal_parameter247 .byte 2 # DW_AT_location248 .byte 145249 .byte 120250 .byte 0 # DW_AT_name251 .byte 1 # DW_AT_decl_file252 .byte 1 # DW_AT_decl_line253 .long 124 # DW_AT_type254 .byte 5 # Abbrev [5] 0x4a:0xb DW_TAG_formal_parameter255 .byte 2 # DW_AT_location256 .byte 145257 .byte 112258 .byte 2 # DW_AT_name259 .byte 1 # DW_AT_decl_file260 .byte 1 # DW_AT_decl_line261 .long 124 # DW_AT_type262 .byte 0 # End Of Children Mark263 .byte 6 # Abbrev [6] 0x56:0x26 DW_TAG_subprogram264 .byte 3 # DW_AT_low_pc265 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc266 .byte 1 # DW_AT_frame_base267 .byte 86268 .byte 5 # DW_AT_name269 .byte 1 # DW_AT_decl_file270 .byte 9 # DW_AT_decl_line271 .long 36 # DW_AT_type272 # DW_AT_external273 .byte 5 # Abbrev [5] 0x65:0xb DW_TAG_formal_parameter274 .byte 2 # DW_AT_location275 .byte 145276 .byte 120277 .byte 6 # DW_AT_name278 .byte 1 # DW_AT_decl_file279 .byte 9 # DW_AT_decl_line280 .long 36 # DW_AT_type281 .byte 5 # Abbrev [5] 0x70:0xb DW_TAG_formal_parameter282 .byte 2 # DW_AT_location283 .byte 145284 .byte 112285 .byte 7 # DW_AT_name286 .byte 1 # DW_AT_decl_file287 .byte 9 # DW_AT_decl_line288 .long 129 # DW_AT_type289 .byte 0 # End Of Children Mark290 .byte 7 # Abbrev [7] 0x7c:0x5 DW_TAG_pointer_type291 .long 36 # DW_AT_type292 .byte 7 # Abbrev [7] 0x81:0x5 DW_TAG_pointer_type293 .long 134 # DW_AT_type294 .byte 7 # Abbrev [7] 0x86:0x5 DW_TAG_pointer_type295 .long 139 # DW_AT_type296 .byte 3 # Abbrev [3] 0x8b:0x4 DW_TAG_base_type297 .byte 8 # DW_AT_name298 .byte 6 # DW_AT_encoding299 .byte 1 # DW_AT_byte_size300 .byte 0 # End Of Children Mark301.Ldebug_info_dwo_end0:302 .section .debug_abbrev.dwo,"e",@progbits303 .byte 1 # Abbreviation Code304 .byte 17 # DW_TAG_compile_unit305 .byte 1 # DW_CHILDREN_yes306 .byte 37 # DW_AT_producer307 .ascii "\202>" # DW_FORM_GNU_str_index308 .byte 19 # DW_AT_language309 .byte 5 # DW_FORM_data2310 .byte 3 # DW_AT_name311 .ascii "\202>" # DW_FORM_GNU_str_index312 .ascii "\260B" # DW_AT_GNU_dwo_name313 .ascii "\202>" # DW_FORM_GNU_str_index314 .ascii "\261B" # DW_AT_GNU_dwo_id315 .byte 7 # DW_FORM_data8316 .byte 0 # EOM(1)317 .byte 0 # EOM(2)318 .byte 2 # Abbreviation Code319 .byte 52 # DW_TAG_variable320 .byte 0 # DW_CHILDREN_no321 .byte 3 # DW_AT_name322 .ascii "\202>" # DW_FORM_GNU_str_index323 .byte 73 # DW_AT_type324 .byte 19 # DW_FORM_ref4325 .byte 63 # DW_AT_external326 .byte 25 # DW_FORM_flag_present327 .byte 58 # DW_AT_decl_file328 .byte 11 # DW_FORM_data1329 .byte 59 # DW_AT_decl_line330 .byte 11 # DW_FORM_data1331 .byte 2 # DW_AT_location332 .byte 24 # DW_FORM_exprloc333 .byte 0 # EOM(1)334 .byte 0 # EOM(2)335 .byte 3 # Abbreviation Code336 .byte 36 # DW_TAG_base_type337 .byte 0 # DW_CHILDREN_no338 .byte 3 # DW_AT_name339 .ascii "\202>" # DW_FORM_GNU_str_index340 .byte 62 # DW_AT_encoding341 .byte 11 # DW_FORM_data1342 .byte 11 # DW_AT_byte_size343 .byte 11 # DW_FORM_data1344 .byte 0 # EOM(1)345 .byte 0 # EOM(2)346 .byte 4 # Abbreviation Code347 .byte 46 # DW_TAG_subprogram348 .byte 1 # DW_CHILDREN_yes349 .byte 17 # DW_AT_low_pc350 .ascii "\201>" # DW_FORM_GNU_addr_index351 .byte 18 # DW_AT_high_pc352 .byte 6 # DW_FORM_data4353 .byte 64 # DW_AT_frame_base354 .byte 24 # DW_FORM_exprloc355 .byte 110 # DW_AT_linkage_name356 .ascii "\202>" # DW_FORM_GNU_str_index357 .byte 3 # DW_AT_name358 .ascii "\202>" # DW_FORM_GNU_str_index359 .byte 58 # DW_AT_decl_file360 .byte 11 # DW_FORM_data1361 .byte 59 # DW_AT_decl_line362 .byte 11 # DW_FORM_data1363 .byte 63 # DW_AT_external364 .byte 25 # DW_FORM_flag_present365 .byte 0 # EOM(1)366 .byte 0 # EOM(2)367 .byte 5 # Abbreviation Code368 .byte 5 # DW_TAG_formal_parameter369 .byte 0 # DW_CHILDREN_no370 .byte 2 # DW_AT_location371 .byte 24 # DW_FORM_exprloc372 .byte 3 # DW_AT_name373 .ascii "\202>" # DW_FORM_GNU_str_index374 .byte 58 # DW_AT_decl_file375 .byte 11 # DW_FORM_data1376 .byte 59 # DW_AT_decl_line377 .byte 11 # DW_FORM_data1378 .byte 73 # DW_AT_type379 .byte 19 # DW_FORM_ref4380 .byte 0 # EOM(1)381 .byte 0 # EOM(2)382 .byte 6 # Abbreviation Code383 .byte 46 # DW_TAG_subprogram384 .byte 1 # DW_CHILDREN_yes385 .byte 17 # DW_AT_low_pc386 .ascii "\201>" # DW_FORM_GNU_addr_index387 .byte 18 # DW_AT_high_pc388 .byte 6 # DW_FORM_data4389 .byte 64 # DW_AT_frame_base390 .byte 24 # DW_FORM_exprloc391 .byte 3 # DW_AT_name392 .ascii "\202>" # DW_FORM_GNU_str_index393 .byte 58 # DW_AT_decl_file394 .byte 11 # DW_FORM_data1395 .byte 59 # DW_AT_decl_line396 .byte 11 # DW_FORM_data1397 .byte 73 # DW_AT_type398 .byte 19 # DW_FORM_ref4399 .byte 63 # DW_AT_external400 .byte 25 # DW_FORM_flag_present401 .byte 0 # EOM(1)402 .byte 0 # EOM(2)403 .byte 7 # Abbreviation Code404 .byte 15 # DW_TAG_pointer_type405 .byte 0 # DW_CHILDREN_no406 .byte 73 # DW_AT_type407 .byte 19 # DW_FORM_ref4408 .byte 0 # EOM(1)409 .byte 0 # EOM(2)410 .byte 0 # EOM(3)411 .section .debug_addr,"",@progbits412.Laddr_table_base0:413 .quad x414 .quad y415 .quad .Lfunc_begin0416 .quad .Lfunc_begin1417 .ident "clang version 15.0.0"418 .section ".note.GNU-stack","",@progbits419 .section .debug_line,"",@progbits420.Lline_table_start0:421