summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndreas Fried <andreas.fried@kit.edu>2018-08-27 17:41:26 +0200
committerDaniel Biester <danielbiester@icloud.com>2020-04-20 15:03:36 +0200
commit93d0a16c1165866b209fac6b3ec7db61b613f42d (patch)
tree2be078336c2de3cf342f9a61695dd59663296100
parentb5aab0a87f130db42a056db960c81cd7fd79ce4a (diff)
Add support for special instructions.
-rw-r--r--src/ast/attribute.c4
-rw-r--r--src/ast/attribute_t.h3
-rw-r--r--src/ast/entity.h2
-rw-r--r--src/firm/ast2firm.c2
-rw-r--r--src/firm/firm_opt.c1
5 files changed, 12 insertions, 0 deletions
diff --git a/src/ast/attribute.c b/src/ast/attribute.c
index 5897999..2af5bcf 100644
--- a/src/ast/attribute.c
+++ b/src/ast/attribute.c
@@ -92,6 +92,7 @@ static const char *const attribute_names[ATTRIBUTE_LAST+1] = {
[ATTRIBUTE_GNU_WEAK] = "weak",
[ATTRIBUTE_GNU_WEAKREF] = "weakref",
[ATTRIBUTE_GNU_WEAK_IMPORT] = "weak_import",
+ [ATTRIBUTE_ICORE_SPECIAL_INSTRUCTION] = "special_instruction",
[ATTRIBUTE_MS_ALIGN] = "align",
[ATTRIBUTE_MS_ALLOCATE] = "allocate",
[ATTRIBUTE_MS_DEPRECATED] = "deprecated",
@@ -366,6 +367,9 @@ void handle_entity_attributes(const attribute_t *attributes, entity_t *entity)
case ATTRIBUTE_GNU_LEAF: modifiers |= DM_LEAF; break;
case ATTRIBUTE_GNU_GNU_INLINE: modifiers |= DM_GNU_INLINE; break;
+ case ATTRIBUTE_ICORE_SPECIAL_INSTRUCTION:
+ modifiers |= DM_SPECIAL_INSTRUCTION; break;
+
case ATTRIBUTE_MS_DLLIMPORT: modifiers |= DM_DLLIMPORT; break;
case ATTRIBUTE_MS_DLLEXPORT: modifiers |= DM_DLLEXPORT; break;
case ATTRIBUTE_MS_NAKED: modifiers |= DM_NAKED; break;
diff --git a/src/ast/attribute_t.h b/src/ast/attribute_t.h
index d9eaf09..7eff140 100644
--- a/src/ast/attribute_t.h
+++ b/src/ast/attribute_t.h
@@ -89,6 +89,9 @@ typedef enum attribute_kind_t {
ATTRIBUTE_GNU_WEAKREF,
ATTRIBUTE_GNU_WEAK_IMPORT,
ATTRIBUTE_GNU_LAST = ATTRIBUTE_GNU_WEAK_IMPORT,
+ ATTRIBUTE_ICORE_FIRST,
+ ATTRIBUTE_ICORE_SPECIAL_INSTRUCTION = ATTRIBUTE_ICORE_FIRST,
+ ATTRIBUTE_ICORE_LAST = ATTRIBUTE_ICORE_SPECIAL_INSTRUCTION,
ATTRIBUTE_MS_FIRST,
ATTRIBUTE_MS_ALIGN = ATTRIBUTE_MS_FIRST,
ATTRIBUTE_MS_ALLOCATE,
diff --git a/src/ast/entity.h b/src/ast/entity.h
index a4dd424..7f8e27d 100644
--- a/src/ast/entity.h
+++ b/src/ast/entity.h
@@ -55,6 +55,8 @@ typedef enum decl_modifiers_t {
DM_LEAF = 1 << 28,
DM_GNU_INLINE = 1 << 29,
DM_PACKED = 1 << 30,
+ DM_SPECIAL_INSTRUCTION
+ = 1 << 31,
} decl_modifiers_t;
unsigned get_declaration_alignment(const declaration_t *declaration);
diff --git a/src/firm/ast2firm.c b/src/firm/ast2firm.c
index 5509c9f..1b39f26 100644
--- a/src/firm/ast2firm.c
+++ b/src/firm/ast2firm.c
@@ -245,6 +245,8 @@ static mtp_additional_properties get_additional_type_properties(
| mtp_property_terminates;
if (modifiers & DM_PURE)
result |= mtp_property_no_write | mtp_property_terminates;
+ if (modifiers & DM_SPECIAL_INSTRUCTION)
+ result |= mtp_special_instruction;
if (modifiers & DM_RETURNS_TWICE)
result |= mtp_property_returns_twice;
if (modifiers & DM_NORETURN)
diff --git a/src/firm/firm_opt.c b/src/firm/firm_opt.c
index d2c2960..afa7c72 100644
--- a/src/firm/firm_opt.c
+++ b/src/firm/firm_opt.c
@@ -396,6 +396,7 @@ static opt_config_t opts[] = {
IRP("opt-proc-clone", do_cloning, "procedure cloning", OPT_FLAG_NONE),
IRP("remove-unused", garbage_collect_entities, "removal of unused functions/variables", OPT_FLAG_NO_DUMP | OPT_FLAG_NO_VERIFY),
IRP("opt-cc", mark_private_methods, "calling conventions optimization", OPT_FLAG_NONE),
+ IRG("ces-si", ces_special_instruction, "CES SI identification", OPT_FLAG_NONE),
#undef IRP
#undef IRG
};