tcc on i386 are still having problems at work.Thank Roy report again. Struck on several variables can be connected to commit in the register. I am worried whether tcc can run the os. Since my machine is ubuntu 64 bits I can test my machine.

master
jiang 2014-05-03 23:51:09 +08:00
parent a0d45c1bcd
commit 089dea355a
6 changed files with 33 additions and 39 deletions

View File

@ -61,7 +61,7 @@
#define RC_IRET RC_R0 /* function return: integer register */
#define RC_LRET RC_R1 /* function return: second integer register */
#define RC_FRET RC_F0 /* function return: float register */
#define RC_MASK (RC_INT|RC_FLOAT)
/* pretty names for the registers */
enum {
TREG_R0 = 0,
@ -540,6 +540,14 @@ void load(int r, SValue *sv)
v = fr & VT_VALMASK;
if (fr & VT_LVAL) {
uint32_t base = 0xB; // fp
if(fr & VT_TMP){
int size, align;
if((ft & VT_BTYPE) == VT_FUNC)
size = PTR_SIZE;
else
size = type_size(&sv->type, &align);
loc_stack(size, 0);
}
if(v == VT_LLOCAL) {
v1.type.t = VT_PTR;
v1.r = VT_LOCAL | VT_LVAL;

View File

@ -58,7 +58,7 @@
#define RC_IRET RC_C67_A4 /* function return: integer register */
#define RC_LRET RC_C67_A5 /* function return: second integer register */
#define RC_FRET RC_C67_A4 /* function return: float register */
#define RC_MASK (RC_INT|RC_FLOAT)
/* pretty names for the registers */
enum {
TREG_EAX = 0, // really A2
@ -1571,12 +1571,21 @@ void load(int r, SValue * sv)
v = fr & VT_VALMASK;
if (fr & VT_LVAL) {
if(fr & VT_TMP){
int size, align;
if((ft & VT_BTYPE) == VT_FUNC)
size = PTR_SIZE;
else
size = type_size(&sv->type, &align);
loc_stack(size, 0);
}
if (v == VT_LLOCAL) {
v1.type.t = VT_INT;
v1.r = VT_LOCAL | VT_LVAL;
v1.c.ul = fc;
load(r, &v1);
fr = r;
fc = 0;
} else if ((ft & VT_BTYPE) == VT_LDOUBLE) {
tcc_error("long double not supported");
} else if ((ft & VT_TYPE) == VT_BYTE) {

View File

@ -21,7 +21,7 @@
#ifdef TARGET_DEFS_ONLY
/* number of available registers */
#define NB_REGS 4
#define NB_REGS 8
#define NB_ASM_REGS 8
/* a register can belong to several classes. The classes must be
@ -41,7 +41,6 @@
#define RC_LRET RC_EDX /* function return: second integer register */
#define RC_FRET RC_ST0 /* function return: float register */
#define RC_MASK (RC_INT|RC_INT2|RC_FLOAT)
/* pretty names for the registers */
enum {
TREG_EAX = 0,
@ -104,8 +103,8 @@ ST_DATA const int reg_classes[NB_REGS] = {
RC_INT|RC_INT2|RC_EBX,
0,
/* st0 */ RC_FLOAT | RC_ST0,
RC_RSI|RC_INT2,
RC_RDI|RC_INT2,
RC_ESI|RC_INT2,
RC_EDI|RC_INT2,
};
static unsigned long func_sub_sp_offset;
@ -241,7 +240,7 @@ ST_FUNC void load(int r, SValue *sv)
if(fr & VT_TMP){
int size, align;
if((ft & VT_BTYPE) == VT_FUNC)
size = 4;
size = PTR_SIZE;
else
size = type_size(&sv->type, &align);
loc_stack(size, 0);
@ -254,6 +253,7 @@ ST_FUNC void load(int r, SValue *sv)
if (!(reg_classes[fr] & RC_INT))
fr = get_reg(RC_INT);
load(fr, &v1);
fc = 0;
}
if ((ft & VT_BTYPE) == VT_FLOAT) {
o(0xd9); /* flds */

2
tcc.h
View File

@ -1350,8 +1350,6 @@ ST_FUNC void gen_le16(int c);
ST_FUNC void gen_le32(int c);
ST_FUNC void gen_addr32(int r, Sym *sym, int c);
ST_FUNC void gen_addrpc32(int r, Sym *sym, int c);
ST_FUNC void struct_copy(SValue *d, SValue *s, SValue *c);
ST_FUNC void gen_putz(SValue *d, int size);
#endif
#ifdef CONFIG_TCC_BCHECK

View File

@ -873,7 +873,7 @@ ST_FUNC int gv(int rc)
#endif
r = vtop->r & VT_VALMASK;
if((rc & ~RC_MASK) && (rc != RC_ST0))
if(rc & ~RC_MASK)
rc2 = ex_rc;
else
rc2 = (rc & RC_FLOAT) ? RC_FLOAT : RC_INT;
@ -2624,20 +2624,19 @@ ST_FUNC void vstore(void)
vtop -=2;
}else{
size = type_size(&vtop->type, &align);
#ifndef TCC_TARGET_X86_64
/* destination */
vswap();
vtop->type.t = VT_PTR;
gaddrof();
/* address of memcpy() */
# ifdef TCC_ARM_EABI
#ifdef TCC_ARM_EABI
if(!(align & 7))
vpush_global_sym(&func_old_type, TOK_memcpy8);
else if(!(align & 3))
vpush_global_sym(&func_old_type, TOK_memcpy4);
else
# endif
#endif
vpush_global_sym(&func_old_type, TOK_memcpy);
vswap();
@ -2646,22 +2645,8 @@ ST_FUNC void vstore(void)
vtop->type.t = VT_PTR;
gaddrof();
/* type size */
vpushs(size);
vpushi(size);
gfunc_call(3);
#else
/* destination */
vswap();
vtop->type.t = VT_PTR;
gaddrof();
/* source */
vpushv(vtop - 1);
vtop->type.t = VT_PTR;
gaddrof();
/* size */
vpushs(size);
struct_copy(&vtop[-2], &vtop[-1], &vtop[0]);
vtop -=3;
#endif
}
} else {
vswap();
@ -5354,22 +5339,16 @@ static void init_putz(CType *t, Section *sec, unsigned long c, int size)
if (sec) {
/* nothing to do because globals are already set to zero */
} else {
#ifndef TCC_TARGET_X86_64
vpush_global_sym(&func_old_type, TOK_memset);
vseti(VT_LOCAL, c);
# ifdef TCC_TARGET_ARM
#ifdef TCC_TARGET_ARM
vpushs(size);
vpushi(0);
# else
vpushi(0);
vpushs(size);
# endif
gfunc_call(3);
#else
vseti(VT_LOCAL, c);
gen_putz(vtop, size);
vtop--;
vpushi(0);
vpushs(size);
#endif
gfunc_call(3);
}
}

View File

@ -408,7 +408,7 @@ void load(int r, SValue *sv)
if(fr & VT_TMP){
int size, align;
if((ft & VT_BTYPE) == VT_FUNC)
size = 8;
size = PTR_SIZE;
else
size = type_size(&sv->type, &align);
loc_stack(size, 0);