1## Test BinaryContext::calculateEmittedSize's functionality to update 2## BinaryBasicBlock::OutputAddressRange in place so that the emitted size 3## of each basic block is given by BinaryBasicBlock::getOutputSize() 4 5# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o 6# RUN: link_fdata %s %t.o %t.fdata 7# RUN: llvm-strip --strip-unneeded %t.o 8# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q 9# RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=all \ 10# RUN: --print-split --print-only=chain --print-output-address-range \ 11# RUN: --data=%t.fdata --reorder-blocks=ext-tsp \ 12# RUN: 2>&1 | FileCheck --check-prefix=SPLITALL %s 13# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o 14# RUN: link_fdata %s %t.o %t.fdata 15# RUN: llvm-strip --strip-unneeded %t.o 16# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q 17# RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --print-split \ 18# RUN: --print-only=chain --print-output-address-range \ 19# RUN: --data=%t.fdata --reorder-blocks=ext-tsp \ 20# RUN: 2>&1 | FileCheck --check-prefix=SPLITHOTCOLD %s 21 22# SPLITALL: {{^\.LBB00}} 23# SPLITALL: Output Address Range: [0x0, 0x12) (18 bytes) 24# SPLITALL: {{^\.LFT0}} 25# SPLITALL: Output Address Range: [0x0, 0xa) (10 bytes) 26# SPLITALL: {{^\.Ltmp1}} 27# SPLITALL: Output Address Range: [0x0, 0x2) (2 bytes) 28# SPLITALL: {{^\.Ltmp0}} 29# SPLITALL: Output Address Range: [0x0, 0x10) (16 bytes) 30# SPLITALL: {{^\.Ltmp2}} 31# SPLITALL: Output Address Range: [0x0, 0x8) (8 bytes) 32# SPLITALL: {{^\.LFT1}} 33# SPLITALL: Output Address Range: [0x0, 0x8) (8 bytes) 34 35# SPLITHOTCOLD: {{^\.LBB00}} 36# SPLITHOTCOLD: Output Address Range: [0x0, 0x9) (9 bytes) 37# SPLITHOTCOLD: {{^\.LFT0}} 38# SPLITHOTCOLD: Output Address Range: [0x9, 0xe) (5 bytes) 39# SPLITHOTCOLD: {{^\.Ltmp1}} 40# SPLITHOTCOLD: Output Address Range: [0xe, 0x10) (2 bytes) 41# SPLITHOTCOLD: {{^\.Ltmp0}} 42# SPLITHOTCOLD: Output Address Range: [0x10, 0x1b) (11 bytes) 43# SPLITHOTCOLD: {{^\.Ltmp2}} 44# SPLITHOTCOLD: Output Address Range: [0x1b, 0x20) (5 bytes) 45# SPLITHOTCOLD: {{^\.LFT1}} 46# SPLITHOTCOLD: Output Address Range: [0x0, 0x8) (8 bytes) 47 48 .text 49 .globl chain 50 .type chain, @function 51chain: 52 pushq %rbp 53 movq %rsp, %rbp 54 cmpl $2, %edi 55LLentry_LLchain_start: 56 jge LLchain_start 57# FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLchain_start# 0 10 58# FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLfast# 0 500 59LLfast: 60 movl $5, %eax 61LLfast_LLexit: 62 jmp LLexit 63# FDATA: 1 chain #LLfast_LLexit# 1 chain #LLexit# 0 500 64LLchain_start: 65 movl $10, %eax 66LLchain_start_LLchain1: 67 jge LLchain1 68# FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLchain1# 0 10 69# FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLcold# 0 0 70LLcold: 71 addl $1, %eax 72LLchain1: 73 addl $1, %eax 74LLchain1_LLexit: 75 jmp LLexit 76# FDATA: 1 chain #LLchain1_LLexit# 1 chain #LLexit# 0 10 77LLexit: 78 popq %rbp 79 ret 80LLchain_end: 81 .size chain, LLchain_end-chain 82 83 84 .globl main 85 .type main, @function 86main: 87 pushq %rbp 88 movq %rsp, %rbp 89 movl $1, %edi 90LLmain_chain1: 91 call chain 92# FDATA: 1 main #LLmain_chain1# 1 chain 0 0 500 93 movl $4, %edi 94LLmain_chain2: 95 call chain 96# FDATA: 1 main #LLmain_chain2# 1 chain 0 0 10 97 xorl %eax, %eax 98 popq %rbp 99 retq 100.Lmain_end: 101 .size main, .Lmain_end-main 102