firm_common.h 1.98 KB
Newer Older
Götz Lindenmaier's avatar
Götz Lindenmaier committed
1
/*
2
 * This file is part of libFirm.
3
 * Copyright (C) 2012 University of Karlsruhe.
Götz Lindenmaier's avatar
Götz Lindenmaier committed
4
 */
Christian Schäfer's avatar
Christian Schäfer committed
5

Michael Beck's avatar
Michael Beck committed
6
/**
7
8
9
 * @file
 * @brief    common firm declarations
 * @author   Martin Trapp, Christian Schaefer, Goetz Lindenmaier
Michael Beck's avatar
Michael Beck committed
10
 */
11
12
#ifndef FIRM_COMMON_FIRM_COMMON_H
#define FIRM_COMMON_FIRM_COMMON_H
Christian Schäfer's avatar
Christian Schäfer committed
13

14
#include "firm_types.h"
15
#include "begin.h"
16

17
18
19
20
21
22
23
/**
 * @defgroup initalization  Library Initialization
 * The functions in this section deal with initialization and deinitalization
 * of the libFirm library.
 * @{
 */

24
25
26
/**
 * Initializes the firm library.  Allocates default data structures.
 */
27
FIRM_API void ir_init(void);
28
29
30
31

/**
 * Frees all memory occupied by the firm library.
 */
Michael Beck's avatar
Michael Beck committed
32
FIRM_API void ir_finish(void);
33
34

/** returns the libFirm major version number */
Michael Beck's avatar
Michael Beck committed
35
FIRM_API unsigned ir_get_version_major(void);
36
/** returns libFirm minor version number */
Michael Beck's avatar
Michael Beck committed
37
FIRM_API unsigned ir_get_version_minor(void);
38
/** returns string describing libFirm revision */
Michael Beck's avatar
Michael Beck committed
39
FIRM_API const char *ir_get_version_revision(void);
40
/** returns string describing libFirm build */
Michael Beck's avatar
Michael Beck committed
41
FIRM_API const char *ir_get_version_build(void);
42

43
/**
44
 * A list of firm kinds.
45
46
47
48
49
 * Most important datastructures in firm contain a firm_kind field at the
 * beginning so given void* pointer you can usually still guess the kind
 * of thing the pointer points to.
 * This is used in debug helper functions and printers.
 */
50
typedef enum firm_kind {
Michael Beck's avatar
Michael Beck committed
51
52
53
54
55
56
57
58
	k_BAD = 0,                /**< An invalid firm node. */
	k_entity,                 /**< An entity. */
	k_type,                   /**< A type. */
	k_ir_graph,               /**< An IR graph. */
	k_ir_node,                /**< An IR node. */
	k_ir_mode,                /**< An IR mode. */
	k_tarval,                 /**< A tarval. */
	k_ir_loop,                /**< A loop. */
59
	k_ir_max                  /**< maximum value -- illegal for firm nodes. */
60
61
} firm_kind;

Michael Beck's avatar
Michael Beck committed
62
63
64
/**
 * Returns the kind of a thing.
 *
Andreas Schösser's avatar
Andreas Schösser committed
65
 * @param firm_thing  pointer representing a firm object
Michael Beck's avatar
Michael Beck committed
66
 */
Michael Beck's avatar
Michael Beck committed
67
FIRM_API firm_kind get_kind(const void *firm_thing);
Christian Schäfer's avatar
Christian Schäfer committed
68

69
70
/** @} */

71
#include "end.h"
72

73
#endif