-fsanitize=address, Func.no_args for setting ext fn arguments
This commit is contained in:
parent
4dac8797eb
commit
2ed9bdf5c4
4
Makefile
4
Makefile
|
@ -1,8 +1,8 @@
|
|||
#
|
||||
# VARIABLES/MACROS
|
||||
#
|
||||
CFLAGS= -Wfatal-errors -Wall -Wextra -Werror=discarded-qualifiers -Werror=ignored-qualifiers
|
||||
LDFLAGS= -g3 -no-pie -z noexecstack -lm
|
||||
CFLAGS= -Wfatal-errors -Wall -Wextra -Werror=discarded-qualifiers -Werror=ignored-qualifiers -fsanitize=address
|
||||
LDFLAGS= -g3 -no-pie -z noexecstack -lm -fsanitize=address -static-libasan
|
||||
ASFLAGS=
|
||||
OBJS= str.o tok.o vec.o lex.o pnode.o reg.o mem.o state.o err.o x86_64.o run.o ir.o gen.o i386.o sprint.o
|
||||
LIB= libpar.a
|
||||
|
|
7
gen.c
7
gen.c
|
@ -171,7 +171,7 @@ void gen_declare_function(Gen*gen,PNode*pn,FILE*file)
|
|||
|
||||
Func func={
|
||||
.name=vec_at(&pn->tokens,0,const Tok*)->str.buffer,
|
||||
/* .type=I32, */
|
||||
.no_args=0,
|
||||
};
|
||||
vec_push((Vec*)&gen->rootnode->funcs,&func);
|
||||
|
||||
|
@ -199,9 +199,6 @@ void gen_declare_function(Gen*gen,PNode*pn,FILE*file)
|
|||
Var var={
|
||||
.name=vec_at(&pn->tokens,i,const Tok*)->str.buffer,
|
||||
.is_arg=true,
|
||||
/* .type=I32, */
|
||||
/* .location=STACK, */
|
||||
/* .regnum=0, */
|
||||
.stackloc=stacksize,
|
||||
};
|
||||
vec_push((Vec*)&gen->stackptr->vars,&var);
|
||||
|
@ -524,7 +521,7 @@ void gen_code(Gen*gen,PNode*pn,FILE*file)
|
|||
|
||||
Func func={
|
||||
.name=vec_at(&pn->tokens,0,const Tok*)->str.buffer,
|
||||
/* .type=I32, */
|
||||
.no_args=0,
|
||||
};
|
||||
vec_push((Vec*)&gen->rootnode->funcs,&func);
|
||||
}
|
||||
|
|
6
mem.h
6
mem.h
|
@ -41,17 +41,15 @@ typedef struct Var
|
|||
{
|
||||
char*name;
|
||||
VTYPE type;
|
||||
// VLOC location;
|
||||
// size_t regnum; // REG: which register?
|
||||
bool is_arg; // Remember to move arg register to stack
|
||||
size_t stackloc; // STACK: rsp-???
|
||||
} Var;
|
||||
|
||||
// Variable descriptor
|
||||
// Function descriptor
|
||||
typedef struct Func
|
||||
{
|
||||
char*name;
|
||||
// VTYPE type;
|
||||
size_t no_args;
|
||||
} Func;
|
||||
|
||||
Var var_new(void);
|
||||
|
|
Loading…
Reference in New Issue
Block a user