changeset 129:948977254fa6 powerpc-goto-arg

fix long argument call in code segement
author kono
date Thu, 03 Apr 2003 03:33:36 +0900
parents d497c39add36
children fea1b499d47b
files mc-code-powerpc.c
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mc-code-powerpc.c	Thu Apr 03 03:04:16 2003 +0900
+++ b/mc-code-powerpc.c	Thu Apr 03 03:33:36 2003 +0900
@@ -153,6 +153,7 @@
 #define r1_offset func_disp_offset+12 
 int code_disp_offset = 0; int jump_offset = 0;
 #define CODE_LVAR l+code_disp_offset
+#define CODE_CALLER_ARG (l-ARG_LVAR_OFFSET)+arg_offset1
 #define FUNC_LVAR l+disp_offset
 #define CALLER_ARG (l-ARG_LVAR_OFFSET)+arg_offset1
 #define CALLEE_ARG l+arg_offset
@@ -192,7 +193,10 @@
 lvar8(int l)
 {
     if (fnptr->sc==CODE) {
-	printf("lo16(%d)(r30)\n",CODE_LVAR);
+	if (l>=ARG_LVAR_OFFSET) {  /* caller's arguments */
+	    printf("lo16(%d)(r1)\n",CODE_CALLER_ARG);
+	} else
+	    printf("lo16(%d)(r30)\n",CODE_LVAR);
     } else if (l<0) {  /* local variable */
 	printf("lo16(%d+L_%d)(r30)\n",FUNC_LVAR,lvar_offset_label);
     } else if (l>=ARG_LVAR_OFFSET) {  /* caller's arguments */
@@ -215,7 +219,10 @@
 lvar16ha(int l)
 {
     if (fnptr->sc==CODE) {
-	printf("la r0,ha16(%d)(r30)\n",CODE_LVAR);
+	if (l>=ARG_LVAR_OFFSET) {  /* caller's arguments */
+	    printf("la r0,ha16(%d)(r1)\n",CODE_CALLER_ARG);
+	} else
+	    printf("la r0,ha16(%d)(r30)\n",CODE_LVAR);
     } else if (l<0) {  /* local variable */
 	printf("la r0,ha16(%d+L_%d)(r30)\n",FUNC_LVAR,lvar_offset_label);
     } else if (l>=ARG_LVAR_OFFSET) {  /* caller's arguments */
@@ -230,7 +237,10 @@
 lvar16lo(int l)
 {
     if (fnptr->sc==CODE) {
-	printf("lo16(%d)(r0)\n",CODE_LVAR);
+	if (l>=ARG_LVAR_OFFSET) {  /* caller's arguments */
+	    printf("lo16(%d)(r0)\n",CODE_CALLER_ARG);
+	} else
+	    printf("lo16(%d)(r0)\n",CODE_LVAR);
     } else if (l<0) {  /* local variable */
 	printf("lo16(%d+L_%d)(r0)\n",FUNC_LVAR,lvar_offset_label);
     } else if (l>=ARG_LVAR_OFFSET) {  /* caller's arguments */