type_t.h 19.9 KB
Newer Older
Christian Würdig's avatar
Christian Würdig committed
1
/*
2
 * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
Christian Würdig's avatar
Christian Würdig committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *
 * This file is part of libFirm.
 *
 * This file may be distributed and/or modified under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation and appearing in the file LICENSE.GPL included in the
 * packaging of this file.
 *
 * Licensees holding valid libFirm Professional Edition licenses may use
 * this file in accordance with the libFirm Commercial License.
 * Agreement provided with the Software.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE.
 */

Michael Beck's avatar
Michael Beck committed
20
/**
Matthias Braun's avatar
Matthias Braun committed
21
 * @file
Michael Beck's avatar
Michael Beck committed
22
23
24
 * @brief   Representation of types -- private header.
 * @author  Goetz Lindenmaier, Michael Beck
 * @version $Id$
Matthias Braun's avatar
Matthias Braun committed
25
 * @see     type.h tpop_t.h tpop.h
Michael Beck's avatar
Michael Beck committed
26
 */
Michael Beck's avatar
Michael Beck committed
27
28
#ifndef FIRM_TR_TYPE_T_H
#define FIRM_TR_TYPE_T_H
29

30
#include <stdbool.h>
31
#include "typerep.h"
32
33
#include "tpop_t.h"
#include "irgraph.h"
34
#include "firm_common.h"
35

36
#include "array.h"
Götz Lindenmaier's avatar
Götz Lindenmaier committed
37

38
39
/** Class flags. */
enum class_flags {
Michael Beck's avatar
Michael Beck committed
40
41
42
43
	cf_none            = 0,  /**< No flags. */
	cf_final_class     = 1,  /**< Set if a class is an final class */
	cf_interface_class = 2,  /**< Set if a class is an "interface" */
	cf_absctract_class = 4,  /**< Set if a class is "abstract" */
44
45
};

46
/** Class type attributes. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
47
typedef struct {
Michael Beck's avatar
Michael Beck committed
48
49
50
51
52
53
54
55
	ir_entity  **members;           /**< Array containing the fields and methods of this class. */
	ir_type **subtypes;          /**< Array containing the direct subtypes. */
	ir_type **supertypes;        /**< Array containing the direct supertypes */
	ir_peculiarity peculiarity;  /**< The peculiarity of this class. */
	ir_entity *type_info;        /**< An ir_entity representing this class, used for type info. */
	int      dfn;                /**< A number that can be used for 'instanceof' operator. */
	unsigned vtable_size;        /**< The size of the vtable for this class. */
	unsigned clss_flags;         /**< Additional class flags. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
56
57
} cls_attr;

58
/** Struct type attributes. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
59
typedef struct {
Michael Beck's avatar
Michael Beck committed
60
	ir_entity **members; /**< Fields of this struct. No method entities allowed. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
61
62
} stc_attr;

63
/** A (type, ir_entity) pair. */
64
typedef struct {
65
66
	ir_type   *tp;      /**< A type. */
	ir_entity *ent;     /**< An ir_entity. */
67
68
} tp_ent_pair;

69
/** Method type attributes. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
70
typedef struct {
71
	size_t       n_params;          /**< Number of parameters. */
Michael Beck's avatar
Michael Beck committed
72
	tp_ent_pair *params;            /**< Array of parameter type/value entities pairs. */
73
	size_t       n_res;             /**< Number of results. */
Michael Beck's avatar
Michael Beck committed
74
	tp_ent_pair *res_type;          /**< Array of result type/value ir_entity pairs. */
75
	ir_variadicity variadicity;     /**< The variadicity of the method. */
76
	mtp_additional_properties additional_properties; /**< Set of additional method properties. */
Michael Beck's avatar
Michael Beck committed
77
	unsigned irg_calling_conv;      /**< A set of calling convention flags. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
78
79
} mtd_attr;

80
/** Union type attributes. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
81
typedef struct {
Michael Beck's avatar
Michael Beck committed
82
	ir_entity **members;    /**< Fields of this union. No method entities allowed. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
83
84
} uni_attr;

85
/** Array type attributes. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
86
typedef struct {
87
	size_t  n_dimensions;   /**< Number of array dimensions.  */
Michael Beck's avatar
Michael Beck committed
88
89
	ir_node **lower_bound;  /**< Lower bounds of dimensions.  Usually all 0. */
	ir_node **upper_bound;  /**< Upper bounds or dimensions. */
