comparison mc-code-mips.c @ 445:5ec2a88b9f4d const-attribute

const
author kono
date Sun, 21 Nov 2004 19:20:18 +0900
parents 8bec605d1701
children c55363eff5e5
comparison
equal deleted inserted replaced
444:8bec605d1701 445:5ec2a88b9f4d
771 goto not_found; 771 goto not_found;
772 } 772 }
773 } 773 }
774 } 774 }
775 not_found: 775 not_found:
776 return list2(LVAR,new_lvar(SIZE_OF_LONGLONG)); 776 return list3(LVAR,new_lvar(SIZE_OF_LONGLONG),0);
777 } 777 }
778 778
779 void 779 void
780 emit_pop_free(int xreg) 780 emit_pop_free(int xreg)
781 { 781 {
1092 if (i+1>=max_reg_var) max_reg_var=i+1; 1092 if (i+1>=max_reg_var) max_reg_var=i+1;
1093 /* その場所を表す番号を返す */ 1093 /* その場所を表す番号を返す */
1094 return list3(REGISTER,j,(int)n); 1094 return list3(REGISTER,j,(int)n);
1095 } 1095 }
1096 } 1096 }
1097 return list2(LVAR,new_lvar(SIZE_OF_INT)); 1097 return list3(LVAR,new_lvar(SIZE_OF_INT),0);
1098 } 1098 }
1099 1099
1100 #define freg_var_num(i) (FREG_VAR_BASE-i+FREG_OFFSET) 1100 #define freg_var_num(i) (FREG_VAR_BASE-i+FREG_OFFSET)
1101 1101
1102 int 1102 int
1119 if (i+1>max_freg_var) max_freg_var=i+1; 1119 if (i+1>max_freg_var) max_freg_var=i+1;
1120 /* その場所を表す番号を返す */ 1120 /* その場所を表す番号を返す */
1121 return list3(FREGISTER,j,(int)n); 1121 return list3(FREGISTER,j,(int)n);
1122 } 1122 }
1123 } 1123 }
1124 return list2(LVAR,new_lvar(SIZE_OF_DOUBLE)); 1124 return list3(LVAR,new_lvar(SIZE_OF_DOUBLE),0);
1125 } 1125 }
1126 1126
1127 int 1127 int
1128 emit_push() 1128 emit_push()
1129 { 1129 {
1813 } else { 1813 } else {
1814 offset += size(n->ty); 1814 offset += size(n->ty);
1815 continue; 1815 continue;
1816 } 1816 }
1817 n->sc = LVAR; 1817 n->sc = LVAR;
1818 g_expr_u(assign_expr0(list2(LVAR,n->dsp),list3(tag,reg,(int)n),t,t)); 1818 g_expr_u(assign_expr0(list3(LVAR,n->dsp,0),list3(tag,reg,(int)n),t,t));
1819 if (tag==REGISTER||tag==DREGISTER||tag==FREGISTER||tag==LREGISTER) { 1819 if (tag==REGISTER||tag==DREGISTER||tag==FREGISTER||tag==LREGISTER) {
1820 free_register(reg); 1820 free_register(reg);
1821 } 1821 }
1822 } 1822 }
1823 if (dots) { 1823 if (dots) {
1824 while ((reg = get_input_register_var(reg_var,0,0))) { 1824 while ((reg = get_input_register_var(reg_var,0,0))) {
1825 g_expr_u(assign_expr0( 1825 g_expr_u(assign_expr0(
1826 list2(LVAR,offset),reg,INT,INT)); 1826 list3(LVAR,offset,0),reg,INT,INT));
1827 offset+=SIZE_OF_INT; 1827 offset+=SIZE_OF_INT;
1828 reg_var++; 1828 reg_var++;
1829 } 1829 }
1830 } 1830 }
1831 my_func_args = offset; 1831 my_func_args = offset;
1985 { 1985 {
1986 if(scalar(t)) { 1986 if(scalar(t)) {
1987 if (mode==AS_SAVE) { 1987 if (mode==AS_SAVE) {
1988 return get_register_var(0); 1988 return get_register_var(0);
1989 } else if (reg_arg+1>MAX_INPUT_REGISTER_VAR) { 1989 } else if (reg_arg+1>MAX_INPUT_REGISTER_VAR) {
1990 return list2(LVAR,caller_arg_offset_v(nargs)); 1990 return list3(LVAR,caller_arg_offset_v(nargs),0);
1991 } else 1991 } else
1992 return get_input_register_var(reg_arg,0,0); 1992 return get_input_register_var(reg_arg,0,0);
1993 } else if (t==LONGLONG||t==ULONGLONG) { 1993 } else if (t==LONGLONG||t==ULONGLONG) {
1994 if (reg_arg%2==1) reg_arg++; // alignment 1994 if (reg_arg%2==1) reg_arg++; // alignment
1995 if (nargs%2==1) nargs++; // alignment 1995 if (nargs%2==1) nargs++; // alignment
1996 if (mode==AS_SAVE) { 1996 if (mode==AS_SAVE) {
1997 return get_lregister_var(0); 1997 return get_lregister_var(0);
1998 } else if (reg_arg+1>=MAX_INPUT_REGISTER_VAR) { 1998 } else if (reg_arg+1>=MAX_INPUT_REGISTER_VAR) {
1999 return list2(LVAR,caller_arg_offset_v(nargs)); 1999 return list3(LVAR,caller_arg_offset_v(nargs),0);
2000 } else 2000 } else
2001 return get_input_lregister_var(reg_arg,0,0); 2001 return get_input_lregister_var(reg_arg,0,0);
2002 } else if (t==FLOAT) { 2002 } else if (t==FLOAT) {
2003 if (mode==AS_SAVE) { 2003 if (mode==AS_SAVE) {
2004 return get_dregister_var(0,0); 2004 return get_dregister_var(0,0);
2005 } else if (freg_arg>=MAX_INPUT_DREGISTER_VAR) { 2005 } else if (freg_arg>=MAX_INPUT_DREGISTER_VAR) {
2006 return list2(LVAR,caller_arg_offset_v(nargs)); 2006 return list3(LVAR,caller_arg_offset_v(nargs),0);
2007 } else 2007 } else
2008 return get_input_dregister_var(freg_arg,0,0,0); 2008 return get_input_dregister_var(freg_arg,0,0,0);
2009 } else if (t==DOUBLE) { 2009 } else if (t==DOUBLE) {
2010 if (reg_arg%2==1) reg_arg++; // alignment 2010 if (reg_arg%2==1) reg_arg++; // alignment
2011 if (nargs%2==1) nargs++; // alignment 2011 if (nargs%2==1) nargs++; // alignment
2012 if (mode==AS_SAVE) { 2012 if (mode==AS_SAVE) {
2013 return get_dregister_var(0,1); 2013 return get_dregister_var(0,1);
2014 } else if (reg_arg+1>=MAX_INPUT_DREGISTER_VAR) { 2014 } else if (reg_arg+1>=MAX_INPUT_DREGISTER_VAR) {
2015 return list2(LVAR,caller_arg_offset_v(nargs)); 2015 return list3(LVAR,caller_arg_offset_v(nargs),0);
2016 } else 2016 } else
2017 return get_input_dregister_var(reg_arg,0,0,1); 2017 return get_input_dregister_var(reg_arg,0,0,1);
2018 } else if (t>=0&&(car(t)==STRUCT||car(t)==UNION)) { 2018 } else if (t>=0&&(car(t)==STRUCT||car(t)==UNION)) {
2019 if (mode==AS_SAVE) { 2019 if (mode==AS_SAVE) {
2020 return get_register_var(0); 2020 return get_register_var(0);
2021 } else 2021 } else
2022 return list2(LVAR,caller_arg_offset_v(nargs)); 2022 return list3(LVAR,caller_arg_offset_v(nargs),0);
2023 } else { 2023 } else {
2024 error(-1); 2024 error(-1);
2025 return get_register_var(0); 2025 return get_register_var(0);
2026 } 2026 }
2027 } 2027 }