changeset 395:f82993ed5ab9

*** empty log message ***
author kono
date Tue, 14 Sep 2004 22:09:37 +0900
parents b96b46baa20f
children bfeefa7f09f5
files Changes mc-code-arm.c
diffstat 2 files changed, 46 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Tue Sep 14 15:49:57 2004 +0900
+++ b/Changes	Tue Sep 14 22:09:37 2004 +0900
@@ -5983,3 +5983,12 @@
 
 だけど、ptr cache と const list
 を一般的に一緒にできない? 両方ともconstだしねぇ。
+
+そうか、ptr cache は外にでちゃっていて、nptr を前提にしている
+ので、ちょっと難しい。uniq nptr を当てはめてやればよいみたい
+だけど...
+
+        str     r1, [fp, #0+.L3]
+        str     r2, [fp, #4+.L3]
+なんだけど、L3 が巨大なのでだめになってしまう。(まぁ、そうだよね)
+まぁ、でも、L3 は巨大にはならないんじゃない?
--- a/mc-code-arm.c	Tue Sep 14 15:49:57 2004 +0900
+++ b/mc-code-arm.c	Tue Sep 14 22:09:37 2004 +0900
@@ -344,7 +344,7 @@
     // int code_f = (fnptr->sc==CODE);
 
     disp &= -SIZE_OF_INT;
-    lvar_offsetv = round16(-disp) +
+    lvar_offsetv = // round16(-disp) +
 	round16((max_func_args<2?2:max_func_args)*SIZE_OF_INT) +
 	2*SIZE_OF_INT;
     r1_offsetv = lvar_offsetv + arg_offset + SIZE_OF_INT*2 +
@@ -384,9 +384,43 @@
     return r1_offsetv;
 }
 
+#define LARGE_OFFSET(l) (l<-511||l>511)
+
+static void lvar_address(int l,int creg);
+
+static int large_lvar;
+static void
+lvar_intro(int l)
+{
+    int large;
+    if (fnptr->sc==CODE) {
+        if (l>=ARG_LVAR_OFFSET) {
+	    large = LARGE_OFFSET(CODE_CALLER_ARG(l-ARG_LVAR_OFFSET));
+        } else
+	    large = LARGE_OFFSET(CODE_LVAR(l));
+    } else if (l<0) {  /* local variable */
+	    large = LARGE_OFFSET(FUNC_LVAR(l));
+    } else if (l>=ARG_LVAR_OFFSET) {  /* caller's arguments */
+	    large = LARGE_OFFSET(CALLER_ARG(l-ARG_LVAR_OFFSET));
+    } else { /* callee's arguments */
+	    large = LARGE_OFFSET(CALLEE_ARG(l));
+    }
+    if (large) {
+	large_lvar = get_register();
+	lvar_address(l,large_lvar);
+    } else {
+	large_lvar = 0;
+    }
+}
+
 static void
 lvar(int l,char *cext)
 {
+    if (large_lvar) {
+	printf("[%s, #0]%s\n",register_name(large_lvar),cext);
+	free_register(large_lvar);
+	return;
+    }
     if (fnptr->sc==CODE) {
         if (l>=ARG_LVAR_OFFSET) {  /* caller's arguments */
             printf("[sp, #%d]%s\n",CODE_CALLER_ARG(l-ARG_LVAR_OFFSET),cext);
@@ -435,8 +469,6 @@
 }
 
 
-#define lvar_intro(e)  /* do nothing */
-
 void
 code_lvar(int e2,int reg) {
     use_int(reg);
@@ -1157,7 +1189,7 @@
      nth element has offset n * SIZE_OF_INT
  */
 
-#define CONST_TBL_COUNT 300
+#define CONST_TBL_COUNT 200
 
 static int
 search_const(int tag,int value,int *label)
@@ -1279,6 +1311,7 @@
 inc_inst(int count)
 {
     static int inst_count;
+// printf("# inst %d\n",inst_count);
     if ((inst_count+=count)>CONST_TBL_COUNT) {
 	inst_count = 0;
 	const_list_table();