MWCC/includes/compiler/CExpr.h

238 lines
9.0 KiB
C
Raw Normal View History

2022-11-07 03:06:21 +00:00
#ifndef COMPILER_CEXPR_H
#define COMPILER_CEXPR_H
#include "compiler/common.h"
#include "compiler/enode.h"
#include "compiler/types.h"
#include "compiler/CScope.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef struct ConIteratorList {
struct ConIteratorList *next;
struct ConIterator *iter;
} ConIteratorList;
typedef struct ConIterator {
struct ConIterator *parent;
ConIteratorList *children;
TypeClass *tclass;
} ConIterator;
typedef struct ConversionIterator {
CScopeObjectIterator objiter;
ConIterator myconiter;
ConIterator *coniter;
} ConversionIterator;
enum {
CheckResult0,
CheckResult1,
CheckResult2,
CheckResult3,
CheckResult4
};
// Rename me to StdMatch?
typedef struct Match5 {
short x0;
short x2;
short x4;
short x6;
short x8;
} Match5;
typedef struct Match13 {
short x0;
short x2;
short x4;
short x6;
short x8;
short xA;
short xC;
short xE;
Match5 match5;
} Match13;
// CExpr.c
extern Boolean (*name_obj_check)(void *, Object *); // TODO figure out the right type
extern Boolean disallowgreaterthan;
// CExpr2.c
extern ENode *assign_node;
extern Boolean temp_reference_init;
// CExpr.c
extern void CExpr_RewriteConst();
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 *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 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 *unary_expression(void);
extern ENode *do_castnullcheck(ENode *a, ENode *b);
extern void CExpr_SafeClassPointerCast();
extern ENode *PointerToMemberCast(ENode *expr, TypeMemberPointer *tm1, TypeMemberPointer *tm2, Boolean flag);
extern void CExpr_MemberPointerConversion();
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 *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 *assignment_expression(void);
extern ENode *conv_assignment_expression(void);
extern void CExpr_CheckUnusedExpression();
extern void s_expression();
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();
// CExpr2.c
typedef void (*CExprSearchCB)(ENode *expr);
typedef ENode *(*CExprReplaceCB)(ENode *expr);
extern void CExpr_SearchExprTree(ENode *expr, CExprSearchCB callback, int count, ...);
extern ENode *CExpr_SearchExprTreeReplace(ENode *expr, CExprReplaceCB callback, int count, ...);
extern Boolean CExpr_HasFuncCall(ENode *expr);
extern void CExpr_AliasTransform(ENode *expr);
extern ENode *CExpr_UnaryFloatExpression(ENode *expr);
extern ENode *CExpr_BinaryFloatExpression(ENode *expr);
extern ENode *CExpr_NewENode(ENodeType ty);
extern ENode *CExpr_NewTemplDepENode(TemplDepSubType t);
extern ENode *nullnode(void);
extern ENode *intconstnode(Type *type, SInt32 value);
extern ENode *stringconstnode(char *str);
extern ENode *forceintegral(ENode *expr);
extern ENode *makemonadicnode(ENode *inner, ENodeType ty);
extern ENode *makediadicnode(ENode *left, ENode *right, ENodeType ty);
extern ENode *makecommaexpression(ENode *left, ENode *right);
extern short iszero(ENode *expr);
extern short isnotzero(ENode *expr);
extern Boolean CExpr_IsOne(ENode *expr);
extern Boolean CExpr_AllBitsSet(ENode *expr);
extern ENode *CExpr_NewETEMPNode(Type *type, Boolean assign_id);
extern ENode *CExpr_GetETEMPCopy(ENode *expr);
extern ENode *integralpromote(ENode *expr);
extern CInt64 CExpr_IntConstConvert(Type *a, Type *b, CInt64 val);
extern ENode *promote(ENode *expr, Type *type);
extern void CExpr_ArithmeticConversion(ENode **left, ENode **right);
extern ENode *CExpr_TempModifyExpr(ENode *expr);
extern Boolean CExpr_IsLValue(ENode *expr);
extern ENode *CExpr_LValue(ENode *expr, Boolean flag1, Boolean flag2);
extern ENode *CExpr_MakeObjRefNode(Object *obj, Boolean flag);
extern ENode *create_objectrefnode(Object *obj);
extern ENode *create_objectnode2(Object *obj);
extern ENode *create_objectnode(Object *obj);
extern ENode *CExpr_IsTempConstruction(ENode *expr, Type *type, ENode **resultexpr);
extern ENode *CExpr_AdjustFunctionCall(ENode *expr);
extern ENode *funccallexpr(Object *func, ENode *arg1, ENode *arg2, ENode *arg3, ENode *arg4);
extern ENode *CExpr_FuncCallSix(Object *func, ENode *arg1, ENode *arg2, ENode *arg3, ENode *arg4, ENode *arg5, ENode *arg6);
extern void CExpr_MatchCV(Type *t1, UInt32 q1, Type *t2, UInt32 q2, Match13 *match);
extern Boolean CExpr_MatchAssign(Type *type, UInt32 qual, ENode *expr, Match13 *match);
extern ENode *CExpr_ClassPointerCast(BClassList *cls, ENode *expr, Boolean nullcheckflag);
extern ENode *CExpr_GetClassAccessNode(BClassList *a, BClassList *b, ENode *expr, Object *obj, AccessType access, Boolean flag);
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 ENode *CExpr_ConvertToCondition(ENode *expr);
extern void CExpr_ConvertToIntegral();
extern void CExpr_CheckArithmConversion();
extern void get_address_of_temp_copy();
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 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_ConstructObject(TypeClass *tclass, ENode *addr_expr, ENodeList *args, Boolean flag1, Boolean flag2, Boolean flag3, Boolean flag4, Boolean flag5);
extern void scannew();
extern void scandelete();
// CExprConvMatch.c
// static void CExpr_GetImplictObjectParamType();
// static void CExpr_GetParamType();
// static void CExpr_HasNParams();
// static void CExpr_TypeCompare();
// static void CExpr_IsReferenceCompatible();
// static void CExpr_IsBaseOf();
// static void CExpr_IsBetterClassConversion();
// static void CExpr_IsBetterStandardConv();
// static void CExpr_IsBetterImplicitConv();
// static void CExpr_SetupStandardConversionResult();
// static void CExpr_SetQualConversionResult();
// static void CExpr_OverloadFuncMatch();
// static void CExpr_StandardConversionMatch();
// static void CExpr_UserConversion();
// static void CExpr_UserConversionMatch();
// static void CExpr_ImplicitConversionMatch();
extern Boolean CExpr_CanImplicitlyConvert(ENode *expr, Type *type, UInt32 qual);
// static void CExpr_DerivedToBase();
// static void CExpr_ClassReferenceConversion();
// static void CExpr_BindToReference();
extern ENode *CExpr_Convert(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boolean flag2);
extern ENode *CExpr_AssignmentPromotion(ENode *expr, Type *type, UInt32 qual, Boolean flag);
// static void CExpr_IsBetterMatch();
// static void CExpr_MatchArgs();
// static void CExpr_GetMatchObject();
// static void CExpr_FindBestMatch();
extern void CExpr_FuncArgMatch();
// static void CExpr_BuildConversionTypeList();
// static void CExpr_NextPromotedIntegralType();
// static void CExpr_NextArithmeticType();
// static void CExpr_NextPromotedArithmeticType();
// static void CExpr_MatchBuiltin();
// static void CExpr_CheckIncDecBuiltin();
// static void CExpr_CheckUnaryBuiltin();
// static void CExpr_CheckBinaryBuiltin();
// static void CExpr_MatchOperands();
extern void CExpr_CondOperatorMatch();
extern void CExpr_OperatorMatch();
// static void CExpr_ClassCopyInit();
#ifdef __MWERKS__
#pragma options align=reset
#endif
#endif