Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-fast
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
mu
mu-impl-fast
Commits
2e850875
Commit
2e850875
authored
Jul 18, 2017
by
qinsoon
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[wip] new trace scheduling should work for x86_64
parent
a1a433f4
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
376 additions
and
196 deletions
+376
-196
src/ast/src/ir.rs
src/ast/src/ir.rs
+37
-1
src/compiler/backend/arch/x86_64/inst_sel.rs
src/compiler/backend/arch/x86_64/inst_sel.rs
+18
-143
src/compiler/passes/ret_sink.rs
src/compiler/passes/ret_sink.rs
+5
-1
src/compiler/passes/trace_gen.rs
src/compiler/passes/trace_gen.rs
+316
-51
No files found.
src/ast/src/ir.rs
View file @
2e850875
...
...
@@ -506,6 +506,38 @@ impl Block {
content
.body
.len
()
}
}
/// is this block ends with a conditional branch?
pub
fn
ends_with_cond_branch
(
&
self
)
->
bool
{
let
block
:
&
BlockContent
=
self
.content
.as_ref
()
.unwrap
();
match
block
.body
.last
()
{
Some
(
node
)
=>
{
match
node
.v
{
TreeNode_
::
Instruction
(
Instruction
{
v
:
Instruction_
::
Branch2
{
..
},
..
})
=>
{
true
}
_
=>
false
}
}
None
=>
false
}
}
/// is this block ends with a return?
pub
fn
ends_with_return
(
&
self
)
->
bool
{
let
block
:
&
BlockContent
=
self
.content
.as_ref
()
.unwrap
();
match
block
.body
.last
()
{
Some
(
node
)
=>
{
match
node
.v
{
TreeNode_
::
Instruction
(
Instruction
{
v
:
Instruction_
::
Return
(
_
),
..
})
=>
{
true
}
_
=>
false
}
}
None
=>
false
}
}
}
/// TraceHint is a hint for the compiler to generate better trace for this block
...
...
@@ -805,9 +837,13 @@ rodal_struct!(Value{hdr, ty, v});
impl
Value
{
/// creates an int constant value
pub
fn
make_int_const
(
id
:
MuID
,
val
:
u64
)
->
P
<
Value
>
{
Value
::
make_int_const_ty
(
id
,
UINT32_TYPE
.clone
(),
val
)
}
pub
fn
make_int_const_ty
(
id
:
MuID
,
ty
:
P
<
MuType
>
,
val
:
u64
)
->
P
<
Value
>
{
P
(
Value
{
hdr
:
MuEntityHeader
::
unnamed
(
id
),
ty
:
UINT32_TYPE
.clone
()
,
ty
:
ty
,
v
:
Value_
::
Constant
(
Constant
::
Int
(
val
))
})
}
...
...
src/compiler/backend/arch/x86_64/inst_sel.rs
View file @
2e850875
This diff is collapsed.
Click to expand it.
src/compiler/passes/ret_sink.rs
View file @
2e850875
...
...
@@ -81,6 +81,7 @@ impl CompilerPass for RetSink {
// rewrite existing RET instruction to a BRANCH
// use RET values as BRANCH's goto values
let
mut
has_ret
:
bool
=
false
;
for
(
blk_id
,
mut
block
)
in
f_content
.blocks
.iter_mut
()
{
trace!
(
"block: {}"
,
blk_id
);
...
...
@@ -104,6 +105,7 @@ impl CompilerPass for RetSink {
});
trace!
(
">> rewrite ret to {}"
,
branch_to_sink
);
new_body
.push
(
branch_to_sink
);
has_ret
=
true
;
}
_
=>
new_body
.push
(
node
.clone
())
}
...
...
@@ -118,7 +120,9 @@ impl CompilerPass for RetSink {
}
// insert return sink
f_content
.blocks
.insert
(
return_sink
.id
(),
return_sink
);
if
has_ret
{
f_content
.blocks
.insert
(
return_sink
.id
(),
return_sink
);
}
// put back the function content
func
.content
=
Some
(
f_content
);
...
...
src/compiler/passes/trace_gen.rs
View file @
2e850875
This diff is collapsed.
Click to expand it.
Yi Lin
@u4776528
mentioned in issue
#27 (closed)
·
Jul 20, 2017
mentioned in issue
#27 (closed)
mentioned in issue #27
Toggle commit list
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