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
8fb60768
Commit
8fb60768
authored
Jan 13, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
in 6g -r (the rsc flag),
rewrite heap pointer moves as xchg. R=ken OCL=22665 CL=22665
parent
1a0bde24
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
2 deletions
+71
-2
src/cmd/6g/cgen.c
src/cmd/6g/cgen.c
+1
-0
src/cmd/6g/gsubr.c
src/cmd/6g/gsubr.c
+52
-2
src/cmd/6g/reg.c
src/cmd/6g/reg.c
+18
-0
No files found.
src/cmd/6g/cgen.c
View file @
8fb60768
...
...
@@ -7,6 +7,7 @@
/*
* generate:
* res = n;
* simplifies and calls gmove.
*/
void
cgen
(
Node
*
n
,
Node
*
res
)
...
...
src/cmd/6g/gsubr.c
View file @
8fb60768
...
...
@@ -511,15 +511,49 @@ gmove(Node *f, Node *t)
goto
st
;
case
TINT32
:
case
TUINT32
:
case
TPTR32
:
a
=
AMOVL
;
goto
st
;
case
TINT64
:
case
TUINT64
:
case
TPTR64
:
a
=
AMOVQ
;
goto
st
;
case
TPTR32
:
case
TPTR64
:
/*
* store to pointer.
*/
if
(
tt
==
TPTR32
)
a
=
AMOVL
;
else
a
=
AMOVQ
;
switch
(
t
->
op
)
{
default:
dump
(
"gmove to"
,
t
);
fatal
(
"gmove t %O"
,
t
->
op
);
case
OINDREG
:
if
(
t
->
val
.
u
.
reg
!=
D_SP
)
goto
refcount
;
break
;
case
ONAME
:
switch
(
t
->
class
)
{
default:
dump
(
"gmove"
,
t
);
fatal
(
"gmove t %O class %d reg %R"
,
t
->
op
,
t
->
class
,
t
->
val
.
u
.
reg
);
case
PEXTERN
:
case
PSTATIC
:
goto
refcount
;
break
;
case
PAUTO
:
case
PPARAM
:
break
;
}
break
;
}
goto
st
;
st:
if
(
f
->
op
==
OCONST
)
{
gins
(
a
,
f
,
t
);
...
...
@@ -532,6 +566,22 @@ gmove(Node *f, Node *t)
regfree
(
&
nod
);
return
;
refcount:
if
(
!
debug
[
'r'
])
goto
st
;
// for now, mark ref count updates with AXCHGQ.
// using a temporary on the left, so no semantic
// changes. code is likely slower, but still correct.
if
(
t64
)
a
=
AXCHGQ
;
else
a
=
AXCHGL
;
regalloc
(
&
nod
,
t
->
type
,
f
);
gmove
(
f
,
&
nod
);
gins
(
a
,
&
nod
,
t
);
regfree
(
&
nod
);
return
;
case
TFLOAT32
:
a
=
AMOVSS
;
goto
fst
;
...
...
src/cmd/6g/reg.c
View file @
8fb60768
...
...
@@ -182,6 +182,19 @@ regopt(Prog *firstp)
for
(
z
=
0
;
z
<
BITS
;
z
++
)
r
->
use1
.
b
[
z
]
|=
bit
.
b
[
z
];
break
;
/*
* left side read+write
*/
case
AXCHGB
:
case
AXCHGW
:
case
AXCHGL
:
case
AXCHGQ
:
for
(
z
=
0
;
z
<
BITS
;
z
++
)
{
r
->
use1
.
b
[
z
]
|=
bit
.
b
[
z
];
r
->
set
.
b
[
z
]
|=
bit
.
b
[
z
];
}
break
;
}
bit
=
mkvar
(
r
,
&
p
->
to
);
...
...
@@ -313,6 +326,11 @@ regopt(Prog *firstp)
case
ASBBL
:
case
ASBBQ
:
case
AXCHGB
:
case
AXCHGW
:
case
AXCHGL
:
case
AXCHGQ
:
case
AADDSD
:
case
AADDSS
:
case
ACMPSD
:
...
...
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