This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Basic block profiling (-a) does produce wrong code for insn prologues

We are in the process of implement the insn prologue / epilogue for the
S/390 platform. By doing
some testing, I found that the basic block profile code is missing the
right support for insn prologues.

On the intel platform for example a program compiled with -fpic -a produces
code like this:

.globl main
     .type     main,@function
     incl .LPBX2(%ebx)
     pushl     %ebp # 41 *pushsi2  [length = 1]
     movl %esp, %ebp     # 43 *movsi_1/2      [length = 2]
     pushl     %ebx # 44 *pushsi2  [length = 1]
     subl $4, %esp  # 46 *pro_epilogue_adjust_stack_1/1      [length = 3]
     call .LPR0     # 47 prologue_get_pc      [length = 16]
     addl $_GLOBAL_OFFSET_TABLE_, %ebx   # 48      prologue_set_got
[length = 10]

The code for the first block is emitted before the prologue code. This
won't work, if the prologue needs to
setup registers which are need by the profiling code. For Intel, only in
the fpic case that is true, for other
platform like S/390 it's always the case.
To solve this it should be possible to emit the block profiling code after
the prologue, like it is done for the other types
of profiling.

    Hartmut Penner

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]