90
	size_t  *order;         /**< Ordering of dimensions. */
Michael Beck's avatar
Michael Beck committed
91
92
93
	ir_type *element_type;  /**< The type of the array elements. */
	ir_entity *element_ent; /**< entity for the array elements, to be used for
	                             element selection with a Sel node. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
94
95
} arr_attr;

96
97
/** An enumerator constant. */
struct ir_enum_const {
Matthias Braun's avatar
Matthias Braun committed
98
	ir_tarval  *value;  /**< The constants that represents this enumerator identifier. */
Michael Beck's avatar
Michael Beck committed
99
100
	ident   *nameid;    /**< The name of the enumerator identifier. */
	ir_type *owner;     /**< owner type of this enumerator constant. */
101
102
103
};

/** Enum type attributes. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
104
typedef struct {
Michael Beck's avatar
Michael Beck committed
105
106
	ir_enum_const *enumer;   /**< Contains all enumerator constants that represent a member
	                              of the enum -- enumerators. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
107
108
} enm_attr;

109
/** Pointer type attributes. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
110
typedef struct {
Michael Beck's avatar
Michael Beck committed
111
	ir_type *points_to;  /**< The type of the ir_entity the pointer points to. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
112
113
} ptr_attr;

114
115
116
117
/** Primitive type attributes. */
typedef struct {
	ir_type *base_type;  /**< For bitfield types: The base primitive type, NULL else. */
} pri_attr;
Götz Lindenmaier's avatar
a    
Götz Lindenmaier committed
118

Michael Beck's avatar
Michael Beck committed
119
/** General type attributes. */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
120
typedef union {
Michael Beck's avatar
Michael Beck committed
121
122
123
124
125
126
127
	cls_attr ca;      /**< Attributes of a class type */
	stc_attr sa;      /**< Attributes of a struct type */
	mtd_attr ma;      /**< Attributes of a method type */
	uni_attr ua;      /**< Attributes of an union type */
	arr_attr aa;      /**< Attributes of an array type */
	enm_attr ea;      /**< Attributes of an enumeration type */
	ptr_attr pa;      /**< Attributes of a pointer type */
128
	pri_attr ba;      /**< Attributes of a primitive bitfield type */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
129
130
} tp_attr;

131
/** Additional type flags. */
132
enum type_flags {
133
134
135
136
137
138
139
140
141
	tf_none             = 0, /**< No flags. */
	tf_lowered_type     = 1U << 0, /**< Set if this is a lowered type. */
	tf_layout_fixed     = 1U << 1, /**< Set if the layout of a type is fixed */

	tf_frame_type       = 1U << 2, /**< Set if this is a frame type. */
	tf_global_type      = 1U << 3, /**< Set only for the global type */
	tf_tls_type         = 1U << 4, /**< Set only for the tls type */
	tf_constructors     = 1U << 5, /**< Set only for the constructors segment type */
	tf_destructors      = 1U << 6, /**< Set only for the destructors segment type */
142
};
143
ENUM_BITSET(type_flags)
144

145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
 *  An abstract data type to represent types.
 *
 *  This is the abstract data type with which any type known in the
 *  compiled program can be represented.  This includes types specified
 *  in the program as well as types defined by the language.  In the
 *  view of the intermediate representation there is no difference
 *  between these types.
 *
 *  There exist several kinds of types, arranged by the structure of
 *  the type.  These are distinguished by a type opcode.
 *  A type is described by a set of attributes.  Some of these attributes
 *  are common to all types, others depend on the kind of the type.
 */
159
struct ir_type {
Michael Beck's avatar
Michael Beck committed
160
161
162
163
164
	firm_kind kind;          /**< the firm kind, must be k_type */
	const tp_op *type_op;    /**< the type operation of the type */
	ident *name;             /**< The name of the type */
	ir_visibility visibility;/**< Visibility of entities of this type. */
	unsigned flags;          /**< Type flags, a bitmask of enum type_flags. */
165
166
167
168
169
170
171
	unsigned size;           /**< Size of an ir_entity of this type. This is
	                              determined when fixing the layout of this
	                              class.  Size must be given in bytes. */
	unsigned align;          /**< Alignment of an ir_entity of this type. This
	                              should be set according to the source
	                              language needs. If not set, it's calculated
	                              automatically by get_type_alignment().
172
	                              Alignment must be given in bytes. */
Michael Beck's avatar
Michael Beck committed
173
	ir_mode *mode;           /**< The mode for atomic types */
174
	ir_visited_t visit;      /**< visited counter for walks of the type information */
Michael Beck's avatar
Michael Beck committed
175
	void *link;              /**< holds temporary data - like in irnode_t.h */
176
	type_dbg_info *dbi;      /**< A pointer to information for debug support. */
177
178
	ir_type *higher_type;    /**< link to highlevel type in case of lowered
	                              types */
Götz Lindenmaier's avatar
Götz Lindenmaier committed
179

180
#ifdef DEBUG_libfirm
181
182
	long nr;                 /**< An unique node number for each node to make
	                              output readable. */
183
#endif
184
185
	tp_attr attr;            /**< Type kind specific fields. This must be the
	                              last entry in this struct!  Varying size! */
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
186
187
};

