aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
authorbellard <bellard>2004-10-04 22:19:21 +0000
committerbellard <bellard>2004-10-04 22:19:21 +0000
commit6e5b1cc43a308e1154090349f6452d6a03bacb00 (patch)
treec28b0403d900bef69dd27676996964ff231730db /tcc.c
parent3bd3c71fd11b1a64cd5d3b54df9520a4443b2702 (diff)
downloadtinycc-6e5b1cc43a308e1154090349f6452d6a03bacb00.tar.gz
tinycc-6e5b1cc43a308e1154090349f6452d6a03bacb00.tar.bz2
ARM fixes (Daniel Glockner)
Diffstat (limited to 'tcc.c')
-rw-r--r--tcc.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/tcc.c b/tcc.c
index 3b7c58a..066391d 100644
--- a/tcc.c
+++ b/tcc.c
@@ -728,6 +728,8 @@ int ieee_finite(double d);
void error(const char *fmt, ...);
void vpushi(int v);
void vrott(int n);
+void vnrott(int n);
+void lexpand_nr(void);
static void vpush_global_sym(CType *type, int v);
void vset(CType *type, int r, int v);
void type_to_str(char *buf, int buf_size,
@@ -4685,6 +4687,34 @@ void lexpand(void)
vtop[-1].type.t = VT_INT | u;
}
+#ifdef TCC_TARGET_ARM
+/* expand long long on stack */
+void lexpand_nr(void)
+{
+ int u,v;
+
+ u = vtop->type.t & VT_UNSIGNED;
+ vdup();
+ vtop->r2 = VT_CONST;
+ vtop->type.t = VT_INT | u;
+ v=vtop[-1].r & (VT_VALMASK | VT_LVAL);
+ if (v == VT_CONST) {
+ vtop[-1].c.ui = vtop->c.ull;
+ vtop->c.ui = vtop->c.ull >> 32;
+ vtop->r = VT_CONST;
+ } else if (v == (VT_LVAL|VT_CONST) || v == (VT_LVAL|VT_LOCAL)) {
+ vtop->c.ui += 4;
+ vtop->r = vtop[-1].r;
+ } else if (v > VT_CONST) {
+ vtop--;
+ lexpand();
+ } else
+ vtop->r = vtop[-1].r2;
+ vtop[-1].r2 = VT_CONST;
+ vtop[-1].type.t = VT_INT | u;
+}
+#endif
+
/* build a long long from two ints */
void lbuild(int t)
{
@@ -4722,6 +4752,22 @@ void vrott(int n)
vtop[-n + 1] = tmp;
}
+#ifdef TCC_TARGET_ARM
+/* like vrott but in other direction
+ In ... I1 -> I(n-1) ... I1 In [top is right]
+ */
+void vnrott(int n)
+{
+ int i;
+ SValue tmp;
+
+ tmp = vtop[-n + 1];
+ for(i = n - 1; i > 0; i--)
+ vtop[-i] = vtop[-i + 1];
+ vtop[0] = tmp;
+}
+#endif
+
/* pop stack value */
void vpop(void)
{
@@ -5531,11 +5577,7 @@ static void gen_cast(CType *type)
}
} else {
do_itof:
-#if !defined(TCC_TARGET_ARM)
- gen_cvt_itof1(dbt);
-#else
gen_cvt_itof(dbt);
-#endif
}
} else if (sf) {
/* convert fp to int */