#include "be.h"
#include "beirg.h"
#include "bearch.h"
-#include "beabi_t.h"
+#include "beabi.h"
struct _be_abi_call_flags_bits_t {
unsigned left_to_right : 1; /**< Arguments are from left to right. */
*/
ir_type *(*get_between_type)(void *self);
- /**
- * Put all registers which are saved by the prologue/epilogue in a set.
- * @param self The callback object.
- * @param regs A set.
- */
- void (*regs_saved_by_me)(void *self, pset *regs);
-
/**
* Generate the prologue.
* @param self The callback object.
void be_abi_call_set_call_address_reg_class(be_abi_call_t *call, const arch_register_class_t *cls);
/**
- * Describe the stack layout for a call parameter. Modifies the abi object.
+ * The ABI can change when we call a function vs. when we have
+ * been called.
+ */
+typedef enum {
+ ABI_CONTEXT_CALLEE = 1 << 0,
+ ABI_CONTEXT_CALLER = 1 << 1,
+ ABI_CONTEXT_BOTH = ABI_CONTEXT_CALLEE | ABI_CONTEXT_CALLER
+} be_abi_context_t;
+
+/**
+ * Record the that ABI transmits call argument pos on the stack. Modifies the abi object.
*
* @param call the abi call object
* @param pos the parameter position
* @param space_before size of allocated additional space before the parameter
* @param space_after size of allocated additional space after the parameter
*/
-void be_abi_call_param_stack(be_abi_call_t *call, int pos, ir_mode *load_mode, unsigned alignment, unsigned space_before, unsigned space_after);
-void be_abi_call_param_reg(be_abi_call_t *call, int pos, const arch_register_t *reg);
-void be_abi_call_res_reg(be_abi_call_t *call, int pos, const arch_register_t *reg);
+void be_abi_call_param_stack(be_abi_call_t *call, int pos, ir_mode *load_mode,
+ unsigned alignment, unsigned space_before,
+ unsigned space_after, be_abi_context_t context);
+
+/**
+ * Record the that ABI transmits call argument pos in the given register.
+ *
+ * @param call the abi call object
+ * @param pos the parameter position
+ * @param reg the register used
+ */
+void be_abi_call_param_reg(be_abi_call_t *call, int pos,
+ const arch_register_t *reg,
+ be_abi_context_t context);
+
+/**
+ * Record the that ABI transmits return value pos in the given register.
+ *
+ * @param call the abi call object
+ * @param pos the return value position
+ * @param reg the register used
+ */
+void be_abi_call_res_reg(be_abi_call_t *call, int pos,
+ const arch_register_t *reg,
+ be_abi_context_t context);
/**
* Get the flags of a ABI call object.