Commit 56668283 authored by Luuk van Dijk's avatar Luuk van Dijk

gc: allow tags on parameters in export section of object files.

This is in preparation of escape analysis; function parameters
can now be tagged with interesting bits by the compiler by
assigning to n->note.

tested by having typecheck put a fake tag on all parameters of
pointer type and compiling the tree.

R=rsc
CC=golang-dev
https://golang.org/cl/4524092
parent ae5a972d
......@@ -1792,24 +1792,12 @@ hidden_opt_sym:
}
hidden_dcl:
hidden_opt_sym hidden_type
hidden_opt_sym hidden_type hidden_tag
{
$$ = nod(ODCLFIELD, $1, typenod($2));
$$->val = $3;
}
| hidden_opt_sym LDDD
{
Type *t;
yyerror("invalid variadic function type in import - recompile import");
t = typ(TARRAY);
t->bound = -1;
t->type = typ(TINTER);
$$ = nod(ODCLFIELD, $1, typenod(t));
$$->isddd = 1;
}
| hidden_opt_sym LDDD hidden_type
| hidden_opt_sym LDDD hidden_type hidden_tag
{
Type *t;
......@@ -1818,6 +1806,7 @@ hidden_dcl:
t->type = $3;
$$ = nod(ODCLFIELD, $1, typenod(t));
$$->isddd = 1;
$$->val = $4;
}
hidden_structdcl:
......
......@@ -403,7 +403,7 @@ func (p *gcParser) parseStructType() Type {
}
// Parameter = ( identifier | "?" ) [ "..." ] Type .
// Parameter = ( identifier | "?" ) [ "..." ] Type [ ":" string_lit ] .
//
func (p *gcParser) parseParameter() (par *ast.Object, isVariadic bool) {
name := p.parseName()
......@@ -415,6 +415,11 @@ func (p *gcParser) parseParameter() (par *ast.Object, isVariadic bool) {
isVariadic = true
}
ptyp := p.parseType()
// ignore argument tag
if p.tok == ':' {
p.next()
p.expect(scanner.String)
}
par = ast.NewObj(ast.Var, name)
par.Type = ptyp
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment