|
HP OpenVMS systems documentation |
Order Number: AA--PV64E--TE
This manual describes how to port Macro-32 source code written for the VAX MACRO compiler to the MACRO compiler for OpenVMS running on either an HP OpenVMS Industry Standard 64 or HP OpenVMS Alpha system. It also describes how to use the compiler.
Revision/Update Information: This revised manual supersedes the OpenVMS MACRO-32 Porting and User's Guide for OpenVMS Version 7.3.
Software Version:
OpenVMS I64 Version 8.2
OpenVMS Alpha Version 8.2
Hewlett-Packard Company Palo Alto, California
© Copyright 2005 Hewlett-Packard Development Company, L.P.
Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.
The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.
Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
Printed in the US
ZK5601
The HP OpenVMS documentation set is available on CD-ROM.
Contents | Index |
This manual is for software engineers responsible for porting application code:
You should have programming skills and an understanding of the relevant operating systems.
This manual is divided into two parts.
Part 1, Concepts and Methodology is composed of the the following chapters:
Part 2, Reference is composed of the following appendixes:
This manual refers readers to the following manuals for additional information on certain topics:
For additional information about HP OpenVMS products and services, visit the following World Wide Web address:
http://www.hp.com/go/openvms |
1 This manual has been archived. It is no longer maintained and is not part of the OpenVMS documentation set. However, you can view it online at http://www.hp.com/go/openvms/doc. |
HP welcomes your comments on this manual. Please send comments to either of the following addresses:
Internet | openvmsdoc@hp.com |
Postal Mail |
Hewlett-Packard Company
OSSG Documentation Group, ZKO3-4/U08 110 Spit Brook Rd. Nashua, NH 03062-2698 |
For information about how to order additional documentation, visit the following World Wide Web address:
http://www.hp.com/go/openvms/doc/order |
The following product names may appear in this manual:
All three names---the longer form and the two abbreviated forms---refer to the version of the OpenVMS operating system that runs on the Intel® Itanium® architecture.
The following conventions might be used in this manual:
Ctrl/ x | A sequence such as Ctrl/ x indicates that you must hold down the key labeled Ctrl while you press another key or a pointing device button. |
PF1 x | A sequence such as PF1 x indicates that you must first press and release the key labeled PF1 and then press and release another key or a pointing device button. |
[Return] |
In examples, a key name enclosed in a box indicates that you press a
key on the keyboard. (In text, a key name is not enclosed in a box.)
In the HTML version of this document, this convention appears as brackets, rather than a box. |
... |
A horizontal ellipsis in examples indicates one of the following
possibilities:
|
.
. . |
A vertical ellipsis indicates the omission of items from a code example or command format; the items are omitted because they are not important to the topic being discussed. |
( ) | In command format descriptions, parentheses indicate that you must enclose choices in parentheses if you specify more than one. |
[ ] | In command format descriptions, brackets indicate optional choices. You can choose one or more items or no items. Do not type the brackets on the command line. However, you must include the brackets in the syntax for OpenVMS directory specifications and for a substring specification in an assignment statement. |
| | In command format descriptions, vertical bars separate choices within brackets or braces. Within brackets, the choices are optional; within braces, at least one choice is required. Do not type the vertical bars on the command line. |
{ } | In command format descriptions, braces indicate required choices; you must choose at least one of the items listed. Do not type the braces on the command line. |
bold type | Bold type represents the introduction of a new term. It also represents the name of an argument, an attribute, or a reason. |
italic type | Italic type indicates important information, complete titles of manuals, or variables. Variables include information that varies in system output (Internal error number), in command lines (/PRODUCER= name), and in command parameters in text (where dd represents the predefined code for the device type). |
UPPERCASE TYPE | Uppercase type indicates a command, the name of a routine, the name of a file, or the abbreviation for a system privilege. |
- | A hyphen at the end of a command format description, command line, or code line indicates that the command or statement continues on the following line. |
numbers | All numbers in text are assumed to be decimal unless otherwise noted. Nondecimal radixes---binary, octal, or hexadecimal---are explicitly indicated. |
This chapter describes a process that software engineers can use when planning to port Macro-32 code from an OpenVMS VAX system to an OpenVMS Alpha or HP OpenVMS Industry Standard 64 system.
This chapter contains the following topics:
See Appendix A for information on how to invoke the compiler. |
The OpenVMS MACRO compiler compiles Macro-32 source code written for OpenVMS VAX systems (the VAX MACRO assembler) into machine code that runs on OpenVMS Alpha and OpenVMS I64 systems.
This compiler is provided for porting Macro-32 code to OpenVMS Alpha and OpenVMS I64 systems. For any new development, it is recommended that you use mid- and high-level languages. |
While some VAX MACRO code can be compiled without any changes, most code modules will require the addition of entry point directives when ported to OpenVMS Alpha or OpenVMS I64. Many code modules will require other changes as well.
The compiler might detect only a few problems with a module at its initial compilation and then, after you have corrected them, the compiler might discover additional problems. In such cases, the resolution of one problem can allow the compiler to further examine the code and discover other problems the initial one concealed.
The compiler includes many features that make this process easier, such as:
The compiler also provides 64-bit addressing support, which is
documented in Chapter 5 and in Appendix E. Support for 64-bit
addressing was introduced in OpenVMS Alpha Version 7.0. This support is
provided for those rare instances when it is preferable to use VAX
MACRO to access 64-bit address space instead of using a high-level
language that is supported on OpenVMS Alpha or OpenVMS I64.
1.2 Differences Between the Compiler and the Assembler
It is important to remember that the MACRO compiler is a compiler, not
an assembler. It does not create output code that exactly matches the
input code. In its optimization process, the compiler might move,
replicate, or remove code and interleave instructions. Furthermore, the
faulting behavior of the ported code might not match that of VAX code.
These differences are described in the following sections.
1.2.1 Moving Code
Mispredicted branches are expensive on an OpenVMS Alpha or OpenVMS I64 system. The compiler attempts to determine the most likely code path through the module and then generates code that consolidates that code path. Code paths deemed unlikely are moved out of line to the end of the module. Consider the following example:
$ASSIGN_S DEVNAM=DEVICE,CHAN=CHANNEL BLBS R0,10$ JSB PROCESS ERROR HALT 10$: |
In this example, the compiler will treat the HALT as an unlikely code path and detect that the two code streams do not rejoin at 10$. Because of these conditions, it will determine that the branch is likely to be taken. It will then move the intervening instructions out of line to the end of the module, change the BLBS instruction to a BLBC that branches to the moved code, and continue with in-line code generation at the label 10$, as follows:
$ASSIGN_S DEVNAM=DEVICE,CHAN=CHANNEL BLBC L1$ 10$: . . . (routine exit) L1$: JSB PROCESS ERROR HALT |
You can change the compiler's determination of the likelihood of
conditional branches with the compiler directives .BRANCH_LIKELY and
.BRANCH_UNLIKELY (see Section 4.2).
1.2.2 Replicating Code
The compiler might replicate small sections of code multiple times to eliminate excessive branching. For example, when compiling branches to the following VAX code, the compiler will replicate the MOVL at each branch to ERROR1 and then branch directly to COMMON_ERROR.
ERROR1: MOVL #ERROR1,R0 BRW COMMON_ERROR |
The compiler's optimizations might determine that some instructions do not contribute to the code flow. In such instances, the instructions might be removed. An example of this is a CMP or TST instruction with no subsequent conditional branch, such as the following:
CMPB (R2),511(R2) JSB EXE$SENDMSG |
Removal of this CMPB instruction could cause a problem if its purpose was to touch two memory locations to ensure that the memory pages were faulted in before calling the routine. This would likely have to be changed in porting to OpenVMS Alpha or OpenVMS I64 anyway because of the different page sizes of VAX and Alpha or I64 systems. In addition to changing the page size, you should replace the instruction with MOVx instructions, such as the following:
MOVB (R2),R1 MOVB 8191(R2),R0 JSB EXE$SENDMSG |
Note that the two MOVB instructions operated on two different registers. The compiler does not currently remove instructions that load values into a register which is never subsequently read before being overwritten. However, this optimization might be done in the future.
In general, code requiring that a memory read reference actually touch memory should be examined carefully, as current or future optimizations might move or remove the references. |
Instruction scheduling, which is performed by default (see
Section 4.3), will interleave the Alpha or Itanium instructions
generated from one VAX instruction with the Alpha or Itanium
instructions generated by surrounding VAX instructions.
1.2.5 Reserved Operand Faults
On VAX systems, some VAX MACRO instructions might generate a reserved operand fault if certain operands are out of a required range. For example, on a bit manipulation instruction such as INSV, if the size operand is greater than 32, a VAX system will generate a run-time reserved operand fault.
On OpenVMS Alpha and OpenVMS I64 systems, if the operand that is out of
range is a compile-time constant, the compiler will flag this condition
with an error message. However, if this operand is variable at run
time, the compiler makes no attempt to generate run-time range checks
on it. If the operand is out of range, the resulting operation might
cause incorrect results yet not create a fault.
1.3 Step-by-Step Porting Process for OpenVMS VAX to OpenVMS Alpha or OpenVMS I64
The following steps have proven to be an efficient means for porting VAX MACRO code to OpenVMS Alpha or OpenVMS I64:
AMAC-I-ARGLISHOME, argument list must be homed in caller |
IMAC-I-ARGLISHOME, argument list must be homed in caller |
Once you have some experience in porting VAX MACRO modules, it will be easier to recognize certain problems while inspecting the source and to fix them before your initial invocation of the compiler.
Next | Contents | Index |