Sebastian Felis's avatar
Sebastian Felis committed
188
/**
Michael Beck's avatar
Michael Beck committed
189
 *   Creates a new type representation:
Sebastian Felis's avatar
Sebastian Felis committed
190
 *
191
192
193
 *   @param type_op  the kind of this type.  May not be type_id.
 *   @param mode     the mode to be used for this type, may be NULL
 *   @param db       debug info
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
194
 *
Michael Beck's avatar
Michael Beck committed
195
196
 *   @return A new type of the given type.  The remaining private attributes are not
 *           initialized.  The type is in state layout_undefined.
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
197
 */
198
ir_type *new_type(const tp_op *type_op, ir_mode *mode, type_dbg_info *db);
199
void free_type_attrs(ir_type *tp);
200

Michael Beck's avatar
Michael Beck committed
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
void free_class_entities      (ir_type *clss);
void free_struct_entities     (ir_type *strct);
void free_method_entities     (ir_type *method);
void free_union_entities      (ir_type *uni);
void free_array_entities      (ir_type *array);
void free_enumeration_entities(ir_type *enumeration);
void free_pointer_entities    (ir_type *pointer);

void free_array_automatic_entities(ir_type *array);

void free_class_attrs      (ir_type *clss);
void free_struct_attrs     (ir_type *strct);
void free_method_attrs     (ir_type *method);
void free_union_attrs      (ir_type *uni);
void free_array_attrs      (ir_type *array);
void free_enumeration_attrs(ir_type *enumeration);
void free_pointer_attrs    (ir_type *pointer);

void set_class_mode(ir_type *tp, ir_mode *mode);
void set_struct_mode(ir_type *tp, ir_mode *mode);
void set_pointer_mode(ir_type *tp, ir_mode *mode);
void set_primitive_mode(ir_type *tp, ir_mode *mode);
void set_enumeration_mode(ir_type *tp, ir_mode *mode);

225
226
227
228
229
void set_class_size(ir_type *tp, unsigned bytes);
void set_struct_size(ir_type *tp, unsigned bytes);
void set_union_size(ir_type *tp, unsigned bytes);
void set_array_size(ir_type *tp, unsigned bytes);
void set_default_size(ir_type *tp, unsigned bytes);
Götz Lindenmaier's avatar
new.  
Götz Lindenmaier committed
230

231
232
233
234
235
/** Set and get a class' dfn --
 * This is an undocumented field, subject to change! */
void set_class_dfn(ir_type *clss, int dfn);
int  get_class_dfn(const ir_type *clss);

236
237
void add_compound_member(ir_type *compound, ir_entity *entity);

238
239
240
241
242
/** Initialize the type module. */
void ir_init_type(void);

/** free internal datastructures of type module */
void ir_finish_type(void);
243

244
245
246
247
248
249
250
251
252
/** Clone an existing method type.
 *
 * @param tp      the method type to clone.
 * @param prefix  if non-null, will be the prefix for the name of
 *                the cloned type
 *
 * @return the cloned method type.
 */
ir_type *clone_type_method(ir_type *tp);
253

254
extern ir_visited_t firm_type_visited;
255

256
257
258
259
260
261
262
263
264
265
266
267
268
269
static inline void _set_master_type_visited(ir_visited_t val)
{
	firm_type_visited = val;
}

static inline ir_visited_t _get_master_type_visited(void)
{
	return firm_type_visited;
}

static inline void _inc_master_type_visited(void)
{
	++firm_type_visited;
}
270

271
272
273
274
275
static inline int is_lowered_type(const ir_type *tp)
{
	return tp->flags & tf_lowered_type;
}

276
static inline ir_type *get_higher_type(const ir_type *tp)
277
{
278
	return tp->higher_type;
279
280
}

