102 lines · plain
1## Test BinaryContext::calculateEmittedSize's functionality to update2## BinaryBasicBlock::OutputAddressRange in place so that the emitted size3## of each basic block is given by BinaryBasicBlock::getOutputSize()4 5# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o6# RUN: link_fdata %s %t.o %t.fdata7# RUN: llvm-strip --strip-unneeded %t.o8# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q9# 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 %s13# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o14# RUN: link_fdata %s %t.o %t.fdata15# RUN: llvm-strip --strip-unneeded %t.o16# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q17# 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 %s21 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 .text49 .globl chain50 .type chain, @function51chain:52 pushq %rbp53 movq %rsp, %rbp54 cmpl $2, %edi55LLentry_LLchain_start:56 jge LLchain_start57# FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLchain_start# 0 1058# FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLfast# 0 50059LLfast:60 movl $5, %eax61LLfast_LLexit:62 jmp LLexit63# FDATA: 1 chain #LLfast_LLexit# 1 chain #LLexit# 0 50064LLchain_start:65 movl $10, %eax66LLchain_start_LLchain1:67 jge LLchain168# FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLchain1# 0 1069# FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLcold# 0 070LLcold:71 addl $1, %eax72LLchain1:73 addl $1, %eax74LLchain1_LLexit:75 jmp LLexit76# FDATA: 1 chain #LLchain1_LLexit# 1 chain #LLexit# 0 1077LLexit:78 popq %rbp79 ret80LLchain_end:81 .size chain, LLchain_end-chain82 83 84 .globl main85 .type main, @function86main:87 pushq %rbp88 movq %rsp, %rbp89 movl $1, %edi90LLmain_chain1:91 call chain92# FDATA: 1 main #LLmain_chain1# 1 chain 0 0 50093 movl $4, %edi94LLmain_chain2:95 call chain96# FDATA: 1 main #LLmain_chain2# 1 chain 0 0 1097 xorl %eax, %eax98 popq %rbp99 retq100.Lmain_end:101 .size main, .Lmain_end-main102