Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
e3850872
Commit
e3850872
authored
Apr 30, 2015
by
Travis Hance
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't spill constant variables onto the stack
parent
227d1a8e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
src/asm_writing/rewriter.cpp
src/asm_writing/rewriter.cpp
+11
-5
No files found.
src/asm_writing/rewriter.cpp
View file @
e3850872
...
@@ -471,10 +471,6 @@ assembler::Immediate RewriterVar::tryGetAsImmediate(bool* is_immediate) {
...
@@ -471,10 +471,6 @@ assembler::Immediate RewriterVar::tryGetAsImmediate(bool* is_immediate) {
assembler
::
Register
RewriterVar
::
getInReg
(
Location
dest
,
bool
allow_constant_in_reg
,
Location
otherThan
)
{
assembler
::
Register
RewriterVar
::
getInReg
(
Location
dest
,
bool
allow_constant_in_reg
,
Location
otherThan
)
{
assert
(
dest
.
type
==
Location
::
Register
||
dest
.
type
==
Location
::
AnyReg
);
assert
(
dest
.
type
==
Location
::
Register
||
dest
.
type
==
Location
::
AnyReg
);
// assembler::Register reg = var->rewriter->allocReg(l);
// var->rewriter->addLocationToVar(var, reg);
// return reg;
assert
(
locations
.
size
());
#ifndef NDEBUG
#ifndef NDEBUG
if
(
!
allow_constant_in_reg
)
{
if
(
!
allow_constant_in_reg
)
{
for
(
Location
l
:
locations
)
{
for
(
Location
l
:
locations
)
{
...
@@ -483,6 +479,15 @@ assembler::Register RewriterVar::getInReg(Location dest, bool allow_constant_in_
...
@@ -483,6 +479,15 @@ assembler::Register RewriterVar::getInReg(Location dest, bool allow_constant_in_
}
}
#endif
#endif
if
(
locations
.
size
()
==
0
&&
this
->
is_constant
)
{
assembler
::
Register
reg
=
rewriter
->
allocReg
(
dest
,
otherThan
);
rewriter
->
const_loader
.
loadConstIntoReg
(
this
->
constant_value
,
reg
);
rewriter
->
addLocationToVar
(
this
,
reg
);
return
reg
;
}
assert
(
locations
.
size
());
// Not sure if this is worth it,
// Not sure if this is worth it,
// but first try to see if we're already in this specific register
// but first try to see if we're already in this specific register
for
(
Location
l
:
locations
)
{
for
(
Location
l
:
locations
)
{
...
@@ -1287,7 +1292,8 @@ void Rewriter::spillRegister(assembler::Register reg, Location preserve) {
...
@@ -1287,7 +1292,8 @@ void Rewriter::spillRegister(assembler::Register reg, Location preserve) {
assert
(
var
);
assert
(
var
);
// There may be no need to spill if the var is held in a different location already.
// There may be no need to spill if the var is held in a different location already.
if
(
var
->
locations
.
size
()
>
1
)
{
// There is no need to spill if it is a constant
if
(
var
->
locations
.
size
()
>
1
||
var
->
is_constant
)
{
removeLocationFromVar
(
var
,
reg
);
removeLocationFromVar
(
var
,
reg
);
return
;
return
;
}
}
...
...
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