This is a final stuff which I'm going to commit.
Any suggestion?
~d

===================================================
   We define new section ".profiler" which holds all profiling information.
   We define new pseudo operation .profiler which will instruct assembler to
   add new profile entry to the object file.
   Pseudo-op format:

.profiler flags,.Lprofile_address,symbol_to_profile [,cycle_corrector,extra]

   where 'flags' is a combination of the following chars:
            s - function entry
            x - function exit
            i - function is in init section
            f - function is in fini section
            l - library call
            c - libc standard call
            d - stack value demand
            I - interrupt service routine
            P - prologue start
            p - prologue end
            E - epilogue start
            e - epilogue end
            j - long jump/ sjlj unwind
            a - an arbitrary code fragment
          '""' optional: "sil" == sil

      .Lprofile_address - an address at which profiling information should be 
                                                                                
                                saved
      symbol_to_profile - function address
      cycle_corrector   - a value which should be added to the cycle counter,
                                                                                
                zero if omitted
      extra - some extra parameter. TBD.  zero if omitted



      For example:
      ------------------------------
        .global fxx
        .type fxx,@function
      fxx:
      .LFrameOffset_xxx=0x08
      .profiler "scdP", fxx, fxx        ; function entry.
                                     ; we also demand stack value to be saved
        push r11
        push r10
        push r9
        push r8
      .Lpstack_check1:
      .profiler "cdp",.Lpstack_check1,fxx,0, .LFrameOffset_xxx  
                                                ; demand stack value at this 
point
                                                ; (this is a prologue end)
                                                ; note, that spare var filled 
                                                ; with the farme size
        mov r15,r8
        ....
      .Lprof_exit0:
      .profiler cdE,.Lprof_exit0,fxx
        pop r8
        pop r9
        pop r10
        pop r11
      .Lprof_exit1:
      .profiler xcde,.Lprof_exit1,fxx,3 ; exit adds 3 to the cycle counter
      ret                               ; cause 'ret' insn takes 3 cycles
      -------------------------------



Reply via email to