Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
36bfd2a9
Commit
36bfd2a9
authored
Jun 08, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
floating point
SVN=121607
parent
8200a0b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
40 deletions
+28
-40
cgen.c
src/cmd/6g/cgen.c
+9
-40
go.y
src/cmd/gc/go.y
+19
-0
No files found.
src/cmd/6g/cgen.c
View file @
36bfd2a9
...
...
@@ -14,7 +14,7 @@ cgen(Node *n, Node *res)
Prog
*
p1
,
*
p2
,
*
p3
;
if
(
debug
[
'g'
])
{
dump
(
"
\n
cgen-
l
"
,
res
);
dump
(
"
\n
cgen-
res
"
,
res
);
dump
(
"cgen-r"
,
n
);
}
if
(
n
==
N
||
n
->
type
==
T
)
...
...
@@ -441,9 +441,9 @@ void
bgen
(
Node
*
n
,
int
true
,
Prog
*
to
)
{
long
lno
;
int
et
,
a
,
b
;
int
et
,
a
;
Node
*
nl
,
*
nr
,
*
r
;
Node
n1
,
n2
,
tmp
;
Node
n1
,
n2
;
Prog
*
p1
,
*
p2
;
if
(
n
==
N
)
...
...
@@ -560,48 +560,17 @@ bgen(Node *n, int true, Prog *to)
}
a
=
optoas
(
a
,
nr
->
type
);
if
(
nr
->
addable
)
{
regalloc
(
&
n1
,
nl
->
type
,
N
);
cgen
(
nl
,
&
n1
);
b
=
optoas
(
OCMP
,
nr
->
type
);
switch
(
b
)
{
case
ACMPQ
:
if
(
nr
->
op
==
OLITERAL
)
if
(
nr
->
val
.
vval
>=
(
1LL
<<
32
))
goto
dolit
;
case
AUCOMISS
:
if
(
nr
->
op
==
OLITERAL
)
goto
dolit
;
if
(
nr
->
op
==
ONAME
)
goto
dolit
;
}
gins
(
b
,
&
n1
,
nr
);
patch
(
gbranch
(
a
,
nr
->
type
),
to
);
regfree
(
&
n1
);
break
;
dolit:
regalloc
(
&
n2
,
nr
->
type
,
N
);
cgen
(
nr
,
&
n2
);
gins
(
b
,
&
n1
,
&
n2
);
patch
(
gbranch
(
a
,
nr
->
type
),
to
);
regfree
(
&
n2
);
regfree
(
&
n1
);
break
;
}
tempname
(
&
tmp
,
nr
->
type
);
cgen
(
nr
,
&
tmp
);
regalloc
(
&
n1
,
nl
->
type
,
N
);
cgen
(
nl
,
&
n1
);
gins
(
optoas
(
OCMP
,
nr
->
type
),
&
n1
,
&
tmp
);
regalloc
(
&
n2
,
nr
->
type
,
N
);
cgen
(
nr
,
&
n2
);
gins
(
optoas
(
OCMP
,
nr
->
type
),
&
n1
,
&
n2
);
patch
(
gbranch
(
a
,
nr
->
type
),
to
);
regfree
(
&
n1
);
regfree
(
&
n2
);
break
;
}
goto
ret
;
...
...
src/cmd/gc/go.y
View file @
36bfd2a9
...
...
@@ -1058,16 +1058,32 @@ arg_type_list_r:
$$
=
nod
(
OLIST
,
$
1
,
$
3
);
}
/*
*
need
semi
in
front
NO
*
need
semi
in
back
NO
*/
Astmt
:
complex_stmt
|
compound_stmt
/*
*
need
semi
in
front
NO
*
need
semi
in
back
YES
*/
Bstmt
:
semi_stmt
|
common_dcl
/*
*
need
semi
in
front
YES
*
need
semi
in
back
YES
*/
Cstmt
:
simple_stmt
/*
*
statement
list
that
need
semi
in
back
NO
*/
Astmt_list_r
:
Astmt
|
Astmt_list_r
Astmt
...
...
@@ -1081,6 +1097,9 @@ Astmt_list_r:
$$
=
N
;
}
/*
*
statement
list
that
need
semi
in
back
YES
*/
Bstmt_list_r
:
Bstmt
|
Cstmt
...
...
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