281
static inline void set_higher_type(ir_type *tp, ir_type *higher_type)
282
{
283
284
	tp->flags |= tf_lowered_type;
	tp->higher_type = higher_type;
285
}
286

287
288
static inline void *_get_type_link(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
289
290
	assert(tp && tp->kind == k_type);
	return(tp -> link);
291
292
}

293
294
static inline void _set_type_link(ir_type *tp, void *l)
{
Michael Beck's avatar
Michael Beck committed
295
296
	assert(tp && tp->kind == k_type);
	tp -> link = l;
297
298
}

299
300
static inline const tp_op *_get_type_tpop(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
301
302
	assert(tp && tp->kind == k_type);
	return tp->type_op;
303
304
}

305
306
static inline ident *_get_type_tpop_nameid(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
307
308
	assert(tp && tp->kind == k_type);
	return get_tpop_ident(tp->type_op);
309
310
}

311
312
static inline tp_opcode _get_type_tpop_code(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
313
314
	assert(tp && tp->kind == k_type);
	return get_tpop_code(tp->type_op);
315
316
}

317
318
static inline ir_mode *_get_type_mode(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
319
320
	assert(tp && tp->kind == k_type);
	return tp->mode;
321
322
}

323
324
static inline unsigned _get_type_size_bytes(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
325
326
	assert(tp && tp->kind == k_type);
	return tp->size;
327
328
}

329
330
static inline ir_type_state _get_type_state(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
331
332
	assert(tp && tp->kind == k_type);
	return tp->flags & tf_layout_fixed ? layout_fixed : layout_undefined;
333
334
}

335
336
static inline ir_visited_t _get_type_visited(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
337
338
	assert(tp && tp->kind == k_type);
	return tp->visit;
339
340
}

341
342
static inline void _set_type_visited(ir_type *tp, ir_visited_t num)
{
Michael Beck's avatar
Michael Beck committed
343
344
	assert(tp && tp->kind == k_type);
	tp->visit = num;
345
346
}

347
348
static inline void _mark_type_visited(ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
349
350
351
	assert(tp && tp->kind == k_type);
	assert(tp->visit < firm_type_visited);
	tp->visit = firm_type_visited;
352
353
}

354
355
static inline int _type_visited(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
356
357
	assert(tp && tp->kind == k_type);
	return tp->visit >= firm_type_visited;
358
359
}

360
361
static inline int _type_not_visited(const ir_type *tp)
{
Michael Beck's avatar
Michael Beck committed
362
363
	assert(tp && tp->kind == k_type);
	return tp->visit  < firm_type_visited;
364
365
}

366
367
static inline type_dbg_info *_get_type_dbg_info(const ir_type *tp)
{
368
369
370
	return tp->dbi;
}

371
372
static inline void _set_type_dbg_info(ir_type *tp, type_dbg_info *db)
{
373
374
375
	tp->dbi = db;
}

376
377
static inline int _is_type(const void *thing)
{
378
	return get_kind(thing) == k_type;
379
380
}

381
382
static inline int _is_class_type(const ir_type *clss)
{
383
	return clss->type_op == type_class;
384
385
}

386
static inline size_t _get_class_n_members(const ir_type *clss)
387
{
388
389
	assert(clss->type_op == type_class);
	return ARR_LEN(clss->attr.ca.members);
Götz Lindenmaier's avatar
Götz Lindenmaier committed
390
391
}

392
static inline ir_entity *_get_class_member(const ir_type *clss, size_t pos)
393
{
394
395
	assert(clss->type_op == type_class);
	assert(pos < _get_class_n_members(clss));
Michael Beck's avatar
Michael Beck committed
396
	return clss->attr.ca.members[pos];
Götz Lindenmaier's avatar
Götz Lindenmaier committed
397
398
}

399
400
static inline unsigned _get_class_vtable_size(const ir_type *clss)
{
401
	assert(clss->type_op == type_class);
Michael Beck's avatar
Michael Beck committed
402
	return clss->attr.ca.vtable_size;
403
404
}

405
406
static inline void _set_class_vtable_size(ir_type *clss, unsigned vtable_size)
{
407
	assert(clss->type_op == type_class);
Michael Beck's avatar
Michael Beck committed
408
	clss->attr.ca.vtable_size = vtable_size;
409
410
}

411
412
static inline int _is_class_final(const ir_type *clss)
{
413
	assert(clss->type_op == type_class);
Michael Beck's avatar
Michael Beck committed
414
	return clss->attr.ca.clss_flags & cf_final_class;
415
416
}

