HPCToolkit
instruction-set.h File Reference
#include <inttypes.h>
Include dependency graph for instruction-set.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PPC_REG_R0   0
 
#define PPC_REG_RA   PPC_REG_R0 /* typical, but not always */
 
#define PPC_REG_R1   1
 
#define PPC_REG_SP   PPC_REG_R1 /* apparently R1 is always SP */
 
#define PPC_REG_FP   PPC_REG_R1 /* apparently never */
 
#define PPC_REG_R2   2
 
#define PPC_REG_R31   31
 
#define PPC_REG_PC   32
 
#define PPC_REG_LR   (-1)
 
#define PPC_OPND_REG_S_MASK   0x03e00000
 
#define PPC_OPND_REG_S_SHIFT   21
 
#define PPC_OPND_REG_S(insn)   (((insn) & PPC_OPND_REG_S_MASK) >> PPC_OPND_REG_S_SHIFT)
 
#define PPC_OPND_REG_T_MASK   PPC_OPND_REG_S_MASK
 
#define PPC_OPND_REG_T_SHIFT   PPC_OPND_REG_S_SHIFT
 
#define PPC_OPND_REG_T(insn)   PPC_OPND_REG_S(insn)
 
#define PPC_OPND_REG_A_MASK   0x001f0000
 
#define PPC_OPND_REG_A_SHIFT   16
 
#define PPC_OPND_REG_A(insn)   (((insn) & PPC_OPND_REG_A_MASK) >> PPC_OPND_REG_A_SHIFT)
 
#define PPC_OPND_REG_B_MASK   0x0000f800
 
#define PPC_OPND_REG_B_SHIFT   11
 
#define PPC_OPND_REG_B(insn)   (((insn) & PPC_OPND_REG_B_MASK) >> PPC_OPND_REG_B_SHIFT)
 
#define PPC_OPND_CC_MASK   0x00000001 /* Condition code bit */
 
#define PPC_OPND_CC_SHIFT   0
 
#define PPC_OPND_REG_SPR_MASK   (PPC_OPND_REG_A_MASK | PPC_OPND_REG_B_MASK)
 
#define PPC_OPND_REG_SPR_SHIFT   16
 
#define PPC_OPND_REG_SPR(insn)   (((insn) & PPC_OPND_REG_SPR_MASK) >> PPC_OPND_REG_SPR_SHIFT)
 
#define PPC_OPND_DISP(x)   (((int16_t)((x) & 0x0000ffff)))
 
#define PPC_OPND_DISP_DS(x)   (((int16_t)((x) & 0x0000fffc)))
 
#define PPC_OP_D_MASK   0xfc000000 /* opcode */
 
#define PPC_OP_DS_MASK   0xfc000003 /* opcode, extra-opc */
 
#define PPC_OP_I_MASK   0xfc000003 /* opcode, AA, LK */
 
#define PPC_OP_X_MASK   0xfc0007fe /* opcode, extra-opc */
 
#define PPC_OP_XFX_MASK   0xfc0007fe /* opcode, extra-opc */
 
#define PPC_OP_XFX_SPR_MASK   (PPC_OP_XFX_MASK | PPC_OPND_REG_SPR_MASK)
 
#define PPC_OP_LWZ   0x80000000 /* D-form */
 
#define PPC_OP_STW   0x90000000 /* D-form */
 
#define PPC_OP_STD   0xf8000000 /* DS-form */
 
#define PPC_OP_STWU   0x94000000 /* D-form */
 
#define PPC_OP_STDU   0xf8000001 /* DS-form */
 
#define PPC_OP_ADDI   0x38000000 /* D-form */
 
#define PPC_OP_ADDIS   0x3c000000 /* D-form */
 
#define PPC_OP_LIS   PPC_OP_ADDIS /* D-form: lis Rx,v = addis Rx,0,v */
 
#define PPC_OP_STWUX   0x7c00016e /* X-form */
 
#define PPC_OP_STDUX   0x7c00016a /* X-form */
 
#define PPC_OP_OR   0x7c000378 /* X-form */
 
#define PPC_OP_MR   PPC_OP_OR /* X-form: mr Rx Ry = or Rx Ry Ry */
 
#define PPC_OP_BLR   0x4e800020 /* XL-form */
 
#define PPC_OP_BL   0x48000001 /* I-form */
 
#define PPC_OP_MFSPR   0x7c0002a6 /* XFX-form (2 args) */
 
