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
f7ff598b
Commit
f7ff598b
authored
May 24, 2016
by
qinsoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[wip] refactoring the code so that register allocator is machine-independent
parent
8f260a2a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
273 additions
and
95 deletions
+273
-95
src/compiler/backend/mod.rs
src/compiler/backend/mod.rs
+1
-0
src/compiler/backend/reg_alloc.rs
src/compiler/backend/reg_alloc.rs
+26
-0
src/compiler/backend/x86_64/asm_backend.rs
src/compiler/backend/x86_64/asm_backend.rs
+229
-94
src/compiler/backend/x86_64/inst_sel.rs
src/compiler/backend/x86_64/inst_sel.rs
+2
-0
src/vm/compiled_func.rs
src/vm/compiled_func.rs
+13
-0
src/vm/mod.rs
src/vm/mod.rs
+2
-1
No files found.
src/compiler/backend/mod.rs
View file @
f7ff598b
pub
mod
inst_sel
;
pub
mod
reg_alloc
;
#[cfg(target_arch
=
"x86_64"
)]
mod
x86_64
;
...
...
src/compiler/backend/reg_alloc.rs
0 → 100644
View file @
f7ff598b
use
compiler
::
CompilerPass
;
use
ast
::
ir
::
*
;
use
vm
::
context
::
VMContext
;
pub
struct
RegisterAllocation
{
name
:
&
'static
str
}
impl
RegisterAllocation
{
pub
fn
new
()
->
RegisterAllocation
{
RegisterAllocation
{
name
:
"Register Allcoation"
}
}
}
impl
CompilerPass
for
RegisterAllocation
{
fn
name
(
&
self
)
->
&
'static
str
{
self
.name
}
#[allow(unused_variables)]
fn
visit_function
(
&
mut
self
,
vm_context
:
&
VMContext
,
func
:
&
mut
MuFunction
)
{
}
}
\ No newline at end of file
src/compiler/backend/x86_64/asm_backend.rs
View file @
f7ff598b
This diff is collapsed.
Click to expand it.
src/compiler/backend/x86_64/inst_sel.rs
View file @
f7ff598b
...
...
@@ -377,6 +377,8 @@ impl <'a> InstructionSelection {
fn
emit_common_prologue
(
&
mut
self
,
args
:
&
Vec
<
P
<
Value
>>
)
{
self
.backend
.start_block
(
"prologue"
);
// TODO: push rbp, store rsp, etc.
// push all callee-saved registers
for
reg
in
x86_64
::
CALLEE_SAVED_GPRs
.iter
()
{
self
.backend
.emit_push_r64
(
&
reg
);
...
...
src/vm/compiled_func.rs
View file @
f7ff598b
use
ast
::
ir
::
*
;
use
ast
::
ptr
::
P
;
pub
struct
CompiledFunction
{
pub
fn_name
:
MuTag
,
pub
mc
:
Box
<
MachineCode
>
}
pub
trait
MachineCode
{
fn
number_of_insts
(
&
self
)
->
usize
;
fn
is_move
(
&
self
,
index
:
usize
)
->
bool
;
fn
get_inst_reg_uses
(
&
self
,
index
:
usize
)
->
Vec
<
MuID
>
;
fn
get_inst_reg_defines
(
&
self
,
index
:
usize
)
->
Vec
<
MuID
>
;
fn
get_reg_uses
(
&
self
,
id
:
MuID
)
->
Vec
<
MuID
>
;
fn
get_reg_defines
(
&
self
,
id
:
MuID
)
->
Vec
<
MuID
>
;
}
\ No newline at end of file
src/vm/mod.rs
View file @
f7ff598b
pub
mod
context
;
mod
compiled_func
;
pub
use
vm
::
compiled_func
::
CompiledFunction
;
\ No newline at end of file
pub
use
vm
::
compiled_func
::
CompiledFunction
;
pub
use
vm
::
compiled_func
::
MachineCode
;
\ 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