HPlogo PA-RISC Procedure Calling Conventions Reference Manual > Chapter 6 Millicode Calls

6.4 Efficiency Factors

MPE documents

Complete PDF
Table of Contents

There are several conditions that contribute to the increased efficiency of millicode calls. The primary one is the fact that any standard routine that makes only millicode calls is considered to be a leaf routine, thereby eliminating the overhead expense (i.e. frame allocation) that would have been added by the presence of calls to standard procedures. A higher percentage of leaf routines improves overall efficiency, since a standard procedure call is much more costly than a millicode call. (in terms of stack frame allocation and usage, etc.). This and other major factors contributing to this efficiency are summarized below:
  1. The compiler is able to identify whether a routine is a leaf or not; it only builds a complete stack frame for non-leaf routines. In the diagram below, a stack frame is created upon the call to Prod in both Fig. A and Fig. B. In Fig. A, another frame is then allocated for Proc2 when the compiler realizes that Proc2 will be subsequently calling Proc3, whereas in Fig. B, no additional frame is necessary because the compiler realizes that Proc2 is only making a millicode call.

    [Figure A and B]

  2. More parameters can be passed in registers to a millicode routine than to a standard procedure call.

  3. The compiler knows more about millicode routines at compile time than it does about user-defined procedures, so it can perform some intra-procedural optimizations across the millicode call.

  4. The millicode calling mechanism is often faster than the standard procedure call; a millicode routine is called through a branch (BL or BLE) directly to the routine or to a pointer to the routine.




6.3 Introduction to Local and External Millicode


6.5 Making a Millicode Call