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
66a09287
Commit
66a09287
authored
Apr 11, 2016
by
qinsoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[wip] started a bit on inst selection. will work on GC for a while
parent
9ea79e21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
2 deletions
+46
-2
src/compiler/backend/x86_64/inst_sel.rs
src/compiler/backend/x86_64/inst_sel.rs
+46
-2
No files found.
src/compiler/backend/x86_64/inst_sel.rs
View file @
66a09287
use
ast
::
ir
::
*
;
use
ast
::
ptr
::
*
;
use
ast
::
inst
::
Instruction_
::
*
;
use
vm
::
context
::
VMContext
;
...
...
@@ -21,6 +22,49 @@ impl CompilerPass for InstructionSelection {
#[allow(unused_variables)]
fn
start_function
(
&
mut
self
,
vm_context
:
&
VMContext
,
func
:
&
mut
MuFunction
)
{
println
!
(
"{}"
,
self
.name
());
debug
!
(
"{}"
,
self
.name
());
}
}
\ No newline at end of file
fn
visit_function
(
&
mut
self
,
vm_context
:
&
VMContext
,
func
:
&
mut
MuFunction
)
{
for
block_label
in
func
.block_trace
.as_ref
()
.unwrap
()
{
let
block
=
func
.content
.as_mut
()
.unwrap
()
.get_block_mut
(
block_label
);
let
block_content
=
block
.content
.as_mut
()
.unwrap
();
for
inst
in
block_content
.body
.iter_mut
()
{
instruction_select
(
inst
);
}
}
}
}
fn
instruction_select
(
inst
:
&
mut
P
<
TreeNode
>
)
{
match
inst
.v
{
TreeNode_
::
Instruction
(
ref
inst
)
=>
{
match
inst
.v
{
Branch2
{
cond
,
ref
true_dest
,
ref
false_dest
,
true_prob
}
=>
{
let
ref
cond
=
inst
.ops
.borrow
()[
cond
];
match
cond
.v
{
TreeNode_
::
Instruction
(
ref
inst
)
=>
{
match
inst
.v
{
CmpOp
(
op
,
op1
,
op2
)
=>
{
},
_
=>
panic!
(
"unexpected inst as child node of branch2: {}"
,
cond
)
}
},
TreeNode_
::
Value
(
ref
pv
)
=>
{
}
}
},
_
=>
unimplemented!
()
}
},
_
=>
panic!
(
"expected instruction"
)
}
}
\ No newline at end of file
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