aboutsummaryrefslogtreecommitdiff
path: root/arm-gen.c
diff options
context:
space:
mode:
authorjiang <30155751@qq.com>2014-05-04 13:18:31 +0800
committerjiang <30155751@qq.com>2014-05-04 13:18:31 +0800
commit5e56fb635a23484d8fda8b54a40900d0a54b0ba1 (patch)
tree6f7491150cfe01700c9863946906203adad0de13 /arm-gen.c
parent089dea355a28da44376ce4f5195baa4b4e0b217d (diff)
downloadtinycc-5e56fb635a23484d8fda8b54a40900d0a54b0ba1.tar.gz
tinycc-5e56fb635a23484d8fda8b54a40900d0a54b0ba1.tar.bz2
Return to: e20c1eb99e1003c1e59522c136dbb15c52d7cc7c
1: The new patch for the other machines still have the problem. 2: libcrt Rename (what if gcc had libcrt as well) 3: parse_number exact problem 4: VT_VLS is to allow tcc Compile the following int b = 9; struct st { int a; int b [b] }; struct st st1; st1.b [8] = 9; printf ("% d \ n", st1.b [8]); tcc a problem. Due to problems in front, and now can not be improved 5: they commit much, bug difficult to lock, you can not let other people help develop. 6: ('\ t') too Thanks to Michael and Ray Their criticism I have benefited!
Diffstat (limited to 'arm-gen.c')
-rw-r--r--arm-gen.c93
1 files changed, 31 insertions, 62 deletions
diff --git a/arm-gen.c b/arm-gen.c
index 567c868..680a490 100644
--- a/arm-gen.c
+++ b/arm-gen.c
@@ -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,14 +540,6 @@ 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;
@@ -1417,60 +1409,37 @@ void gjmp_addr(int a)
/* generate a test. set 'inv' to invert test. Stack entry is popped */
int gtst(int inv, int t)
{
- int v, r;
- uint32_t op;
- v = vtop->r & VT_VALMASK;
- r=ind;
- if (v == VT_CMP) {
- op=mapcc(inv?negcc(vtop->c.i):vtop->c.i);
- op|=encbranch(r,t,1);
- o(op);
- t=r;
- } else if (v == VT_JMP || v == VT_JMPI) {
- if ((v & 1) == inv) {
- if(!vtop->c.i)
- vtop->c.i=t;
- else {
- uint32_t *x;
- int p,lp;
- if(t) {
- p = vtop->c.i;
- do {
- p = decbranch(lp=p);
- } while(p);
- x = (uint32_t *)(cur_text_section->data + lp);
- *x &= 0xff000000;
- *x |= encbranch(lp,t,1);
- }
- t = vtop->c.i;
- }
- } else {
- t = gjmp(t);
- gsym(vtop->c.i);
+ int v, r;
+ uint32_t op;
+ v = vtop->r & VT_VALMASK;
+ r=ind;
+ if (v == VT_CMP) {
+ op=mapcc(inv?negcc(vtop->c.i):vtop->c.i);
+ op|=encbranch(r,t,1);
+ o(op);
+ t=r;
+ } else { /* VT_JMP || VT_JMPI */
+ if ((v & 1) == inv) {
+ if(!vtop->c.i)
+ vtop->c.i=t;
+ else {
+ uint32_t *x;
+ int p,lp;
+ if(t) {
+ p = vtop->c.i;
+ do {
+ p = decbranch(lp=p);
+ } while(p);
+ x = (uint32_t *)(cur_text_section->data + lp);
+ *x &= 0xff000000;
+ *x |= encbranch(lp,t,1);
+ }
+ t = vtop->c.i;
+ }
+ } else {
+ t = gjmp(t);
+ gsym(vtop->c.i);
}
- } else {
- if (is_float(vtop->type.t)) {
- r=gv(RC_FLOAT);
-#ifdef TCC_ARM_VFP
- o(0xEEB50A40|(vfpr(r)<<12)|T2CPR(vtop->type.t)); /* fcmpzX */
- o(0xEEF1FA10); /* fmstat */
-#else
- o(0xEE90F118|(fpr(r)<<16));
-#endif
- vtop->r = VT_CMP;
- vtop->c.i = TOK_NE;
- return gtst(inv, t);
- } else if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
- /* constant jmp optimization */
- if ((vtop->c.i != 0) != inv)
- t = gjmp(t);
- } else {
- v = gv(RC_INT);
- o(0xE3300000|(intr(v)<<16));
- vtop->r = VT_CMP;
- vtop->c.i = TOK_NE;
- return gtst(inv, t);
- }
}
vtop--;
return t;