2022-11-07 03:06:21 +00:00
|
|
|
#ifndef COMPILER_OPERANDS_H
|
|
|
|
#define COMPILER_OPERANDS_H
|
|
|
|
|
|
|
|
#include "compiler/common.h"
|
|
|
|
|
|
|
|
#ifdef __MWERKS__
|
|
|
|
#pragma options align=mac68k
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern Float one_point_zero;
|
|
|
|
|
|
|
|
enum OperandType {
|
|
|
|
// Value in a register (identified by 'reg')
|
|
|
|
OpndType_GPR = 0,
|
|
|
|
// Uses 'reg', 'object, 'immOffset'
|
|
|
|
OpndType_GPR_ImmOffset = 1,
|
|
|
|
// Uses 'reg', 'regOffset'
|
|
|
|
OpndType_GPR_Indexed = 2,
|
|
|
|
// Value in two registers (identified by 'reg' and 'regHi')
|
|
|
|
OpndType_GPRPair = 3,
|
2022-11-20 05:07:22 +00:00
|
|
|
// Immediate 32-bit value
|
2022-11-07 03:06:21 +00:00
|
|
|
OpndType_Absolute = 4,
|
|
|
|
// Value in a float register (identified by 'reg')
|
|
|
|
OpndType_FPR = 5,
|
|
|
|
// Value in a vector register (identified by 'reg')
|
|
|
|
OpndType_VR = 6,
|
|
|
|
// Condition value: 'reg' stores which condition register, and 'regOffset' is equal to ENOTEQU, EEQU, EGREATEREQU,
|
|
|
|
// ELESS, ELESS or ELESSEQU
|
|
|
|
OpndType_CRField = 7,
|
|
|
|
// Value of a symbol (identified by 'object')
|
|
|
|
OpndType_Symbol = 8,
|
|
|
|
// Reference to a location (at 'reg', offset using 'object' and 'immOffset')
|
|
|
|
OpndType_IndirectGPR_ImmOffset = 9,
|
|
|
|
// Reference to a location (at 'reg', offset using the value of register 'regOffset')
|
|
|
|
OpndType_IndirectGPR_Indexed = 0xA,
|
|
|
|
// Reference to a symbol (identified by 'object')
|
|
|
|
OpndType_IndirectSymbol = 0xB
|
|
|
|
};
|
|
|
|
|
|
|
|
// These are probably the same as the PCode Flags and can be unified?
|
|
|
|
enum {
|
|
|
|
OpndFlags_Const = 0x40,
|
|
|
|
OpndFlags_Volatile = 0x80
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Operand {
|
|
|
|
enum OperandType optype;
|
|
|
|
SInt16 reg;
|
|
|
|
SInt16 regHi;
|
|
|
|
SInt16 regOffset;
|
|
|
|
SInt32 immOffset;
|
2022-11-20 05:07:22 +00:00
|
|
|
SInt32 immediate;
|
2022-11-07 03:06:21 +00:00
|
|
|
Object *object;
|
|
|
|
UInt32 flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern void load_immediate(short reg, SInt32 value);
|
|
|
|
extern void symbol_operand(Operand *op, Object *obj);
|
|
|
|
extern void indirect(Operand *op, ENode *expr);
|
|
|
|
extern void combine(Operand *opA, Operand *opB, short output_reg, Operand *opOut);
|
|
|
|
extern void coerce_to_addressable(Operand *op);
|
|
|
|
extern void Coerce_to_register(Operand *op, Type *type, short output_reg);
|
|
|
|
extern void coerce_to_register_pair(Operand *op, Type *type, short output_reg, short output_regHi);
|
2023-01-11 22:29:53 +00:00
|
|
|
extern void Coerce_to_fp_register(Operand *op, Type *type, short output_reg);
|
|
|
|
extern void Coerce_to_v_register(Operand *op, Type *type, short output_reg);
|
2022-11-07 03:06:21 +00:00
|
|
|
extern void store(short reg, Operand *op, Type *type);
|
|
|
|
extern void store_pair(short reg, short regHi, Operand *op, Type *type);
|
2022-11-20 05:07:22 +00:00
|
|
|
extern void store_fp(short reg, Operand *op, Type *tint);
|
|
|
|
extern void store_v(short reg, Operand *op, Type *tstruct);
|
2022-11-07 03:06:21 +00:00
|
|
|
extern void extend32(Operand *op, Type *type, short output_reg);
|
|
|
|
extern void extend64(Operand *op, Type *type, short output_reg, short output_regHi);
|
2023-01-11 22:29:53 +00:00
|
|
|
extern void load_floating_constant(short reg, Type *type, Float *data);
|
2022-11-07 03:06:21 +00:00
|
|
|
extern void convert_integer_to_floating(Operand *op, Boolean is_single, short output_reg);
|
|
|
|
extern void convert_unsigned_to_floating(Operand *op, Boolean is_single, short output_reg);
|
|
|
|
extern void convert_floating_to_integer(Operand *op, short output_reg);
|
|
|
|
extern void convert_floating_to_unsigned(Operand *op, short output_reg);
|
|
|
|
extern void extract_bitfield(Operand *input_op, TypeBitfield *tbitfield, short output_reg, Operand *output_op);
|
|
|
|
extern void insert_bitfield(short reg, Operand *op, TypeBitfield *tbitfield);
|
|
|
|
extern void load_address(short dest_reg, Operand *op);
|
|
|
|
|
|
|
|
#ifdef __MWERKS__
|
|
|
|
#pragma options align=reset
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|