summaryrefslogtreecommitdiffhomepage
path: root/ir/be/riscv/riscv_cconv.h
blob: 5e978c6543be3d408492294c0a8c6eaa1f4b6963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * This file is part of libFirm.
 * Copyright (C) 2018 Christoph Mallon.
 */

#ifndef FIRM_BE_RISCV_RISCV_CCONV_H
#define FIRM_BE_RISCV_RISCV_CCONV_H

#include <stdbool.h>
#include "be_types.h"

typedef struct riscv_reg_or_slot_t {
	arch_register_t const *reg;
	unsigned               offset;
	ir_entity             *entity;
} riscv_reg_or_slot_t;

typedef struct riscv_calling_convention_t {
	bool                 omit_fp;          /**< do not use frame pointer (and no
	                                           save/restore) */
	unsigned             param_stack_size;
	unsigned             n_mem_param;
	unsigned             va_arg_first_slot;
	riscv_reg_or_slot_t *parameters;
	riscv_reg_or_slot_t *results;
	ir_entity           *va_start_addr;
} riscv_calling_convention_t;

void riscv_determine_calling_convention(riscv_calling_convention_t *cconv, ir_type *fun_type, unsigned named_parameters, ir_graph *irg);

void riscv_layout_parameter_entities(riscv_calling_convention_t *cconv, ir_graph *irg);

void riscv_free_calling_convention(riscv_calling_convention_t *cconv);

#endif