Gen: stackptr for var.stackloc
This commit is contained in:
parent
b3577b17af
commit
087466fa70
6
gen.c
6
gen.c
@ -2,8 +2,10 @@
|
||||
|
||||
Gen gen_new(void)
|
||||
{
|
||||
Gen gen;
|
||||
gen.labelno=0;
|
||||
Gen gen={
|
||||
.labelno=0,
|
||||
.stackptr=NULL,
|
||||
};
|
||||
return gen;
|
||||
}
|
||||
|
||||
|
2
gen.h
2
gen.h
@ -6,10 +6,12 @@
|
||||
#pragma once
|
||||
|
||||
#include"mem.h"
|
||||
#include"pnode.h"
|
||||
|
||||
typedef struct Gen
|
||||
{
|
||||
size_t labelno;
|
||||
const PNode*stackptr;
|
||||
} Gen;
|
||||
|
||||
Gen gen_new(void);
|
||||
|
1
x86_64.c
1
x86_64.c
@ -31,6 +31,7 @@ void gen_x86_64(Gen*gen,const PNode*pn,FILE*file)
|
||||
err_log("%u: nested function declaration",pn->firstline);
|
||||
fprintf(file,"global %s\n%s:\n",vec_at(&pn->tokens,0,const Tok*)->str.buffer,vec_at(&pn->tokens,0,const Tok*)->str.buffer);
|
||||
|
||||
gen->stackptr=pn;
|
||||
size_t stacksize=gen_x86_64_stacksize(pn);
|
||||
gen_x86_64_prolog(pn,file,stacksize);
|
||||
for(size_t i=0;i<pn->pnodes.size;++i)
|
||||
|
Loading…
Reference in New Issue
Block a user