<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include "../../util/alloc.h"

#include "../type.h"
#include "../type_nav.h"
#include "../type_is.h"
#include "../pack.h"

#include "../cc1.h" /* cc1_mstack_align */

#include "val.h"
#include "out.h"
#include "virt.h"
#include "ctx.h"
#include "asm.h"
#include "impl.h"

#define TODO() \
	fprintf(stderr, "%s:%d: TODO: %s\n", __FILE__, __LINE__, __func__)

void out_flush_volatile(out_ctx *octx, out_val *val)
{
	out_val_consume(octx, v_to_reg(octx, val));
}

int v_is_const_reg(out_val *v)
{
	return v->type == V_REG
		&& impl_reg_frame_const(&v->bits.regoff.reg);
}

out_val *v_to_stack_mem(out_ctx *octx, out_val *vp, long stack_pos)
{
	out_val *store = v_new_sp3(octx, NULL, vp->t, stack_pos);

	vp = v_to(octx, vp, TO_CONST | TO_REG);

	out_val_retain(octx, store);

	out_store(octx, store, vp);

	return store;
}

void v_reg_to_stack(
		out_ctx *octx,
		const struct vreg *vr,
		type *ty, long where)
{
	out_val *reg = v_new_reg(octx, NULL, ty, vr);
	out_flush_volatile(octx,
			v_to_stack_mem(octx, reg, -where));
}

static int v_in(out_val *vp, enum vto to)
{
	switch(vp->type){<commit_msg>v_to_stack_mem() changes type to a spilt register<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

#include "../../util/alloc.h"

#include "../type.h"
#include "../type_nav.h"
#include "../type_is.h"
#include "../pack.h"

#include "../cc1.h" /* cc1_mstack_align */

#include "val.h"
#include "out.h"
#include "virt.h"
#include "ctx.h"
#include "asm.h"
#include "impl.h"

#define TODO() \
	fprintf(stderr, "%s:%d: TODO: %s\n", __FILE__, __LINE__, __func__)

void out_flush_volatile(out_ctx *octx, out_val *val)
{
	out_val_consume(octx, v_to_reg(octx, val));
}

int v_is_const_reg(out_val *v)
{
	return v->type == V_REG
		&& impl_reg_frame_const(&v->bits.regoff.reg);
}

out_val *v_to_stack_mem(out_ctx *octx, out_val *vp, long stack_pos)
{
	out_val *store = v_new_sp3(octx, NULL, vp->t, stack_pos);

	vp = v_to(octx, vp, TO_CONST | TO_REG);

	out_val_retain(octx, store);

	out_store(octx, store, vp);

	store->type = V_REG_SPILT;
	store->t = type_ptr_to(store->t);

	return store;
}

void v_reg_to_stack(
		out_ctx *octx,
		const struct vreg *vr,
		type *ty, long where)
{
	out_val *reg = v_new_reg(octx, NULL, ty, vr);
	out_flush_volatile(octx,
			v_to_stack_mem(octx, reg, -where));
}

static int v_in(out_val *vp, enum vto to)
{
	switch(vp->type){
{'fraction_non_alphanumeric': 0.18086816720257234, 'fraction_numerical': 0.002411575562700965, 'mean_word_length': 4.568232662192393, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '188613', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1114, 'n_words': 233}