#define PPC_OP_MFLR   0x7c0802a6 /* XFX-form (1 arg) */
 
#define PPC_OP_MTSPR   0x7c0003a6 /* XFX-form (2 args) */
 
#define PPC_OP_MTLR   0x7c0803a6 /* XFX-form (1 arg) */
 
#define PPC_INSN_D_MASK   0xffff0000 /* opcode RS, RA */
 
#define PPC_INSN_DS_MASK   0xffff0003 /* opcode RS, RA , extra-opc */
 
#define PPC_INSN_X_MASK   0xfffffffe /* opcode RS, RA, RB, extra-opc */
 
#define PPC_INSN_XFX_MASK   0xfffffffe /* opcode RS, SPR, extra-opc */
 
#define PPC_INSN_D(opc, RS, RA, D)
 
#define PPC_INSN_DS(opc, RS, RA, D)
 
#define PPC_INSN_X(opc, RS, RA, RB, Rc)
 
#define PPC_INSN_XFX1(opc, RS)   ((opc) | ((RS) << PPC_OPND_REG_S_SHIFT))
 
#define PPC_INSN_XFX2(opc, RS, SPR)
 

Macro Definition Documentation

◆ PPC_INSN_D

#define PPC_INSN_D (   opc,
  RS,
  RA,
 
)
Value:
((opc) | ((RS) << PPC_OPND_REG_S_SHIFT) \
| ((RA) << PPC_OPND_REG_A_SHIFT) \
| (D))
#define PPC_OPND_REG_A_SHIFT
#define RS
#define PPC_OPND_REG_S_SHIFT

Definition at line 177 of file instruction-set.h.

◆ PPC_INSN_D_MASK

#define PPC_INSN_D_MASK   0xffff0000 /* opcode RS, RA */

Definition at line 172 of file instruction-set.h.

◆ PPC_INSN_DS

#define PPC_INSN_DS (   opc,
  RS,
  RA,
 
)
Value:
((opc) | ((RS) << PPC_OPND_REG_S_SHIFT) \
| ((RA) << PPC_OPND_REG_A_SHIFT) \
| ((D) << 2))
#define PPC_OPND_REG_A_SHIFT
#define RS
#define PPC_OPND_REG_S_SHIFT

Definition at line 182 of file instruction-set.h.

◆ PPC_INSN_DS_MASK

#define PPC_INSN_DS_MASK   0xffff0003 /* opcode RS, RA , extra-opc */

Definition at line 173 of file instruction-set.h.

◆ PPC_INSN_X

#define PPC_INSN_X (   opc,
  RS,
  RA,
  RB,
  Rc 
)
Value:
((opc) | ((RS) << PPC_OPND_REG_S_SHIFT) \
| ((RA) << PPC_OPND_REG_A_SHIFT) \
| ((RB) << PPC_OPND_REG_B_SHIFT) \
| (Rc))
#define PPC_OPND_REG_A_SHIFT
#define RS
#define PPC_OPND_REG_S_SHIFT
#define PPC_OPND_REG_B_SHIFT

Definition at line 187 of file instruction-set.h.

◆ PPC_INSN_X_MASK

#define PPC_INSN_X_MASK   0xfffffffe /* opcode RS, RA, RB, extra-opc */

Definition at line 174 of file instruction-set.h.

◆ PPC_INSN_XFX1

#define PPC_INSN_XFX1 (   opc,
  RS 
)    ((opc) | ((RS) << PPC_OPND_REG_S_SHIFT))

Definition at line 193 of file instruction-set.h.

◆ PPC_INSN_XFX2

#define PPC_INSN_XFX2 (   opc,
  RS,
  SPR 
)
Value:
((opc) | ((RS) << PPC_OPND_REG_S_SHIFT) \
| ((SPR) << PPC_OPND_REG_SPR_SHIFT))
#define RS
#define PPC_OPND_REG_S_SHIFT
#define PPC_OPND_REG_SPR_SHIFT

Definition at line 196 of file instruction-set.h.

◆ PPC_INSN_XFX_MASK

#define PPC_INSN_XFX_MASK   0xfffffffe /* opcode RS, SPR, extra-opc */

Definition at line 175 of file instruction-set.h.

◆ PPC_OP_ADDI

#define PPC_OP_ADDI   0x38000000 /* D-form */

Definition at line 147 of file instruction-set.h.

◆ PPC_OP_ADDIS

