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
1a3f9445
Commit
1a3f9445
authored
Jun 25, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simul assignment
SVN=124591
parent
deaac980
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
11 deletions
+86
-11
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+86
-11
No files found.
src/cmd/gc/walk.c
View file @
1a3f9445
...
@@ -1908,42 +1908,117 @@ loop1:
...
@@ -1908,42 +1908,117 @@ loop1:
/*
/*
* from ascompat[ee]
* from ascompat[ee]
* a,b = c,d
* a,b = c,d
* simultaneous assignment. there can
be
* simultaneous assignment. there can
not
* later use of an earlier lvalue.
*
be
later use of an earlier lvalue.
*/
*/
int
int
vmatch
(
Node
*
l
,
Node
*
r
)
vmatch
2
(
Node
*
l
,
Node
*
r
)
{
{
dump
(
"l"
,
l
);
dump
(
"r"
,
r
);
loop:
/*
* isolate all right sides
*/
if
(
r
==
N
)
return
0
;
return
0
;
switch
(
r
->
op
)
{
case
ONAME
:
// match each right given left
if
(
l
==
r
)
return
1
;
case
OLITERAL
:
return
0
;
}
if
(
vmatch2
(
l
,
r
->
right
))
return
1
;
r
=
r
->
left
;
goto
loop
;
}
int
vmatch1
(
Node
*
l
,
Node
*
r
)
{
loop:
/*
* isolate all left sides
*/
if
(
l
==
N
)
return
0
;
switch
(
l
->
op
)
{
case
ONAME
:
// match each left with all rights
return
vmatch2
(
l
,
r
);
case
OLITERAL
:
return
0
;
}
if
(
vmatch1
(
l
->
right
,
r
))
return
1
;
l
=
l
->
left
;
goto
loop
;
}
}
Node
*
Node
*
reorder3
(
Node
*
n
)
reorder3
(
Node
*
n
)
{
{
Iter
save1
,
save2
;
Iter
save1
,
save2
;
Node
*
l1
,
*
l2
;
Node
*
l1
,
*
l2
,
*
q
,
*
r
;
int
c1
,
c2
;
int
c1
,
c2
;
r
=
N
;
l1
=
listfirst
(
&
save1
,
&
n
);
l1
=
listfirst
(
&
save1
,
&
n
);
c1
=
0
;
c1
=
0
;
while
(
l1
!=
N
)
{
while
(
l1
!=
N
)
{
l2
=
listfirst
(
&
save
1
,
&
n
);
l2
=
listfirst
(
&
save
2
,
&
n
);
c2
=
0
;
c2
=
0
;
while
(
l2
!=
N
)
{
while
(
l2
!=
N
)
{
if
(
c2
>
c1
)
{
if
(
c2
>
c1
)
{
if
(
vmatch
(
l1
->
left
,
l2
->
right
))
{
if
(
vmatch1
(
l1
->
left
,
l2
->
right
))
{
q
=
nod
(
OXXX
,
N
,
N
);
tempname
(
q
,
l2
->
right
->
type
);
q
=
nod
(
OAS
,
l1
->
left
,
q
);
l1
->
left
=
q
->
right
;
if
(
r
==
N
)
r
=
q
;
else
r
=
nod
(
OLIST
,
r
,
q
);
break
;
}
}
}
}
l2
=
listnext
(
&
save
1
);
l2
=
listnext
(
&
save
2
);
c2
++
;
c2
++
;
}
}
l1
=
listnext
(
&
save1
);
l1
=
listnext
(
&
save1
);
c1
++
;
c1
++
;
}
}
if
(
r
==
N
)
return
n
;
return
n
;
q
=
N
;
l1
=
listfirst
(
&
save1
,
&
n
);
while
(
l1
!=
N
)
{
if
(
q
==
N
)
q
=
l1
;
else
q
=
nod
(
OLIST
,
q
,
l1
);
l1
=
listnext
(
&
save1
);
}
r
=
rev
(
r
);
l1
=
listfirst
(
&
save1
,
&
r
);
while
(
l1
!=
N
)
{
if
(
q
==
N
)
q
=
l1
;
else
q
=
nod
(
OLIST
,
q
,
l1
);
l1
=
listnext
(
&
save1
);
}
q
=
rev
(
q
);
//dump("res", q);
return
q
;
}
}
Node
*
Node
*
...
...
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