1# clang++ -g -gdwarf-4 -emit-llvm -S main.cpp 2# llc -O2 -mtriple=x86_64-unknown-linux-gnu main.ll 3# 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 .text 19 .file "main.cpp" 20 .file 1 "." "main.cpp" 21 .globl _Z3usePiS_ # -- Begin function _Z3usePiS_ 22 .p2align 4, 0x90 23 .type _Z3usePiS_,@function 24_Z3usePiS_: # @_Z3usePiS_ 25.Lfunc_begin0: 26 .loc 1 1 0 # main.cpp:1:0 27 .cfi_startproc 28# %bb.0: # %entry 29 #DEBUG_VALUE: use:x <- $rdi 30 #DEBUG_VALUE: use:y <- $rsi 31 .loc 1 2 4 prologue_end # main.cpp:2:4 32 addl $4, (%rdi) 33 .loc 1 3 4 # main.cpp:3:4 34 addl $-2, (%rsi) 35 .loc 1 4 1 # main.cpp:4:1 36 retq 37.Ltmp0: 38.Lfunc_end0: 39 .size _Z3usePiS_, .Lfunc_end0-_Z3usePiS_ 40 .cfi_endproc 41 # -- End function 42 .globl main # -- Begin function main 43 .p2align 4, 0x90 44 .type main,@function 45main: # @main 46.Lfunc_begin1: 47 .loc 1 9 0 # main.cpp:9:0 48 .cfi_startproc 49# %bb.0: # %entry 50 #DEBUG_VALUE: main:argc <- $edi 51 #DEBUG_VALUE: main:argv <- $rsi 52 # kill: def $edi killed $edi def $rdi 53 .loc 1 2 4 prologue_end # main.cpp:2:4 54 leal 4(%rdi), %eax 55 movl %eax, x(%rip) 56.Ltmp1: 57 #DEBUG_VALUE: use:x <- undef 58 .loc 1 3 4 # main.cpp:3:4 59 leal 1(%rdi), %esi 60.Ltmp2: 61 #DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rsi 62 movl %esi, y(%rip) 63.Ltmp3: 64 #DEBUG_VALUE: use:y <- undef 65 .loc 1 13 11 # main.cpp:13:11 66 movl %eax, %edi 67.Ltmp4: 68 #DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $edi 69 jmp _Z6helperii # TAILCALL 70.Ltmp5: 71.Lfunc_end1: 72 .size main, .Lfunc_end1-main 73 .cfi_endproc 74 # -- End function 75 .type x,@object # @x 76 .bss 77 .globl x 78 .p2align 2 79x: 80 .long 0 # 0x0 81 .size x, 4 82 83 .type y,@object # @y 84 .data 85 .globl y 86 .p2align 2 87y: 88 .long 1 # 0x1 89 .size y, 4 90 91 .section .debug_loc.dwo,"e",@progbits 92.Ldebug_loc0: 93 .byte 3 94 .byte 3 95 .long .Ltmp4-.Lfunc_begin1 96 .short 1 # Loc expr size 97 .byte 85 # super-register DW_OP_reg5 98 .byte 3 99 .byte 5 100 .long .Lfunc_end1-.Ltmp4 101 .short 4 # Loc expr size 102 .byte 243 # DW_OP_GNU_entry_value 103 .byte 1 # 1 104 .byte 85 # super-register DW_OP_reg5 105 .byte 159 # DW_OP_stack_value 106 .byte 0 107.Ldebug_loc1: 108 .byte 3 109 .byte 3 110 .long .Ltmp2-.Lfunc_begin1 111 .short 1 # Loc expr size 112 .byte 84 # DW_OP_reg4 113 .byte 3 114 .byte 6 115 .long .Lfunc_end1-.Ltmp2 116 .short 4 # Loc expr size 117 .byte 243 # DW_OP_GNU_entry_value 118 .byte 1 # 1 119 .byte 84 # DW_OP_reg4 120 .byte 159 # DW_OP_stack_value 121 .byte 0 122 .section .debug_abbrev,"",@progbits 123 .byte 1 # Abbreviation Code 124 .byte 17 # DW_TAG_compile_unit 125 .byte 0 # DW_CHILDREN_no 126 .byte 16 # DW_AT_stmt_list 127 .byte 23 # DW_FORM_sec_offset 128 .byte 27 # DW_AT_comp_dir 129 .byte 14 # DW_FORM_strp 130 .ascii "\260B" # DW_AT_GNU_dwo_name 131 .byte 14 # DW_FORM_strp 132 .ascii "\261B" # DW_AT_GNU_dwo_id 133 .byte 7 # DW_FORM_data8 134 .byte 17 # DW_AT_low_pc 135 .byte 1 # DW_FORM_addr 136 .byte 18 # DW_AT_high_pc 137 .byte 6 # DW_FORM_data4 138 .ascii "\263B" # DW_AT_GNU_addr_base 139 .byte 23 # DW_FORM_sec_offset 140 .byte 0 # EOM(1) 141 .byte 0 # EOM(2) 142 .byte 0 # EOM(3) 143 .section .debug_info,"",@progbits 144.Lcu_begin0: 145 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 146.Ldebug_info_start0: 147 .short 4 # DWARF version number 148 .long .debug_abbrev # Offset Into Abbrev. Section 149 .byte 8 # Address Size (in bytes) 150 .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit 151 .long .Lline_table_start0 # DW_AT_stmt_list 152 .long .Lskel_string0 # DW_AT_comp_dir 153 .long .Lskel_string1 # DW_AT_GNU_dwo_name 154 .quad -4922924650784735988 # DW_AT_GNU_dwo_id 155 .quad .Lfunc_begin0 # DW_AT_low_pc 156 .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc 157 .long .Laddr_table_base0 # DW_AT_GNU_addr_base 158.Ldebug_info_end0: 159 .section .debug_str,"MS",@progbits,1 160.Lskel_string0: 161 .asciz "." # string offset=0 162.Lskel_string1: 163 .asciz "main.dwo" # string offset=2 164 .section .debug_str.dwo,"eMS",@progbits,1 165.Linfo_string0: 166 .asciz "x" # string offset=0 167.Linfo_string1: 168 .asciz "int" # string offset=2 169.Linfo_string2: 170 .asciz "y" # string offset=6 171.Linfo_string3: 172 .asciz "_Z3usePiS_" # string offset=8 173.Linfo_string4: 174 .asciz "use" # string offset=19 175.Linfo_string5: 176 .asciz "_Z6helperii" # string offset=23 177.Linfo_string6: 178 .asciz "helper" # string offset=35 179.Linfo_string7: 180 .asciz "main" # string offset=42 181.Linfo_string8: 182 .asciz "argc" # string offset=47 183.Linfo_string9: 184 .asciz "argv" # string offset=52 185.Linfo_string10: 186 .asciz "char" # string offset=57 187.Linfo_string11: 188 .asciz "clang version 15.0.0" # string offset=62 189.Linfo_string12: 190 .asciz "main.cpp" # string offset=83 191.Linfo_string13: 192 .asciz "main.dwo" # string offset=92 193 .section .debug_str_offsets.dwo,"e",@progbits 194 .long 0 195 .long 2 196 .long 6 197 .long 8 198 .long 19 199 .long 23 200 .long 35 201 .long 42 202 .long 47 203 .long 52 204 .long 57 205 .long 62 206 .long 83 207 .long 92 208 .section .debug_info.dwo,"e",@progbits 209 .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit 210.Ldebug_info_dwo_start0: 211 .short 4 # DWARF version number 212 .long 0 # Offset Into Abbrev. Section 213 .byte 8 # Address Size (in bytes) 214 .byte 1 # Abbrev [1] 0xb:0xbd DW_TAG_compile_unit 215 .byte 11 # DW_AT_producer 216 .short 33 # DW_AT_language 217 .byte 12 # DW_AT_name 218 .byte 13 # DW_AT_GNU_dwo_name 219 .quad -4922924650784735988 # DW_AT_GNU_dwo_id 220 .byte 2 # Abbrev [2] 0x19:0xb DW_TAG_variable 221 .byte 0 # DW_AT_name 222 .long 36 # DW_AT_type 223 # DW_AT_external 224 .byte 1 # DW_AT_decl_file 225 .byte 7 # DW_AT_decl_line 226 .byte 2 # DW_AT_location 227 .byte 251 228 .byte 0 229 .byte 3 # Abbrev [3] 0x24:0x4 DW_TAG_base_type 230 .byte 1 # DW_AT_name 231 .byte 5 # DW_AT_encoding 232 .byte 4 # DW_AT_byte_size 233 .byte 2 # Abbrev [2] 0x28:0xb DW_TAG_variable 234 .byte 2 # DW_AT_name 235 .long 36 # DW_AT_type 236 # DW_AT_external 237 .byte 1 # DW_AT_decl_file 238 .byte 8 # DW_AT_decl_line 239 .byte 2 # DW_AT_location 240 .byte 251 241 .byte 1 242 .byte 4 # Abbrev [4] 0x33:0x1b DW_TAG_subprogram 243 .byte 2 # DW_AT_low_pc 244 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc 245 .byte 1 # DW_AT_frame_base 246 .byte 87 247 # DW_AT_GNU_all_call_sites 248 .long 78 # DW_AT_abstract_origin 249 .byte 5 # Abbrev [5] 0x3f:0x7 DW_TAG_formal_parameter 250 .byte 1 # DW_AT_location 251 .byte 85 252 .long 84 # DW_AT_abstract_origin 253 .byte 5 # Abbrev [5] 0x46:0x7 DW_TAG_formal_parameter 254 .byte 1 # DW_AT_location 255 .byte 84 256 .long 92 # DW_AT_abstract_origin 257 .byte 0 # End Of Children Mark 258 .byte 6 # Abbrev [6] 0x4e:0x17 DW_TAG_subprogram 259 .byte 3 # DW_AT_linkage_name 260 .byte 4 # DW_AT_name 261 .byte 1 # DW_AT_decl_file 262 .byte 1 # DW_AT_decl_line 263 # DW_AT_external 264 .byte 1 # DW_AT_inline 265 .byte 7 # Abbrev [7] 0x54:0x8 DW_TAG_formal_parameter 266 .byte 0 # DW_AT_name 267 .byte 1 # DW_AT_decl_file 268 .byte 1 # DW_AT_decl_line 269 .long 101 # DW_AT_type 270 .byte 7 # Abbrev [7] 0x5c:0x8 DW_TAG_formal_parameter 271 .byte 2 # DW_AT_name 272 .byte 1 # DW_AT_decl_file 273 .byte 1 # DW_AT_decl_line 274 .long 101 # DW_AT_type 275 .byte 0 # End Of Children Mark 276 .byte 8 # Abbrev [8] 0x65:0x5 DW_TAG_pointer_type 277 .long 36 # DW_AT_type 278 .byte 9 # Abbrev [9] 0x6a:0x3b DW_TAG_subprogram 279 .byte 3 # DW_AT_low_pc 280 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc 281 .byte 1 # DW_AT_frame_base 282 .byte 87 283 # DW_AT_GNU_all_call_sites 284 .byte 7 # DW_AT_name 285 .byte 1 # DW_AT_decl_file 286 .byte 9 # DW_AT_decl_line 287 .long 36 # DW_AT_type 288 # DW_AT_external 289 .byte 10 # Abbrev [10] 0x79:0xc DW_TAG_formal_parameter 290 .long .Ldebug_loc0-.debug_loc.dwo # DW_AT_location 291 .byte 8 # DW_AT_name 292 .byte 1 # DW_AT_decl_file 293 .byte 9 # DW_AT_decl_line 294 .long 36 # DW_AT_type 295 .byte 10 # Abbrev [10] 0x85:0xc DW_TAG_formal_parameter 296 .long .Ldebug_loc1-.debug_loc.dwo # DW_AT_location 297 .byte 9 # DW_AT_name 298 .byte 1 # DW_AT_decl_file 299 .byte 9 # DW_AT_decl_line 300 .long 185 # DW_AT_type 301 .byte 11 # Abbrev [11] 0x91:0xd DW_TAG_inlined_subroutine 302 .long 78 # DW_AT_abstract_origin 303 .byte 3 # DW_AT_low_pc 304 .long .Ltmp3-.Lfunc_begin1 # DW_AT_high_pc 305 .byte 1 # DW_AT_call_file 306 .byte 12 # DW_AT_call_line 307 .byte 4 # DW_AT_call_column 308 .byte 12 # Abbrev [12] 0x9e:0x6 DW_TAG_GNU_call_site 309 .long 165 # DW_AT_abstract_origin 310 # DW_AT_GNU_tail_call 311 .byte 4 # DW_AT_low_pc 312 .byte 0 # End Of Children Mark 313 .byte 13 # Abbrev [13] 0xa5:0x14 DW_TAG_subprogram 314 .byte 5 # DW_AT_linkage_name 315 .byte 6 # DW_AT_name 316 .byte 1 # DW_AT_decl_file 317 .byte 6 # DW_AT_decl_line 318 .long 36 # DW_AT_type 319 # DW_AT_declaration 320 # DW_AT_external 321 .byte 14 # Abbrev [14] 0xae:0x5 DW_TAG_formal_parameter 322 .long 36 # DW_AT_type 323 .byte 14 # Abbrev [14] 0xb3:0x5 DW_TAG_formal_parameter 324 .long 36 # DW_AT_type 325 .byte 0 # End Of Children Mark 326 .byte 8 # Abbrev [8] 0xb9:0x5 DW_TAG_pointer_type 327 .long 190 # DW_AT_type 328 .byte 8 # Abbrev [8] 0xbe:0x5 DW_TAG_pointer_type 329 .long 195 # DW_AT_type 330 .byte 3 # Abbrev [3] 0xc3:0x4 DW_TAG_base_type 331 .byte 10 # DW_AT_name 332 .byte 6 # DW_AT_encoding 333 .byte 1 # DW_AT_byte_size 334 .byte 0 # End Of Children Mark 335.Ldebug_info_dwo_end0: 336 .section .debug_abbrev.dwo,"e",@progbits 337 .byte 1 # Abbreviation Code 338 .byte 17 # DW_TAG_compile_unit 339 .byte 1 # DW_CHILDREN_yes 340 .byte 37 # DW_AT_producer 341 .ascii "\202>" # DW_FORM_GNU_str_index 342 .byte 19 # DW_AT_language 343 .byte 5 # DW_FORM_data2 344 .byte 3 # DW_AT_name 345 .ascii "\202>" # DW_FORM_GNU_str_index 346 .ascii "\260B" # DW_AT_GNU_dwo_name 347 .ascii "\202>" # DW_FORM_GNU_str_index 348 .ascii "\261B" # DW_AT_GNU_dwo_id 349 .byte 7 # DW_FORM_data8 350 .byte 0 # EOM(1) 351 .byte 0 # EOM(2) 352 .byte 2 # Abbreviation Code 353 .byte 52 # DW_TAG_variable 354 .byte 0 # DW_CHILDREN_no 355 .byte 3 # DW_AT_name 356 .ascii "\202>" # DW_FORM_GNU_str_index 357 .byte 73 # DW_AT_type 358 .byte 19 # DW_FORM_ref4 359 .byte 63 # DW_AT_external 360 .byte 25 # DW_FORM_flag_present 361 .byte 58 # DW_AT_decl_file 362 .byte 11 # DW_FORM_data1 363 .byte 59 # DW_AT_decl_line 364 .byte 11 # DW_FORM_data1 365 .byte 2 # DW_AT_location 366 .byte 24 # DW_FORM_exprloc 367 .byte 0 # EOM(1) 368 .byte 0 # EOM(2) 369 .byte 3 # Abbreviation Code 370 .byte 36 # DW_TAG_base_type 371 .byte 0 # DW_CHILDREN_no 372 .byte 3 # DW_AT_name 373 .ascii "\202>" # DW_FORM_GNU_str_index 374 .byte 62 # DW_AT_encoding 375 .byte 11 # DW_FORM_data1 376 .byte 11 # DW_AT_byte_size 377 .byte 11 # DW_FORM_data1 378 .byte 0 # EOM(1) 379 .byte 0 # EOM(2) 380 .byte 4 # Abbreviation Code 381 .byte 46 # DW_TAG_subprogram 382 .byte 1 # DW_CHILDREN_yes 383 .byte 17 # DW_AT_low_pc 384 .ascii "\201>" # DW_FORM_GNU_addr_index 385 .byte 18 # DW_AT_high_pc 386 .byte 6 # DW_FORM_data4 387 .byte 64 # DW_AT_frame_base 388 .byte 24 # DW_FORM_exprloc 389 .ascii "\227B" # DW_AT_GNU_all_call_sites 390 .byte 25 # DW_FORM_flag_present 391 .byte 49 # DW_AT_abstract_origin 392 .byte 19 # DW_FORM_ref4 393 .byte 0 # EOM(1) 394 .byte 0 # EOM(2) 395 .byte 5 # Abbreviation Code 396 .byte 5 # DW_TAG_formal_parameter 397 .byte 0 # DW_CHILDREN_no 398 .byte 2 # DW_AT_location 399 .byte 24 # DW_FORM_exprloc 400 .byte 49 # DW_AT_abstract_origin 401 .byte 19 # DW_FORM_ref4 402 .byte 0 # EOM(1) 403 .byte 0 # EOM(2) 404 .byte 6 # Abbreviation Code 405 .byte 46 # DW_TAG_subprogram 406 .byte 1 # DW_CHILDREN_yes 407 .byte 110 # DW_AT_linkage_name 408 .ascii "\202>" # DW_FORM_GNU_str_index 409 .byte 3 # DW_AT_name 410 .ascii "\202>" # DW_FORM_GNU_str_index 411 .byte 58 # DW_AT_decl_file 412 .byte 11 # DW_FORM_data1 413 .byte 59 # DW_AT_decl_line 414 .byte 11 # DW_FORM_data1 415 .byte 63 # DW_AT_external 416 .byte 25 # DW_FORM_flag_present 417 .byte 32 # DW_AT_inline 418 .byte 11 # DW_FORM_data1 419 .byte 0 # EOM(1) 420 .byte 0 # EOM(2) 421 .byte 7 # Abbreviation Code 422 .byte 5 # DW_TAG_formal_parameter 423 .byte 0 # DW_CHILDREN_no 424 .byte 3 # DW_AT_name 425 .ascii "\202>" # DW_FORM_GNU_str_index 426 .byte 58 # DW_AT_decl_file 427 .byte 11 # DW_FORM_data1 428 .byte 59 # DW_AT_decl_line 429 .byte 11 # DW_FORM_data1 430 .byte 73 # DW_AT_type 431 .byte 19 # DW_FORM_ref4 432 .byte 0 # EOM(1) 433 .byte 0 # EOM(2) 434 .byte 8 # Abbreviation Code 435 .byte 15 # DW_TAG_pointer_type 436 .byte 0 # DW_CHILDREN_no 437 .byte 73 # DW_AT_type 438 .byte 19 # DW_FORM_ref4 439 .byte 0 # EOM(1) 440 .byte 0 # EOM(2) 441 .byte 9 # Abbreviation Code 442 .byte 46 # DW_TAG_subprogram 443 .byte 1 # DW_CHILDREN_yes 444 .byte 17 # DW_AT_low_pc 445 .ascii "\201>" # DW_FORM_GNU_addr_index 446 .byte 18 # DW_AT_high_pc 447 .byte 6 # DW_FORM_data4 448 .byte 64 # DW_AT_frame_base 449 .byte 24 # DW_FORM_exprloc 450 .ascii "\227B" # DW_AT_GNU_all_call_sites 451 .byte 25 # DW_FORM_flag_present 452 .byte 3 # DW_AT_name 453 .ascii "\202>" # DW_FORM_GNU_str_index 454 .byte 58 # DW_AT_decl_file 455 .byte 11 # DW_FORM_data1 456 .byte 59 # DW_AT_decl_line 457 .byte 11 # DW_FORM_data1 458 .byte 73 # DW_AT_type 459 .byte 19 # DW_FORM_ref4 460 .byte 63 # DW_AT_external 461 .byte 25 # DW_FORM_flag_present 462 .byte 0 # EOM(1) 463 .byte 0 # EOM(2) 464 .byte 10 # Abbreviation Code 465 .byte 5 # DW_TAG_formal_parameter 466 .byte 0 # DW_CHILDREN_no 467 .byte 2 # DW_AT_location 468 .byte 23 # DW_FORM_sec_offset 469 .byte 3 # DW_AT_name 470 .ascii "\202>" # DW_FORM_GNU_str_index 471 .byte 58 # DW_AT_decl_file 472 .byte 11 # DW_FORM_data1 473 .byte 59 # DW_AT_decl_line 474 .byte 11 # DW_FORM_data1 475 .byte 73 # DW_AT_type 476 .byte 19 # DW_FORM_ref4 477 .byte 0 # EOM(1) 478 .byte 0 # EOM(2) 479 .byte 11 # Abbreviation Code 480 .byte 29 # DW_TAG_inlined_subroutine 481 .byte 0 # DW_CHILDREN_no 482 .byte 49 # DW_AT_abstract_origin 483 .byte 19 # DW_FORM_ref4 484 .byte 17 # DW_AT_low_pc 485 .ascii "\201>" # DW_FORM_GNU_addr_index 486 .byte 18 # DW_AT_high_pc 487 .byte 6 # DW_FORM_data4 488 .byte 88 # DW_AT_call_file 489 .byte 11 # DW_FORM_data1 490 .byte 89 # DW_AT_call_line 491 .byte 11 # DW_FORM_data1 492 .byte 87 # DW_AT_call_column 493 .byte 11 # DW_FORM_data1 494 .byte 0 # EOM(1) 495 .byte 0 # EOM(2) 496 .byte 12 # Abbreviation Code 497 .ascii "\211\202\001" # DW_TAG_GNU_call_site 498 .byte 0 # DW_CHILDREN_no 499 .byte 49 # DW_AT_abstract_origin 500 .byte 19 # DW_FORM_ref4 501 .ascii "\225B" # DW_AT_GNU_tail_call 502 .byte 25 # DW_FORM_flag_present 503 .byte 17 # DW_AT_low_pc 504 .ascii "\201>" # DW_FORM_GNU_addr_index 505 .byte 0 # EOM(1) 506 .byte 0 # EOM(2) 507 .byte 13 # Abbreviation Code 508 .byte 46 # DW_TAG_subprogram 509 .byte 1 # DW_CHILDREN_yes 510 .byte 110 # DW_AT_linkage_name 511 .ascii "\202>" # DW_FORM_GNU_str_index 512 .byte 3 # DW_AT_name 513 .ascii "\202>" # DW_FORM_GNU_str_index 514 .byte 58 # DW_AT_decl_file 515 .byte 11 # DW_FORM_data1 516 .byte 59 # DW_AT_decl_line 517 .byte 11 # DW_FORM_data1 518 .byte 73 # DW_AT_type 519 .byte 19 # DW_FORM_ref4 520 .byte 60 # DW_AT_declaration 521 .byte 25 # DW_FORM_flag_present 522 .byte 63 # DW_AT_external 523 .byte 25 # DW_FORM_flag_present 524 .byte 0 # EOM(1) 525 .byte 0 # EOM(2) 526 .byte 14 # Abbreviation Code 527 .byte 5 # DW_TAG_formal_parameter 528 .byte 0 # DW_CHILDREN_no 529 .byte 73 # DW_AT_type 530 .byte 19 # DW_FORM_ref4 531 .byte 0 # EOM(1) 532 .byte 0 # EOM(2) 533 .byte 0 # EOM(3) 534 .section .debug_addr,"",@progbits 535.Laddr_table_base0: 536 .quad x 537 .quad y 538 .quad .Lfunc_begin0 539 .quad .Lfunc_begin1 540 .quad .Ltmp5 541 .quad .Ltmp4 542 .quad .Ltmp2 543 .ident "clang version 15.0.0" 544 .section ".note.GNU-stack","",@progbits 545 .section .debug_line,"",@progbits 546.Lline_table_start0: 547