Browse Prior Art Database

Effective Source Listing Annotation For Inline Procedure Expansions

IP.com Disclosure Number: IPCOM000123013D
Original Publication Date: 1998-Apr-01
Included in the Prior Art Database: 2005-Apr-04
Document File: 2 page(s) / 79K

Publishing Venue

IBM

Related People

Hanson, SP: AUTHOR [+2]

Abstract

A method for annotating inline procedure expansions within a compiler listing is disclosed. This method involves interleaving the source code from the inlined procedure within the machine instructions shown in the compiler listing.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 53% of the total text.

Effective Source Listing Annotation For Inline Procedure Expansions

      A method for annotating inline procedure expansions within a
compiler listing is disclosed.  This method involves interleaving the
source code from the inlined procedure within the machine
instructions shown in the compiler listing.

      Many modern compilers, in addition to creating object files,
allow the creation of an instruction listing file which shows all of
the machine instructions that are generated for a particular source
file.  This instruction listing can be used by the programmer to
debug the program, investigate performance problems, analyze the
quality of the generated code from the compiler, etc.  It is a
valuable piece of information that allows the programmer to perform a
detailed examination  of the compiler output.  Upon examination of
this information, a common  desire is to attempt to match the machine
instructions with the specific  source code statements that caused
those instructions to be generated.  One very good method of matching
the source code statements  with the machine instructions is to have
the compiler annotate the listing.  To annotate means to interleave
the source code within the machine instructions, listing the source
statement immediately prior to  the machine instructions generated
from that source statement.  This invention discloses a method to
annotate inline procedure expansions within this context.  When an
inline procedure expansion is to be annotated, it is not only
annotated with the source code for the inline  procedure call, it is
also annotated with the source code from the inline  procedure
itself.  In this way, the source code from the inline procedure is
used to enhance the readability of the inline procedure expansion.
Consider the following example C++ source file used to illustrate the
invention.  Two procedures are declared; the first is an  inline
procedure called 'inlineproc' and the second is called 'foo'. The
'foo' procedure calls the inline procedure 'inlineproc' twice.
  inline int inlineproc(int a, int b) {
      int c;
      c = a + b;
      return c;
  }
  int foo() {
      int c, d;
      c = inlineproc(3,4);
      d = inlineproc(5,6);
      return c + d;
  }

The following example illustrates the current invention when used on
the previous example.  Notice the source annotation from within the
inline procedure itself (source lines 1 through 5).  Although it is
possible to associate the generated instructions with the
corresponding line from the inline procedure without using the source
annotation, the association is much easier with t...