#define PPC_OP_ADDIS   0x3c000000 /* D-form */

Definition at line 148 of file instruction-set.h.

◆ PPC_OP_BL

#define PPC_OP_BL   0x48000001 /* I-form */

Definition at line 158 of file instruction-set.h.

◆ PPC_OP_BLR

#define PPC_OP_BLR   0x4e800020 /* XL-form */

Definition at line 157 of file instruction-set.h.

◆ PPC_OP_D_MASK

#define PPC_OP_D_MASK   0xfc000000 /* opcode */

Definition at line 132 of file instruction-set.h.

◆ PPC_OP_DS_MASK

#define PPC_OP_DS_MASK   0xfc000003 /* opcode, extra-opc */

Definition at line 133 of file instruction-set.h.

◆ PPC_OP_I_MASK

#define PPC_OP_I_MASK   0xfc000003 /* opcode, AA, LK */

Definition at line 134 of file instruction-set.h.

◆ PPC_OP_LIS

#define PPC_OP_LIS   PPC_OP_ADDIS /* D-form: lis Rx,v = addis Rx,0,v */

Definition at line 149 of file instruction-set.h.

◆ PPC_OP_LWZ

#define PPC_OP_LWZ   0x80000000 /* D-form */

Definition at line 139 of file instruction-set.h.

◆ PPC_OP_MFLR

#define PPC_OP_MFLR   0x7c0802a6 /* XFX-form (1 arg) */

Definition at line 161 of file instruction-set.h.

◆ PPC_OP_MFSPR

#define PPC_OP_MFSPR   0x7c0002a6 /* XFX-form (2 args) */

Definition at line 160 of file instruction-set.h.

◆ PPC_OP_MR

#define PPC_OP_MR   PPC_OP_OR /* X-form: mr Rx Ry = or Rx Ry Ry */

Definition at line 155 of file instruction-set.h.

◆ PPC_OP_MTLR

#define PPC_OP_MTLR   0x7c0803a6 /* XFX-form (1 arg) */

Definition at line 164 of file instruction-set.h.

◆ PPC_OP_MTSPR

#define PPC_OP_MTSPR   0x7c0003a6 /* XFX-form (2 args) */

Definition at line 163 of file instruction-set.h.

◆ PPC_OP_OR

#define PPC_OP_OR   0x7c000378 /* X-form */

Definition at line 154 of file instruction-set.h.

◆ PPC_OP_STD

#define PPC_OP_STD   0xf8000000 /* DS-form */

Definition at line 142 of file instruction-set.h.

◆ PPC_OP_STDU

#define PPC_OP_STDU   0xf8000001 /* DS-form */

Definition at line 145 of file instruction-set.h.

◆ PPC_OP_STDUX

#define PPC_OP_STDUX   0x7c00016a /* X-form */

Definition at line 152 of file instruction-set.h.

◆ PPC_OP_STW

#define PPC_OP_STW   0x90000000 /* D-form */

Definition at line 141 of file instruction-set.h.

◆ PPC_OP_STWU

#define PPC_OP_STWU   0x94000000 /* D-form */

Definition at line 144 of file instruction-set.h.

◆ PPC_OP_STWUX

#define PPC_OP_STWUX   0x7c00016e /* X-form */

Definition at line 151 of file instruction-set.h.

◆ PPC_OP_X_MASK

#define PPC_OP_X_MASK   0xfc0007fe /* opcode, extra-opc */

Definition at line 135 of file instruction-set.h.

◆ PPC_OP_XFX_MASK

#define PPC_OP_XFX_MASK   0xfc0007fe /* opcode, extra-opc */

Definition at line 136 of file instruction-set.h.

◆ PPC_OP_XFX_SPR_MASK

#define PPC_OP_XFX_SPR_MASK   (PPC_OP_XFX_MASK | PPC_OPND_REG_SPR_MASK)

Definition at line 137 of file instruction-set.h.

◆ PPC_OPND_CC_MASK

#define PPC_OPND_CC_MASK   0x00000001 /* Condition code bit */

Definition at line 115 of file instruction-set.h.

◆ PPC_OPND_CC_SHIFT

#define PPC_OPND_CC_SHIFT   0

Definition at line 116 of file instruction-set.h.

◆ PPC_OPND_DISP

#define PPC_OPND_DISP (   x)    (((int16_t)((x) & 0x0000ffff)))

Definition at line 124 of file instruction-set.h.

