summaryrefslogtreecommitdiff
path: root/includes/compiler.h
blob: c811e6acb443042ddb2c475f0423b867e86240df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#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 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