417
418
static inline void _set_class_final(ir_type *clss, int final)
{
419
	assert(clss->type_op == type_class);
Michael Beck's avatar
Michael Beck committed
420
421
422
423
	if (final)
		clss->attr.ca.clss_flags |= cf_final_class;
	else
		clss->attr.ca.clss_flags &= ~cf_final_class;
424
425
}

426
427
static inline int _is_class_interface(const ir_type *clss)
{
428
	assert(clss->type_op == type_class);
Michael Beck's avatar
Michael Beck committed
429
	return clss->attr.ca.clss_flags & cf_interface_class;
430
431
}

432
433
static inline void _set_class_interface(ir_type *clss, int final)
{
434
	assert(clss->type_op == type_class);
Michael Beck's avatar
Michael Beck committed
435
436
437
438
	if (final)
		clss->attr.ca.clss_flags |= cf_interface_class;
	else
		clss->attr.ca.clss_flags &= ~cf_interface_class;
439
440
}

441
442
static inline int _is_class_abstract(const ir_type *clss)
{
443
	assert(clss->type_op == type_class);
Michael Beck's avatar
Michael Beck committed
444
	return clss->attr.ca.clss_flags & cf_absctract_class;
445
}
446

447
448
static inline void _set_class_abstract(ir_type *clss, int final)
{
449
	assert(clss->type_op == type_class);
Michael Beck's avatar
Michael Beck committed
450
451
452
453
	if (final)
		clss->attr.ca.clss_flags |= cf_absctract_class;
	else
		clss->attr.ca.clss_flags &= ~cf_absctract_class;
454
455
}

456
457
static inline int _is_struct_type(const ir_type *strct)
{
Michael Beck's avatar
Michael Beck committed
458
	return (strct->type_op == type_struct);
459
460
}

461
462
static inline int _is_method_type(const ir_type *method)
{
Michael Beck's avatar
Michael Beck committed
463
	return (method->type_op == type_method);
464
465
}

466
467
static inline int _is_union_type(const ir_type *uni)
{
Michael Beck's avatar
Michael Beck committed
468
	return (uni->type_op == type_union);
469
470
}

471
472
static inline int _is_array_type(const ir_type *array)
{
Michael Beck's avatar
Michael Beck committed
473
	return (array->type_op == type_array);
474
475
}

476
477
static inline int _is_enumeration_type(const ir_type *enumeration)
{
Michael Beck's avatar
Michael Beck committed
478
	return (enumeration->type_op == type_enumeration);
479
480
}

481
482
static inline int _is_pointer_type(const ir_type *pointer)
{
Michael Beck's avatar
Michael Beck committed
483
	return (pointer->type_op == type_pointer);
484
485
486
}

/** Returns true if a type is a primitive type. */
487
488
static inline int _is_primitive_type(const ir_type *primitive)
{
489
	assert(primitive->kind == k_type);
Michael Beck's avatar
Michael Beck committed
490
	return (primitive->type_op == type_primitive);
491
492
}

493
494
static inline int _is_atomic_type(const ir_type *tp)
{
495
	assert(tp->kind == k_type);
Michael Beck's avatar
Michael Beck committed
496
497
	return (_is_primitive_type(tp) || _is_pointer_type(tp) ||
	        _is_enumeration_type(tp));
498
499
}

500
static inline size_t _get_method_n_params(const ir_type *method)
501
{
502
	assert(method->type_op == type_method);
Michael Beck's avatar
Michael Beck committed
503
	return method->attr.ma.n_params;
504
505
}

506
static inline size_t _get_method_n_ress(const ir_type *method)
507
{
508
	assert(method->type_op == type_method);
Michael Beck's avatar
Michael Beck committed
509
	return method->attr.ma.n_res;
510
511
}

512
static inline mtp_additional_properties _get_method_additional_properties(const ir_type *method)
513
{
514
	assert(method->type_op == type_method);
Michael Beck's avatar
Michael Beck committed
515
	return method->attr.ma.additional_properties;
516
517
}

518
static inline void _set_method_additional_properties(ir_type *method, mtp_additional_properties mask)
519
{
520
	assert(method->type_op == type_method);
521

Michael Beck's avatar
Michael Beck committed
522
523
524
	/* do not allow to set the mtp_property_inherited flag or
	 * the automatic inheritance of flags will not work */
	method->attr.ma.additional_properties = mask & ~mtp_property_inherited;
525
526
}

