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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
#include "mdef.h"
#include "compiler.h"
#include "opcode.h"
#include "mdq.h"
#include "resolve_blocks.h"
GBLREF mline mline_root;
void resolve_blocks(void)
{
triple *ref, *t1;
mline *mlx, *mly;
for (mlx = mline_root.child ; mlx ; mlx = mly)
{
if (mly = mlx->child)
{
if (mlx->sibling)
{
ref = maketriple(OC_JMP);
ref->operand[0] = put_tjmp(mlx->sibling->externalentry);
} else
{ ref = maketriple(OC_RET);
}
t1 = mly->externalentry;
t1 = t1->exorder.bl;
ref->src = t1->src;
dqins(t1, exorder, ref);
} else if ((mly = mlx->sibling) == 0)
{
for (mly = mlx->parent ; mly ; mly = mly->parent)
{
if (mly->sibling)
{
mly = mly->sibling;
break;
}
}
if (mly)
{
ref = maketriple(OC_RET);
t1 = mly->externalentry->exorder.bl;
ref->src = t1->src;
dqins(t1, exorder, ref);
}
}
}
}
|