arm_nodes_attr.h 3.4 KB
Newer Older
Christian Würdig's avatar
Christian Würdig committed
1
2
/*
 * This file is part of libFirm.
3
 * Copyright (C) 2012 University of Karlsruhe.
Christian Würdig's avatar
Christian Würdig committed
4
5
 */

6
7
/**
 * @file
Michael Beck's avatar
Michael Beck committed
8
9
 * @brief   declarations for ARM node attributes
 * @author  Oliver Richter, Tobias Gneist, Michael Beck
10
11
12
 */
#ifndef FIRM_BE_ARM_ARM_NODES_ATTR_H
#define FIRM_BE_ARM_ARM_NODES_ATTR_H
13

14
#include "firm_types.h"
Michael Beck's avatar
Michael Beck committed
15
#include "irnode_t.h"
16

Michael Beck's avatar
Michael Beck committed
17
/**
18
 * Possible ARM "shifter operand" addressing mode types.
Michael Beck's avatar
Michael Beck committed
19
 */
20
typedef enum arm_shift_modifier_t {
21
22
23
24
25
26
27
28
29
30
31
32
	ARM_SHF_INVALID,   /**< invalid shift */
	ARM_SHF_REG,       /**< simple register operand */
	ARM_SHF_IMM,       /**< immediate operand with implicit ROR */
	ARM_SHF_ASR_IMM,   /**< arithmetic shift right */
	ARM_SHF_ASR_REG,   /**< arithmetic shift right */
	ARM_SHF_LSL_IMM,   /**< logical shift left */
	ARM_SHF_LSL_REG,   /**< logical shift left */
	ARM_SHF_LSR_IMM,   /**< logical shift right */
	ARM_SHF_LSR_REG,   /**< logical shift right */
	ARM_SHF_ROR_IMM,   /**< rotate right */
	ARM_SHF_ROR_REG,   /**< rotate right */
	ARM_SHF_RRX,       /**< rotate right through carry bits */
33
} arm_shift_modifier_t;
Michael Beck's avatar
Michael Beck committed
34

Michael Beck's avatar
Michael Beck committed
35
36
37
38
39
40
41
42
43
44
45
46
47
/** Encoding for fpa immediates */
enum fpa_immediates {
	fpa_null = 0,
	fpa_one,
	fpa_two,
	fpa_three,
	fpa_four,
	fpa_five,
	fpa_ten,
	fpa_half,
	fpa_max
};

Michael Beck's avatar
Michael Beck committed
48
/** Generic ARM node attributes. */
49
typedef struct arm_attr_t {
Matthias Braun's avatar
Matthias Braun committed
50
51
	except_attr exc;                /**< the exception attribute. MUST be the first one. */
	bool        is_load_store : 1;  /**< if set, this is a load or store instruction */
52
53
} arm_attr_t;

54
55
56
57
58
/**
 * This struct holds information needed to produce the arm
 * "data processing operands" also called "shifter operand" addressing modes
 */
typedef struct arm_shifter_operand_t {
Matthias Braun's avatar
Matthias Braun committed
59
60
	arm_attr_t           base;
	arm_shift_modifier_t shift_modifier;
61
	uint8_t              shifter_op_input;
Matthias Braun's avatar
Matthias Braun committed
62
63
	uint8_t              immediate_value;
	uint8_t              shift_immediate;
64
65
66
} arm_shifter_operand_t;

typedef struct arm_cmp_attr_t {
Matthias Braun's avatar
Matthias Braun committed
67
68
69
	arm_shifter_operand_t base;
	bool                  ins_permuted : 1;
	bool                  is_unsigned  : 1;
70
71
72
73
74
75
} arm_cmp_attr_t;

/**
 * this struct holds information needed to produce the arm addressing modes
 * for "Load and Store Word or Unsigned Byte", "Miscellaneous Loads and Stores"
 * and "Load and Store Multiple" */
76
typedef struct arm_load_store_attr_t {
77
78
	arm_attr_t  base;
	ir_mode    *load_store_mode;
79
80
	ir_entity  *entity;
	long        offset;
81
82
	bool        is_frame_entity : 1;
	bool        entity_sign     : 1;
83
84
} arm_load_store_attr_t;

85
86
/** Attributes for an Address */
typedef struct arm_Address_attr_t {
87
88
89
	arm_attr_t  base;
	ir_entity  *entity;
	int         fp_offset;
90
} arm_Address_attr_t;
Michael Beck's avatar
Michael Beck committed
91
92

/** Attributes for a CondJmp */
93
typedef struct arm_CondJmp_attr_t {
94
	arm_attr_t  base;
95
	ir_relation relation;
Michael Beck's avatar
Michael Beck committed
96
97
98
} arm_CondJmp_attr_t;

/** Attributes for a SwitchJmp */
99
typedef struct arm_SwitchJmp_attr_t {
Matthias Braun's avatar
Matthias Braun committed
100
101
	arm_attr_t             base;
	const ir_switch_table *table;
Michael Beck's avatar
Michael Beck committed
102
103
} arm_SwitchJmp_attr_t;

104
/** CopyB attributes */
105
typedef struct arm_CopyB_attr_t {
Matthias Braun's avatar
Matthias Braun committed
106
107
	arm_attr_t base;
	unsigned   size;
108
109
} arm_CopyB_attr_t;

110
111
/** Attributes for a fConst */
typedef struct arm_fConst_attr_t {
112
	arm_attr_t  base;
Matthias Braun's avatar
Matthias Braun committed
113
	ir_tarval  *tv;              /**< the tarval representing the FP const */
114
115
116
117
118
119
120
} arm_fConst_attr_t;

/** attributes for floatingpoint arithmetic operations */
typedef struct arm_farith_attr_t {
	arm_attr_t  base;
	ir_mode    *mode; /* operation mode */
} arm_farith_attr_t;
Michael Beck's avatar
Michael Beck committed
121
122
123
124

#define CAST_ARM_ATTR(type,ptr)        ((type *)(ptr))
#define CONST_CAST_ARM_ATTR(type,ptr)  ((const type *)(ptr))

125
#endif