summaryrefslogtreecommitdiffhomepage
path: root/ir/tr
diff options
context:
space:
mode:
authorJohannes Bucher <johannes.bucher2@student.kit.edu>2019-10-18 15:23:03 +0200
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-10-24 17:36:32 +0200
commitc5b9af12a94c49c01ff38c44f7c75939165f3ff3 (patch)
tree021fa0fb05d3d5f6f4c71cee8b48c9d940b5ea78 /ir/tr
parent5f28a187ad4393f4cca61b89c5a108d7de80f4d7 (diff)
riscv: add support for variadic functions
lowering of builtin va_arg still uses the be_default_lower_va_arg function which is not correct due to the alignment requirements of variadic arguments; a RISC-V specific implementation is needed
Diffstat (limited to 'ir/tr')
-rw-r--r--ir/tr/type.c5
-rw-r--r--ir/tr/type_t.h9
2 files changed, 14 insertions, 0 deletions
diff --git a/ir/tr/type.c b/ir/tr/type.c
index 581b3cc..7d34783 100644
--- a/ir/tr/type.c
+++ b/ir/tr/type.c
@@ -617,6 +617,11 @@ int get_method_variadic_index(ir_type const *const method) {
return method->attr.method.variadic;
}
+void set_method_variadic_index(ir_type *const method, int variadic_index) {
+ assert(is_Method_type(method) && variadic_index >= -1);
+ method->attr.method.variadic = variadic_index;
+}
+
mtp_additional_properties (get_method_additional_properties)(const ir_type *method)
{
return get_method_additional_properties_(method);
diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h
index 35bfb3f..dfa357d 100644
--- a/ir/tr/type_t.h
+++ b/ir/tr/type_t.h
@@ -318,6 +318,15 @@ static inline size_t get_method_n_ress_(const ir_type *method)
int get_method_variadic_index(ir_type const *const method);
+/**
+ * Set the variadic index of a method.
+ * Values >= 0 represent the index of the first variadic parameter which equals the number of named parameters.
+ * A value of -1 marks the method as not variadic.
+ * @param method
+ * @param variadic_index >= -1
+ */
+void set_method_variadic_index(ir_type *const method, int variadic_index);
+
static inline mtp_additional_properties get_method_additional_properties_(const ir_type *method)
{
assert(is_Method_type(method));