becopyheur4: Clean up co_mst_irn_init().
[libfirm] / ir / be / ia32 / ia32_address_mode.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       This file contains functions for matching firm graphs for
9  *              nodes that can be used as address mode for x86 instructions
10  * @author      Matthias Braun
11  */
12 #ifndef IA32_ADDRESS_MODE_H
13 #define IA32_ADDRESS_MODE_H
14
15 #include <stdbool.h>
16 #include "irtypes.h"
17
18 /**
19  * The address mode data: Used to construct (memory) address modes.
20  */
21 typedef struct ia32_address_t ia32_address_t;
22 struct ia32_address_t {
23         ir_node   *base;          /**< The base register (if any) */
24         ir_node   *index;         /**< The index register (if any). */
25         ir_node   *mem;           /**< The memory value (if any). */
26         int        offset;        /**< An integer offset. */
27         int        scale;         /**< An integer scale. {0,1,2,3} */
28         ir_entity *symconst_ent;  /**< A SynConst entity if any. */
29         bool       use_frame;     /**< Set, if the frame is accessed */
30         bool       tls_segment;   /**< Set if AM is relative to TLS */
31         ir_entity *frame_entity;  /**< The accessed frame entity if any. */
32         bool       symconst_sign; /**< The "sign" of the symconst. */
33 };
34
35 /**
36  * Additional flags for the address mode creation.
37  */
38 typedef enum ia32_create_am_flags_t {
39         ia32_create_am_normal     = 0,       /**< Normal operation. */
40         ia32_create_am_force      = 1U << 0, /**< Ignore the marking of node as a
41                                                   non-address-mode node. */
42         ia32_create_am_double_use = 1U << 1  /**< Fold AM, even if the root of
43                                                   address calculation has two users.
44                                                   This is useful for dest AM. */
45 } ia32_create_am_flags_t;
46
47 /**
48  * Create an address mode for a given node.
49  */
50 void ia32_create_address_mode(ia32_address_t *addr, ir_node *node, ia32_create_am_flags_t);
51
52 /**
53  * Mark those nodes of the given graph that cannot be used inside an
54  * address mode because there values must be materialized in registers.
55  */
56 void ia32_calculate_non_address_mode_nodes(ir_graph *irg);
57
58 /**
59  * Free the non_address_mode information.
60  */
61 void ia32_free_non_address_mode_nodes(void);
62
63 /**
64  * Tells whether the given node is a non address mode node.
65  */
66 int ia32_is_non_address_mode_node(ir_node const *node);
67
68 /**
69  * mark a node so it will not be used as part of address modes
70  */
71 void ia32_mark_non_am(ir_node *node);
72
73 #endif