summaryrefslogtreecommitdiff
path: root/src/cmd/5c
diff options
context:
space:
mode:
authorKai Backman <kaib@golang.org>2009-06-16 11:25:58 -0700
committerKai Backman <kaib@golang.org>2009-06-16 11:25:58 -0700
commitd8d32ed23908784cef4e58cb472b95b2f32f994f (patch)
treef27cddc4cd0618b6458d7cad64c96c754fb21fbb /src/cmd/5c
parent2b0035494db5755b495de8a5b94282a8446b70a7 (diff)
downloadgolang-d8d32ed23908784cef4e58cb472b95b2f32f994f.tar.gz
grab bag of changes aimed at getting stack splitting to work:
- morestack support for 5l and arm runtime - argsize support in 5c, 5l, ar and nm. assembly code from 5a will break in interesting ways unless NOSPLIT is specified - explicit cond execution constants - fix 5l output to use %d instead of %ld so that negative values show. - added a lot of code to arm/asm.s. runtime entry code almost working currently aborts at gogo not implemented R=rsc APPROVED=rsc DELTA=305 (125 added, 29 deleted, 151 changed) OCL=30246 CL=30347
Diffstat (limited to 'src/cmd/5c')
-rw-r--r--src/cmd/5c/gc.h11
-rw-r--r--src/cmd/5c/list.c14
-rw-r--r--src/cmd/5c/sgen.c30
-rw-r--r--src/cmd/5c/swt.c9
4 files changed, 53 insertions, 11 deletions
diff --git a/src/cmd/5c/gc.h b/src/cmd/5c/gc.h
index 4ddff6d9a..297a6073e 100644
--- a/src/cmd/5c/gc.h
+++ b/src/cmd/5c/gc.h
@@ -61,6 +61,7 @@ typedef struct Rgn Rgn;
struct Adr
{
int32 offset;
+ int32 offset2;
double dval;
char sval[NSNAME];
Ieee ieee;
@@ -140,7 +141,7 @@ struct Reg
int32 regu;
int32 loop; /* could be shorter */
-
+
Reg* log5;
int32 active;
@@ -362,10 +363,10 @@ int32 FtoB(int);
int BtoR(int32);
int BtoF(int32);
-void predicate(void);
-int isbranch(Prog *);
-int predicable(Prog *p);
-int modifiescpsr(Prog *p);
+void predicate(void);
+int isbranch(Prog *);
+int predicable(Prog *p);
+int modifiescpsr(Prog *p);
#pragma varargck type "A" int
#pragma varargck type "B" Bits
diff --git a/src/cmd/5c/list.c b/src/cmd/5c/list.c
index 14454abb0..c792c130d 100644
--- a/src/cmd/5c/list.c
+++ b/src/cmd/5c/list.c
@@ -28,6 +28,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+
#define EXTERN
#include "gc.h"
@@ -71,9 +72,9 @@ Bconv(Fmt *fp)
}
char *extra [] = {
- ".EQ", ".NE", ".CS", ".CC",
- ".MI", ".PL", ".VS", ".VC",
- ".HI", ".LS", ".GE", ".LT",
+ ".EQ", ".NE", ".CS", ".CC",
+ ".MI", ".PL", ".VS", ".VC",
+ ".HI", ".LS", ".GE", ".LT",
".GT", ".LE", "", ".NV",
};
@@ -86,7 +87,7 @@ Pconv(Fmt *fp)
p = va_arg(fp->args, Prog*);
a = p->as;
- s = p->scond;
+ s = p->scond;
strcpy(sc, extra[s & C_SCOND]);
if(s & C_SBIT)
strcat(sc, ".S");
@@ -162,6 +163,10 @@ Dconv(Fmt *fp)
sprint(str, "$%N", a);
break;
+ case D_CONST2:
+ sprint(str, "$%d-%d", a->offset, a->offset2);
+ break;
+
case D_SHIFT:
v = a->offset;
op = "<<>>->@>" + (((v>>5) & 3) << 1);
@@ -224,6 +229,7 @@ Rconv(Fmt *fp)
sprint(str, "GOK-reglist");
switch(a->type) {
case D_CONST:
+ case D_CONST2:
if(a->reg != NREG)
break;
if(a->sym != S)
diff --git a/src/cmd/5c/sgen.c b/src/cmd/5c/sgen.c
index b7f61bb7e..e18cb6168 100644
--- a/src/cmd/5c/sgen.c
+++ b/src/cmd/5c/sgen.c
@@ -30,6 +30,31 @@
#include "gc.h"
+int32
+argsize(void)
+{
+ Type *t;
+ int32 s;
+
+//print("t=%T\n", thisfn);
+ s = 0;
+ for(t=thisfn->down; t!=T; t=t->down) {
+ switch(t->etype) {
+ case TVOID:
+ break;
+ case TDOT:
+ s += 64;
+ break;
+ default:
+ s = align(s, t, Aarg1);
+ s = align(s, t, Aarg2);
+ break;
+ }
+//print(" %d %T\n", s, t);
+ }
+ return (s+7) & ~7;
+}
+
void
codgen(Node *n, Node *nn)
{
@@ -53,6 +78,9 @@ codgen(Node *n, Node *nn)
}
nearln = nn->lineno;
gpseudo(ATEXT, n1->sym, nodconst(stkoff));
+ p->to.type = D_CONST2;
+ p->to.offset2 = argsize();
+
sp = p;
/*
@@ -313,7 +341,7 @@ loop:
patch(spc, pc);
gen(l->right->right); /* inc */
- patch(sp, pc);
+ patch(sp, pc);
if(l->left != Z) { /* test */
bcomplex(l->left, Z);
patch(p, breakpc);
diff --git a/src/cmd/5c/swt.c b/src/cmd/5c/swt.c
index 83f7f5621..28314daca 100644
--- a/src/cmd/5c/swt.c
+++ b/src/cmd/5c/swt.c
@@ -338,7 +338,7 @@ loop:
if(vs < 0) {
gopcode(OAS, &nod1, Z, &nod1);
gopcode(OSUB, &nod1, nodconst(0), nn);
- } else
+ } else
gopcode(OAS, &nod1, Z, nn);
regfree(&nod1);
return 1;
@@ -649,6 +649,13 @@ zaddr(char *bp, Adr *a, int s)
case D_PSR:
break;
+ case D_CONST2:
+ l = a->offset2;
+ bp[0] = l;
+ bp[1] = l>>8;
+ bp[2] = l>>16;
+ bp[3] = l>>24;
+ bp += 4; // fall through
case D_OREG:
case D_CONST:
case D_BRANCH: