1# clang++ -g -gdwarf-5 -emit-llvm -S main.cpp 2# llc -O0 -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 0 "." "main.cpp" md5 0x1f627913a0daee879e00a3a51726f0ef 21 .globl _Z3usePiS_ # -- Begin function _Z3usePiS_ 22 .p2align 4, 0x90 23 .type _Z3usePiS_,@function 24_Z3usePiS_: # @_Z3usePiS_ 25.Lfunc_begin0: 26 .loc 0 1 0 # main.cpp:1:0 27 .cfi_startproc 28# %bb.0: # %entry 29 pushq %rbp 30 .cfi_def_cfa_offset 16 31 .cfi_offset %rbp, -16 32 movq %rsp, %rbp 33 .cfi_def_cfa_register %rbp 34 movq %rdi, -8(%rbp) 35 movq %rsi, -16(%rbp) 36.Ltmp0: 37 .loc 0 2 2 prologue_end # main.cpp:2:2 38 movq -8(%rbp), %rax 39 .loc 0 2 4 is_stmt 0 # main.cpp:2:4 40 movl (%rax), %ecx 41 addl $4, %ecx 42 movl %ecx, (%rax) 43 .loc 0 3 2 is_stmt 1 # main.cpp:3:2 44 movq -16(%rbp), %rax 45 .loc 0 3 4 is_stmt 0 # main.cpp:3:4 46 movl (%rax), %ecx 47 subl $2, %ecx 48 movl %ecx, (%rax) 49 .loc 0 4 1 is_stmt 1 # main.cpp:4:1 50 popq %rbp 51 .cfi_def_cfa %rsp, 8 52 retq 53.Ltmp1: 54.Lfunc_end0: 55 .size _Z3usePiS_, .Lfunc_end0-_Z3usePiS_ 56 .cfi_endproc 57 # -- End function 58 .globl main # -- Begin function main 59 .p2align 4, 0x90 60 .type main,@function 61main: # @main 62.Lfunc_begin1: 63 .loc 0 9 0 # main.cpp:9:0 64 .cfi_startproc 65# %bb.0: # %entry 66 pushq %rbp 67 .cfi_def_cfa_offset 16 68 .cfi_offset %rbp, -16 69 movq %rsp, %rbp 70 .cfi_def_cfa_register %rbp 71 subq $16, %rsp 72 movl $0, -4(%rbp) 73 movl %edi, -8(%rbp) 74 movq %rsi, -16(%rbp) 75.Ltmp2: 76 .loc 0 10 8 prologue_end # main.cpp:10:8 77 movl -8(%rbp), %eax 78 .loc 0 10 6 is_stmt 0 # main.cpp:10:6 79 movl %eax, x 80 .loc 0 11 8 is_stmt 1 # main.cpp:11:8 81 movl -8(%rbp), %eax 82 .loc 0 11 13 is_stmt 0 # main.cpp:11:13 83 addl $3, %eax 84 .loc 0 11 6 # main.cpp:11:6 85 movl %eax, y 86 .loc 0 12 4 is_stmt 1 # main.cpp:12:4 87 movabsq $x, %rdi 88 movabsq $y, %rsi 89 callq _Z3usePiS_ 90 .loc 0 13 18 # main.cpp:13:18 91 movl x, %edi 92 .loc 0 13 21 is_stmt 0 # main.cpp:13:21 93 movl y, %esi 94 .loc 0 13 11 # main.cpp:13:11 95 callq _Z6helperii 96 .loc 0 13 4 # main.cpp:13:4 97 addq $16, %rsp 98 popq %rbp 99 .cfi_def_cfa %rsp, 8 100 retq 101.Ltmp3: 102.Lfunc_end1: 103 .size main, .Lfunc_end1-main 104 .cfi_endproc 105 # -- End function 106 .type x,@object # @x 107 .bss 108 .globl x 109 .p2align 2 110x: 111 .long 0 # 0x0 112 .size x, 4 113 114 .type y,@object # @y 115 .data 116 .globl y 117 .p2align 2 118y: 119 .long 1 # 0x1 120 .size y, 4 121 122 .section .debug_abbrev,"",@progbits 123 .byte 1 # Abbreviation Code 124 .byte 74 # DW_TAG_skeleton_unit 125 .byte 0 # DW_CHILDREN_no 126 .byte 16 # DW_AT_stmt_list 127 .byte 23 # DW_FORM_sec_offset 128 .byte 114 # DW_AT_str_offsets_base 129 .byte 23 # DW_FORM_sec_offset 130 .byte 27 # DW_AT_comp_dir 131 .byte 37 # DW_FORM_strx1 132 .ascii "\264B" # DW_AT_GNU_pubnames 133 .byte 25 # DW_FORM_flag_present 134 .byte 118 # DW_AT_dwo_name 135 .byte 37 # DW_FORM_strx1 136 .byte 17 # DW_AT_low_pc 137 .byte 27 # DW_FORM_addrx 138 .byte 18 # DW_AT_high_pc 139 .byte 6 # DW_FORM_data4 140 .byte 115 # DW_AT_addr_base 141 .byte 23 # DW_FORM_sec_offset 142 .byte 0 # EOM(1) 143 .byte 0 # EOM(2) 144 .byte 0 # EOM(3) 145 .section .debug_info,"",@progbits 146.Lcu_begin0: 147 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 148.Ldebug_info_start0: 149 .short 5 # DWARF version number 150 .byte 4 # DWARF Unit Type 151 .byte 8 # Address Size (in bytes) 152 .long .debug_abbrev # Offset Into Abbrev. Section 153 .quad 2452897014735893912 154 .byte 1 # Abbrev [1] 0x14:0x14 DW_TAG_skeleton_unit 155 .long .Lline_table_start0 # DW_AT_stmt_list 156 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base 157 .byte 0 # DW_AT_comp_dir 158 # DW_AT_GNU_pubnames 159 .byte 1 # DW_AT_dwo_name 160 .byte 2 # DW_AT_low_pc 161 .long .Lfunc_end1-.Lfunc_begin0 # DW_AT_high_pc 162 .long .Laddr_table_base0 # DW_AT_addr_base 163.Ldebug_info_end0: 164 .section .debug_str_offsets,"",@progbits 165 .long 12 # Length of String Offsets Set 166 .short 5 167 .short 0 168.Lstr_offsets_base0: 169 .section .debug_str,"MS",@progbits,1 170.Lskel_string0: 171 .asciz "." # string offset=0 172.Lskel_string1: 173 .asciz "main.dwo" # string offset=2 174 .section .debug_str_offsets,"",@progbits 175 .long .Lskel_string0 176 .long .Lskel_string1 177 .section .debug_str_offsets.dwo,"e",@progbits 178 .long 52 # Length of String Offsets Set 179 .short 5 180 .short 0 181 .section .debug_str.dwo,"eMS",@progbits,1 182.Linfo_string0: 183 .asciz "x" # string offset=0 184.Linfo_string1: 185 .asciz "int" # string offset=2 186.Linfo_string2: 187 .asciz "y" # string offset=6 188.Linfo_string3: 189 .asciz "_Z3usePiS_" # string offset=8 190.Linfo_string4: 191 .asciz "use" # string offset=19 192.Linfo_string5: 193 .asciz "main" # string offset=23 194.Linfo_string6: 195 .asciz "argc" # string offset=28 196.Linfo_string7: 197 .asciz "argv" # string offset=33 198.Linfo_string8: 199 .asciz "char" # string offset=38 200.Linfo_string9: 201 .asciz "clang version 15.0.0" # string offset=43 202.Linfo_string10: 203 .asciz "main.cpp" # string offset=64 204.Linfo_string11: 205 .asciz "main.dwo" # string offset=73 206 .section .debug_str_offsets.dwo,"e",@progbits 207 .long 0 208 .long 2 209 .long 6 210 .long 8 211 .long 19 212 .long 23 213 .long 28 214 .long 33 215 .long 38 216 .long 43 217 .long 64 218 .long 73 219 .section .debug_info.dwo,"e",@progbits 220 .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit 221.Ldebug_info_dwo_start0: 222 .short 5 # DWARF version number 223 .byte 5 # DWARF Unit Type 224 .byte 8 # Address Size (in bytes) 225 .long 0 # Offset Into Abbrev. Section 226 .quad 2452897014735893912 227 .byte 1 # Abbrev [1] 0x14:0x7d DW_TAG_compile_unit 228 .byte 9 # DW_AT_producer 229 .short 33 # DW_AT_language 230 .byte 10 # DW_AT_name 231 .byte 11 # DW_AT_dwo_name 232 .byte 2 # Abbrev [2] 0x1a:0xb DW_TAG_variable 233 .byte 0 # DW_AT_name 234 .long 37 # DW_AT_type 235 # DW_AT_external 236 .byte 0 # DW_AT_decl_file 237 .byte 7 # DW_AT_decl_line 238 .byte 2 # DW_AT_location 239 .byte 161 240 .byte 0 241 .byte 3 # Abbrev [3] 0x25:0x4 DW_TAG_base_type 242 .byte 1 # DW_AT_name 243 .byte 5 # DW_AT_encoding 244 .byte 4 # DW_AT_byte_size 245 .byte 2 # Abbrev [2] 0x29:0xb DW_TAG_variable 246 .byte 2 # DW_AT_name 247 .long 37 # DW_AT_type 248 # DW_AT_external 249 .byte 0 # DW_AT_decl_file 250 .byte 8 # DW_AT_decl_line 251 .byte 2 # DW_AT_location 252 .byte 161 253 .byte 1 254 .byte 4 # Abbrev [4] 0x34:0x23 DW_TAG_subprogram 255 .byte 2 # DW_AT_low_pc 256 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc 257 .byte 1 # DW_AT_frame_base 258 .byte 86 259 .byte 3 # DW_AT_linkage_name 260 .byte 4 # DW_AT_name 261 .byte 0 # DW_AT_decl_file 262 .byte 1 # DW_AT_decl_line 263 # DW_AT_external 264 .byte 5 # Abbrev [5] 0x40:0xb DW_TAG_formal_parameter 265 .byte 2 # DW_AT_location 266 .byte 145 267 .byte 120 268 .byte 0 # DW_AT_name 269 .byte 0 # DW_AT_decl_file 270 .byte 1 # DW_AT_decl_line 271 .long 125 # DW_AT_type 272 .byte 5 # Abbrev [5] 0x4b:0xb DW_TAG_formal_parameter 273 .byte 2 # DW_AT_location 274 .byte 145 275 .byte 112 276 .byte 2 # DW_AT_name 277 .byte 0 # DW_AT_decl_file 278 .byte 1 # DW_AT_decl_line 279 .long 125 # DW_AT_type 280 .byte 0 # End Of Children Mark 281 .byte 6 # Abbrev [6] 0x57:0x26 DW_TAG_subprogram 282 .byte 3 # DW_AT_low_pc 283 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc 284 .byte 1 # DW_AT_frame_base 285 .byte 86 286 .byte 5 # DW_AT_name 287 .byte 0 # DW_AT_decl_file 288 .byte 9 # DW_AT_decl_line 289 .long 37 # DW_AT_type 290 # DW_AT_external 291 .byte 5 # Abbrev [5] 0x66:0xb DW_TAG_formal_parameter 292 .byte 2 # DW_AT_location 293 .byte 145 294 .byte 120 295 .byte 6 # DW_AT_name 296 .byte 0 # DW_AT_decl_file 297 .byte 9 # DW_AT_decl_line 298 .long 37 # DW_AT_type 299 .byte 5 # Abbrev [5] 0x71:0xb DW_TAG_formal_parameter 300 .byte 2 # DW_AT_location 301 .byte 145 302 .byte 112 303 .byte 7 # DW_AT_name 304 .byte 0 # DW_AT_decl_file 305 .byte 9 # DW_AT_decl_line 306 .long 130 # DW_AT_type 307 .byte 0 # End Of Children Mark 308 .byte 7 # Abbrev [7] 0x7d:0x5 DW_TAG_pointer_type 309 .long 37 # DW_AT_type 310 .byte 7 # Abbrev [7] 0x82:0x5 DW_TAG_pointer_type 311 .long 135 # DW_AT_type 312 .byte 7 # Abbrev [7] 0x87:0x5 DW_TAG_pointer_type 313 .long 140 # DW_AT_type 314 .byte 3 # Abbrev [3] 0x8c:0x4 DW_TAG_base_type 315 .byte 8 # DW_AT_name 316 .byte 6 # DW_AT_encoding 317 .byte 1 # DW_AT_byte_size 318 .byte 0 # End Of Children Mark 319.Ldebug_info_dwo_end0: 320 .section .debug_abbrev.dwo,"e",@progbits 321 .byte 1 # Abbreviation Code 322 .byte 17 # DW_TAG_compile_unit 323 .byte 1 # DW_CHILDREN_yes 324 .byte 37 # DW_AT_producer 325 .byte 37 # DW_FORM_strx1 326 .byte 19 # DW_AT_language 327 .byte 5 # DW_FORM_data2 328 .byte 3 # DW_AT_name 329 .byte 37 # DW_FORM_strx1 330 .byte 118 # DW_AT_dwo_name 331 .byte 37 # DW_FORM_strx1 332 .byte 0 # EOM(1) 333 .byte 0 # EOM(2) 334 .byte 2 # Abbreviation Code 335 .byte 52 # DW_TAG_variable 336 .byte 0 # DW_CHILDREN_no 337 .byte 3 # DW_AT_name 338 .byte 37 # DW_FORM_strx1 339 .byte 73 # DW_AT_type 340 .byte 19 # DW_FORM_ref4 341 .byte 63 # DW_AT_external 342 .byte 25 # DW_FORM_flag_present 343 .byte 58 # DW_AT_decl_file 344 .byte 11 # DW_FORM_data1 345 .byte 59 # DW_AT_decl_line 346 .byte 11 # DW_FORM_data1 347 .byte 2 # DW_AT_location 348 .byte 24 # DW_FORM_exprloc 349 .byte 0 # EOM(1) 350 .byte 0 # EOM(2) 351 .byte 3 # Abbreviation Code 352 .byte 36 # DW_TAG_base_type 353 .byte 0 # DW_CHILDREN_no 354 .byte 3 # DW_AT_name 355 .byte 37 # DW_FORM_strx1 356 .byte 62 # DW_AT_encoding 357 .byte 11 # DW_FORM_data1 358 .byte 11 # DW_AT_byte_size 359 .byte 11 # DW_FORM_data1 360 .byte 0 # EOM(1) 361 .byte 0 # EOM(2) 362 .byte 4 # Abbreviation Code 363 .byte 46 # DW_TAG_subprogram 364 .byte 1 # DW_CHILDREN_yes 365 .byte 17 # DW_AT_low_pc 366 .byte 27 # DW_FORM_addrx 367 .byte 18 # DW_AT_high_pc 368 .byte 6 # DW_FORM_data4 369 .byte 64 # DW_AT_frame_base 370 .byte 24 # DW_FORM_exprloc 371 .byte 110 # DW_AT_linkage_name 372 .byte 37 # DW_FORM_strx1 373 .byte 3 # DW_AT_name 374 .byte 37 # DW_FORM_strx1 375 .byte 58 # DW_AT_decl_file 376 .byte 11 # DW_FORM_data1 377 .byte 59 # DW_AT_decl_line 378 .byte 11 # DW_FORM_data1 379 .byte 63 # DW_AT_external 380 .byte 25 # DW_FORM_flag_present 381 .byte 0 # EOM(1) 382 .byte 0 # EOM(2) 383 .byte 5 # Abbreviation Code 384 .byte 5 # DW_TAG_formal_parameter 385 .byte 0 # DW_CHILDREN_no 386 .byte 2 # DW_AT_location 387 .byte 24 # DW_FORM_exprloc 388 .byte 3 # DW_AT_name 389 .byte 37 # DW_FORM_strx1 390 .byte 58 # DW_AT_decl_file 391 .byte 11 # DW_FORM_data1 392 .byte 59 # DW_AT_decl_line 393 .byte 11 # DW_FORM_data1 394 .byte 73 # DW_AT_type 395 .byte 19 # DW_FORM_ref4 396 .byte 0 # EOM(1) 397 .byte 0 # EOM(2) 398 .byte 6 # Abbreviation Code 399 .byte 46 # DW_TAG_subprogram 400 .byte 1 # DW_CHILDREN_yes 401 .byte 17 # DW_AT_low_pc 402 .byte 27 # DW_FORM_addrx 403 .byte 18 # DW_AT_high_pc 404 .byte 6 # DW_FORM_data4 405 .byte 64 # DW_AT_frame_base 406 .byte 24 # DW_FORM_exprloc 407 .byte 3 # DW_AT_name 408 .byte 37 # DW_FORM_strx1 409 .byte 58 # DW_AT_decl_file 410 .byte 11 # DW_FORM_data1 411 .byte 59 # DW_AT_decl_line 412 .byte 11 # DW_FORM_data1 413 .byte 73 # DW_AT_type 414 .byte 19 # DW_FORM_ref4 415 .byte 63 # DW_AT_external 416 .byte 25 # DW_FORM_flag_present 417 .byte 0 # EOM(1) 418 .byte 0 # EOM(2) 419 .byte 7 # Abbreviation Code 420 .byte 15 # DW_TAG_pointer_type 421 .byte 0 # DW_CHILDREN_no 422 .byte 73 # DW_AT_type 423 .byte 19 # DW_FORM_ref4 424 .byte 0 # EOM(1) 425 .byte 0 # EOM(2) 426 .byte 0 # EOM(3) 427 .section .debug_addr,"",@progbits 428 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution 429.Ldebug_addr_start0: 430 .short 5 # DWARF version number 431 .byte 8 # Address size 432 .byte 0 # Segment selector size 433.Laddr_table_base0: 434 .quad x 435 .quad y 436 .quad .Lfunc_begin0 437 .quad .Lfunc_begin1 438.Ldebug_addr_end0: 439 .section .debug_gnu_pubnames,"",@progbits 440 .long .LpubNames_end0-.LpubNames_start0 # Length of Public Names Info 441.LpubNames_start0: 442 .short 2 # DWARF Version 443 .long .Lcu_begin0 # Offset of Compilation Unit Info 444 .long 40 # Compilation Unit Length 445 .long 87 # DIE offset 446 .byte 48 # Attributes: FUNCTION, EXTERNAL 447 .asciz "main" # External Name 448 .long 26 # DIE offset 449 .byte 32 # Attributes: VARIABLE, EXTERNAL 450 .asciz "x" # External Name 451 .long 41 # DIE offset 452 .byte 32 # Attributes: VARIABLE, EXTERNAL 453 .asciz "y" # External Name 454 .long 52 # DIE offset 455 .byte 48 # Attributes: FUNCTION, EXTERNAL 456 .asciz "use" # External Name 457 .long 0 # End Mark 458.LpubNames_end0: 459 .section .debug_gnu_pubtypes,"",@progbits 460 .long .LpubTypes_end0-.LpubTypes_start0 # Length of Public Types Info 461.LpubTypes_start0: 462 .short 2 # DWARF Version 463 .long .Lcu_begin0 # Offset of Compilation Unit Info 464 .long 40 # Compilation Unit Length 465 .long 37 # DIE offset 466 .byte 144 # Attributes: TYPE, STATIC 467 .asciz "int" # External Name 468 .long 140 # DIE offset 469 .byte 144 # Attributes: TYPE, STATIC 470 .asciz "char" # External Name 471 .long 0 # End Mark 472.LpubTypes_end0: 473 .ident "clang version 15.0.0" 474 .section ".note.GNU-stack","",@progbits 475 .section .debug_line,"",@progbits 476.Lline_table_start0: 477