+
+
+/**
+ * Get the register class which shall be used to store a value of a given mode.
+ * @param self The this pointer.
+ * @param mode The mode in question.
+ * @return A register class which can hold values of the given mode.
+ */
+const arch_register_class_t *TEMPLATE_get_reg_class_for_mode(const void *self,
+ const ir_mode *mode)
+{
+ (void) self;
+ if (mode_is_float(mode))
+ return &TEMPLATE_reg_classes[CLASS_TEMPLATE_floating_point];
+ else
+ return &TEMPLATE_reg_classes[CLASS_TEMPLATE_general_purpose];
+}
+
+
+
+typedef struct {
+ be_abi_call_flags_bits_t flags;
+ const arch_env_t *arch_env;
+ ir_graph *irg;
+} TEMPLATE_abi_env_t;
+
+static void *TEMPLATE_abi_init(const be_abi_call_t *call, const arch_env_t *arch_env, ir_graph *irg)
+{
+ TEMPLATE_abi_env_t *env = xmalloc(sizeof(env[0]));
+ be_abi_call_flags_t fl = be_abi_call_get_flags(call);
+ env->flags = fl.bits;
+ env->irg = irg;
+ env->arch_env = arch_env;
+ return env;
+}
+
+/**
+ * Get the between type for that call.
+ * @param self The callback object.
+ * @return The between type of for that call.
+ */
+static ir_type *TEMPLATE_get_between_type(void *self)
+{
+ static ir_type *between_type = NULL;
+ static ir_entity *old_bp_ent = NULL;
+ (void) self;
+
+ if(!between_type) {
+ ir_entity *ret_addr_ent;
+ ir_type *ret_addr_type = new_type_primitive(new_id_from_str("return_addr"), mode_P);
+ ir_type *old_bp_type = new_type_primitive(new_id_from_str("bp"), mode_P);
+
+ between_type = new_type_class(new_id_from_str("TEMPLATE_between_type"));
+ old_bp_ent = new_entity(between_type, new_id_from_str("old_bp"), old_bp_type);
+ ret_addr_ent = new_entity(between_type, new_id_from_str("old_bp"), ret_addr_type);
+
+ set_entity_offset(old_bp_ent, 0);
+ set_entity_offset(ret_addr_ent, get_type_size_bytes(old_bp_type));
+ set_type_size_bytes(between_type, get_type_size_bytes(old_bp_type) + get_type_size_bytes(ret_addr_type));
+ }
+
+ return between_type;
+}
+
+static void TEMPLATE_abi_dont_save_regs(void *self, pset *s)
+{
+ TEMPLATE_abi_env_t *env = self;
+ if (env->flags.try_omit_fp) {
+ /* insert the BP register into the ignore set */
+ pset_insert_ptr(s, env->arch_env->bp);
+ }