527
static inline void _add_method_additional_properties(ir_type *method, mtp_additional_properties flag)
528
{
529
	assert(method->type_op == type_method);
530

Michael Beck's avatar
Michael Beck committed
531
532
533
	/* do not allow to set the mtp_property_inherited flag or
	 * the automatic inheritance of flags will not work */
	method->attr.ma.additional_properties |= flag & ~mtp_property_inherited;
534
535
}

536
537
static inline unsigned _get_method_calling_convention(const ir_type *method)
{
538
	assert(method->type_op == type_method);
Michael Beck's avatar
Michael Beck committed
539
	return method->attr.ma.irg_calling_conv;
540
541
}

542
543
static inline void _set_method_calling_convention(ir_type *method, unsigned cc_mask)
{
544
	assert(method->type_op == type_method);
Michael Beck's avatar
Michael Beck committed
545
	method->attr.ma.irg_calling_conv = cc_mask;
546
}
547

548

549
550
551
552
553
554
555
556
557
#define set_master_type_visited(val)      _set_master_type_visited(val)
#define get_master_type_visited()         _get_master_type_visited()
#define inc_master_type_visited()         _inc_master_type_visited()
#define get_type_link(tp)                 _get_type_link(tp)
#define set_type_link(tp, l)              _set_type_link(tp, l)
#define get_type_tpop(tp)                 _get_type_tpop(tp)
#define get_type_tpop_nameid(tp)          _get_type_tpop_nameid(tp)
#define get_type_tpop_code(tp)            _get_type_tpop_code(tp)
#define get_type_mode(tp)                 _get_type_mode(tp)
558
#define get_type_size_bytes(tp)           _get_type_size_bytes(tp)
559
560
561
562
563
564
#define get_type_state(tp)                _get_type_state(tp)
#define get_type_visited(tp)              _get_type_visited(tp)
#define set_type_visited(tp, num)         _set_type_visited(tp, num)
#define mark_type_visited(tp)             _mark_type_visited(tp)
#define type_visited(tp)                  _type_visited(tp)
#define type_not_visited(tp)              _type_not_visited(tp)
565
566
#define get_type_dbg_info(tp)             _get_type_dbg_info(tp)
#define set_type_dbg_info(tp, db)         _set_type_dbg_info(tp, db)
567
568
569
570
#define is_type(thing)                    _is_type(thing)
#define is_Class_type(clss)               _is_class_type(clss)
#define get_class_n_members(clss)         _get_class_n_members(clss)
#define get_class_member(clss, pos)       _get_class_member(clss, pos)
571
572
#define get_class_vtable_size(clss)       _get_class_vtable_size(clss)
#define set_class_vtable_size(clss, size) _set_class_vtable_size(clss, size)
573
#define is_class_final(clss)              _is_class_final(clss)
574
575
576
577
578
#define set_class_final(clss, flag)       _set_class_final(clss, flag)
#define is_class_interface(clss)          _is_class_interface(clss)
#define set_class_interface(clss, flag)   _set_class_interface(clss, flag)
#define is_class_abstract(clss)           _is_class_abstract(clss)
#define set_class_abstract(clss, flag)    _set_class_abstract(clss, flag)
579
580
581
582
583
584
585
#define is_Struct_type(strct)             _is_struct_type(strct)
#define is_Method_type(method)            _is_method_type(method)
#define is_Union_type(uni)                _is_union_type(uni)
#define is_Array_type(array)              _is_array_type(array)
#define is_Enumeration_type(enumeration)  _is_enumeration_type(enumeration)
#define is_Pointer_type(pointer)          _is_pointer_type(pointer)
#define is_Primitive_type(primitive)      _is_primitive_type(primitive)
586
#define is_atomic_type(tp)                _is_atomic_type(tp)
587
588
#define get_method_n_params(method)       _get_method_n_params(method)
#define get_method_n_ress(method)         _get_method_n_ress(method)
589
590
#define get_method_additional_properties(method)        _get_method_additional_properties(method)
#define set_method_additional_properties(method, mask)  _set_method_additional_properties(method, mask)
591
#define add_method_additional_properties(method, flag)  _add_method_additional_properties(method, flag)
592
593
#define get_method_calling_convention(method)           _get_method_calling_convention(method)
#define set_method_calling_convention(method, cc_mask)  _set_method_calling_convention(method, cc_mask)
594

Michael Beck's avatar
Michael Beck committed
595
#endif /* FIRM_TR_TYPE_T_H */