summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beasm.h
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-05-08 12:05:00 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2018-05-08 12:05:00 +0200
commit46210b81e457b068ae83f19ee7d4f1a3a05a9a77 (patch)
tree21cd970bccfabd633915d434b0d4a2973b39228d /ir/be/beasm.h
parent314369bc156ad55385d5d761e0013ff8d9f13549 (diff)
be: Use a common struct to hold basic asm operand information.
Diffstat (limited to 'ir/be/beasm.h')
-rw-r--r--ir/be/beasm.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/ir/be/beasm.h b/ir/be/beasm.h
index b9ecc48..94cbad4 100644
--- a/ir/be/beasm.h
+++ b/ir/be/beasm.h
@@ -10,6 +10,7 @@
#ifndef FIRM_BE_BEASM_H
#define FIRM_BE_BEASM_H
+#include <assert.h>
#include <stdbool.h>
#include "be_types.h"
@@ -24,6 +25,18 @@ typedef enum be_asm_operand_kind_t {
BE_ASM_OPERAND_MEMORY,
} be_asm_operand_kind_t;
+typedef struct be_asm_operand_t {
+ be_asm_operand_kind_t kind;
+ int pos;
+} 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));
+ op->kind = kind;
+ op->pos = pos;
+}
+
/**
* An assembler constraint.
*/