2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief common firm declarations
9 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
11 #ifndef FIRM_COMMON_FIRM_COMMON_H
12 #define FIRM_COMMON_FIRM_COMMON_H
14 #include "firm_types.h"
18 * @defgroup initalization Library Initialization
19 * The functions in this section deal with initialization and deinitalization
20 * of the libFirm library.
25 * Initializes the firm library. Allocates default data structures.
27 FIRM_API void ir_init(void);
30 * Frees all memory occupied by the firm library.
32 FIRM_API void ir_finish(void);
34 /** returns the libFirm major version number */
35 FIRM_API unsigned ir_get_version_major(void);
36 /** returns libFirm minor version number */
37 FIRM_API unsigned ir_get_version_minor(void);
38 /** returns string describing libFirm revision */
39 FIRM_API const char *ir_get_version_revision(void);
40 /** returns string describing libFirm build */
41 FIRM_API const char *ir_get_version_build(void);
44 * A list of firm kinds.
45 * Most important datastructures in firm contain a firm_kind field at the
46 * beginning so given void* pointer you can usually still guess the kind
47 * of thing the pointer points to.
48 * This is used in debug helper functions and printers.
50 typedef enum firm_kind {
51 k_BAD = 0, /**< An invalid firm node. */
52 k_entity, /**< An entity. */
53 k_type, /**< A type. */
54 k_ir_graph, /**< An IR graph. */
55 k_ir_node, /**< An IR node. */
56 k_ir_mode, /**< An IR mode. */
57 k_ir_op, /**< An IR opcode. */
58 k_tarval, /**< A tarval. */
59 k_ir_loop, /**< A loop. */
60 k_ir_prog, /**< A program representation (irp). */
61 k_ir_graph_pass, /**< An ir_graph pass. */
62 k_ir_prog_pass, /**< An ir_prog pass. */
63 k_ir_graph_pass_mgr, /**< An ir_graph pass manager. */
64 k_ir_prog_pass_mgr, /**< An ir_prog pass manager. */
65 k_ir_max /**< maximum value -- illegal for firm nodes. */
69 * Returns the kind of a thing.
71 * @param firm_thing pointer representing a firm object
73 FIRM_API firm_kind get_kind(const void *firm_thing);