summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2019-03-17 15:51:43 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2019-03-17 15:51:43 +0100
commit73f793c23293f8b7859d2c068d52f4a5a4a7e19e (patch)
treea59cefe812037945cf782d0bcda96157c6ebcbcd
parentbe24dcfe4c5ed3c3da83fb4a8b7ef8811da85860 (diff)
Add asm_operand_t as base of asm_argument_t.
-rw-r--r--src/ast/entity.h1
-rw-r--r--src/ast/entity_t.h9
-rw-r--r--src/parser/parser.c13
3 files changed, 14 insertions, 9 deletions
diff --git a/src/ast/entity.h b/src/ast/entity.h
index e57d133..3a682d1 100644
--- a/src/ast/entity.h
+++ b/src/ast/entity.h
@@ -6,6 +6,7 @@
#define ENTITY_H
typedef struct asm_argument_t asm_argument_t;
+typedef struct asm_operand_t asm_operand_t;
typedef struct compound_member_t compound_member_t;
typedef struct compound_t compound_t;
typedef struct declaration_t declaration_t;
diff --git a/src/ast/entity_t.h b/src/ast/entity_t.h
index 63b84c0..36434b1 100644
--- a/src/ast/entity_t.h
+++ b/src/ast/entity_t.h
@@ -235,11 +235,15 @@ struct function_t {
ir_entity *irentity;
};
-struct asm_argument_t {
+struct asm_operand_t {
entity_base_t base;
+ unsigned pos;
+};
+
+struct asm_argument_t {
+ asm_operand_t base;
const string_t *constraints;
expression_t *expression;
- unsigned pos;
bool direct_read :1;/**< argument value is read */
bool direct_write :1;/**< argument is lvalue and written to */
bool indirect_read :1;/**< argument is address which is read */
@@ -259,6 +263,7 @@ union entity_t {
function_t function;
compound_member_t compound_member;
asm_argument_t asm_argument;
+ asm_operand_t asm_operand;
};
#define DECLARATION_KIND_CASES \
diff --git a/src/parser/parser.c b/src/parser/parser.c
index 991b241..f060019 100644
--- a/src/parser/parser.c
+++ b/src/parser/parser.c
@@ -9019,12 +9019,12 @@ static void semantic_asm_argument(asm_argument_t *argument, bool is_out)
const char *constraints = argument->constraints->begin;
asm_constraint_flags_t asm_flags = be_parse_asm_constraints(constraints);
if (asm_flags & ASM_CONSTRAINT_FLAG_INVALID) {
- errorf(&argument->base.pos, "some constraints in '%s' are invalid",
+ errorf(&argument->base.base.pos, "some constraints in '%s' are invalid",
constraints);
return;
}
if (asm_flags & ASM_CONSTRAINT_FLAG_NO_SUPPORT) {
- errorf(&argument->base.pos,
+ errorf(&argument->base.base.pos,
"some constraints in '%s' are not supported on target",
constraints);
return;
@@ -9032,7 +9032,7 @@ static void semantic_asm_argument(asm_argument_t *argument, bool is_out)
if (is_out) {
if ((asm_flags & ASM_CONSTRAINT_FLAG_MODIFIER_WRITE) == 0)
- errorf(&argument->base.pos,
+ errorf(&argument->base.base.pos,
"constraints '%s' for output operand do not indicate write",
constraints);
@@ -9084,7 +9084,7 @@ static void semantic_asm_argument(asm_argument_t *argument, bool is_out)
errorf(&expression->base.pos,
"asm output argument is not an lvalue");
} else if (asm_flags & ASM_CONSTRAINT_FLAG_MODIFIER_WRITE) {
- errorf(&argument->base.pos,
+ errorf(&argument->base.base.pos,
"constraints '%s' for input operand indicate write",
constraints);
}
@@ -9218,7 +9218,7 @@ static void parse_asm_labels(asm_label_t **anchor)
static unsigned set_asm_operand_entities(unsigned pos, bool *const need_normalization, entity_t *const operands)
{
for (entity_t *i = operands; i; i = i->base.next) {
- i->asm_argument.pos = pos++;
+ i->asm_operand.pos = pos++;
if (i->base.symbol) {
*need_normalization = true;
entity_t *const old = set_entity(i);
@@ -9295,8 +9295,7 @@ static void normalize_asm_text(asm_statement_t *asm_statement)
for ( ; c < b; ++c) {
obstack_1grow(&string_obst, *c);
}
- obstack_printf(&string_obst, "%u",
- argument->asm_argument.pos);
+ obstack_printf(&string_obst, "%u", argument->asm_operand.pos);
c = e;
continue;
}