2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
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
12 #ifndef IA32_ADDRESS_MODE_H
13 #define IA32_ADDRESS_MODE_H
19 * The address mode data: Used to construct (memory) address modes.
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. */
36 * Additional flags for the address mode creation.
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;
48 * Create an address mode for a given node.
50 void ia32_create_address_mode(ia32_address_t *addr, ir_node *node, ia32_create_am_flags_t);
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.
56 void ia32_calculate_non_address_mode_nodes(ir_graph *irg);
59 * Free the non_address_mode information.
61 void ia32_free_non_address_mode_nodes(void);
64 * Tells whether the given node is a non address mode node.
66 int ia32_is_non_address_mode_node(ir_node const *node);
69 * mark a node so it will not be used as part of address modes
71 void ia32_mark_non_am(ir_node *node);