mirror of https://git.wuffs.org/MWCC
273 lines
8.1 KiB
C
273 lines
8.1 KiB
C
#include "compiler/common.h"
|
|
|
|
// THESE TYPES ARE NOT YET SORTED
|
|
#include "compiler/tokens.h"
|
|
#include "compiler/CompilerTools.h"
|
|
|
|
#ifdef __MWERKS__
|
|
#pragma options align=mac68k
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
struct DefArgCtorInfo {
|
|
Object *default_func;
|
|
ENode *default_arg;
|
|
};
|
|
|
|
typedef struct XRefOffset {
|
|
UInt32 xrefoffset;
|
|
SInt32 offset;
|
|
} XRefOffset;
|
|
|
|
struct InlineXRef {
|
|
InlineXRef *next;
|
|
Object *object;
|
|
UInt16 xrefmode;
|
|
UInt16 numxrefs;
|
|
XRefOffset xref[1];
|
|
};
|
|
|
|
|
|
|
|
|
|
struct MemInitializer {
|
|
MemInitializer *next;
|
|
union {
|
|
ENodeList *nodes;
|
|
ENode *expr;
|
|
} e;
|
|
union {
|
|
ObjMemberVar *ivar;
|
|
Type *type;
|
|
} u;
|
|
Boolean is_ivar;
|
|
Boolean is_expr;
|
|
};
|
|
|
|
|
|
typedef enum DepNameType {
|
|
DNT_NAME,
|
|
DNT_CONVERSION,
|
|
DNT_DTOR,
|
|
DNT_NAMESPACE,
|
|
DNT_QUALNAME,
|
|
DNT_TEMPLATE,
|
|
DNT_TYPENAME
|
|
} DepNameType;
|
|
|
|
struct DepName {
|
|
DepName *next;
|
|
union {
|
|
HashNameNode *name;
|
|
NameSpace *nspace;
|
|
struct {
|
|
Type *type;
|
|
UInt32 qual;
|
|
} conv;
|
|
struct {
|
|
HashNameNode *name;
|
|
TemplArg *args;
|
|
} templ;
|
|
struct {
|
|
HashNameNode *name;
|
|
Type *type;
|
|
} tname;
|
|
} u;
|
|
DepNameType type;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum SubKind {
|
|
SUBKIND_NAMESPACE,
|
|
SUBKIND_TYPE,
|
|
SUBKIND_OBJECT
|
|
} SubKind;
|
|
|
|
typedef struct Substitution {
|
|
struct Substitution *next;
|
|
union {
|
|
NameSpace *nspace;
|
|
struct {
|
|
Type *type;
|
|
UInt32 qual;
|
|
} type;
|
|
Object *obj;
|
|
} u;
|
|
int id;
|
|
SubKind kind;
|
|
} Substitution;
|
|
|
|
// Registers.c
|
|
|
|
// RegisterInfo.c
|
|
|
|
// LOOSE DECLS
|
|
extern short high_offset;
|
|
extern short low_offset;
|
|
extern short high_reg;
|
|
extern short low_reg;
|
|
extern short high_reg2;
|
|
extern short low_reg2;
|
|
extern void PrecompilerRead(short refnum, void *buffer);
|
|
extern void PrecompilerWrite();
|
|
extern void CodeGen_InitCompiler();
|
|
extern void CodeGen_TermCompiler();
|
|
extern void CodeGen_InitBackEndOptions();
|
|
extern void CodeGen_UpdateOptimizerOptions();
|
|
extern void CodeGen_UpdateBackEndOptions();
|
|
extern void MWUnmangle(const char *name, char *buf, int size);
|
|
//extern COpts copts;
|
|
extern CParams *cparamblkptr;
|
|
extern FuncArg elipsis;
|
|
extern FuncArg oldstyle;
|
|
extern jmp_buf errorreturn;
|
|
extern Boolean cprep_nomem_exit;
|
|
extern Boolean anyerrors;
|
|
extern Boolean fatalerrors;
|
|
extern SInt32 lines;
|
|
extern char string[256];
|
|
extern TemplStack *ctempl_curinstance;
|
|
//extern ParserTryBlock *trychain;
|
|
extern Boolean in_assembler;
|
|
extern Boolean preprocessing_only;
|
|
extern void AssemblerError();
|
|
#include "compiler/types.h"
|
|
extern short tk;
|
|
extern HashNameNode *tkidentifier;
|
|
extern short lex();
|
|
extern short notendofline();
|
|
extern short lookahead();
|
|
extern Object *CClass_Constructor(TypeClass *tclass);
|
|
extern Object *CClass_Destructor(TypeClass *tclass);
|
|
extern int CClass_CheckPures(TypeClass *tclass);
|
|
extern Boolean CClass_IsConstructor(Object *func);
|
|
extern short CABI_GetStructResultArgumentIndex();
|
|
extern Boolean CParser_HasInternalLinkage(Object *obj);
|
|
extern HashNameNode *CParser_GetUniqueName();
|
|
extern SInt32 CParser_GetUniqueID();
|
|
extern Boolean CParserIsVolatileExpr(ENode *expr);
|
|
extern Boolean CParserIsConstExpr(ENode *expr);
|
|
extern Boolean CParser_IsPublicRuntimeObject(Object *obj);
|
|
extern Boolean CParser_ParseOperatorName(short *token, Boolean flag1, Boolean flag2);
|
|
extern Boolean CTemplTool_EqualArgs(TemplArg *a, TemplArg *b);
|
|
extern Boolean CTemplTool_IsTemplateArgumentDependentType(Type *type);
|
|
extern TypeTemplDep *CDecl_NewTemplDepType(TypeTemplDepType tdtype);
|
|
extern Type *CDecl_NewPointerType(Type *type);
|
|
extern Type *CDecl_NewStructType(SInt32 size, SInt32 align);
|
|
extern Type *CDecl_NewArrayType(Type *type, SInt32 num);
|
|
extern GList name_mangle_list;
|
|
extern void CPrep_UnLex();
|
|
extern Type *CTempl_ClassGetType(TypeClass *tclass);
|
|
//extern short is_typesame(Type *t1, Type *t2);
|
|
extern Boolean is_unsigned(Type *type);
|
|
extern void CDecl_CompleteType(Type *type);
|
|
extern TemplArg *CTempl_ParseUncheckTemplArgs(void *fixmelater, Boolean flag);
|
|
extern SInt32 CClass_VirtualBaseOffset(TypeClass *tclass, TypeClass *base);
|
|
extern Boolean CClass_IsMoreAccessiblePath(BClassList *a, BClassList *b);
|
|
extern Boolean CClass_ClassDominates(TypeClass *a, TypeClass *b);
|
|
extern Boolean CParser_CheckTemplateClassUsage(TemplClass *tmclass, Boolean flag);
|
|
extern Type *CTempl_ParseTemplTemplParam(Type *t);
|
|
extern void CClass_CheckPathAccess(BClassList *bcl, void *unk, AccessType access);
|
|
extern BClassList *CClass_GetPathCopy(BClassList *path, Boolean flag);
|
|
extern Object *CClass_ThisSelfObject();
|
|
extern AccessType global_access;
|
|
extern HashNameNode *this_name_node;
|
|
extern void CParser_Setup();
|
|
extern Boolean CParser_IsConst(Type *type, UInt32 qual);
|
|
extern void CParser_Cleanup();
|
|
extern void SetupPrecompiler(Boolean flag);
|
|
extern void CleanupPrecompiler();
|
|
extern void SetupAssembler();
|
|
extern void CleanupAssembler();
|
|
extern void ObjGen_Setup();
|
|
extern void ObjGen_Finish();
|
|
extern void ObjGen_Cleanup();
|
|
extern void ObjGen_CodeCleanup();
|
|
extern void ObjGen_DeclareFloatConst(Object *obj);
|
|
extern void ObjGen_DeclareVectorConst(Object *obj);
|
|
extern void ObjGen_DeclareCodeLabel(Object *labelobj, SInt32 offset, Object *funcobj);
|
|
extern Boolean ObjGen_IsExported(Object *obj);
|
|
extern void PointerAnalysis_Setup();
|
|
extern void PointerAnalysis_Cleanup();
|
|
extern Boolean CPrep_Preprocess();
|
|
extern void cparser();
|
|
extern void CBrowse_Setup(CParams *param);
|
|
extern void CBrowse_Finish(CParams *param);
|
|
extern void CBrowse_Cleanup(CParams *param);
|
|
extern UInt32 CParser_GetTypeQualifiers(Type *type, UInt32 qual);
|
|
extern void CTemplClass_RegisterUsingDecl(TemplClass *tclass, Type *target, AccessType access);
|
|
extern void CodeGen_InsertSpecialMacros();
|
|
extern void CPrep_PreprocessDumpFileInfo(Boolean flag);
|
|
extern void CPrep_PreprocessDumpNewLine();
|
|
extern Boolean gForceSourceLoc;
|
|
extern void ObjGen_SegmentName(); // might take an arg, not sure since it's empty
|
|
extern void ObjGen_SrcBreakName(HashNameNode *name, SInt32 modDate, Boolean flag);
|
|
extern char *precomp_target_str;
|
|
extern Object *CParser_ParseObject();
|
|
extern void PointerAnalysis_PragmaMode();
|
|
extern void CExcept_Terminate();
|
|
extern void CExcept_ArrayInit();
|
|
extern void CExcept_Magic();
|
|
extern void CSOM_PragmaReleaseOrder();
|
|
extern void CSOM_PragmaClassVersion();
|
|
extern void CSOM_PragmaMetaClass();
|
|
extern void CSOM_PragmaCallStyle();
|
|
extern short GetPrec(short t);
|
|
extern short localcount;
|
|
extern Boolean InlineAsm_gccmode;
|
|
extern void initialize_aliases();
|
|
extern Statement *current_statement;
|
|
extern int pclist_bad_operand;
|
|
extern int n_real_registers[];
|
|
extern short pic_base_reg;
|
|
extern Object pic_base;
|
|
extern ObjectList *exceptionlist;
|
|
extern ObjectList *arguments;
|
|
extern ObjectList *locals;
|
|
extern ObjectList *toclist;
|
|
extern Boolean uses_globals;
|
|
extern Boolean requires_frame;
|
|
extern void assign_locals_to_memory(ObjectList *locals);
|
|
extern PCodeLabel *pic_base_pcodelabel;
|
|
extern void *make_alias(Object *obj, SInt32 offset, SInt32 size);
|
|
extern Boolean is_volatile_object(Object *obj);
|
|
extern Boolean is_pascal_object(Object *obj);
|
|
extern Boolean local_is_16bit_offset(Object *obj);
|
|
extern Boolean can_add_displ_to_local(Object *obj, SInt32 displ);
|
|
extern int local_base_register(Object *obj);
|
|
extern int disable_optimizer;
|
|
extern Boolean IsTempName(HashNameNode *name);
|
|
extern void assign_local_memory(Object *obj);
|
|
extern void move_varargs_to_memory();
|
|
extern Type stvoid;
|
|
extern TypePointer void_ptr;
|
|
extern int countexceptionactionregisters(ExceptionAction *exc);
|
|
extern void noteexceptionactionregisters(ExceptionAction *exc, PCodeArg *);
|
|
extern void recordexceptionactions(PCode *pc, ExceptionAction *exc);
|
|
extern SInt32 functionbodyoffset;
|
|
extern Object *CParser_NewRTFunc(Type *returntype, HashNameNode *name, Boolean unkflag, int argcount, ...);
|
|
extern SInt32 curstmtvalue;
|
|
extern Object *__memcpy_object;
|
|
extern void CInit_RewriteString(ENode *expr, Boolean flag);
|
|
extern int is_intrinsic_function_call(ENode *expr);
|
|
extern SInt32 I8_log2n(SInt64 value);
|
|
extern void PPCError_Error(int code);
|
|
|
|
enum {
|
|
INTRINSIC_8 = 8,
|
|
INTRINSIC_35 = 35,
|
|
INTRINSIC_36 = 36
|
|
};
|
|
|
|
extern char *ScanFloat(char *input, double *output, Boolean *fail);
|
|
|
|
#ifdef __MWERKS__
|
|
#pragma options align=reset
|
|
#endif
|