add a bunch of code and a ton of stub files for later

This commit is contained in:
Ash Wolf
2022-11-20 00:07:22 -05:00
parent 9a46dd0e2e
commit 9d2728a560
190 changed files with 23694 additions and 1175 deletions

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_ADDPROPAGATION_H
#define COMPILER_ADDPROPAGATION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_ALIAS_H
#define COMPILER_ALIAS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_BITVECTORS_H
#define COMPILER_BITVECTORS_H
#include "compiler/common.h"
#endif

View File

@@ -8,7 +8,7 @@
#pragma options align=mac68k
#endif
extern short CABI_GetStructResultArgumentIndex(void);
extern short CABI_GetStructResultArgumentIndex(TypeFunc *tfunc);
extern Type *CABI_GetSizeTType(void);
extern Type *CABI_GetPtrDiffTType(void);
extern SInt16 CABI_StructSizeAlignValue(Type *type, SInt32 size);

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CBROWSE_H
#define COMPILER_CBROWSE_H
#include "compiler/common.h"
#endif

View File

@@ -25,7 +25,7 @@ extern ENode *CClass_DefaultConstructorCall(TypeClass *a, TypeClass *b, ENode *e
extern Object *CClass_AssignmentOperator(TypeClass *tclass);
extern Object *CClass_CopyConstructor(TypeClass *tclass);
extern NameSpaceObjectList *CClass_MemberObject(TypeClass *tclass, HashNameNode *name);
extern Object *CClass_Constructor(TypeClass *tclass);
extern NameSpaceObjectList *CClass_Constructor(TypeClass *tclass);
extern Object *CClass_Destructor(TypeClass *tclass);
extern Boolean CClass_IsConstructor(Object *obj);
extern Boolean CClass_IsDestructor(Object *obj);

View File

@@ -0,0 +1,14 @@
#ifndef COMPILER_CCOMPILER_H
#define COMPILER_CCOMPILER_H
#include "compiler/common.h"
extern Boolean systemHandles;
extern Boolean crippled;
extern SInt32 license_cookie;
extern CParams cparams;
extern CWPLUGIN_ENTRY(MWC_main)(CWPluginContext context);
extern void PrintProgressFunction(const char *str);
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CEXCEPTION_H
#define COMPILER_CEXCEPTION_H
#include "compiler/common.h"
#endif

View File

@@ -45,19 +45,26 @@ typedef struct Match5 {
} Match5;
typedef struct Match13 {
short x0;
short x2;
short x4;
short x6;
short x8;
short xA;
short xC;
Object *obj;
Match5 anotherm5;
short xE;
Match5 match5;
ObjectList *list;
} Match13;
typedef struct FuncMatchArgs {
ENodeList *exprs;
FuncArg *args;
} FuncMatchArgs;
typedef struct Conversion {
ENode *x0;
ENode *left;
ENode *right;
} Conversion;
// CExpr.c
extern Boolean (*name_obj_check)(void *, Object *); // TODO figure out the right type
extern Boolean (*name_obj_check)(HashNameNode *, Object *);
extern Boolean disallowgreaterthan;
// CExpr2.c
@@ -65,63 +72,63 @@ extern ENode *assign_node;
extern Boolean temp_reference_init;
// CExpr.c
extern void CExpr_RewriteConst();
extern ENode *CExpr_RewriteConst(ENode *expr);
extern void optimizecomm(ENode *expr);
extern short canadd(ENode *expr, SInt32 value);
extern ENode *checkreference(ENode *expr);
extern ENode *pointer_generation(ENode *expr);
extern void CExpr_PointerGeneration();
extern void oldassignmentpromotion();
extern ENode *CExpr_PointerGeneration(ENode *expr);
extern ENode *oldassignmentpromotion(ENode *expr, Type *type, short qual, Boolean flag);
extern ENode *argumentpromotion(ENode *expr, Type *type, short qual, Boolean flag);
extern ENode *classargument(ENode *expr);
extern ENodeList *CExpr_ScanExpressionList(Boolean flag);
extern void CExpr_DoExplicitConversion();
extern void CExpr_MakeNameLookupResultExpr();
extern void scansizeof();
extern void scanalignof();
extern ENodeList *CExpr_ScanExpressionList(Boolean is_parens);
extern ENode *CExpr_DoExplicitConversion(Type *type, UInt32 qual, ENodeList *list);
extern ENode *CExpr_MakeNameLookupResultExpr(CScopeParseResult *pr);
extern SInt32 scansizeof(void);
extern SInt32 scanalignof(void);
extern ENode *getnodeaddress(ENode *expr, Boolean flag);
extern void getpointertomemberfunc();
extern void CExpr_New_ELOGNOT_Node();
extern void CExpr_New_EMONMIN_Node();
extern void CExpr_New_EBINNOT_Node();
extern ENode *getpointertomemberfunc(ENode *expr, Type *type, Boolean flag);
extern ENode *CExpr_New_ELOGNOT_Node(ENode *expr);
extern ENode *CExpr_New_EMONMIN_Node(ENode *expr);
extern ENode *CExpr_New_EBINNOT_Node(ENode *expr);
extern ENode *unary_expression(void);
extern ENode *do_castnullcheck(ENode *a, ENode *b);
extern void CExpr_SafeClassPointerCast();
extern ENode *do_castnullcheck(ENode *condexpr, ENode *nullcheckexpr);
extern ENode *CExpr_SafeClassPointerCast(ENode *expr, TypeClass *a, TypeClass *b, Boolean typconflag, Boolean pathcheckflag);
extern ENode *PointerToMemberCast(ENode *expr, TypeMemberPointer *tm1, TypeMemberPointer *tm2, Boolean flag);
extern void CExpr_MemberPointerConversion();
extern ENode *CExpr_MemberPointerConversion(ENode *expr, TypeMemberPointer *type, Boolean flag1);
extern ENode *do_typecast(ENode *expr, Type *type, UInt32 qual);
extern void cast_expression();
extern void CExpr_New_EMUL_Node();
extern void CExpr_New_EDIV_Node();
extern void CExpr_New_EMODULO_Node();
extern void CExpr_New_EADD_Node();
extern void CExpr_New_ESUB_Node();
extern void CExpr_New_ESHL_Node();
extern void CExpr_New_ESHR_Node();
extern void CExpr_New_ELESS_Node();
extern void CExpr_New_ELESSEQU_Node();
extern void CExpr_New_EGREATER_Node();
extern void CExpr_New_EGREATEREQU_Node();
extern ENode *cast_expression(void);
extern ENode *CExpr_New_EMUL_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_EDIV_Node(ENode *left, ENode *right, Boolean no_warning);
extern ENode *CExpr_New_EMODULO_Node(ENode *left, ENode *right, Boolean no_warning);
extern ENode *CExpr_New_EADD_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_ESUB_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_ESHL_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_ESHR_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_ELESS_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_ELESSEQU_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_EGREATER_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_EGREATEREQU_Node(ENode *left, ENode *right);
extern ENode *memberpointercompare(ENodeType t, ENode *left, ENode *right);
extern void CExpr_New_EEQU_Node();
extern void CExpr_New_ENOTEQU_Node();
extern void CExpr_New_EAND_Node();
extern void CExpr_New_EXOR_Node();
extern void CExpr_New_EOR_Node();
extern void CExpr_New_ELAND_Node();
extern void CExpr_New_ELOR_Node();
extern void CExpr_NewDyadicNode();
extern void CExpr_New_ECOND_Node();
extern ENode *CExpr_New_EEQU_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_ENOTEQU_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_EAND_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_EXOR_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_EOR_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_ELAND_Node(ENode *left, ENode *right);
extern ENode *CExpr_New_ELOR_Node(ENode *left, ENode *right);
extern ENode *CExpr_NewDyadicNode(ENode *left, ENodeType nt, ENode *right);
extern ENode *CExpr_New_ECOND_Node(ENode *cond, ENode *expr1, ENode *expr2);
extern ENode *assignment_expression(void);
extern ENode *conv_assignment_expression(void);
extern void CExpr_CheckUnusedExpression();
extern void s_expression();
extern void CExpr_CheckUnusedExpression(ENode *expr);
extern ENode *s_expression(void);
extern ENode *expression(void);
extern CInt64 CExpr_IntegralConstExprType(Type **tint);
extern ENode *CExpr_IntegralConstOrDepExpr(void);
extern CInt64 CExpr_IntegralConstExpr(void);
extern void CExpr_CheckUnwantedAssignment();
extern void CExpr_ParseAsmExpr();
extern void CExpr_CheckUnwantedAssignment(ENode *expr);
extern Boolean CExpr_ParseAsmExpr(Object **objptr, CInt64 *valptr);
// CExpr2.c
typedef void (*CExprSearchCB)(ENode *expr);
@@ -170,24 +177,24 @@ extern ENode *CExpr_GetClassAccessNode(BClassList *a, BClassList *b, ENode *expr
extern ENode *CExpr_ConvertToBool(ENode *expr, Boolean flag);
extern void CExpr_ConversionIteratorInit(ConversionIterator *iter, TypeClass *tclass);
extern Object *CExpr_ConversionIteratorNext(ConversionIterator *iter);
extern void user_assign_check();
extern short user_assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boolean flag2, Boolean flag3);
extern ENode *CExpr_ConvertToCondition(ENode *expr);
extern void CExpr_ConvertToIntegral();
extern void CExpr_CheckArithmConversion();
extern void get_address_of_temp_copy();
extern ENode *CExpr_ConvertToIntegral(ENode *expr);
extern void CExpr_CheckArithmConversion(ENode *expr, Type *type);
extern ENode *get_address_of_temp_copy(ENode *expr, Boolean flag);
extern short assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boolean flag2, Boolean flag3);
extern void CExpr_MatchCompare();
extern void CExpr_GetFuncMatchArgs();
extern Boolean CExpr_MatchCompare(Object *obj, Match13 *a, Match13 *b);
extern Boolean CExpr_GetFuncMatchArgs(Object *obj, ENodeList *argexprs, ENode *expr, FuncMatchArgs *result);
extern ENode *CExpr_GetDefaultArgument(ENode *funcexpr, FuncArg *arg);
extern ENode *CExpr_VarArgPromotion(ENode *expr, Boolean flag);
extern void CExpr_GenericFuncCall();
extern void CExpr_GenericPtmfCall();
extern void CExpr_MakeFunctionCall();
extern void CExpr_CheckOperatorConversion();
extern void CExpr_CheckOperator();
extern ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, Object *obj, NameSpaceObjectList *nsol, TemplArg *templargs, ENodeList *nodes, Boolean flag2, Boolean flag3, Boolean flag4);
extern ENode *CExpr_GenericPtmfCall(Object *obj, TypeFunc *tfunc, ENodeList *arg_exprs);
extern ENode *CExpr_MakeFunctionCall(ENode *funcexpr, ENodeList *arg_exprs);
extern Boolean CExpr_CheckOperatorConversion(short token, ENode *left, ENode *right, ENodeList *list, Conversion *conv);
extern Boolean CExpr_CheckOperator(short token, ENode *left, ENode *right, Conversion *conv);
extern ENode *CExpr_ConstructObject(TypeClass *tclass, ENode *addr_expr, ENodeList *args, Boolean flag1, Boolean flag2, Boolean flag3, Boolean flag4, Boolean flag5);
extern void scannew();
extern void scandelete();
extern ENode *scannew(Boolean flag);
extern ENode *scandelete(Boolean flag);
// CExprConvMatch.c
// static void CExpr_GetImplictObjectParamType();
@@ -216,7 +223,7 @@ extern ENode *CExpr_AssignmentPromotion(ENode *expr, Type *type, UInt32 qual, Bo
// static void CExpr_MatchArgs();
// static void CExpr_GetMatchObject();
// static void CExpr_FindBestMatch();
extern void CExpr_FuncArgMatch();
extern void CExpr_FuncArgMatch(NameSpaceObjectList *nsol, TemplArg *templargs, ENodeList *argexprs, Match13 *match, ENode *expr, Boolean flag);
// static void CExpr_BuildConversionTypeList();
// static void CExpr_NextPromotedIntegralType();
// static void CExpr_NextArithmeticType();
@@ -226,8 +233,8 @@ extern void CExpr_FuncArgMatch();
// static void CExpr_CheckUnaryBuiltin();
// static void CExpr_CheckBinaryBuiltin();
// static void CExpr_MatchOperands();
extern void CExpr_CondOperatorMatch();
extern void CExpr_OperatorMatch();
extern Boolean CExpr_CondOperatorMatch(ENode *left, ENode *right, Conversion *conv);
extern Boolean CExpr_OperatorMatch(short token, ENode *left, ENode *right, Conversion *conv);
// static void CExpr_ClassCopyInit();
#ifdef __MWERKS__

View File

@@ -47,9 +47,19 @@ typedef enum StatementType {
} StatementType;
enum {
StmtFlag_1 = 1
StmtFlag_1 = 1,
StmtFlag_8 = 8,
StmtFlag_10 = 0x10
};
// TODO: move me - ST_BEGINLOOP related?
typedef struct LoopInfo {
int x0;
int x4;
short x8;
Statement *stmt;
} LoopInfo;
struct Statement {
Statement *next;
StatementType type;

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CIRTRANSFORM_H
#define COMPILER_CIRTRANSFORM_H
#include "compiler/common.h"
#endif

View File

@@ -101,7 +101,7 @@ extern Boolean CInline_ExpressionHasSideEffect(ENode *expr);
extern ENode *CInline_CopyExpression(ENode *expr, CInlineCopyMode mode);
extern void CInline_SerializeStatement(Statement *stmt);
extern Object *CInline_GetLocalObj(SInt32 id, Boolean flag);
extern SInt32 CInline_GetStatementNumber(Statement *first, Statement *stmt);
extern SInt16 CInline_GetStatementNumber(Statement *first, Statement *stmt);
extern void CInline_PackIFunctionData(CI_FuncData *packed, Statement *stmt, Object *obj);
extern void CInline_UnpackIFunctionData(Object *obj, CI_FuncData *packed, Statement *stmt);
extern void CInline_AddDefaultFunctionAction(Object *obj);

View File

@@ -71,7 +71,7 @@ extern SInt32 CMach_StructLayoutGetOffset(Type *type, UInt32 qual);
extern SInt32 CMach_StructLayoutBitfield(TypeBitfield *tbitfield, UInt32 qual);
extern UInt8 CMach_GetFunctionResultClass(TypeFunc *tfunc);
extern Boolean CMach_PassResultInHiddenArg(Type *type);
extern const char *CMach_GetCPU(void);
extern char *CMach_GetCPU(void);
extern Boolean CMach_FloatIsPowerOf2(Float flt);
extern Float CMach_FloatReciprocal(Float flt);
extern SInt32 CMach_RoundedSizeOf(Object *object);

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_COBJC_H
#define COMPILER_COBJC_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_COBJCMODERN_H
#define COMPILER_COBJCMODERN_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,55 @@
#ifndef COMPILER_COPTIMIZER_H
#define COMPILER_COPTIMIZER_H
#include "compiler/common.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef struct COptBlockList {
struct COptBlockList *next;
struct COptBlock *block;
} COptBlockList;
typedef struct COptBlock {
struct COptBlock *next;
COptBlockList *blocks;
COptBlockList *blocks2;
Statement *stmt;
short *set1;
short *set2;
UInt32 allocmask;
short x1C;
Boolean x1E;
} COptBlock;
typedef struct COptCSE {
struct COptCSE *next;
struct COptCSE *left;
struct COptCSE *right;
COptBlock *block;
ENode *expr;
ENode *mexpr;
ENode *replaced;
short x1C;
} COptCSE;
typedef struct COptCSEList {
struct COptCSEList *next;
COptCSE *cse;
ENode *expr;
} COptCSEList;
#ifdef __MWERKS__
#pragma options align=reset
#endif
extern COptBlock *basicblocks;
extern Boolean copt_isleaffunction;
extern UInt32 RegAllocMask(short var);
extern void MarkRegAllocMask(short var, short bit, Boolean flag);
extern void SetVarUsage(Object *obj, Boolean noregister);
extern void COpt_SimpleOptimizer(Object *obj, Statement *stmt);
extern Statement *COpt_Optimizer(Object *obj, Statement *stmt);
#endif

View File

@@ -22,6 +22,37 @@ enum {
AlignMode8_Packed
};
enum {
CPU_PPC401,
CPU_PPC403,
CPU_PPC505,
CPU_PPC509,
CPU_PPC555,
CPU_PPC601,
CPU_PPC602,
CPU_PPC603,
CPU_PPC603e,
CPU_PPC604,
CPU_PPC604e,
CPU_PPC740,
CPU_PPC750,
CPU_PPC801,
CPU_PPC821,
CPU_PPC823,
CPU_PPC850,
CPU_PPC860,
CPU_PPC8240,
CPU_PPC8260,
CPU_Generic,
CPU_PPC7400,
CPU_PPCGEKKO,
CPU_PPCELF,
CPU_PPC7450,
CPU_PPC556,
CPU_PPC565
};
// not sure how many of these are char and how many are unsigned char or Boolean
typedef struct COpts {
Boolean little_endian;
@@ -33,18 +64,18 @@ typedef struct COpts {
char x06; // linker/objgen related
short cpu;
char schedule_cpu;
unsigned char schedule_mode; // may be an enum??
char schedule_mode; // may be an enum??
SInt32 debuglisting;
char profile;
char traceback;
Boolean profile;
Boolean traceback;
Boolean disable_registers;
char fp_contract;
Boolean fp_contract;
Boolean no_register_save_helpers;
char ppc_unroll_speculative;
short ppc_unroll_instructions_limit;
short ppc_unroll_factor_limit;
Boolean altivec_model;
UInt8 x1B; // altivec/vrsave related
UInt8 altivec_vrsave;
UInt8 code_alignment;
char x1D;
UInt8 x1E; // some register used in TOC_use_isel
@@ -53,7 +84,7 @@ typedef struct COpts {
Boolean use_lmw_stmw;
char report_heap_info;
char misaligned_mem_access;
char switch_tables;
Boolean switch_tables;
char prepare_compress;
char some_alignment; // used in CMach_AllocationAlignment
Boolean asmsemicolcomment;
@@ -80,7 +111,7 @@ typedef struct COpts {
Boolean cpp_extensions;
Boolean pointercast_lvalue;
char useRTTI;
char delete_exception;
Boolean delete_exception;
char _4B;
Boolean oldalignment;
Boolean unsignedchars;
@@ -95,7 +126,7 @@ typedef struct COpts {
Boolean longlong;
Boolean longlong_enums;
char no_tfuncinline;
char _59;
Boolean _59;
Boolean flat_include;
char syspath_once;
Boolean always_import;
@@ -110,7 +141,7 @@ typedef struct COpts {
Boolean array_new_delete;
Boolean dollar_identifiers;
char def_inline_tfuncs;
char arg_dep_lookup;
Boolean arg_dep_lookup;
Boolean simple_prepdump;
char line_prepdump;
char fullpath_prepdump;
@@ -139,18 +170,18 @@ typedef struct COpts {
Boolean supress_warnings;
Boolean warn_illpragma;
Boolean warn_emptydecl;
char warn_possunwant;
Boolean warn_possunwant;
char warn_unusedvar;
char warn_unusedarg;
Boolean warn_extracomma;
char warn_hidevirtual;
Boolean warn_largeargs;
char warn_implicitconv;
Boolean warn_implicitconv;
char warn_notinlined;
Boolean warn_structclass;
Boolean warn_padding;
char warn_no_side_effect;
char warn_resultnotused;
Boolean warn_no_side_effect;
Boolean warn_resultnotused;
char warn_ptr_int_conv;
char align_mode;
Boolean align_array_members;
@@ -163,7 +194,7 @@ typedef struct COpts {
char dont_inline;
char always_inline;
Boolean peephole;
char global_optimizer;
Boolean global_optimizer;
char side_effects;
Boolean internal;
Boolean import;
@@ -173,7 +204,7 @@ typedef struct COpts {
char force_active;
char optimizationlevel;
Boolean optimize_for_size;
char optimizewithasm;
Boolean optimizewithasm;
Boolean crippled;
char opt_common_subs;
char opt_loop_invariants;

View File

@@ -24,6 +24,15 @@ typedef struct TokenStack {
Boolean macrocheck;
} TokenStack;
//#define OPT_OFFSET(optname) ((short) (((char *) (&copts.optname)) - ((char *) &copts)))
#define OPT_OFFSET(optname) ((short) ( &((COpts *)0)->optname ))
enum {
OPT_OFFSET_MASK = 0x1FFF,
OPT_FLAG_2000 = 0x2000,
OPT_FLAG_4000 = 0x4000,
OPT_FLAG_8000 = 0x8000
};
extern CParams *cparamblkptr;
extern short tk;
extern CInt64 tkintconst;
@@ -71,9 +80,12 @@ extern void CPrep_RemoveSpecialMacros(void);
extern Boolean setupprep(void);
extern void cleanupprep(void);
extern void CPrep_TSBufferGrow(int amount);
// this is actually an arg of `PrepState *`
extern void CPrep_TokenStreamGetState(SInt32 *state);
// this is actually an arg of `const PrepState *`
extern void CPrep_TokenStreamSetState(SInt32 *state);
extern void CPrep_UnLex(void);
// this is actually an arg of `const PrepState *`
extern void CPrep_TokenStreamSetCurState(SInt32 *state);
typedef void (*CPrepStreamFuncPtr)(TStreamElement *);
extern void CPrep_StreamGetBlock(TStream *stream, CPrepStreamFuncPtr func, int arg);

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CPREPROCESS_H
#define COMPILER_CPREPROCESS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CRTTI_H
#define COMPILER_CRTTI_H
#include "compiler/common.h"
#endif

6
includes/compiler/CSOM.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CSOM_H
#define COMPILER_CSOM_H
#include "compiler/common.h"
#endif

View File

@@ -20,6 +20,7 @@ typedef struct CScopeSave {
Boolean is_member_func;
} CScopeSave; // assumed name
// this might be called NameResult
typedef struct CScopeParseResult {
NameSpace *nspace_0;
HashNameNode *name_4;

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CTEMPLATECLASS_H
#define COMPILER_CTEMPLATECLASS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CTEMPLATEFUNC_H
#define COMPILER_CTEMPLATEFUNC_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CTEMPLATENEW_H
#define COMPILER_CTEMPLATENEW_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CTEMPLATETOOLS_H
#define COMPILER_CTEMPLATETOOLS_H
#include "compiler/common.h"
#endif

View File

@@ -11,8 +11,8 @@
extern Macro vecM;
extern Macro altivecM;
extern Object *gFunction;
extern PCodeLabel *returnlabel;
extern PCodeLabel *cleanreturnlabel;
extern CLabel *returnlabel;
extern CLabel *cleanreturnlabel;
extern Boolean needs_cleanup;
extern Statement *current_statement;
extern int has_catch_blocks;
@@ -48,29 +48,29 @@ extern Object *maketemporary(Type *type);
typedef void (*ArgumentProcessor)(Object *obj, short reg);
extern void process_arguments(ArgumentProcessor func, Boolean flag);
extern void move_assigned_argument(Object *obj, short reg);
extern void assign_labels();
extern void CodeGen_Generator();
extern void CodeGen_GenVDispatchThunk();
extern void CodeGen_SetupRuntimeObjects();
extern void assign_labels(Statement *stmt);
extern void CodeGen_Generator(Statement **statements, Object *func, UInt8 mysteryFlag, Boolean callOnModuleBind);
extern void CodeGen_GenVDispatchThunk(Object *thunkobj, Object *obj, SInt32 a, SInt32 b, SInt32 c);
extern void CodeGen_SetupRuntimeObjects(void);
extern Boolean CodeGen_ReInitRuntimeObjects(Boolean is_precompiler);
extern Boolean CodeGen_IsPublicRuntimeObject(Object *obj);
extern void CodeGen_SOMStub();
extern void CodeGen_SOMStub(Object *a, Object *b, Object *c, SInt32 offset);
extern void CodeGen_ParseDeclSpec(HashNameNode *identifier, DeclInfo *declinfo);
extern void CodeGen_ParsePragma(HashNameNode *name);
extern void CodeGen_UpdateObject(Object *object);
extern void CodeGen_UpdateBackEndOptions();
extern void CodeGen_UpdateBackEndOptions(void);
extern void CodeGen_objc_method_self_offset();
extern void CodeGen_objc_method_sel_offset();
extern void CodeGen_objc_method_arg_offset();
extern void CodeGen_objc_method_args_size();
extern void CodeGen_HandleIntrinsicCall();
extern void CodeGen_HandleTypeCast();
extern ENode *CodeGen_HandleIntrinsicCall(Object *func, ENodeList *arg_exprs);
extern ENode *CodeGen_HandleTypeCast(ENode *expr, Type *type, UInt32 qual);
extern short CodeGen_AssignCheck(ENode *expr, Type *type, Boolean flag1, Boolean flag2);
extern void CodeGen_CollapseVectorExpression();
extern void CodeGen_InsertSpecialMacros();
extern Boolean CodeGen_CollapseVectorExpression(ENode *expr, MWVector128 *vec, Type *type);
extern void CodeGen_InsertSpecialMacros(void);
extern char *CodeGen_ExpandSpecialMacro(Macro *macro);
extern void CodeGen_reportheapinfo();
extern void CodeGen_InitialSanityCheck();
extern void CodeGen_reportheapinfo(Boolean release_flag, char *name, char *text);
extern void CodeGen_InitialSanityCheck(void);
#ifdef __MWERKS__
#pragma options align=reset

View File

@@ -0,0 +1,11 @@
#ifndef COMPILER_CODEGENOPTPPC_H
#define COMPILER_CODEGENOPTPPC_H
#include "compiler/common.h"
extern void CodeGen_InitCompiler(void);
extern void CodeGen_TermCompiler(void);
extern void CodeGen_InitBackEndOptions(void);
extern void Test_Version_Numbers(void);
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CODEMOTION_H
#define COMPILER_CODEMOTION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_COLORING_H
#define COMPILER_COLORING_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_CONSTANTPROPAGATION_H
#define COMPILER_CONSTANTPROPAGATION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_COPYPROPAGATION_H
#define COMPILER_COPYPROPAGATION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,122 @@
#ifndef COMPILER_EXCEPTIONS_H
#define COMPILER_EXCEPTIONS_H
#include "compiler/common.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef enum ExceptionActionType {
EAT_NOP,
EAT_DESTROYLOCAL,
EAT_DESTROYLOCALCOND,
EAT_DESTROYLOCALOFFSET,
EAT_DESTROYLOCALPOINTER,
EAT_DESTROYLOCALARRAY,
EAT_DESTROYPARTIALARRAY,
EAT_DESTROYMEMBER,
EAT_DESTROYMEMBERCOND,
EAT_DESTROYMEMBERARRAY,
EAT_DELETEPOINTER,
EAT_DELETELOCALPOINTER,
EAT_DELETEPOINTERCOND,
EAT_CATCHBLOCK,
EAT_ACTIVECATCHBLOCK,
EAT_SPECIFICATION,
EAT_TERMINATE,
EAT_DESTROYBASE,
EAT_NACTIONS
} ExceptionActionType;
struct ExceptionAction {
ExceptionAction *prev;
union {
struct {
Object *local;
Object *dtor;
} destroy_local;
struct {
Object *local;
Object *cond;
Object *dtor;
} destroy_local_cond;
struct {
Object *local;
Object *dtor;
SInt32 offset;
} destroy_local_offset;
struct {
Object *pointer;
Object *dtor;
} destroy_local_pointer;
struct {
Object *localarray;
Object *dtor;
SInt32 elements;
SInt32 element_size;
} destroy_local_array;
struct {
Object *arraypointer;
Object *arraycounter;
Object *dtor;
Object *element_size;
} destroy_partial_array;
struct {
Object *objectptr;
Object *dtor;
SInt32 offset;
} destroy_member;
struct {
Object *objectptr;
Object *cond;
Object *dtor;
SInt32 offset;
} destroy_member_cond;
struct {
Object *objectptr;
Object *dtor;
SInt32 offset;
SInt32 elements;
SInt32 element_size;
} destroy_member_array;
struct {
Object *pointerobject;
Object *deletefunc;
} delete_pointer;
struct {
Object *pointerobject;
Object *deletefunc;
Object *cond;
} delete_pointer_cond;
struct {
Object *catch_object;
Object *catch_info_object;
CLabel *catch_label;
Object *catch_typeid;
Type *catch_type;
UInt32 catch_qual;
} catch_block;
struct {
Object *catch_info_object;
Boolean call_dtor;
} active_catch_block;
struct {
SInt32 unexp_ids;
Object **unexp_id;
CLabel *unexp_label;
Object *unexp_info_object;
} specification;
struct {
Object *object;
Boolean is_dep;
} local;
} data;
ExceptionActionType type;
};
#ifdef __MWERKS__
#pragma options align=reset
#endif
#endif

View File

@@ -0,0 +1,12 @@
#ifndef COMPILER_FUNCLEVELASMPPC_H
#define COMPILER_FUNCLEVELASMPPC_H
#include "compiler/common.h"
extern void setup_assembly_argument(Object *obj, short i);
extern void assign_local_addresses();
extern void Assembler();
extern void SetupAssembler();
extern void CleanupAssembler();
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_FUNCTIONCALLS_H
#define COMPILER_FUNCTIONCALLS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,11 @@
#ifndef COMPILER_GCCINLINEASM_H
#define COMPILER_GCCINLINEASM_H
#include "compiler/common.h"
extern void InlineAsm_SkipComment();
extern void InlineAsm_gcc_parse(void);
extern Statement *first_ST_ASM;
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_GENSTABS_H
#define COMPILER_GENSTABS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_GLOBALOPTIMIZER_H
#define COMPILER_GLOBALOPTIMIZER_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROUSEDEF_H
#define COMPILER_IROUSEDEF_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,239 @@
#ifndef COMPILER_INLINEASM_H
#define COMPILER_INLINEASM_H
#include "compiler/common.h"
#include "compiler/PCodeInfo.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef struct IAMnemonic {
char *name;
UInt32 x4;
char *format;
UInt32 cpu;
UInt32 x10;
} IAMnemonic;
typedef struct IARegister {
char *name;
char rclass;
SInt32 num;
Object *object;
} IARegister;
typedef enum IAOperandType {
IAOpnd_0,
IAOpnd_Imm,
IAOpnd_Reg,
IAOpnd_3,
IAOpnd_4,
IAOpnd_Lab,
IAOpnd_6,
IAOpnd_7,
IAOpnd_LabDiff
} IAOperandType;
typedef struct IAOperand {
IAOperandType type;
Boolean negated;
union {
// type 1
struct {
SInt32 value;
} imm;
// type 2
struct {
SInt32 num;
Object *object;
short effect;
short rclass;
} reg;
// type 3, 4
struct {
SInt32 offset;
Object *obj;
short unk;
} obj;
// type 5
struct {
CLabel *label;
} lab;
// type 6
struct {
SInt32 num;
UInt8 unk4;
short effect;
short rclass;
} unk6;
// type 7
struct {
SInt32 value;
Boolean unk1;
short unk2;
short unk3;
} unk7;
// type 8
struct {
CLabel *label1;
CLabel *label2;
SInt32 offset;
} labdiff;
} u;
} IAOperand;
typedef enum IAExprType {
IAExpr_0,
IAExpr_1,
IAExpr_2,
IAExpr_3,
IAExpr_4,
IAExpr_5,
IAExpr_6,
IAExpr_7,
IAExpr_8,
IAExpr_9,
IAExpr_10
} IAExprType;
typedef struct IAExpr {
IAExprType type;
UInt8 flags;
short reg;
SInt32 value;
Object *object;
Object *xC;
Object *x10;
CLabel *label;
CLabel *x18;
} IAExpr;
enum {
IAFlag1 = 1,
IAFlag2 = 2
};
enum {
IAFlagsB_1 = 1,
IAFlagsB_2 = 2,
IAFlagsB_4 = 4,
IAFlagsB_8 = 8,
IAFlagsB_10 = 0x10,
IAFlagsB_20 = 0x20,
IAFlagsB_40 = 0x40
};
typedef struct InlineAsm {
Opcode opcode;
unsigned char flags;
unsigned char flags2;
short argcount;
IAOperand args[0];
} InlineAsm;
typedef struct IALookupResult {
HashNameNode *name;
CLabel *label;
Object *object;
Type *type;
UInt32 value;
Boolean has_value;
} IALookupResult;
typedef struct IAEntryPoint {
short x0;
char x2;
int x4;
Object *x8;
SInt32 size;
} IAEntryPoint;
typedef enum IAEffectType {
IAEffect_0,
IAEffect_1,
IAEffect_2,
IAEffect_3
} IAEffectType;
typedef struct IAEffect {
IAEffectType type;
Object *object;
SInt32 offset;
SInt32 size;
} IAEffect;
typedef struct IAEffects {
Boolean x0;
Boolean x1;
Boolean x2;
Boolean x3;
Boolean x4;
Boolean x5;
UInt32 numoperands;
UInt32 numlabels;
IAEffect operands[16];
CLabel *labels[16];
} IAEffects;
#ifdef __MWERKS__
#pragma options align=reset
#endif
extern int backtracking;
extern jmp_buf backtrack;
extern jmp_buf InlineAsm_assemblererror;
extern int allow_array_expressions;
extern void AssemblerError(void);
extern void InlineAsm_SyntaxError(short code);
extern CLabel *InlineAsm_LookupLabel(HashNameNode *name);
extern CLabel *InlineAsm_DeclareLabel(HashNameNode *name);
extern Boolean InlineAsm_LookupSymbolOrTag(HashNameNode *name, IALookupResult *result, Boolean allow_tag);
extern Boolean InlineAsm_LookupSymbol(HashNameNode *name, IALookupResult *result);
extern SInt32 InlineAsm_StructMemberOffset(Type *type);
extern SInt32 InlineAsm_StructArrayMemberOffset(Type *type);
extern SInt32 InlineAsm_StructPointerMemberOffset(Type *type);
extern SInt32 InlineAsm_ConstantExpression(void);
extern HashNameNode *MakeLocalLabel(CInt64 num);
extern void InlineAsm_ScanStatements(volatile short endToken);
extern void InlineAsm_ScanFunction(volatile short endToken);
extern void InlineAsm_Assemble(void);
extern void InlineAsm_PackAsmStatement(Statement *stmt, Statement *first, void **output, SInt32 *outsize);
extern void InlineAsm_UnpackAsmStatement(Statement *stmt, CLabel **labelArray, Boolean flag, void *data, SInt32 size);
extern void InlineAsm_CheckLocalUsage(Statement *stmt);
extern CLabel *InlineAsm_GetReferencedLabel(Statement *stmt);
extern CLabel *InlineAsm_GetReferencedLabel2(Statement *stmt);
extern Object *InlineAsm_GetObjectOffset(InlineAsm *ia, SInt32 index, SInt32 *offset);
extern char *InlineAsm_DumpStatement(Statement *stmt);
// unknown name
inline void InlineAsm_InitExpr5(IAExpr *expr, SInt32 value) {
expr->type = IAExpr_5;
expr->flags = 0;
expr->value = value;
expr->reg = 0;
expr->object = NULL;
expr->xC = NULL;
expr->x10 = NULL;
expr->label = NULL;
expr->x18 = NULL;
}
// unknown name
inline int InlineAsm_CheckExpr(IAExpr *expr) {
return (expr->xC == NULL && expr->object == NULL && expr->label == NULL);
}
// unknown name
inline SInt32 InlineAsm_GetExprValue(IAExpr *expr) {
switch (expr->type) {
case IAExpr_8:
return HIGH_PART(expr->value);
case IAExpr_7:
return (short) (expr->value >> 16);
case IAExpr_6:
return (short) expr->value;
default:
return expr->value;
}
}
#endif

View File

@@ -0,0 +1,10 @@
#ifndef COMPILER_INLINEASMMNEMONICSPPC_H
#define COMPILER_INLINEASMMNEMONICSPPC_H
#include "compiler/common.h"
#include "compiler/InlineAsm.h"
extern void InlineAsm_InitializeMnemonicsPPC(void);
extern IAMnemonic *InlineAsm_LookupMnemonicPPC(char *name);
#endif

View File

@@ -0,0 +1,82 @@
#ifndef COMPILER_INLINEASMPPC_H
#define COMPILER_INLINEASMPPC_H
#include "compiler/common.h"
#include "compiler/InlineAsm.h"
extern char asm_alloc_flags[10];
extern unsigned char sm_section;
extern UInt32 cpu;
extern SInt32 fralloc_parameter_area_size;
extern Boolean user_responsible_for_frame;
extern Boolean supports_hardware_fpu;
extern UInt32 assembledinstructions;
extern UInt8 assembler_type;
extern char volatileasm;
extern Boolean InlineAsm_gccmode;
extern Boolean InlineAsm_labelref;
extern CLabel *pic_base_label;
enum {
IADirective_Null,
IADirective_Entry,
IADirective_FrAlloc,
IADirective_NoFrAlloc,
IADirective_FrFree,
IADirective_Machine,
IADirective_SmClass,
IADirective_PicBase
};
enum {
CPUFLAG_LOW_MASK = 0xFFFFF,
CPUFLAG_100000 = 0x100000,
CPUFLAG_200000 = 0x200000,
CPUFLAG_400000 = 0x400000,
CPUFLAG_800000 = 0x800000,
CPUFLAG_1000000 = 0x1000000,
CPUFLAG_2000000 = 0x2000000,
CPUFLAG_4000000 = 0x4000000,
CPUFLAG_8000000 = 0x8000000,
CPUFLAG_10000000 = 0x10000000,
CPUFLAG_20000000 = 0x20000000,
CPUFLAG_40000000 = 0x40000000,
CPUFLAG_80000000 = 0x80000000
};
#define OPCODE_PART_1(opcode) ( (opcode) >> 26 )
#define OPCODE_PART_2(opcode) ( ((opcode) >> 21) & 0x1F )
#define OPCODE_PART_3(opcode) ( ((opcode) >> 1) & 0x3FF )
enum {
CPUMask_401 = CPUFLAG_8000000 | 0x40,
CPUMask_403 = CPUFLAG_8000000 | 0x80,
CPUMask_50x = CPUFLAG_10000000 | CPUFLAG_80000000 | 0x800,
CPUMask_55x_56x = CPUFLAG_10000000 | CPUFLAG_80000000 | 0x1000,
CPUMask_601 = CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_80000000 | 1,
CPUMask_602 = CPUFLAG_800000 | CPUFLAG_1000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | CPUFLAG_80000000 | 2,
CPUMask_8240 = CPUFLAG_800000 | CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | CPUFLAG_80000000 | 0x10000,
CPUMask_8260 = CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | 0x10000,
CPUMask_603 = CPUFLAG_800000 | CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | CPUFLAG_80000000 | 4,
CPUMask_604 = CPUFLAG_800000 | CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | CPUFLAG_80000000 | 8,
CPUMask_740_750 = CPUFLAG_800000 | CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | CPUFLAG_80000000 | 0x2000,
CPUMask_801_821_860 = CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | 0x10,
CPUMask_823_850 = CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | 0x20,
CPUMask_74xx = CPUFLAG_800000 | CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | CPUFLAG_40000000 | CPUFLAG_80000000 | 0x6000,
CPUMask_All = CPUFLAG_800000 | CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | CPUFLAG_40000000 | CPUFLAG_80000000 | 0xFFFFF,
CPUMask_Generic = CPUFLAG_800000 | CPUFLAG_1000000 | CPUFLAG_2000000 | CPUFLAG_4000000 | CPUFLAG_8000000 | CPUFLAG_10000000 | CPUFLAG_40000000 | CPUFLAG_80000000 | 0xE00E
};
extern void InlineAsm_InitializePPC(void);
extern void InlineAsm_Initialize(UInt8 assemblertype);
extern SInt32 InlineAsm_IsDirective(UInt8 assemblertype);
extern void InlineAsm_ProcessDirective(SInt32 directive);
extern void InlineAsm_ScanAssemblyDirective(void);
extern void InlineAsm_ScanAssemblyInstruction(void);
extern void InlineAsm_TranslateIRtoPCode(Statement *stmt);
extern const char *InlineAsm_GetMnemonic(InlineAsm *ia);
extern void CodeGen_GetAsmEffects(Statement *stmt, IAEffects *effects);
extern void CodeGen_PropagateIntoAsm(Statement *stmt, Object *obj, ENode *expr);
extern Statement *CodeGen_CopyAsmStat(Statement *stmt);
#endif

View File

@@ -0,0 +1,11 @@
#ifndef COMPILER_INLINEASMREGISTERS_H
#define COMPILER_INLINEASMREGISTERS_H
#include "compiler/common.h"
#include "compiler/InlineAsm.h"
extern void InlineAsm_InitializeRegisters(void);
extern void InlineAsm_InsertRegister(char *name, char rclass, short num, Object *object);
extern IARegister *InlineAsm_LookupRegister(char *name);
#endif

View File

@@ -0,0 +1,12 @@
#ifndef COMPILER_INLINEASMREGISTERSPPC_H
#define COMPILER_INLINEASMREGISTERSPPC_H
#include "compiler/common.h"
#include "compiler/InlineAsm.h"
extern IARegister *InlineAsm_LookupRegisterPPCName(HashNameNode *name);
extern IARegister *InlineAsm_LookupRegisterPPC(char *name);
extern IARegister *InlineAsm_LookupDCRRegister(char *name);
extern void InlineAsm_InitializeRegistersPPC(void);
#endif

View File

@@ -0,0 +1,128 @@
#ifndef COMPILER_INSTRSELECTION_H
#define COMPILER_INSTRSELECTION_H
#include "compiler/common.h"
#include "compiler/enode.h"
#include "compiler/Operands.h"
#include "compiler/PCodeInfo.h"
typedef struct PrecomputedOperand {
struct PrecomputedOperand *next;
SInt32 precompid;
Operand operand;
} PrecomputedOperand;
extern PrecomputedOperand *precomputedoperands;
extern void (*cgdispatch[MAXEXPR + 1])(ENode *, short, short, Operand *);
extern void init_cgdispatch(void);
extern void gen_DEFINE(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_REUSE(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_POSTINCDEC(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_INDIRECT(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_MONMIN(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_BINNOT(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_FORCELOAD(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_MUL(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_DIV(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_MODULO(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_ADD(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_SUB(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_SHL(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_SHR(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_AND(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_XOR(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_OR(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_ASS(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern ENode *evaluate_and_skip_comma(ENode *expr);
extern void gen_COMMA(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_TYPCON(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_BITFIELD(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_INTCONST(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_FLOATCONST(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_STRINGCONST(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_COND(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_CONDASS(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_FUNCCALL(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_OBJREF(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_UNEXPECTED(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void binary_operator(Opcode opcode, ENode *left, ENode *right, short outputReg, Operand *output);
extern void unary_operator(Opcode opcode, ENode *expr, short outputReg, Operand *output);
extern void fp_unary_operator(Opcode opcode, ENode *expr, short outputReg, Operand *output);
extern void fp_multiply_add(Opcode opcode, ENode *a, ENode *b, ENode *c, short outputReg, Operand *output);
extern void gen_COMPARE(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_LOGICAL(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_NULLCHECK(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_PRECOMP(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void logical_expression(ENode *cond, PCodeLabel *a, PCodeLabel *b, PCodeLabel *c);
extern void gen_condition(ENode *cond, Operand *output);
extern void gen_condition_gpr(ENode *cond, Operand *output, short outputReg);
extern void gen_negated_condition_gpr(ENode *cond, Operand *output, short outputReg);
extern void compare_floating(short nt, ENode *left, ENode *right, Operand *output);
extern void compare_integer(short nt, ENode *left, ENode *right, Operand *output);
extern void compare_immediate(short nt, ENode *left, SInt32 value, Operand *output);
extern void compare_immediate_long(short nt, ENode *left, SInt32 value, Operand *output);
extern int ismaskconstant(SInt32 value, short *first, short *last);
extern int ispostincrementopportunity(ENode *expr, Operand *op, SInt32 *value);
extern void add_register_immediate(short regA, short regB, SInt32 value);
extern void I8_gen_ADD(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_INTCONST(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_SUB(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_XOR(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_OR(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_AND(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern int I8_getbit(UInt64 val);
extern int I8_log2n(UInt64 val);
extern void I8_ShiftLeftImmediate(Operand opnd, SInt32 value, int is_unsigned, SInt32 size, short reg, short regHi);
extern void I8_ShiftRightImmediate(Operand opnd, SInt32 value, int is_unsigned, short reg, short regHi, int unk);
extern void I8_gen_MUL(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_BINNOT(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_MONMIN(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_ASS(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_POSTINCDEC(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_INDIRECT(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_condition(ENode *cond, Operand *output, int write_to_gpr);
extern void I8_gen_SHL_SHR(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_DIV_MOD(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void I8_gen_TYPCON(ENode *expr, short outputReg, short outputRegHi, Operand *output);
extern void gen_VECTOR128CONST(ENode *expr, short outputReg, short outputRegHi, Operand *output);
#define GEN_NODE(node, opnd) cgdispatch[(node)->type]((node), 0, 0, (opnd))
#define GEN_NODE_TO_REG(node, reg, regHi, opnd) cgdispatch[(node)->type]((node), (reg), (regHi), (opnd))
#define ENSURE_GPR(opnd, type, reg) \
do { \
if ((opnd)->optype != OpndType_GPR) \
Coerce_to_register((opnd), (type), (reg)); \
} while (0)
#define ENSURE_FPR(opnd, type, reg) \
do { \
if ((opnd)->optype != OpndType_FPR) \
Coerce_to_fp_register((opnd), (type), (reg)); \
} while (0)
#define ENSURE_VR(opnd, type, reg) \
do { \
if ((opnd)->optype != OpndType_VR) \
Coerce_to_v_register((opnd), (type), (reg)); \
} while (0)
#define GEN_NODE_TO_GPR(node, opnd, type, reg) \
do { \
GEN_NODE((node), (opnd)); \
ENSURE_GPR((opnd), (type), (reg)); \
} while (0)
#define GEN_NODE_TO_FPR(node, opnd, type, reg) \
do { \
GEN_NODE((node), (opnd)); \
ENSURE_FPR((opnd), (type), (reg)); \
} while (0)
#define GEN_NODE_TO_VR(node, opnd, type, reg) \
do { \
GEN_NODE((node), (opnd)); \
ENSURE_VR((opnd), (type), (reg)); \
} while (0)
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_INTERFERENCEGRAPH_H
#define COMPILER_INTERFERENCEGRAPH_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_INTRINSICS_H
#define COMPILER_INTRINSICS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,9 @@
#ifndef COMPILER_IROPTIMIZER_H
#define COMPILER_IROPTIMIZER_H
#include "compiler/common.h"
// do me
extern Statement *IRO_Optimizer(Object *obj, Statement *stmt);
#endif

View File

@@ -0,0 +1,35 @@
#ifndef COMPILER_IROBITVECT_H
#define COMPILER_IROBITVECT_H
#include "compiler/common.h"
#include "compiler/CError.h"
typedef struct BitVector {
UInt32 size;
UInt32 data[0];
} BitVector;
extern void Bv_AllocVector(BitVector **bv, UInt32 size);
extern void Bv_AllocVectorLocal(BitVector **bv, UInt32 size);
extern void Bv_ClearBit(UInt32 bit, BitVector *bv);
extern void Bv_And(const BitVector *a, BitVector *b);
extern void Bv_Or(const BitVector *a, BitVector *b);
extern Boolean Bv_BitsInCommon(const BitVector *a, const BitVector *b);
extern Boolean Bv_Compare(const BitVector *a, const BitVector *b);
extern void Bv_Minus(const BitVector *a, BitVector *b);
extern void Bv_Copy(const BitVector *src, BitVector *dst);
extern void Bv_Clear(BitVector *bv);
extern void Bv_Set(BitVector *bv);
extern Boolean Bv_IsSubset(const BitVector *a, const BitVector *b);
extern Boolean Bv_IsEmpty(const BitVector *bv);
inline void Bv_SetBit(UInt32 bit, BitVector *bv) {
if ((bit / 32) < bv->size) {
bv->data[bit / 32] |= ~(1 << (bit & 31));
} else {
#line 56
CError_FATAL();
}
}
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROCSE_H
#define COMPILER_IROCSE_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IRODUMP_H
#define COMPILER_IRODUMP_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROEMPTYLOOP_H
#define COMPILER_IROEMPTYLOOP_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROEVAL_H
#define COMPILER_IROEVAL_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROEXPRREGENERATION_H
#define COMPILER_IROEXPRREGENERATION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROFLOWGRAPH_H
#define COMPILER_IROFLOWGRAPH_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROJUMP_H
#define COMPILER_IROJUMP_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROLINEARFORM_H
#define COMPILER_IROLINEARFORM_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROLOOP_H
#define COMPILER_IROLOOP_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROMALLOC_H
#define COMPILER_IROMALLOC_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROPOINTERANALYSIS_H
#define COMPILER_IROPOINTERANALYSIS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROPROPAGATE_H
#define COMPILER_IROPROPAGATE_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IRORANGEPROPAGATION_H
#define COMPILER_IRORANGEPROPAGATION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROSUBABLE_H
#define COMPILER_IROSUBABLE_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROUNROLLLOOP_H
#define COMPILER_IROUNROLLLOOP_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROUTIL_H
#define COMPILER_IROUTIL_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_IROVARS_H
#define COMPILER_IROVARS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_LOADDELETION_H
#define COMPILER_LOADDELETION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_LOOPDETECTION_H
#define COMPILER_LOOPDETECTION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_LOOPOPTIMIZATION_H
#define COMPILER_LOOPOPTIMIZATION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_MACHO_H
#define COMPILER_MACHO_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_OBJGENMACHO_H
#define COMPILER_OBJGENMACHO_H
#include "compiler/common.h"
#endif

View File

@@ -18,7 +18,7 @@ enum OperandType {
OpndType_GPR_Indexed = 2,
// Value in two registers (identified by 'reg' and 'regHi')
OpndType_GPRPair = 3,
// Value at an absolute address (identified by 'abs_address')
// Immediate 32-bit value
OpndType_Absolute = 4,
// Value in a float register (identified by 'reg')
OpndType_FPR = 5,
@@ -49,7 +49,7 @@ struct Operand {
SInt16 regHi;
SInt16 regOffset;
SInt32 immOffset;
SInt32 abs_address;
SInt32 immediate;
Object *object;
UInt32 flags;
};
@@ -61,15 +61,15 @@ 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);
extern void Coerce_to_fp_register(Operand *op, TypeIntegral *tint, short output_reg);
extern void Coerce_to_v_register(Operand *op, TypeStruct *tstruct, short output_reg);
extern void Coerce_to_fp_register(Operand *op, Type *tint, short output_reg);
extern void Coerce_to_v_register(Operand *op, Type *tstruct, short output_reg);
extern void store(short reg, Operand *op, Type *type);
extern void store_pair(short reg, short regHi, Operand *op, Type *type);
extern void store_fp(short reg, Operand *op, TypeIntegral *tint);
extern void store_v(short reg, Operand *op, TypeStruct *tstruct);
extern void store_fp(short reg, Operand *op, Type *tint);
extern void store_v(short reg, Operand *op, Type *tstruct);
extern void extend32(Operand *op, Type *type, short output_reg);
extern void extend64(Operand *op, Type *type, short output_reg, short output_regHi);
extern void load_floating_constant(short reg, TypeIntegral *type, double *data);
extern void load_floating_constant(short reg, Type *type, double *data);
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);

View File

@@ -2,11 +2,15 @@
#define COMPILER_PCODE_H
#include "compiler/common.h"
#include "compiler/PCodeInfo.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
#define FLAG_SET_T(flags) (((flags) & (fPCodeFlag1 | fPCodeFlag8)) ? (flags) : 0)
#define FLAG_SET_F(flags) (((flags) & (fPCodeFlag1 | fPCodeFlag8)) ? 0 : (flags))
#define PCODE_FLAG_SET_T(pcode) (((pcode)->flags & (fPCodeFlag1 | fPCodeFlag8)) ? (pcode)->flags : 0)
#define PCODE_FLAG_SET_F(pcode) (((pcode)->flags & (fPCodeFlag1 | fPCodeFlag8)) ? 0 : (pcode)->flags)
@@ -15,7 +19,7 @@ enum {
EffectWrite = 2
};
typedef enum {
/*typedef enum {
PCOp_REGISTER,
PCOp_SYSREG,
PCOp_IMMEDIATE,
@@ -23,7 +27,7 @@ typedef enum {
PCOp_LABEL,
PCOp_LABELDIFF,
PCOp_PLACEHOLDEROPERAND
} PCOpKind;
} PCOpKind;*/
typedef enum {
RefType_0,
@@ -142,6 +146,8 @@ enum {
fOverflow = 0x800000,
fSetsCarry = 0x10000000,
// ??
fPCodeFlag2000000 = 0x2000000,
fPCodeFlag4000000 = 0x4000000,
fPCodeFlag8000000 = 0x8000000,
fPCodeFlag10000000 = 0x10000000,
fPCodeFlag20000000 = 0x20000000,
@@ -167,25 +173,25 @@ extern PCodeBlock **depthfirstordering;
extern int pcblockcount;
extern int pcloopweight;
extern void initpcode();
extern PCode *makepcode(short op, ...);
extern void emitpcode(short op, ...);
extern void initpcode(void);
extern PCode *makepcode(Opcode op, ...);
extern void emitpcode(Opcode op, ...);
extern PCode *copypcode(PCode *pcode);
extern PCodeLabel *makepclabel();
extern PCodeBlock *makepcblock();
extern PCodeLabel *makepclabel(void);
extern PCodeBlock *makepcblock(void);
extern void pclabel(PCodeBlock *block, PCodeLabel *label);
extern void pcbranch(PCodeBlock *block, PCodeLabel *label);
extern void pccomputepredecessors();
extern void pccomputepredecessors(void);
extern void deleteblock(PCodeBlock *block);
extern void deleteunreachableblocks();
extern void deleteunreachableblocks(void);
extern void appendpcode(PCodeBlock *block, PCode *pcode);
extern void deletepcode(PCode *pcode);
extern void insertpcodebefore(PCode *anchor, PCode *newpcode);
extern void insertpcodeafter(PCode *anchor, PCode *newpcode);
extern void setpcodeflags(int flags);
extern void clearpcodeflags(int flags);
extern int pccomputeoffsets();
extern void computedepthfirstordering();
extern int pccomputeoffsets(void);
extern void computedepthfirstordering(void);
#ifdef __MWERKS__
#pragma options align=reset

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_PCODEASSEMBLY_H
#define COMPILER_PCODEASSEMBLY_H
#include "compiler/common.h"
#endif

View File

@@ -1,22 +1,33 @@
#ifndef COMPILER_PCODEINFO_H
#define COMPILER_PCODEINFO_H
#include "compiler/PCode.h"
#include "compiler/common.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef enum {
PCOp_REGISTER,
PCOp_SYSREG,
PCOp_IMMEDIATE,
PCOp_MEMORY,
PCOp_LABEL,
PCOp_LABELDIFF,
PCOp_PLACEHOLDEROPERAND
} PCOpKind;
typedef struct _OpcodeInfo {
const char *name;
const char *format;
unsigned char x8;
unsigned char x9;
int flags;
unsigned int insn;
UInt32 flags;
SInt32 insn;
} OpcodeInfo;
/*enum {
typedef enum Opcode {
PC_INVALID = -1,
PC_B = 0x0,
PC_BL = 0x1,
PC_BC = 0x2,
@@ -448,7 +459,7 @@ typedef struct _OpcodeInfo {
PC_PENTRY = 0x1AC,
PC_PEXIT = 0x1AD,
OPCODE_MAX = 0x1AE
};*/
} Opcode;
//#define PC_B 0x0
//#define PC_BL 0x1
//#define PC_BC 0x2
@@ -880,443 +891,443 @@ typedef struct _OpcodeInfo {
//#define PC_PENTRY 0x1AC
//#define PC_PEXIT 0x1AD
//#define OPCODE_MAX 0x1AE
const short PC_B = 0x0;
const short PC_BL = 0x1;
const short PC_BC = 0x2;
const short PC_BCLR = 0x3;
const short PC_BCCTR = 0x4;
const short PC_BT = 0x5;
const short PC_BTLR = 0x6;
const short PC_BTCTR = 0x7;
const short PC_BF = 0x8;
const short PC_BFLR = 0x9;
const short PC_BFCTR = 0xA;
const short PC_BDNZ = 0xB;
const short PC_BDNZT = 0xC;
const short PC_BDNZF = 0xD;
const short PC_BDZ = 0xE;
const short PC_BDZT = 0xF;
const short PC_BDZF = 0x10;
const short PC_BLR = 0x11;
const short PC_BCTR = 0x12;
const short PC_BCTRL = 0x13;
const short PC_BLRL = 0x14;
const short PC_LBZ = 0x15;
const short PC_LBZU = 0x16;
const short PC_LBZX = 0x17;
const short PC_LBZUX = 0x18;
const short PC_LHZ = 0x19;
const short PC_LHZU = 0x1A;
const short PC_LHZX = 0x1B;
const short PC_LHZUX = 0x1C;
const short PC_LHA = 0x1D;
const short PC_LHAU = 0x1E;
const short PC_LHAX = 0x1F;
const short PC_LHAUX = 0x20;
const short PC_LHBRX = 0x21;
const short PC_LWZ = 0x22;
const short PC_LWZU = 0x23;
const short PC_LWZX = 0x24;
const short PC_LWZUX = 0x25;
const short PC_LWBRX = 0x26;
const short PC_LMW = 0x27;
const short PC_STB = 0x28;
const short PC_STBU = 0x29;
const short PC_STBX = 0x2A;
const short PC_STBUX = 0x2B;
const short PC_STH = 0x2C;
const short PC_STHU = 0x2D;
const short PC_STHX = 0x2E;
const short PC_STHUX = 0x2F;
const short PC_STHBRX = 0x30;
const short PC_STW = 0x31;
const short PC_STWU = 0x32;
const short PC_STWX = 0x33;
const short PC_STWUX = 0x34;
const short PC_STWBRX = 0x35;
const short PC_STMW = 0x36;
const short PC_DCBF = 0x37;
const short PC_DCBST = 0x38;
const short PC_DCBT = 0x39;
const short PC_DCBTST = 0x3A;
const short PC_DCBZ = 0x3B;
const short PC_ADD = 0x3C;
const short PC_ADDC = 0x3D;
const short PC_ADDE = 0x3E;
const short PC_ADDI = 0x3F;
const short PC_ADDIC = 0x40;
const short PC_ADDICR = 0x41;
const short PC_ADDIS = 0x42;
const short PC_ADDME = 0x43;
const short PC_ADDZE = 0x44;
const short PC_DIVW = 0x45;
const short PC_DIVWU = 0x46;
const short PC_MULHW = 0x47;
const short PC_MULHWU = 0x48;
const short PC_MULLI = 0x49;
const short PC_MULLW = 0x4A;
const short PC_NEG = 0x4B;
const short PC_SUBF = 0x4C;
const short PC_SUBFC = 0x4D;
const short PC_SUBFE = 0x4E;
const short PC_SUBFIC = 0x4F;
const short PC_SUBFME = 0x50;
const short PC_SUBFZE = 0x51;
const short PC_CMPI = 0x52;
const short PC_CMP = 0x53;
const short PC_CMPLI = 0x54;
const short PC_CMPL = 0x55;
const short PC_ANDI = 0x56;
const short PC_ANDIS = 0x57;
const short PC_ORI = 0x58;
const short PC_ORIS = 0x59;
const short PC_XORI = 0x5A;
const short PC_XORIS = 0x5B;
const short PC_AND = 0x5C;
const short PC_OR = 0x5D;
const short PC_XOR = 0x5E;
const short PC_NAND = 0x5F;
const short PC_NOR = 0x60;
const short PC_EQV = 0x61;
const short PC_ANDC = 0x62;
const short PC_ORC = 0x63;
const short PC_EXTSB = 0x64;
const short PC_EXTSH = 0x65;
const short PC_CNTLZW = 0x66;
const short PC_RLWINM = 0x67;
const short PC_RLWNM = 0x68;
const short PC_RLWIMI = 0x69;
const short PC_SLW = 0x6A;
const short PC_SRW = 0x6B;
const short PC_SRAWI = 0x6C;
const short PC_SRAW = 0x6D;
const short PC_CRAND = 0x6E;
const short PC_CRANDC = 0x6F;
const short PC_CREQV = 0x70;
const short PC_CRNAND = 0x71;
const short PC_CRNOR = 0x72;
const short PC_CROR = 0x73;
const short PC_CRORC = 0x74;
const short PC_CRXOR = 0x75;
const short PC_MCRF = 0x76;
const short PC_MTXER = 0x77;
const short PC_MTCTR = 0x78;
const short PC_MTLR = 0x79;
const short PC_MTCRF = 0x7A;
const short PC_MTMSR = 0x7B;
const short PC_MTSPR = 0x7C;
const short PC_MFMSR = 0x7D;
const short PC_MFSPR = 0x7E;
const short PC_MFXER = 0x7F;
const short PC_MFCTR = 0x80;
const short PC_MFLR = 0x81;
const short PC_MFCR = 0x82;
const short PC_MFFS = 0x83;
const short PC_MTFSF = 0x84;
const short PC_EIEIO = 0x85;
const short PC_ISYNC = 0x86;
const short PC_SYNC = 0x87;
const short PC_RFI = 0x88;
const short PC_LI = 0x89;
const short PC_LIS = 0x8A;
const short PC_MR = 0x8B;
const short PC_NOP = 0x8C;
const short PC_NOT = 0x8D;
const short PC_LFS = 0x8E;
const short PC_LFSU = 0x8F;
const short PC_LFSX = 0x90;
const short PC_LFSUX = 0x91;
const short PC_LFD = 0x92;
const short PC_LFDU = 0x93;
const short PC_LFDX = 0x94;
const short PC_LFDUX = 0x95;
const short PC_STFS = 0x96;
const short PC_STFSU = 0x97;
const short PC_STFSX = 0x98;
const short PC_STFSUX = 0x99;
const short PC_STFD = 0x9A;
const short PC_STFDU = 0x9B;
const short PC_STFDX = 0x9C;
const short PC_STFDUX = 0x9D;
const short PC_FMR = 0x9E;
const short PC_FABS = 0x9F;
const short PC_FNEG = 0xA0;
const short PC_FNABS = 0xA1;
const short PC_FADD = 0xA2;
const short PC_FADDS = 0xA3;
const short PC_FSUB = 0xA4;
const short PC_FSUBS = 0xA5;
const short PC_FMUL = 0xA6;
const short PC_FMULS = 0xA7;
const short PC_FDIV = 0xA8;
const short PC_FDIVS = 0xA9;
const short PC_FMADD = 0xAA;
const short PC_FMADDS = 0xAB;
const short PC_FMSUB = 0xAC;
const short PC_FMSUBS = 0xAD;
const short PC_FNMADD = 0xAE;
const short PC_FNMADDS = 0xAF;
const short PC_FNMSUB = 0xB0;
const short PC_FNMSUBS = 0xB1;
const short PC_FRES = 0xB2;
const short PC_FRSQRTE = 0xB3;
const short PC_FSEL = 0xB4;
const short PC_FRSP = 0xB5;
const short PC_FCTIW = 0xB6;
const short PC_FCTIWZ = 0xB7;
const short PC_FCMPU = 0xB8;
const short PC_FCMPO = 0xB9;
const short PC_LWARX = 0xBA;
const short PC_LSWI = 0xBB;
const short PC_LSWX = 0xBC;
const short PC_STFIWX = 0xBD;
const short PC_STSWI = 0xBE;
const short PC_STSWX = 0xBF;
const short PC_STWCX = 0xC0;
const short PC_ECIWX = 0xC1;
const short PC_ECOWX = 0xC2;
const short PC_DCBI = 0xC3;
const short PC_ICBI = 0xC4;
const short PC_MCRFS = 0xC5;
const short PC_MCRXR = 0xC6;
const short PC_MFTB = 0xC7;
const short PC_MFSR = 0xC8;
const short PC_MTSR = 0xC9;
const short PC_MFSRIN = 0xCA;
const short PC_MTSRIN = 0xCB;
const short PC_MTFSB0 = 0xCC;
const short PC_MTFSB1 = 0xCD;
const short PC_MTFSFI = 0xCE;
const short PC_SC = 0xCF;
const short PC_FSQRT = 0xD0;
const short PC_FSQRTS = 0xD1;
const short PC_TLBIA = 0xD2;
const short PC_TLBIE = 0xD3;
const short PC_TLBLD = 0xD4;
const short PC_TLBLI = 0xD5;
const short PC_TLBSYNC = 0xD6;
const short PC_TW = 0xD7;
const short PC_TRAP = 0xD8;
const short PC_TWI = 0xD9;
const short PC_OPWORD = 0xDA;
const short PC_MFROM = 0xDB;
const short PC_DSA = 0xDC;
const short PC_ESA = 0xDD;
const short PC_DCCCI = 0xDE;
const short PC_DCREAD = 0xDF;
const short PC_ICBT = 0xE0;
const short PC_ICCCI = 0xE1;
const short PC_ICREAD = 0xE2;
const short PC_RFCI = 0xE3;
const short PC_TLBRE = 0xE4;
const short PC_TLBSX = 0xE5;
const short PC_TLBWE = 0xE6;
const short PC_WRTEE = 0xE7;
const short PC_WRTEEI = 0xE8;
const short PC_MFDCR = 0xE9;
const short PC_MTDCR = 0xEA;
const short PC_DCBA = 0xEB;
const short PC_DSS = 0xEC;
const short PC_DSSALL = 0xED;
const short PC_DST = 0xEE;
const short PC_DSTT = 0xEF;
const short PC_DSTST = 0xF0;
const short PC_DSTSTT = 0xF1;
const short PC_LVEBX = 0xF2;
const short PC_LVEHX = 0xF3;
const short PC_LVEWX = 0xF4;
const short PC_LVSL = 0xF5;
const short PC_LVSR = 0xF6;
const short PC_LVX = 0xF7;
const short PC_LVXL = 0xF8;
const short PC_STVEBX = 0xF9;
const short PC_STVEHX = 0xFA;
const short PC_STVEWX = 0xFB;
const short PC_STVX = 0xFC;
const short PC_STVXL = 0xFD;
const short PC_MFVSCR = 0xFE;
const short PC_MTVSCR = 0xFF;
const short PC_VADDCUW = 0x100;
const short PC_VADDFP = 0x101;
const short PC_VADDSBS = 0x102;
const short PC_VADDSHS = 0x103;
const short PC_VADDSWS = 0x104;
const short PC_VADDUBM = 0x105;
const short PC_VADDUBS = 0x106;
const short PC_VADDUHM = 0x107;
const short PC_VADDUHS = 0x108;
const short PC_VADDUWM = 0x109;
const short PC_VADDUWS = 0x10A;
const short PC_VAND = 0x10B;
const short PC_VANDC = 0x10C;
const short PC_VAVGSB = 0x10D;
const short PC_VAVGSH = 0x10E;
const short PC_VAVGSW = 0x10F;
const short PC_VAVGUB = 0x110;
const short PC_VAVGUH = 0x111;
const short PC_VAVGUW = 0x112;
const short PC_VCFSX = 0x113;
const short PC_VCFUX = 0x114;
const short PC_VCMPBFP = 0x115;
const short PC_VCMPEQFP = 0x116;
const short PC_VCMPEQUB = 0x117;
const short PC_VCMPEQUH = 0x118;
const short PC_VCMPEQUW = 0x119;
const short PC_VCMPGEFP = 0x11A;
const short PC_VCMPGTFP = 0x11B;
const short PC_VCMPGTSB = 0x11C;
const short PC_VCMPGTSH = 0x11D;
const short PC_VCMPGTSW = 0x11E;
const short PC_VCMPGTUB = 0x11F;
const short PC_VCMPGTUH = 0x120;
const short PC_VCMPGTUW = 0x121;
const short PC_VCTSXS = 0x122;
const short PC_VCTUXS = 0x123;
const short PC_VEXPTEFP = 0x124;
const short PC_VLOGEFP = 0x125;
const short PC_VMAXFP = 0x126;
const short PC_VMAXSB = 0x127;
const short PC_VMAXSH = 0x128;
const short PC_VMAXSW = 0x129;
const short PC_VMAXUB = 0x12A;
const short PC_VMAXUH = 0x12B;
const short PC_VMAXUW = 0x12C;
const short PC_VMINFP = 0x12D;
const short PC_VMINSB = 0x12E;
const short PC_VMINSH = 0x12F;
const short PC_VMINSW = 0x130;
const short PC_VMINUB = 0x131;
const short PC_VMINUH = 0x132;
const short PC_VMINUW = 0x133;
const short PC_VMRGHB = 0x134;
const short PC_VMRGHH = 0x135;
const short PC_VMRGHW = 0x136;
const short PC_VMRGLB = 0x137;
const short PC_VMRGLH = 0x138;
const short PC_VMRGLW = 0x139;
const short PC_VMULESB = 0x13A;
const short PC_VMULESH = 0x13B;
const short PC_VMULEUB = 0x13C;
const short PC_VMULEUH = 0x13D;
const short PC_VMULOSB = 0x13E;
const short PC_VMULOSH = 0x13F;
const short PC_VMULOUB = 0x140;
const short PC_VMULOUH = 0x141;
const short PC_VNOR = 0x142;
const short PC_VOR = 0x143;
const short PC_VPKPX = 0x144;
const short PC_VPKSHSS = 0x145;
const short PC_VPKSHUS = 0x146;
const short PC_VPKSWSS = 0x147;
const short PC_VPKSWUS = 0x148;
const short PC_VPKUHUM = 0x149;
const short PC_VPKUHUS = 0x14A;
const short PC_VPKUWUM = 0x14B;
const short PC_VPKUWUS = 0x14C;
const short PC_VREFP = 0x14D;
const short PC_VRFIM = 0x14E;
const short PC_VRFIN = 0x14F;
const short PC_VRFIP = 0x150;
const short PC_VRFIZ = 0x151;
const short PC_VRLB = 0x152;
const short PC_VRLH = 0x153;
const short PC_VRLW = 0x154;
const short PC_VRSQRTEFP = 0x155;
const short PC_VSL = 0x156;
const short PC_VSLB = 0x157;
const short PC_VSLH = 0x158;
const short PC_VSLO = 0x159;
const short PC_VSLW = 0x15A;
const short PC_VSPLTB = 0x15B;
const short PC_VSPLTH = 0x15C;
const short PC_VSPLTW = 0x15D;
const short PC_VSPLTISB = 0x15E;
const short PC_VSPLTISH = 0x15F;
const short PC_VSPLTISW = 0x160;
const short PC_VSR = 0x161;
const short PC_VSRAB = 0x162;
const short PC_VSRAH = 0x163;
const short PC_VSRAW = 0x164;
const short PC_VSRB = 0x165;
const short PC_VSRH = 0x166;
const short PC_VSRO = 0x167;
const short PC_VSRW = 0x168;
const short PC_VSUBCUW = 0x169;
const short PC_VSUBFP = 0x16A;
const short PC_VSUBSBS = 0x16B;
const short PC_VSUBSHS = 0x16C;
const short PC_VSUBSWS = 0x16D;
const short PC_VSUBUBM = 0x16E;
const short PC_VSUBUBS = 0x16F;
const short PC_VSUBUHM = 0x170;
const short PC_VSUBUHS = 0x171;
const short PC_VSUBUWM = 0x172;
const short PC_VSUBUWS = 0x173;
const short PC_VSUMSWS = 0x174;
const short PC_VSUM2SWS = 0x175;
const short PC_VSUM4SBS = 0x176;
const short PC_VSUM4SHS = 0x177;
const short PC_VSUM4UBS = 0x178;
const short PC_VUPKHPX = 0x179;
const short PC_VUPKHSB = 0x17A;
const short PC_VUPKHSH = 0x17B;
const short PC_VUPKLPX = 0x17C;
const short PC_VUPKLSB = 0x17D;
const short PC_VUPKLSH = 0x17E;
const short PC_VXOR = 0x17F;
const short PC_VMADDFP = 0x180;
const short PC_VMHADDSHS = 0x181;
const short PC_VMHRADDSHS = 0x182;
const short PC_VMLADDUHM = 0x183;
const short PC_VMSUMMBM = 0x184;
const short PC_VMSUMSHM = 0x185;
const short PC_VMSUMSHS = 0x186;
const short PC_VMSUMUBM = 0x187;
const short PC_VMSUMUHM = 0x188;
const short PC_VMSUMUHS = 0x189;
const short PC_VNMSUBFP = 0x18A;
const short PC_VPERM = 0x18B;
const short PC_VSEL = 0x18C;
const short PC_VSLDOI = 0x18D;
const short PC_VMR = 0x18E;
const short PC_VMRP = 0x18F;
const short PC_SLE = 0x190;
const short PC_SLEQ = 0x191;
const short PC_SLIQ = 0x192;
const short PC_SLLIQ = 0x193;
const short PC_SLLQ = 0x194;
const short PC_SLQ = 0x195;
const short PC_SRAIQ = 0x196;
const short PC_SRAQ = 0x197;
const short PC_SRE = 0x198;
const short PC_SREA = 0x199;
const short PC_SREQ = 0x19A;
const short PC_SRIQ = 0x19B;
const short PC_SRLIQ = 0x19C;
const short PC_SRLQ = 0x19D;
const short PC_SRQ = 0x19E;
const short PC_MASKG = 0x19F;
const short PC_MASKIR = 0x1A0;
const short PC_LSCBX = 0x1A1;
const short PC_DIV = 0x1A2;
const short PC_DIVS = 0x1A3;
const short PC_DOZ = 0x1A4;
const short PC_MUL = 0x1A5;
const short PC_NABS = 0x1A6;
const short PC_ABS = 0x1A7;
const short PC_CLCS = 0x1A8;
const short PC_DOZI = 0x1A9;
const short PC_RLMI = 0x1AA;
const short PC_RRIB = 0x1AB;
const short PC_PENTRY = 0x1AC;
const short PC_PEXIT = 0x1AD;
const short OPCODE_MAX = 0x1AE;
//const short PC_B = 0x0;
//const short PC_BL = 0x1;
//const short PC_BC = 0x2;
//const short PC_BCLR = 0x3;
//const short PC_BCCTR = 0x4;
//const short PC_BT = 0x5;
//const short PC_BTLR = 0x6;
//const short PC_BTCTR = 0x7;
//const short PC_BF = 0x8;
//const short PC_BFLR = 0x9;
//const short PC_BFCTR = 0xA;
//const short PC_BDNZ = 0xB;
//const short PC_BDNZT = 0xC;
//const short PC_BDNZF = 0xD;
//const short PC_BDZ = 0xE;
//const short PC_BDZT = 0xF;
//const short PC_BDZF = 0x10;
//const short PC_BLR = 0x11;
//const short PC_BCTR = 0x12;
//const short PC_BCTRL = 0x13;
//const short PC_BLRL = 0x14;
//const short PC_LBZ = 0x15;
//const short PC_LBZU = 0x16;
//const short PC_LBZX = 0x17;
//const short PC_LBZUX = 0x18;
//const short PC_LHZ = 0x19;
//const short PC_LHZU = 0x1A;
//const short PC_LHZX = 0x1B;
//const short PC_LHZUX = 0x1C;
//const short PC_LHA = 0x1D;
//const short PC_LHAU = 0x1E;
//const short PC_LHAX = 0x1F;
//const short PC_LHAUX = 0x20;
//const short PC_LHBRX = 0x21;
//const short PC_LWZ = 0x22;
//const short PC_LWZU = 0x23;
//const short PC_LWZX = 0x24;
//const short PC_LWZUX = 0x25;
//const short PC_LWBRX = 0x26;
//const short PC_LMW = 0x27;
//const short PC_STB = 0x28;
//const short PC_STBU = 0x29;
//const short PC_STBX = 0x2A;
//const short PC_STBUX = 0x2B;
//const short PC_STH = 0x2C;
//const short PC_STHU = 0x2D;
//const short PC_STHX = 0x2E;
//const short PC_STHUX = 0x2F;
//const short PC_STHBRX = 0x30;
//const short PC_STW = 0x31;
//const short PC_STWU = 0x32;
//const short PC_STWX = 0x33;
//const short PC_STWUX = 0x34;
//const short PC_STWBRX = 0x35;
//const short PC_STMW = 0x36;
//const short PC_DCBF = 0x37;
//const short PC_DCBST = 0x38;
//const short PC_DCBT = 0x39;
//const short PC_DCBTST = 0x3A;
//const short PC_DCBZ = 0x3B;
//const short PC_ADD = 0x3C;
//const short PC_ADDC = 0x3D;
//const short PC_ADDE = 0x3E;
//const short PC_ADDI = 0x3F;
//const short PC_ADDIC = 0x40;
//const short PC_ADDICR = 0x41;
//const short PC_ADDIS = 0x42;
//const short PC_ADDME = 0x43;
//const short PC_ADDZE = 0x44;
//const short PC_DIVW = 0x45;
//const short PC_DIVWU = 0x46;
//const short PC_MULHW = 0x47;
//const short PC_MULHWU = 0x48;
//const short PC_MULLI = 0x49;
//const short PC_MULLW = 0x4A;
//const short PC_NEG = 0x4B;
//const short PC_SUBF = 0x4C;
//const short PC_SUBFC = 0x4D;
//const short PC_SUBFE = 0x4E;
//const short PC_SUBFIC = 0x4F;
//const short PC_SUBFME = 0x50;
//const short PC_SUBFZE = 0x51;
//const short PC_CMPI = 0x52;
//const short PC_CMP = 0x53;
//const short PC_CMPLI = 0x54;
//const short PC_CMPL = 0x55;
//const short PC_ANDI = 0x56;
//const short PC_ANDIS = 0x57;
//const short PC_ORI = 0x58;
//const short PC_ORIS = 0x59;
//const short PC_XORI = 0x5A;
//const short PC_XORIS = 0x5B;
//const short PC_AND = 0x5C;
//const short PC_OR = 0x5D;
//const short PC_XOR = 0x5E;
//const short PC_NAND = 0x5F;
//const short PC_NOR = 0x60;
//const short PC_EQV = 0x61;
//const short PC_ANDC = 0x62;
//const short PC_ORC = 0x63;
//const short PC_EXTSB = 0x64;
//const short PC_EXTSH = 0x65;
//const short PC_CNTLZW = 0x66;
//const short PC_RLWINM = 0x67;
//const short PC_RLWNM = 0x68;
//const short PC_RLWIMI = 0x69;
//const short PC_SLW = 0x6A;
//const short PC_SRW = 0x6B;
//const short PC_SRAWI = 0x6C;
//const short PC_SRAW = 0x6D;
//const short PC_CRAND = 0x6E;
//const short PC_CRANDC = 0x6F;
//const short PC_CREQV = 0x70;
//const short PC_CRNAND = 0x71;
//const short PC_CRNOR = 0x72;
//const short PC_CROR = 0x73;
//const short PC_CRORC = 0x74;
//const short PC_CRXOR = 0x75;
//const short PC_MCRF = 0x76;
//const short PC_MTXER = 0x77;
//const short PC_MTCTR = 0x78;
//const short PC_MTLR = 0x79;
//const short PC_MTCRF = 0x7A;
//const short PC_MTMSR = 0x7B;
//const short PC_MTSPR = 0x7C;
//const short PC_MFMSR = 0x7D;
//const short PC_MFSPR = 0x7E;
//const short PC_MFXER = 0x7F;
//const short PC_MFCTR = 0x80;
//const short PC_MFLR = 0x81;
//const short PC_MFCR = 0x82;
//const short PC_MFFS = 0x83;
//const short PC_MTFSF = 0x84;
//const short PC_EIEIO = 0x85;
//const short PC_ISYNC = 0x86;
//const short PC_SYNC = 0x87;
//const short PC_RFI = 0x88;
//const short PC_LI = 0x89;
//const short PC_LIS = 0x8A;
//const short PC_MR = 0x8B;
//const short PC_NOP = 0x8C;
//const short PC_NOT = 0x8D;
//const short PC_LFS = 0x8E;
//const short PC_LFSU = 0x8F;
//const short PC_LFSX = 0x90;
//const short PC_LFSUX = 0x91;
//const short PC_LFD = 0x92;
//const short PC_LFDU = 0x93;
//const short PC_LFDX = 0x94;
//const short PC_LFDUX = 0x95;
//const short PC_STFS = 0x96;
//const short PC_STFSU = 0x97;
//const short PC_STFSX = 0x98;
//const short PC_STFSUX = 0x99;
//const short PC_STFD = 0x9A;
//const short PC_STFDU = 0x9B;
//const short PC_STFDX = 0x9C;
//const short PC_STFDUX = 0x9D;
//const short PC_FMR = 0x9E;
//const short PC_FABS = 0x9F;
//const short PC_FNEG = 0xA0;
//const short PC_FNABS = 0xA1;
//const short PC_FADD = 0xA2;
//const short PC_FADDS = 0xA3;
//const short PC_FSUB = 0xA4;
//const short PC_FSUBS = 0xA5;
//const short PC_FMUL = 0xA6;
//const short PC_FMULS = 0xA7;
//const short PC_FDIV = 0xA8;
//const short PC_FDIVS = 0xA9;
//const short PC_FMADD = 0xAA;
//const short PC_FMADDS = 0xAB;
//const short PC_FMSUB = 0xAC;
//const short PC_FMSUBS = 0xAD;
//const short PC_FNMADD = 0xAE;
//const short PC_FNMADDS = 0xAF;
//const short PC_FNMSUB = 0xB0;
//const short PC_FNMSUBS = 0xB1;
//const short PC_FRES = 0xB2;
//const short PC_FRSQRTE = 0xB3;
//const short PC_FSEL = 0xB4;
//const short PC_FRSP = 0xB5;
//const short PC_FCTIW = 0xB6;
//const short PC_FCTIWZ = 0xB7;
//const short PC_FCMPU = 0xB8;
//const short PC_FCMPO = 0xB9;
//const short PC_LWARX = 0xBA;
//const short PC_LSWI = 0xBB;
//const short PC_LSWX = 0xBC;
//const short PC_STFIWX = 0xBD;
//const short PC_STSWI = 0xBE;
//const short PC_STSWX = 0xBF;
//const short PC_STWCX = 0xC0;
//const short PC_ECIWX = 0xC1;
//const short PC_ECOWX = 0xC2;
//const short PC_DCBI = 0xC3;
//const short PC_ICBI = 0xC4;
//const short PC_MCRFS = 0xC5;
//const short PC_MCRXR = 0xC6;
//const short PC_MFTB = 0xC7;
//const short PC_MFSR = 0xC8;
//const short PC_MTSR = 0xC9;
//const short PC_MFSRIN = 0xCA;
//const short PC_MTSRIN = 0xCB;
//const short PC_MTFSB0 = 0xCC;
//const short PC_MTFSB1 = 0xCD;
//const short PC_MTFSFI = 0xCE;
//const short PC_SC = 0xCF;
//const short PC_FSQRT = 0xD0;
//const short PC_FSQRTS = 0xD1;
//const short PC_TLBIA = 0xD2;
//const short PC_TLBIE = 0xD3;
//const short PC_TLBLD = 0xD4;
//const short PC_TLBLI = 0xD5;
//const short PC_TLBSYNC = 0xD6;
//const short PC_TW = 0xD7;
//const short PC_TRAP = 0xD8;
//const short PC_TWI = 0xD9;
//const short PC_OPWORD = 0xDA;
//const short PC_MFROM = 0xDB;
//const short PC_DSA = 0xDC;
//const short PC_ESA = 0xDD;
//const short PC_DCCCI = 0xDE;
//const short PC_DCREAD = 0xDF;
//const short PC_ICBT = 0xE0;
//const short PC_ICCCI = 0xE1;
//const short PC_ICREAD = 0xE2;
//const short PC_RFCI = 0xE3;
//const short PC_TLBRE = 0xE4;
//const short PC_TLBSX = 0xE5;
//const short PC_TLBWE = 0xE6;
//const short PC_WRTEE = 0xE7;
//const short PC_WRTEEI = 0xE8;
//const short PC_MFDCR = 0xE9;
//const short PC_MTDCR = 0xEA;
//const short PC_DCBA = 0xEB;
//const short PC_DSS = 0xEC;
//const short PC_DSSALL = 0xED;
//const short PC_DST = 0xEE;
//const short PC_DSTT = 0xEF;
//const short PC_DSTST = 0xF0;
//const short PC_DSTSTT = 0xF1;
//const short PC_LVEBX = 0xF2;
//const short PC_LVEHX = 0xF3;
//const short PC_LVEWX = 0xF4;
//const short PC_LVSL = 0xF5;
//const short PC_LVSR = 0xF6;
//const short PC_LVX = 0xF7;
//const short PC_LVXL = 0xF8;
//const short PC_STVEBX = 0xF9;
//const short PC_STVEHX = 0xFA;
//const short PC_STVEWX = 0xFB;
//const short PC_STVX = 0xFC;
//const short PC_STVXL = 0xFD;
//const short PC_MFVSCR = 0xFE;
//const short PC_MTVSCR = 0xFF;
//const short PC_VADDCUW = 0x100;
//const short PC_VADDFP = 0x101;
//const short PC_VADDSBS = 0x102;
//const short PC_VADDSHS = 0x103;
//const short PC_VADDSWS = 0x104;
//const short PC_VADDUBM = 0x105;
//const short PC_VADDUBS = 0x106;
//const short PC_VADDUHM = 0x107;
//const short PC_VADDUHS = 0x108;
//const short PC_VADDUWM = 0x109;
//const short PC_VADDUWS = 0x10A;
//const short PC_VAND = 0x10B;
//const short PC_VANDC = 0x10C;
//const short PC_VAVGSB = 0x10D;
//const short PC_VAVGSH = 0x10E;
//const short PC_VAVGSW = 0x10F;
//const short PC_VAVGUB = 0x110;
//const short PC_VAVGUH = 0x111;
//const short PC_VAVGUW = 0x112;
//const short PC_VCFSX = 0x113;
//const short PC_VCFUX = 0x114;
//const short PC_VCMPBFP = 0x115;
//const short PC_VCMPEQFP = 0x116;
//const short PC_VCMPEQUB = 0x117;
//const short PC_VCMPEQUH = 0x118;
//const short PC_VCMPEQUW = 0x119;
//const short PC_VCMPGEFP = 0x11A;
//const short PC_VCMPGTFP = 0x11B;
//const short PC_VCMPGTSB = 0x11C;
//const short PC_VCMPGTSH = 0x11D;
//const short PC_VCMPGTSW = 0x11E;
//const short PC_VCMPGTUB = 0x11F;
//const short PC_VCMPGTUH = 0x120;
//const short PC_VCMPGTUW = 0x121;
//const short PC_VCTSXS = 0x122;
//const short PC_VCTUXS = 0x123;
//const short PC_VEXPTEFP = 0x124;
//const short PC_VLOGEFP = 0x125;
//const short PC_VMAXFP = 0x126;
//const short PC_VMAXSB = 0x127;
//const short PC_VMAXSH = 0x128;
//const short PC_VMAXSW = 0x129;
//const short PC_VMAXUB = 0x12A;
//const short PC_VMAXUH = 0x12B;
//const short PC_VMAXUW = 0x12C;
//const short PC_VMINFP = 0x12D;
//const short PC_VMINSB = 0x12E;
//const short PC_VMINSH = 0x12F;
//const short PC_VMINSW = 0x130;
//const short PC_VMINUB = 0x131;
//const short PC_VMINUH = 0x132;
//const short PC_VMINUW = 0x133;
//const short PC_VMRGHB = 0x134;
//const short PC_VMRGHH = 0x135;
//const short PC_VMRGHW = 0x136;
//const short PC_VMRGLB = 0x137;
//const short PC_VMRGLH = 0x138;
//const short PC_VMRGLW = 0x139;
//const short PC_VMULESB = 0x13A;
//const short PC_VMULESH = 0x13B;
//const short PC_VMULEUB = 0x13C;
//const short PC_VMULEUH = 0x13D;
//const short PC_VMULOSB = 0x13E;
//const short PC_VMULOSH = 0x13F;
//const short PC_VMULOUB = 0x140;
//const short PC_VMULOUH = 0x141;
//const short PC_VNOR = 0x142;
//const short PC_VOR = 0x143;
//const short PC_VPKPX = 0x144;
//const short PC_VPKSHSS = 0x145;
//const short PC_VPKSHUS = 0x146;
//const short PC_VPKSWSS = 0x147;
//const short PC_VPKSWUS = 0x148;
//const short PC_VPKUHUM = 0x149;
//const short PC_VPKUHUS = 0x14A;
//const short PC_VPKUWUM = 0x14B;
//const short PC_VPKUWUS = 0x14C;
//const short PC_VREFP = 0x14D;
//const short PC_VRFIM = 0x14E;
//const short PC_VRFIN = 0x14F;
//const short PC_VRFIP = 0x150;
//const short PC_VRFIZ = 0x151;
//const short PC_VRLB = 0x152;
//const short PC_VRLH = 0x153;
//const short PC_VRLW = 0x154;
//const short PC_VRSQRTEFP = 0x155;
//const short PC_VSL = 0x156;
//const short PC_VSLB = 0x157;
//const short PC_VSLH = 0x158;
//const short PC_VSLO = 0x159;
//const short PC_VSLW = 0x15A;
//const short PC_VSPLTB = 0x15B;
//const short PC_VSPLTH = 0x15C;
//const short PC_VSPLTW = 0x15D;
//const short PC_VSPLTISB = 0x15E;
//const short PC_VSPLTISH = 0x15F;
//const short PC_VSPLTISW = 0x160;
//const short PC_VSR = 0x161;
//const short PC_VSRAB = 0x162;
//const short PC_VSRAH = 0x163;
//const short PC_VSRAW = 0x164;
//const short PC_VSRB = 0x165;
//const short PC_VSRH = 0x166;
//const short PC_VSRO = 0x167;
//const short PC_VSRW = 0x168;
//const short PC_VSUBCUW = 0x169;
//const short PC_VSUBFP = 0x16A;
//const short PC_VSUBSBS = 0x16B;
//const short PC_VSUBSHS = 0x16C;
//const short PC_VSUBSWS = 0x16D;
//const short PC_VSUBUBM = 0x16E;
//const short PC_VSUBUBS = 0x16F;
//const short PC_VSUBUHM = 0x170;
//const short PC_VSUBUHS = 0x171;
//const short PC_VSUBUWM = 0x172;
//const short PC_VSUBUWS = 0x173;
//const short PC_VSUMSWS = 0x174;
//const short PC_VSUM2SWS = 0x175;
//const short PC_VSUM4SBS = 0x176;
//const short PC_VSUM4SHS = 0x177;
//const short PC_VSUM4UBS = 0x178;
//const short PC_VUPKHPX = 0x179;
//const short PC_VUPKHSB = 0x17A;
//const short PC_VUPKHSH = 0x17B;
//const short PC_VUPKLPX = 0x17C;
//const short PC_VUPKLSB = 0x17D;
//const short PC_VUPKLSH = 0x17E;
//const short PC_VXOR = 0x17F;
//const short PC_VMADDFP = 0x180;
//const short PC_VMHADDSHS = 0x181;
//const short PC_VMHRADDSHS = 0x182;
//const short PC_VMLADDUHM = 0x183;
//const short PC_VMSUMMBM = 0x184;
//const short PC_VMSUMSHM = 0x185;
//const short PC_VMSUMSHS = 0x186;
//const short PC_VMSUMUBM = 0x187;
//const short PC_VMSUMUHM = 0x188;
//const short PC_VMSUMUHS = 0x189;
//const short PC_VNMSUBFP = 0x18A;
//const short PC_VPERM = 0x18B;
//const short PC_VSEL = 0x18C;
//const short PC_VSLDOI = 0x18D;
//const short PC_VMR = 0x18E;
//const short PC_VMRP = 0x18F;
//const short PC_SLE = 0x190;
//const short PC_SLEQ = 0x191;
//const short PC_SLIQ = 0x192;
//const short PC_SLLIQ = 0x193;
//const short PC_SLLQ = 0x194;
//const short PC_SLQ = 0x195;
//const short PC_SRAIQ = 0x196;
//const short PC_SRAQ = 0x197;
//const short PC_SRE = 0x198;
//const short PC_SREA = 0x199;
//const short PC_SREQ = 0x19A;
//const short PC_SRIQ = 0x19B;
//const short PC_SRLIQ = 0x19C;
//const short PC_SRLQ = 0x19D;
//const short PC_SRQ = 0x19E;
//const short PC_MASKG = 0x19F;
//const short PC_MASKIR = 0x1A0;
//const short PC_LSCBX = 0x1A1;
//const short PC_DIV = 0x1A2;
//const short PC_DIVS = 0x1A3;
//const short PC_DOZ = 0x1A4;
//const short PC_MUL = 0x1A5;
//const short PC_NABS = 0x1A6;
//const short PC_ABS = 0x1A7;
//const short PC_CLCS = 0x1A8;
//const short PC_DOZI = 0x1A9;
//const short PC_RLMI = 0x1AA;
//const short PC_RRIB = 0x1AB;
//const short PC_PENTRY = 0x1AC;
//const short PC_PEXIT = 0x1AD;
//const short OPCODE_MAX = 0x1AE;
extern OpcodeInfo opcodeinfo[OPCODE_MAX];
extern void pcode_get_hi_lo(int bits, char typechar, SInt32 *hi, SInt32 *lo);
extern int pcode_check_imm_bits(SInt32 value, int bits, char typechar);
extern int pcode_const_from_format(const char *format, int *pResult);
extern int pcode_const_from_format(const char *format, SInt32 *pResult);
extern PCode *vformatpcode(short opcode, va_list argList);
extern int expectandformatoperand(PCodeArg *operand, PCOpKind expectedKind, char a3, int bitCount, char *buf);
extern int formatoperand(PCodeArg *operand, char *buf);

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_PCODELISTING_H
#define COMPILER_PCODELISTING_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,11 @@
#ifndef COMPILER_PPCERROR_H
#define COMPILER_PPCERROR_H
#include "compiler/common.h"
extern void PPCError_Error(int code, ...);
extern void PPCError_Warning(int code, ...);
extern void PPCError_Message(char *format, ...);
extern void PPCError_ErrorTerm(short code, ...);
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_PEEPHOLE_H
#define COMPILER_PEEPHOLE_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,42 @@
#ifndef COMPILER_REGISTERINFO_H
#define COMPILER_REGISTERINFO_H
#include "compiler/common.h"
#include "compiler/Registers.h"
extern short last_exception_register[RegClassMax];
extern short first_fe_temporary_register[RegClassMax];
extern short last_argument_register[RegClassMax];
extern short _FP_;
extern short _CALLER_SP_;
extern char *special_register_names[RegClassMax][RegisterMax];
extern short spr_to_sysreg[4];
extern void asm_used_register(char rclass, short reg);
extern void retain_register(Object *obj, char rclass, short reg);
extern void retain_GPR_pair(Object *obj, short reg, short regHi);
extern int is_register_object(Object *obj);
extern int GetABIFirstNonVolatile(char rclass);
extern char GetRegisterClassName(char rclass);
extern void setup_diagnostic_reg_strings(void);
extern void init_target_registers(void);
extern void assign_register_by_type(Object *obj);
extern void assign_GPR_pair(Object *obj);
extern void open_fe_temp_registers(void);
extern void set_last_exception_registers(void);
extern VarInfo *Registers_GetVarInfo(Object *obj);
extern int used_vrstate_VRs(void);
extern UInt32 colored_vrs_as_vrsave(PCodeBlock *block);
extern void save_before_coloring_nonvolatile_registers(char rclass);
extern void reset_nonvolatile_registers(char rclass);
extern int is_nonvolatile_register(char rclass, int reg);
extern void init_endian(void);
extern void update_asm_nonvolatile_registers(void);
#define OBJECT_REG(obj) ( Registers_GetVarInfo((obj)) ? (Registers_GetVarInfo((obj))->reg) : 0 )
#define OBJECT_REG_HI(obj) ( Registers_GetVarInfo((obj)) ? (Registers_GetVarInfo((obj))->regHi) : 0 )
#define ALLOC_GPR() (used_virtual_registers[RegClass_GPR]++)
#define ALLOC_FPR() (used_virtual_registers[RegClass_FPR]++)
#define ALLOC_VR() (used_virtual_registers[RegClass_VR]++)
#endif

View File

@@ -0,0 +1,54 @@
#ifndef COMPILER_REGISTERS_H
#define COMPILER_REGISTERS_H
#include "compiler/common.h"
enum {
RegisterMax = 32
};
const char RegClass_SPR = 0;
const char RegClass_CRFIELD = 1;
const char RegClass_VR = 2;
const char RegClass_FPR = 3;
const char RegClass_GPR = 4;
const char RegClassMax = 5;
const char RegClass_6 = 6;
const char RegClass_DCR = 7;
enum {
RegState0 = 0,
RegState1 = 1,
RegState2 = 2
};
extern int used_virtual_registers[RegClassMax];
extern int used_nonvolatile_registers[RegClassMax];
extern int assignable_registers[RegClassMax];
extern int n_real_registers[RegClassMax];
extern int n_scratch_registers[RegClassMax];
extern int scratch_registers[RegClassMax][RegisterMax];
extern int n_nonvolatile_registers[RegClassMax];
extern int nonvolatile_registers[RegClassMax][RegisterMax];
extern UInt8 reg_state[RegClassMax][RegisterMax];
extern int first_temporary_register[RegClassMax];
extern int last_temporary_register[RegClassMax];
extern char *register_class_name[RegClassMax];
extern char *register_class_format[RegClassMax];
extern int coloring;
extern int optimizing;
extern void init_registers(void);
extern void assign_register_to_variable(Object *obj, char rclass);
extern void retain_register_for_argument(Object *obj, char rclass, short reg);
extern int available_registers(char rclass);
extern UInt32 volatile_registers(char rclass);
extern short obtain_nonvolatile_register(char rclass);
extern void open_temp_registers(void);
extern void check_temp_registers(void);
extern void close_temp_registers(void);
extern int count_scratch_registers(void);
extern void init_modified_registers(void);
extern void note_modified_registers(Object *obj);
extern void find_modified_registers(Object *obj, UInt32 *masks);
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_SCHEDULER_H
#define COMPILER_SCHEDULER_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_SPILLCODE_H
#define COMPILER_SPILLCODE_H
#include "compiler/common.h"
#endif

View File

@@ -22,12 +22,12 @@ extern Boolean large_stack;
extern Object *dummyvaparam;
extern void *dummyprofiler;
extern void init_stack_globals(void);
extern void init_frame_sizes(void);
extern void init_stack_globals(Object *funcobj);
extern void init_frame_sizes(Boolean has_varargs);
extern void assign_local_memory(Object *obj);
extern void assign_locals_to_memory(ObjectList *first);
extern void compute_frame_sizes(void);
extern void generate_prologue(PCodeBlock *block);
extern void generate_prologue(PCodeBlock *block, Boolean has_varargs);
extern void generate_epilogue(PCodeBlock *block, Boolean add_blr);
extern void allocate_dynamic_stack_space(Boolean flag1, int reg1, int reg2, SInt32 size);
extern char *generate_traceback(SInt32 funcsize, char *funcname, SInt32 *tbsize, Object *func);

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_STRENGTHREDUCTION_H
#define COMPILER_STRENGTHREDUCTION_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_STRUCTMOVES_H
#define COMPILER_STRUCTMOVES_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,28 @@
#ifndef COMPILER_SWITCH_H
#define COMPILER_SWITCH_H
#include "compiler/common.h"
typedef struct SwitchCase {
struct SwitchCase *next;
CLabel *label;
CInt64 min;
CInt64 max;
} SwitchCase;
typedef struct CaseRange {
CInt64 min;
CInt64 range;
PCodeLabel *label;
} CaseRange;
typedef struct SwitchInfo {
SwitchCase *cases;
CLabel *defaultlabel;
} SwitchInfo;
extern ObjectList *switchtables;
extern void switchstatement(ENode *expr, SwitchInfo *info);
extern void dumpswitchtables(Object *funcobj);
#endif

View File

@@ -41,7 +41,7 @@ typedef struct COVCResult {
// this struct might be used in other places too???
short op1;
short op2;
unsigned char arg;
char arg;
} COVCResult;
extern Boolean canoptimizevectorconst(MWVector128 *vecp, Type *type, COVCResult *result);
extern Boolean TOC_use_fsel(ENode *expr);

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_UNMANGLE_H
#define COMPILER_UNMANGLE_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_USEDEFCHAINS_H
#define COMPILER_USEDEFCHAINS_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_VALUENUMBERING_H
#define COMPILER_VALUENUMBERING_H
#include "compiler/common.h"
#endif

View File

@@ -0,0 +1,6 @@
#ifndef COMPILER_VECTORARRAYSTOREGS_H
#define COMPILER_VECTORARRAYSTOREGS_H
#include "compiler/common.h"
#endif

View File

@@ -204,14 +204,15 @@ typedef struct TemplParamID {
typedef enum TemplDepSubType {
TDE_PARAM,
TDE_TYPEEXPR,
TDE_unk2, // may actually be 1?
TDE_CAST,
TDE_QUALNAME,
TDE_QUALTEMPL,
TDE_OBJACCESS,
TDE_SOURCEREF,
TDE_FUNCCALL,
TDE_LOCAL,
TDE_MONAND,
//TDE_OBJACCESS,
//TDE_SOURCEREF,
//TDE_FUNCCALL,
//TDE_LOCAL,
TDE_MONAND = 7,
TDE_MONPLUS,
TDE_MONMUL,
TDE_NEW,
@@ -333,6 +334,14 @@ struct CParams {
CWDataType targetCPU;
char *targetName;
};
#define FITS_IN_SHORT(value) ( (value) == ((short) (value)) )
#define FITS_IN_USHORT(value) ( (value) == ((unsigned short) (value)) )
#define FITS_IN_HI_SHORT(value) ( (value) == (value & 0xFFFF0000) )
#define FITS_IN_SHORT2(value) ( ((short) (value)) == (value) )
#define HIGH_PART(value) ( (short) (((value) >> 16) + (((value) & 0x8000) >> 15)) )
#define LOW_PART(value) ( (short) (value) )
#ifdef __MWERKS__
#pragma options align=reset
#endif

View File

@@ -91,10 +91,12 @@ typedef enum ENodeType {
struct EMemberInfo {
BClassList *path;
ENodeList *nodes;
void *x8;
void *xC;
void *x10;
ENode *expr;
NameSpaceObjectList *list;
TemplArg *templargs;
Boolean pr_1D;
Boolean x11;
Boolean isambig;
};
@@ -172,7 +174,9 @@ typedef union ENodeUnion {
struct {
NameSpaceObjectList *list;
TemplArg *templargs;
HashNameNode *name;
} objlist;
EMemberInfo *emember;
void *inst;
MemInitializer *ctorinit;
Statement *stmt;
@@ -275,9 +279,13 @@ enum {
};
#define ENODE_IS(_enode, _etype) ( (_enode)->type == (_etype) )
#define ENODE_IS2(_enode, _etype1, _etype2) ( ENODE_IS(_enode, (_etype1)) || ENODE_IS(_enode, (_etype2)) )
#define ENODE_IS3(_enode, _etype1, _etype2, _etype3) ( ENODE_IS(_enode, (_etype1)) || ENODE_IS(_enode, (_etype2)) || ENODE_IS(_enode, (_etype3)) )
#define ENODE_IS2(_enode, _etype1, _etype2) ( ENODE_IS((_enode), (_etype1)) || ENODE_IS(_enode, (_etype2)) )
#define ENODE_IS3(_enode, _etype1, _etype2, _etype3) ( ENODE_IS((_enode), (_etype1)) || ENODE_IS(_enode, (_etype2)) || ENODE_IS(_enode, (_etype3)) )
#define ENODE_IS_RANGE(_enode, _lo, _hi) ( ((_enode)->type >= (_lo)) && ((_enode)->type <= (_hi)) )
#define ENODE_QUALS(_enode) ( (UInt32) ( (_enode)->flags & ENODE_FLAG_QUALS ) )
#define ENODE_IS_INDIRECT_TO(_enode, _etype) ( ENODE_IS((_enode), EINDIRECT) && ENODE_IS((_enode)->data.monadic, (_etype)) )
#define ENODE_IS_ASSIGN(_enode) ( ENODE_IS_RANGE((_enode), EASS, EORASS) )
#define ENODE_IS_ASSIGN_TO(_enode, _etype) ( ENODE_IS_RANGE((_enode), EASS, EORASS) && ENODE_IS((_enode)->data.diadic.left->data.monadic, (_etype)) )
#ifdef __MWERKS__
#pragma options align=reset

View File

@@ -2,6 +2,7 @@
#define COMPILER_OBJECTS_H
#include "compiler/common.h"
#include "compiler/tokens.h"
#ifdef __MWERKS__
#pragma options align=mac68k

View File

@@ -160,6 +160,7 @@ struct TemplClassInst {
#define TEMPL_CLASS(ty) ( (TemplClass *) (ty) )
#define TEMPL_CLASS_INST(ty) ( (TemplClassInst *) (ty) )
#define IS_TEMPL_CLASS(ty) ( IS_TYPE_CLASS(ty) && (TYPE_CLASS(ty)->flags & CLASS_FLAGS_100) )
/*************/
/* Functions */
@@ -189,6 +190,10 @@ struct TemplFuncInstance { // verified via CPrec
Boolean static_instantiated;
};
#define TEMPL_FUNC(ty) ( (TemplateFunction *) (ty) )
#define TEMPL_FUNC_INST(ty) ( (TemplFuncInstance *) (ty) )
#define IS_TEMPL_FUNC(ty) ( IS_TYPE_FUNC(ty) && (TYPE_FUNC(ty)->flags & FUNC_FLAGS_100000) )
/***********/
/* Actions */
/***********/

View File

@@ -180,6 +180,7 @@ struct TStreamElement {
TData data;
};
// this is actually called TokenStream
struct TStream {
SInt32 tokens;
TStreamElement *firsttoken;

View File

@@ -51,9 +51,18 @@ typedef enum IntegralType {
IT_FLOAT = 13,
IT_SHORTDOUBLE = 14,
IT_DOUBLE = 15,
IT_LONGDOUBLE = 16
IT_LONGDOUBLE = 16,
IT_17 = 17,
IT_18 = 18,
IT_19 = 19,
IT_20 = 20,
IT_21 = 21,
IT_22 = 22,
IT_23 = 23,
IT_24 = 24
} IntegralType;
// This is probably actually called AtomType / TypeAtom
struct TypeIntegral {
TypeType type;
SInt32 size;
@@ -87,10 +96,11 @@ struct StructMember {
UInt32 qual;
};
enum {
/*enum {
STRUCT_TYPE_STRUCT = 0,
STRUCT_TYPE_UNION = 1,
STRUCT_TYPE_CLASS = 2,
STRUCT_TYPE_3 = 3,
STRUCT_TYPE_4 = 4,
STRUCT_TYPE_5 = 5,
STRUCT_TYPE_6 = 6,
@@ -102,7 +112,22 @@ enum {
STRUCT_TYPE_C = 12,
STRUCT_TYPE_D = 13,
STRUCT_TYPE_E = 14
};
};*/
const char STRUCT_TYPE_STRUCT = 0;
const char STRUCT_TYPE_UNION = 1;
const char STRUCT_TYPE_CLASS = 2;
const char STRUCT_TYPE_3 = 3;
const char STRUCT_TYPE_4 = 4;
const char STRUCT_TYPE_5 = 5;
const char STRUCT_TYPE_6 = 6;
const char STRUCT_TYPE_7 = 7;
const char STRUCT_TYPE_8 = 8;
const char STRUCT_TYPE_9 = 9;
const char STRUCT_TYPE_A = 10;
const char STRUCT_TYPE_B = 11;
const char STRUCT_TYPE_C = 12;
const char STRUCT_TYPE_D = 13;
const char STRUCT_TYPE_E = 14;
struct ClassList { // checked via CPrec
@@ -235,7 +260,7 @@ enum {
FUNC_FLAGS_40 = 0x40, // func that's like "operator SomeOtherType()"
FUNC_FLAGS_80 = 0x80,
FUNC_FLAGS_100 = 0x100,
FUNC_FLAGS_200 = 0x200,
FUNC_FLAGS_200 = 0x200, // intrinsic?
FUNC_FLAGS_NOTHROW = 0x400,
FUNC_FLAGS_800 = 0x800,
FUNC_FLAGS_1000 = 0x1000,
@@ -367,16 +392,22 @@ struct TypeList {
#define TYPE_TEMPLATE(ty) ((TypeTemplDep *) (ty))
#define TYPE_MEMBER_POINTER(ty) ((TypeMemberPointer *) (ty))
#define TYPE_POINTER(ty) ((TypePointer *) (ty))
#define TPTR_TARGET(ty) (TYPE_POINTER(ty)->target)
#define TPTR_QUAL(ty) (TYPE_POINTER(ty)->qual)
#define IS_TYPE_VOID(ty) ( (ty)->type == TYPEVOID )
#define IS_TYPE_INT(ty) ( (ty)->type == TYPEINT )
#define IS_TYPE_ENUM(ty) ( (ty)->type == TYPEENUM )
#define IS_TYPE_INT_OR_ENUM(ty) ( IS_TYPE_INT(ty) || IS_TYPE_ENUM(ty) )
#define IS_TYPE_FLOAT(ty) ( (ty)->type == TYPEFLOAT )
#define IS_TYPE_INT_OR_FLOAT(ty) ( IS_TYPE_INT(ty) || IS_TYPE_FLOAT(ty) )
#define IS_TYPE_STRUCT(ty) ( (ty)->type == TYPESTRUCT )
#define IS_TYPE_CLASS(ty) ( (ty)->type == TYPECLASS )
#define IS_TYPE_FUNC(ty) ( (ty)->type == TYPEFUNC )
#define IS_TYPEFUNC_METHOD(ty) ( (ty)->flags & FUNC_FLAGS_METHOD )
#define IS_TYPE_METHOD(ty) ( IS_TYPE_FUNC(ty) && IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) )
#define IS_TYPE_NONSTATIC_METHOD(ty) ( IS_TYPE_FUNC(ty) && IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) && !TYPE_METHOD(ty)->x26 )
#define IS_TYPE_STATIC_METHOD(ty) ( IS_TYPE_FUNC(ty) && IS_TYPEFUNC_METHOD(TYPE_FUNC(ty)) && TYPE_METHOD(ty)->x26 )
#define IS_TYPE_TEMPLATE(ty) ( (ty)->type == TYPETEMPLATE )
#define IS_TYPE_POINTER(ty) ( (ty)->type == TYPEPOINTER || (ty)->type == TYPEARRAY )
#define IS_TYPE_POINTER_ONLY(ty) ( (ty)->type == TYPEPOINTER )
@@ -384,7 +415,8 @@ struct TypeList {
#define IS_TYPEPOINTER_REFERENCE(ty) ( (ty)->qual & Q_REFERENCE )
#define IS_TYPE_ARRAY(ty) ( (ty)->type == TYPEARRAY )
#define IS_TYPE_BITFIELD(ty) ( (ty)->type == TYPEBITFIELD )
#define IS_TYPESTRUCT_VECTOR(ty) ( (ty)->stype >= STRUCT_TYPE_4 && (ty)->stype <= STRUCT_TYPE_E )
#define IS_TYPE_TEMPLDEPEXPR(ty) ( (ty)->type == TYPETEMPLDEPEXPR )
#define IS_TYPESTRUCT_VECTOR(ty) ( TYPE_STRUCT(ty)->stype >= STRUCT_TYPE_4 && TYPE_STRUCT(ty)->stype <= STRUCT_TYPE_E )
#define IS_TYPE_VECTOR(ty) ( (ty)->type == TYPESTRUCT && IS_TYPESTRUCT_VECTOR(TYPE_STRUCT(ty)) )
#define IS_TYPE_NONVECTOR_STRUCT(ty) ( (ty)->type == TYPESTRUCT && !IS_TYPESTRUCT_VECTOR(TYPE_STRUCT(ty)) )
#define IS_TYPE_MEMBERPOINTER(ty) ( (ty)->type == TYPEMEMBERPOINTER )
@@ -393,6 +425,8 @@ struct TypeList {
#define TYPE_FITS_IN_REGISTER(ty) ( ((ty)->type == TYPEINT) || ((ty)->type == TYPEENUM) || (IS_TYPE_POINTER(ty) && ((ty)->type != TYPEARRAY)) || IS_TYPE_4BYTES_MEMBERPOINTER(ty) )
#define TYPE_IS_8BYTES(ty) ( (((ty)->type == TYPEINT) || ((ty)->type == TYPEENUM)) && ((ty)->size == 8) )
#define TYPE_FITS_IN_REGISTER_2(ty) ( ((ty)->type == TYPEINT) || ((ty)->type == TYPEENUM) || IS_TYPE_POINTER(ty) || IS_TYPE_4BYTES_MEMBERPOINTER(ty) )
#define OBJ_GET_TARGET_VOLATILE(obj) ( IS_TYPE_POINTER((obj)->type) ? (TYPE_POINTER((obj)->type)->qual & Q_VOLATILE) : ((obj)->qual & Q_VOLATILE) )
#define OBJ_GET_TARGET_CONST(obj) ( IS_TYPE_POINTER((obj)->type) ? (TYPE_POINTER((obj)->type)->qual & Q_CONST) : ((obj)->qual & Q_CONST) )