◆ PPC_OPND_DISP_DS

#define PPC_OPND_DISP_DS (   x)    (((int16_t)((x) & 0x0000fffc)))

Definition at line 125 of file instruction-set.h.

◆ PPC_OPND_REG_A

#define PPC_OPND_REG_A (   insn)    (((insn) & PPC_OPND_REG_A_MASK) >> PPC_OPND_REG_A_SHIFT)

Definition at line 107 of file instruction-set.h.

◆ PPC_OPND_REG_A_MASK

#define PPC_OPND_REG_A_MASK   0x001f0000

Definition at line 105 of file instruction-set.h.

◆ PPC_OPND_REG_A_SHIFT

#define PPC_OPND_REG_A_SHIFT   16

Definition at line 106 of file instruction-set.h.

◆ PPC_OPND_REG_B

#define PPC_OPND_REG_B (   insn)    (((insn) & PPC_OPND_REG_B_MASK) >> PPC_OPND_REG_B_SHIFT)

Definition at line 112 of file instruction-set.h.

◆ PPC_OPND_REG_B_MASK

#define PPC_OPND_REG_B_MASK   0x0000f800

Definition at line 110 of file instruction-set.h.

◆ PPC_OPND_REG_B_SHIFT

#define PPC_OPND_REG_B_SHIFT   11

Definition at line 111 of file instruction-set.h.

◆ PPC_OPND_REG_S

#define PPC_OPND_REG_S (   insn)    (((insn) & PPC_OPND_REG_S_MASK) >> PPC_OPND_REG_S_SHIFT)

Definition at line 98 of file instruction-set.h.

◆ PPC_OPND_REG_S_MASK

#define PPC_OPND_REG_S_MASK   0x03e00000

Definition at line 96 of file instruction-set.h.

◆ PPC_OPND_REG_S_SHIFT

#define PPC_OPND_REG_S_SHIFT   21

Definition at line 97 of file instruction-set.h.

◆ PPC_OPND_REG_SPR

#define PPC_OPND_REG_SPR (   insn)    (((insn) & PPC_OPND_REG_SPR_MASK) >> PPC_OPND_REG_SPR_SHIFT)

Definition at line 120 of file instruction-set.h.

◆ PPC_OPND_REG_SPR_MASK

#define PPC_OPND_REG_SPR_MASK   (PPC_OPND_REG_A_MASK | PPC_OPND_REG_B_MASK)

Definition at line 118 of file instruction-set.h.

◆ PPC_OPND_REG_SPR_SHIFT

#define PPC_OPND_REG_SPR_SHIFT   16

Definition at line 119 of file instruction-set.h.

◆ PPC_OPND_REG_T

#define PPC_OPND_REG_T (   insn)    PPC_OPND_REG_S(insn)

Definition at line 103 of file instruction-set.h.

◆ PPC_OPND_REG_T_MASK

#define PPC_OPND_REG_T_MASK   PPC_OPND_REG_S_MASK

Definition at line 101 of file instruction-set.h.

◆ PPC_OPND_REG_T_SHIFT

#define PPC_OPND_REG_T_SHIFT   PPC_OPND_REG_S_SHIFT

Definition at line 102 of file instruction-set.h.

◆ PPC_REG_FP

#define PPC_REG_FP   PPC_REG_R1 /* apparently never */

Definition at line 81 of file instruction-set.h.

◆ PPC_REG_LR

#define PPC_REG_LR   (-1)

Definition at line 89 of file instruction-set.h.

◆ PPC_REG_PC

#define PPC_REG_PC   32

Definition at line 87 of file instruction-set.h.

◆ PPC_REG_R0

#define PPC_REG_R0   0

Definition at line 76 of file instruction-set.h.

◆ PPC_REG_R1

#define PPC_REG_R1   1

Definition at line 79 of file instruction-set.h.

◆ PPC_REG_R2

#define PPC_REG_R2   2

Definition at line 83 of file instruction-set.h.

◆ PPC_REG_R31

#define PPC_REG_R31   31

Definition at line 85 of file instruction-set.h.

◆ PPC_REG_RA

#define PPC_REG_RA   PPC_REG_R0 /* typical, but not always */

Definition at line 77 of file instruction-set.h.

◆ PPC_REG_SP

#define PPC_REG_SP   PPC_REG_R1 /* apparently R1 is always SP */

Definition at line 80 of file instruction-set.h.