summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beasm.h
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2019-03-25 20:18:07 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2019-03-25 20:18:07 +0100
commite3359952fb04bff07900230dcb81c1c00335b807 (patch)
tree4ddd1c236229008742806da9c2be9f57f4c11358 /ir/be/beasm.h
parent026e48ad8cbd83a608c1132443fa5064c0bb686a (diff)
amd64, ia32: Support all address modes in inline asm.
Diffstat (limited to 'ir/be/beasm.h')
-rw-r--r--ir/be/beasm.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/ir/be/beasm.h b/ir/be/beasm.h
index d7fe333..33af771 100644
--- a/ir/be/beasm.h
+++ b/ir/be/beasm.h
@@ -35,7 +35,7 @@ typedef struct be_asm_operand_t {
static inline void be_set_asm_operand(be_asm_operand_t* const op, be_asm_operand_kind_t const kind, int const pos)
{
- assert((kind == BE_ASM_OPERAND_IMMEDIATE) == (pos == -1));
+ assert(pos == -1 ? kind == BE_ASM_OPERAND_IMMEDIATE || kind == BE_ASM_OPERAND_MEMORY : kind != BE_ASM_OPERAND_IMMEDIATE);
op->kind = kind;
op->pos = pos;
}
@@ -71,12 +71,19 @@ typedef struct be_asm_info_t {
be_asm_info_t be_asm_prepare_info(ir_node const *node);
-static inline void be_asm_add_in(be_asm_info_t *const info, be_asm_operand_t *const op, be_asm_operand_kind_t const kind, ir_node *const in, arch_register_req_t const *const req)
+static inline size_t be_asm_append_in(be_asm_info_t *const info, ir_node *const in, arch_register_req_t const *const req)
{
- assert(kind == BE_ASM_OPERAND_INPUT_VALUE || kind == BE_ASM_OPERAND_MEMORY);
- be_set_asm_operand(op, kind, ARR_LEN(info->ins));
+ size_t const pos = ARR_LEN(info->ins);
ARR_APP1(ir_node*, info->ins, in);
ARR_APP1(arch_register_req_t const*, info->in_reqs, req);
+ return pos;
+}
+
+static inline void be_asm_add_in(be_asm_info_t *const info, be_asm_operand_t *const op, be_asm_operand_kind_t const kind, ir_node *const in, arch_register_req_t const *const req)
+{
+ assert(kind == BE_ASM_OPERAND_INPUT_VALUE || kind == BE_ASM_OPERAND_MEMORY);
+ size_t const pos = be_asm_append_in(info, in, req);
+ be_set_asm_operand(op, kind, pos);
}
static inline arch_register_req_t const *be_asm_make_same_req(struct obstack *const obst, arch_register_req_t const *const req, unsigned const pos)