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
565fdc2b
Commit
565fdc2b
authored
May 26, 2017
by
qinsoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
we need to keep track of original block during instruction selection (so
we can get control flow info for it)
parent
33a88450
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
src/compiler/backend/arch/x86_64/inst_sel.rs
src/compiler/backend/arch/x86_64/inst_sel.rs
+11
-3
No files found.
src/compiler/backend/arch/x86_64/inst_sel.rs
View file @
565fdc2b
...
...
@@ -106,6 +106,7 @@ pub struct InstructionSelection {
current_callsite_id
:
usize
,
current_frame
:
Option
<
Frame
>
,
current_block
:
Option
<
MuName
>
,
current_block_in_ir
:
Option
<
MuName
>
,
current_func_start
:
Option
<
ValueLocation
>
,
// key: block id, val: callsite that names the block as exception block
current_exn_callsites
:
HashMap
<
MuID
,
Vec
<
ValueLocation
>>
,
...
...
@@ -126,7 +127,13 @@ impl <'a> InstructionSelection {
current_fv_id
:
0
,
current_callsite_id
:
0
,
current_frame
:
None
,
current_block
:
None
,
current_block
:
None
,
// which block we are generating code for
current_block_in_ir
:
None
,
// it is possible the block is newly created in instruction selection
// but sometimes we want to know its control flow
// so we need to track what block it is from the IR
// FIXME: ideally we should not create new blocks in instruction selection
// see Issue #6
current_func_start
:
None
,
// key: block id, val: callsite that names the block as exception block
current_exn_callsites
:
HashMap
::
new
(),
...
...
@@ -158,7 +165,7 @@ impl <'a> InstructionSelection {
// 'branch_if_true' == false, we emit opposite cjmp as CmpOp (jne for EQ, je for NE)
let
(
fallthrough_dest
,
branch_dest
,
branch_if_true
)
=
{
// get current block and next block in trace (fallthrough block)
let
cur_block
=
f_content
.get_block_by_name
(
self
.current_block
.as_ref
()
.unwrap
()
.clone
());
let
cur_block
=
f_content
.get_block_by_name
(
self
.current_block
_in_ir
.as_ref
()
.unwrap
()
.clone
());
let
next_block_in_trace
=
cur_block
.control_flow
.get_hottest_succ
()
.unwrap
();
if
next_block_in_trace
==
true_dest
.target
{
...
...
@@ -4746,7 +4753,7 @@ impl CompilerPass for InstructionSelection {
let
block
=
f_content
.get_block
(
*
block_id
);
let
block_label
=
block
.name
()
.unwrap
();
self
.current_block
=
Some
(
block_label
.clone
());
self
.current_block_in_ir
=
Some
(
block_label
.clone
());
let
block_content
=
block
.content
.as_ref
()
.unwrap
();
if
is_exception_block
{
...
...
@@ -4794,6 +4801,7 @@ impl CompilerPass for InstructionSelection {
self
.backend
.end_block
(
current_block
.clone
());
}
self
.current_block
=
None
;
self
.current_block_in_ir
=
None
;
}
}
...
...
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