E Assembler Coding Notes


Instruction Mnemonics 611
Operand Addressing Modes 612
Registers 612
Expressions 612


This section describes the conventions used in the Diab Assembler to specify instruction mnemonics and addressing modes.


Instruction Mnemonics

The Diab Assembler supports all PowerPC instructions as described in the PowerPC Microprocessor Family: The Programming Environments manuals, including the simplified mnemonics described there.


Operand Addressing Modes

Registers

This section specifies the valid names for registers. See Register use, p.181 for details on register use.

Registers can be specified in the following ways, in either lower or upper case:

Table E-1   Register names 
Register   Use/Description  

r0 - r31
0
- 31  

General purpose registers; can only be used where a general purpose register is expected.  

f0 - f31
0
- 31  

Floating point registers; can only be used where a floating point register is expected.  

cr0 - cr7
0
- 7  

Condition code registers; can only be used where a condition code register is expected.  

sr0 - sr15
0
- 15  

Segment registers; can only be used where a segment register is expected.  

1 - 1023
xer
(1)
ctr (9)
lr (8)  

Special purpose registers; can only be used where a special purpose register is expected. Only the most common register names are shown. Diab Assembler recognizes all special purpose registers for the supported targets.  

Expressions

See Chapter 19, Assembler Expressions, p.311, for a complete description of valid expressions. There are no limits on the complexity of an expression as long as all the operands are constants. When a label is used in the expression, the assembler will generate a relocation entry so that the linker can patch the instruction with the correct address. See Table F-7, ELF relocation types and examples, p.624 and Table G-8, COFF relocation types, p.638 for a complete list of relocation types.

The following table shows examples of expressions for common addressing modes:

 

support@windriver.com
Copyright © 2002, Wind River Systems, Inc. All rights reserved.