Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
610644a1
Commit
610644a1
authored
Jun 08, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asdf
SVN=121615
parent
e285ed60
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
77 deletions
+47
-77
src/cmd/6g/cgen.c
src/cmd/6g/cgen.c
+41
-70
src/cmd/gc/go.y
src/cmd/gc/go.y
+6
-7
No files found.
src/cmd/6g/cgen.c
View file @
610644a1
...
@@ -127,62 +127,6 @@ cgen(Node *n, Node *res)
...
@@ -127,62 +127,6 @@ cgen(Node *n, Node *res)
regfree
(
&
n1
);
regfree
(
&
n1
);
break
;
break
;
// case OINDEXPTRSTR:
// nl = n->left;
// nr = n->right;
// if(nl->addable) {
// cgen(nr);
// cgen(nl);
// gopcode(P_LOADI, T_ADDR, N);
// gopcodet(P_INDEXZ, nr->type, N);
// break;
// }
// break;
// case OINDEXSTR:
// nl = n->left;
// nr = n->right;
// if(nl->addable) {
// cgen(nr);
// gopcodet(P_INDEXZ, nr->type, nl);
// break;
// }
// cgen(nl);
// r = tempname(nl->type);
// gopcodet(P_STORE, nl->type, r);
// cgen(nr);
// gopcodet(P_INDEXZ, nr->type, r);
// break;
// case OSLICESTR:
// case OSLICEPTRSTR:
// nl = n->left; // name
// nr = n->right;
//
// r = nr->right; // index2
// if(!r->addable) {
// cgen(r);
// r = tempname(r->type);
// gopcodet(P_STORE, r->type, r);
// }
//
// // string into T_ADDR
// if(!nl->addable) {
// cgen(nl);
// gconv(T_ADDR, nl->type->etype);
// } else
// gopcode(P_LOAD, T_ADDR, nl);
//
// if(n->op == OSLICEPTRSTR)
// gopcode(P_LOADI, T_ADDR, N);
//
// // offset in int reg
// cgen(nr->left);
//
// // index 2 addressed
// gopcodet(P_SLICE, r->type, r);
// break;
case
OS2I
:
case
OS2I
:
case
OI2I
:
case
OI2I
:
case
OI2S
:
case
OI2S
:
...
@@ -210,11 +154,6 @@ cgen(Node *n, Node *res)
...
@@ -210,11 +154,6 @@ cgen(Node *n, Node *res)
fatal
(
"cgen: OLEN: unknown type %lT"
,
nl
->
type
);
fatal
(
"cgen: OLEN: unknown type %lT"
,
nl
->
type
);
break
;
break
;
// case ODOTMETH:
// case ODOTINTER:
// cgen(n->left);
// break;
case
OADDR
:
case
OADDR
:
agen
(
nl
,
res
);
agen
(
nl
,
res
);
break
;
break
;
...
@@ -238,6 +177,7 @@ cgen(Node *n, Node *res)
...
@@ -238,6 +177,7 @@ cgen(Node *n, Node *res)
case
ODIV
:
case
ODIV
:
cgen_div
(
n
->
op
,
nl
,
nr
,
res
);
cgen_div
(
n
->
op
,
nl
,
nr
,
res
);
break
;
break
;
case
OLSH
:
case
OLSH
:
case
ORSH
:
case
ORSH
:
cgen_shift
(
n
->
op
,
nl
,
nr
,
res
);
cgen_shift
(
n
->
op
,
nl
,
nr
,
res
);
...
@@ -287,7 +227,7 @@ agen(Node *n, Node *res)
...
@@ -287,7 +227,7 @@ agen(Node *n, Node *res)
{
{
Node
*
nl
,
*
nr
;
Node
*
nl
,
*
nr
;
Node
n1
,
n2
,
n3
,
tmp
;
Node
n1
,
n2
,
n3
,
tmp
;
ulong
w
;
ulong
w
,
lno
;
Type
*
t
;
Type
*
t
;
if
(
n
==
N
||
n
->
type
==
T
)
if
(
n
==
N
||
n
->
type
==
T
)
...
@@ -296,14 +236,21 @@ agen(Node *n, Node *res)
...
@@ -296,14 +236,21 @@ agen(Node *n, Node *res)
if
(
!
isptr
[
res
->
type
->
etype
])
if
(
!
isptr
[
res
->
type
->
etype
])
fatal
(
"agen: not tptr: %T"
,
res
->
type
);
fatal
(
"agen: not tptr: %T"
,
res
->
type
);
lno
=
dynlineno
;
if
(
n
->
op
!=
ONAME
)
dynlineno
=
n
->
lineno
;
// for diagnostics
if
(
n
->
addable
)
{
if
(
n
->
addable
)
{
regalloc
(
&
n1
,
types
[
tptr
],
res
);
regalloc
(
&
n1
,
types
[
tptr
],
res
);
gins
(
ALEAQ
,
n
,
&
n1
);
gins
(
ALEAQ
,
n
,
&
n1
);
gmove
(
&
n1
,
res
);
gmove
(
&
n1
,
res
);
regfree
(
&
n1
);
regfree
(
&
n1
);
return
;
goto
ret
;
}
}
nl
=
n
->
left
;
nr
=
n
->
right
;
switch
(
n
->
op
)
{
switch
(
n
->
op
)
{
default:
default:
fatal
(
"agen: unknown op %N"
,
n
);
fatal
(
"agen: unknown op %N"
,
n
);
...
@@ -317,8 +264,6 @@ agen(Node *n, Node *res)
...
@@ -317,8 +264,6 @@ agen(Node *n, Node *res)
// break;
// break;
case
OINDEXPTR
:
case
OINDEXPTR
:
nl
=
n
->
left
;
nr
=
n
->
right
;
w
=
n
->
type
->
width
;
w
=
n
->
type
->
width
;
if
(
nr
->
addable
)
if
(
nr
->
addable
)
goto
iprad
;
goto
iprad
;
...
@@ -347,8 +292,6 @@ agen(Node *n, Node *res)
...
@@ -347,8 +292,6 @@ agen(Node *n, Node *res)
// case OINDREG:
// case OINDREG:
case
OINDEX
:
case
OINDEX
:
nl
=
n
->
left
;
nr
=
n
->
right
;
w
=
n
->
type
->
width
;
w
=
n
->
type
->
width
;
if
(
nr
->
addable
)
if
(
nr
->
addable
)
goto
irad
;
goto
irad
;
...
@@ -395,7 +338,6 @@ agen(Node *n, Node *res)
...
@@ -395,7 +338,6 @@ agen(Node *n, Node *res)
// break;
// break;
case
ODOT
:
case
ODOT
:
nl
=
n
->
left
;
t
=
nl
->
type
;
t
=
nl
->
type
;
agen
(
nl
,
res
);
agen
(
nl
,
res
);
if
(
n
->
xoffset
!=
0
)
{
if
(
n
->
xoffset
!=
0
)
{
...
@@ -405,7 +347,6 @@ agen(Node *n, Node *res)
...
@@ -405,7 +347,6 @@ agen(Node *n, Node *res)
break
;
break
;
case
ODOTPTR
:
case
ODOTPTR
:
nl
=
n
->
left
;
t
=
nl
->
type
;
t
=
nl
->
type
;
if
(
!
isptr
[
t
->
etype
])
if
(
!
isptr
[
t
->
etype
])
fatal
(
"agen: not ptr %N"
,
n
);
fatal
(
"agen: not ptr %N"
,
n
);
...
@@ -416,6 +357,9 @@ agen(Node *n, Node *res)
...
@@ -416,6 +357,9 @@ agen(Node *n, Node *res)
}
}
break
;
break
;
}
}
ret:
dynlineno
=
lno
;
}
}
vlong
vlong
...
@@ -443,7 +387,7 @@ bgen(Node *n, int true, Prog *to)
...
@@ -443,7 +387,7 @@ bgen(Node *n, int true, Prog *to)
long
lno
;
long
lno
;
int
et
,
a
;
int
et
,
a
;
Node
*
nl
,
*
nr
,
*
r
;
Node
*
nl
,
*
nr
,
*
r
;
Node
n1
,
n2
;
Node
n1
,
n2
,
tmp
;
Prog
*
p1
,
*
p2
;
Prog
*
p1
,
*
p2
;
if
(
n
==
N
)
if
(
n
==
N
)
...
@@ -453,6 +397,9 @@ bgen(Node *n, int true, Prog *to)
...
@@ -453,6 +397,9 @@ bgen(Node *n, int true, Prog *to)
if
(
n
->
op
!=
ONAME
)
if
(
n
->
op
!=
ONAME
)
dynlineno
=
n
->
lineno
;
// for diagnostics
dynlineno
=
n
->
lineno
;
// for diagnostics
nl
=
n
->
left
;
nr
=
n
->
right
;
if
(
n
->
type
==
T
)
{
if
(
n
->
type
==
T
)
{
convlit
(
n
,
types
[
TBOOL
]);
convlit
(
n
,
types
[
TBOOL
]);
if
(
n
->
type
==
T
)
if
(
n
->
type
==
T
)
...
@@ -558,8 +505,32 @@ bgen(Node *n, int true, Prog *to)
...
@@ -558,8 +505,32 @@ bgen(Node *n, int true, Prog *to)
nl
=
nr
;
nl
=
nr
;
nr
=
r
;
nr
=
r
;
}
}
a
=
optoas
(
a
,
nr
->
type
);
a
=
optoas
(
a
,
nr
->
type
);
if
(
nr
->
ullman
>=
UINF
)
{
regalloc
(
&
n1
,
nr
->
type
,
N
);
cgen
(
nr
,
&
n1
);
tempname
(
&
tmp
,
nr
->
type
);
gmove
(
&
n1
,
&
tmp
);
regfree
(
&
n1
);
regalloc
(
&
n1
,
nl
->
type
,
N
);
cgen
(
nl
,
&
n1
);
regalloc
(
&
n2
,
nr
->
type
,
&
n2
);
cgen
(
&
tmp
,
&
n2
);
gins
(
optoas
(
OCMP
,
nr
->
type
),
&
n1
,
&
n2
);
patch
(
gbranch
(
a
,
nr
->
type
),
to
);
regfree
(
&
n1
);
regfree
(
&
n2
);
break
;
}
regalloc
(
&
n1
,
nl
->
type
,
N
);
regalloc
(
&
n1
,
nl
->
type
,
N
);
cgen
(
nl
,
&
n1
);
cgen
(
nl
,
&
n1
);
...
...
src/cmd/gc/go.y
View file @
610644a1
...
@@ -1065,6 +1065,10 @@ arg_type_list_r:
...
@@ -1065,6 +1065,10 @@ arg_type_list_r:
Astmt
:
Astmt
:
complex_stmt
complex_stmt
|
compound_stmt
|
compound_stmt
|
';'
{
$$
=
N
;
}
/*
/*
*
need
semi
in
front
NO
*
need
semi
in
front
NO
...
@@ -1091,11 +1095,6 @@ Astmt_list_r:
...
@@ -1091,11 +1095,6 @@ Astmt_list_r:
$$
=
nod
(
OLIST
,
$
1
,
$
2
);
$$
=
nod
(
OLIST
,
$
1
,
$
2
);
}
}
|
Bstmt_list_r
';'
|
Bstmt_list_r
';'
|
Astmt_list_r
';'
|
';'
{
$$
=
N
;
}
/*
/*
*
statement
list
that
need
semi
in
back
YES
*
statement
list
that
need
semi
in
back
YES
...
@@ -1107,11 +1106,11 @@ Bstmt_list_r:
...
@@ -1107,11 +1106,11 @@ Bstmt_list_r:
{
{
$$
=
nod
(
OLIST
,
$
1
,
$
2
);
$$
=
nod
(
OLIST
,
$
1
,
$
2
);
}
}
|
Astmt_list_r
C
stmt
|
Astmt_list_r
B
stmt
{
{
$$
=
nod
(
OLIST
,
$
1
,
$
2
);
$$
=
nod
(
OLIST
,
$
1
,
$
2
);
}
}
|
Astmt_list_r
B
stmt
|
Astmt_list_r
C
stmt
{
{
$$
=
nod
(
OLIST
,
$
1
,
$
2
);
$$
=
nod
(
OLIST
,
$
1
,
$
2
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment