<commit_before>// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include "gg.h"

void
cgen(Node *n, Node *res)
{
	long lno;
	Node *nl, *nr, *r;
	Node n1, n2;
	int a;
	Prog *p1, *p2, *p3;

	if(debug['g']) {
		dump("\ncgen-res", res);
		dump("cgen-r", n);
	}
	if(n == N || n->type == T)
		return;

	lno = setlineno(n);

	if(res == N || res->type == T)
		fatal("cgen: res nil");

	if(n->ullman >= UINF) {
		if(n->op == OINDREG)
			fatal("cgen: this is going to misscompile");
		if(res->ullman >= UINF) {
			dump("fncalls", n);
			fatal("cgen: node and result functions");
		}
	}

	if(isfat(n->type)) {
		sgen(n, res, n->type->width);
		goto ret;
	}

	if(!res->addable) {
		if(n->ullman > res->ullman) {
			regalloc(&n1, n->type, res);
			cgen(n, &n1);
			cgen(&n1, res);
			regfree(&n1);
			return;
		}

		igen(res, &n1, N);
		cgen(n, &n1);
		regfree(&n1);
		goto ret;
	}

	if(n->addable) {
		gmove(n, res);
		goto ret;
	}

	nl = n->left;
	nr = n->right;
	if(nl != N && nl->ullman >= UINF)
	if(nr != N && nr->ullman >= UINF) {
		dump("fncalls", n);
		fatal("cgen: both sides functions");
		goto ret;
	}

	switch(n->op) {
	default:
		dump("cgen", n);
		fatal("cgen: unknown op %N", n);
		break;<commit_msg>fixed fncall both sides<commit_after>// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include "gg.h"

void
cgen(Node *n, Node *res)
{
	long lno;
	Node *nl, *nr, *r;
	Node n1, n2;
	int a;
	Prog *p1, *p2, *p3;

	if(debug['g']) {
		dump("\ncgen-res", res);
		dump("cgen-r", n);
	}
	if(n == N || n->type == T)
		return;

	lno = setlineno(n);

	if(res == N || res->type == T)
		fatal("cgen: res nil");

	if(n->ullman >= UINF) {
		if(n->op == OINDREG)
			fatal("cgen: this is going to misscompile");
		if(res->ullman >= UINF) {
			dump("fncalls", n);
			fatal("cgen: node and result functions");
		}
	}

	if(isfat(n->type)) {
		sgen(n, res, n->type->width);
		goto ret;
	}

	if(!res->addable) {
		if(n->ullman > res->ullman) {
			regalloc(&n1, n->type, res);
			cgen(n, &n1);
			cgen(&n1, res);
			regfree(&n1);
			return;
		}

		igen(res, &n1, N);
		cgen(n, &n1);
		regfree(&n1);
		goto ret;
	}

	if(n->addable) {
		gmove(n, res);
		goto ret;
	}

	nl = n->left;
	nr = n->right;
	if(nl != N && nl->ullman >= UINF)
	if(nr != N && nr->ullman >= UINF) {
		tempname(&n1, nr->type);
		cgen(nr, &n1);
		n2 = *n;
		n2.right = &n1;
		cgen(&n2, res);
		goto ret;
	}

	switch(n->op) {
	default:
		dump("cgen", n);
		fatal("cgen: unknown op %N", n);
		break;
{'fraction_non_alphanumeric': 0.21530382595648911, 'fraction_numerical': 0.014253563390847712, 'mean_word_length': 2.9805970149253733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 50, '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': '2924436', 'n_tokens_mistral': 1319, 'n_tokens_neox': 1196, 'n_words': 304}