libFirm
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
irgraph.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
3
*
4
* This file is part of libFirm.
5
*
6
* This file may be distributed and/or modified under the terms of the
7
* GNU General Public License version 2 as published by the Free Software
8
* Foundation and appearing in the file LICENSE.GPL included in the
9
* packaging of this file.
10
*
11
* Licensees holding valid libFirm Professional Edition licenses may use
12
* this file in accordance with the libFirm Commercial License.
13
* Agreement provided with the Software.
14
*
15
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
* PURPOSE.
18
*/
19
25
#ifndef FIRM_IR_IRGRAPH_H
26
#define FIRM_IR_IRGRAPH_H
27
28
#include <stddef.h>
29
30
#include "
firm_types.h
"
31
#include "
begin.h
"
32
149
FIRM_API
ir_graph
*
new_ir_graph
(
ir_entity
*ent,
int
n_loc);
150
159
FIRM_API
void
free_ir_graph
(
ir_graph
*irg);
160
169
FIRM_API
int
is_ir_graph
(
const
void
*thing);
170
172
FIRM_API
ir_entity
*
get_irg_entity
(
const
ir_graph
*irg);
174
FIRM_API
void
set_irg_entity
(
ir_graph
*irg,
ir_entity
*ent);
175
177
FIRM_API
ir_type
*
get_irg_frame_type
(
ir_graph
*irg);
179
FIRM_API
void
set_irg_frame_type
(
ir_graph
*irg,
ir_type
*ftp);
180
182
FIRM_API
ir_node
*
get_irg_start_block
(
const
ir_graph
*irg);
184
FIRM_API
void
set_irg_start_block
(
ir_graph
*irg,
ir_node
*node);
185
187
FIRM_API
ir_node
*
get_irg_start
(
const
ir_graph
*irg);
189
FIRM_API
void
set_irg_start
(
ir_graph
*irg,
ir_node
*node);
190
192
FIRM_API
ir_node
*
get_irg_end_block
(
const
ir_graph
*irg);
194
FIRM_API
void
set_irg_end_block
(
ir_graph
*irg,
ir_node
*node);
195
197
FIRM_API
ir_node
*
get_irg_end
(
const
ir_graph
*irg);
199
FIRM_API
void
set_irg_end
(
ir_graph
*irg,
ir_node
*node);
200
203
FIRM_API
ir_node
*
get_irg_initial_exec
(
const
ir_graph
*irg);
205
FIRM_API
void
set_irg_initial_exec
(
ir_graph
*irg,
ir_node
*node);
206
208
FIRM_API
ir_node
*
get_irg_frame
(
const
ir_graph
*irg);
210
FIRM_API
void
set_irg_frame
(
ir_graph
*irg,
ir_node
*node);
211
213
FIRM_API
ir_node
*
get_irg_initial_mem
(
const
ir_graph
*irg);
215
FIRM_API
void
set_irg_initial_mem
(
ir_graph
*irg,
ir_node
*node);
216
218
FIRM_API
ir_node
*
get_irg_args
(
const
ir_graph
*irg);
220
FIRM_API
void
set_irg_args
(
ir_graph
*irg,
ir_node
*node);
221
223
FIRM_API
ir_node
*
get_irg_no_mem
(
const
ir_graph
*irg);
225
FIRM_API
void
set_irg_no_mem
(
ir_graph
*irg,
ir_node
*node);
226
228
FIRM_API
int
get_irg_n_locs
(
ir_graph
*irg);
229
231
FIRM_API
long
get_irg_graph_nr
(
const
ir_graph
*irg);
232
238
FIRM_API
size_t
get_irg_idx
(
const
ir_graph
*irg);
239
249
FIRM_API
ir_node
*
get_idx_irn
(
const
ir_graph
*irg,
unsigned
idx);
250
258
FIRM_API
op_pin_state
get_irg_pinned
(
const
ir_graph
*irg);
259
267
typedef
enum
{
268
irg_callee_info_none,
269
irg_callee_info_consistent,
270
irg_callee_info_inconsistent
271
}
irg_callee_info_state
;
272
274
FIRM_API
irg_callee_info_state
get_irg_callee_info_state
(
const
ir_graph
*irg);
275
277
FIRM_API
void
set_irg_callee_info_state
(
ir_graph
*irg,
irg_callee_info_state
s);
278
280
FIRM_API
void
set_irg_link
(
ir_graph
*irg,
void
*thing);
282
FIRM_API
void
*
get_irg_link
(
const
ir_graph
*irg);
283
286
FIRM_API
void
inc_irg_visited
(
ir_graph
*irg);
289
FIRM_API
ir_visited_t
get_irg_visited
(
const
ir_graph
*irg);
292
FIRM_API
void
set_irg_visited
(
ir_graph
*irg,
ir_visited_t
i);
295
FIRM_API
ir_visited_t
get_max_irg_visited
(
void
);
298
FIRM_API
void
set_max_irg_visited
(
int
val);
301
FIRM_API
ir_visited_t
inc_max_irg_visited
(
void
);
302
305
FIRM_API
void
inc_irg_block_visited
(
ir_graph
*irg);
308
FIRM_API
ir_visited_t
get_irg_block_visited
(
const
ir_graph
*irg);
311
FIRM_API
void
set_irg_block_visited
(
ir_graph
*irg,
ir_visited_t
i);
312
318
typedef
enum
ir_resources_t
{
319
IR_RESOURCE_NONE
= 0,
320
IR_RESOURCE_BLOCK_VISITED
= 1 << 0,
321
IR_RESOURCE_BLOCK_MARK
= 1 << 1,
322
IR_RESOURCE_IRN_VISITED
= 1 << 2,
323
IR_RESOURCE_IRN_LINK
= 1 << 3,
324
IR_RESOURCE_LOOP_LINK
= 1 << 4,
325
IR_RESOURCE_PHI_LIST
= 1 << 5
326
}
ir_resources_t
;
327
ENUM_BITSET
(
ir_resources_t
)
328
329
#ifndef NDEBUG
330
337
FIRM_API
void
ir_reserve_resources
(
ir_graph
*irg,
ir_resources_t
resources);
339
FIRM_API
void
ir_free_resources
(
ir_graph
*irg,
ir_resources_t
resources);
341
FIRM_API
ir_resources_t
ir_resources_reserved
(
const
ir_graph
*irg);
342
#else
343
#define ir_reserve_resources(irg,resources) (void)0
344
#define ir_free_resources(irg,resources) (void)0
345
#define ir_resources_reserved(irg) 0
346
#endif
347
354
typedef
enum
ir_graph_constraints_t
{
358
IR_GRAPH_CONSTRAINT_ARCH_DEP
= 1U << 0,
363
IR_GRAPH_CONSTRAINT_MODEB_LOWERED
= 1U << 1,
369
IR_GRAPH_CONSTRAINT_NORMALISATION2
= 1U << 2,
375
IR_GRAPH_CONSTRAINT_OPTIMIZE_UNREACHABLE_CODE
= 1U << 3,
381
IR_GRAPH_CONSTRAINT_CONSTRUCTION
= 1U << 4,
386
IR_GRAPH_CONSTRAINT_TARGET_LOWERED
= 1U << 5,
391
IR_GRAPH_CONSTRAINT_BACKEND
= 1U << 6,
392
}
ir_graph_constraints_t
;
393
ENUM_BITSET
(
ir_graph_constraints_t
)
394
395
396
FIRM_API
void
add_irg_constraints
(
ir_graph
*irg,
397
ir_graph_constraints_t
constraints);
399
FIRM_API
void
clear_irg_constraints
(
ir_graph
*irg,
400
ir_graph_constraints_t
constraints);
402
FIRM_API
int
irg_is_constrained
(const
ir_graph
*irg,
403
ir_graph_constraints_t
constraints);
404
410
typedef enum
ir_graph_properties_t
{
411
IR_GRAPH_PROPERTIES_NONE = 0,
413
IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES
= 1U << 0,
415
IR_GRAPH_PROPERTY_NO_BADS
= 1U << 1,
417
IR_GRAPH_PROPERTY_NO_TUPLES
= 1U << 2,
423
IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE
= 1U << 3,
425
IR_GRAPH_PROPERTY_ONE_RETURN
= 1U << 4,
427
IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE
= 1U << 5,
429
IR_GRAPH_PROPERTY_CONSISTENT_POSTDOMINANCE
= 1U << 6,
431
IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE_FRONTIERS
= 1U << 7,
436
IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES
= 1U << 8,
438
IR_GRAPH_PROPERTY_CONSISTENT_OUTS
= 1U << 9,
440
IR_GRAPH_PROPERTY_CONSISTENT_LOOPINFO
= 1U << 10,
442
IR_GRAPH_PROPERTY_CONSISTENT_ENTITY_USAGE
= 1U << 11,
444
IR_GRAPH_PROPERTY_MANY_RETURNS
= 1U << 12,
445
450
IR_GRAPH_PROPERTIES_CONTROL_FLOW
=
451
IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES
452
|
IR_GRAPH_PROPERTY_ONE_RETURN
453
|
IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE
454
|
IR_GRAPH_PROPERTY_CONSISTENT_LOOPINFO
455
|
IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE
456
|
IR_GRAPH_PROPERTY_CONSISTENT_POSTDOMINANCE
457
|
IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE_FRONTIERS
,
458
462
IR_GRAPH_PROPERTIES_ALL
=
463
IR_GRAPH_PROPERTIES_CONTROL_FLOW
464
|
IR_GRAPH_PROPERTY_NO_BADS
465
|
IR_GRAPH_PROPERTY_NO_TUPLES
466
|
IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES
467
|
IR_GRAPH_PROPERTY_CONSISTENT_OUTS
468
|
IR_GRAPH_PROPERTY_CONSISTENT_ENTITY_USAGE
469
|
IR_GRAPH_PROPERTY_MANY_RETURNS
,
470
471
}
ir_graph_properties_t
;
472
ENUM_BITSET
(
ir_graph_properties_t
)
473
474
475
FIRM_API
void
add_irg_properties
(
ir_graph
*irg,
ir_graph_properties_t
props);
477
FIRM_API
void
clear_irg_properties
(
ir_graph
*irg,
ir_graph_properties_t
props);
479
FIRM_API
int
irg_has_properties
(const
ir_graph
*irg,
480
ir_graph_properties_t
props);
481
483
FIRM_API
void
set_irg_loc_description
(
ir_graph
*irg,
int
n,
void
*description);
484
486
FIRM_API
void
*
get_irg_loc_description
(
ir_graph
*irg,
int
n);
487
491
FIRM_API
unsigned
get_irg_estimated_node_cnt
(const
ir_graph
*irg);
492
494
FIRM_API
unsigned
get_irg_last_idx
(const
ir_graph
*irg);
495
497
FIRM_API
unsigned
get_irg_fp_model
(const
ir_graph
*irg);
498
500
FIRM_API
void
set_irg_fp_model
(
ir_graph
*irg,
unsigned
model);
501
506
FIRM_API
void
assure_irg_properties
(
ir_graph
*irg,
ir_graph_properties_t
props);
507
513
FIRM_API
void
confirm_irg_properties
(
ir_graph
*irg,
ir_graph_properties_t
props);
514
524
#define get_irg_data(graph,type,off) \
525
(assert(off > 0 && "Invalid graph data offset"), (type *) ((char *) (graph) - (off)))
526
533
#define get_irg_data_base(data,off) \
534
(assert(off > 0 && "Invalid graph data offset"), (ir_graph *) ((char *) (data) + (off)))
535
543
FIRM_API
size_t
register_additional_graph_data
(
size_t
size);
544
547
#include "
end.h
"
548
549
#endif
libfirm
irgraph.h
Generated on Sat Nov 24 2012 19:13:48 for libFirm by
1.8.1.2