GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit 9e67a38d authored by Javad Ebrahimian Amiri's avatar Javad Ebrahimian Amiri

Merge branch 'rtmu-dev' into 'master'

rtmu dev

See merge request !59
parents 6f647556 c6557f98
...@@ -7,20 +7,26 @@ stages: ...@@ -7,20 +7,26 @@ stages:
before_script: before_script:
- export MU_ZEBU=$CI_PROJECT_DIR - export MU_ZEBU=$CI_PROJECT_DIR
- export ZEBU_BUILD=release - export ZEBU_BUILD=release
- export ZEBU_CARGO_ARG="--release"
- export CARGO_HOME=.cargo - export CARGO_HOME=.cargo
- export CC=clang - export CC=clang
- export CXX=clang++ - export CXX=clang++
- export RUST_TEST_THREADS=1 - export RUST_TEST_THREADS=1
- export LD_LIBRARY_PATH=$MU_ZEBU/target/$ZEBU_BUILD/deps/:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH=$MU_ZEBU/target/$ZEBU_BUILD/deps/:$LD_LIBRARY_PATH
- export PYTHONPATH=mu-client-pypy
- source /home/gitlab-runner/ci/bin/activate - source /home/gitlab-runner/ci/bin/activate
build: build:
stage: build stage: build
script: script:
- rustup run 1.30.1-x86_64-unknown-linux-gnu cargo clean - rustc --version
- time rustup run 1.30.1-x86_64-unknown-linux-gnu cargo test -j6 --release --no-run --color=always - cargo clean
- time cargo test -j6 $ZEBU_CARGO_ARG --no-run --color=always
artifacts: artifacts:
paths: paths:
- target/debug/deps/libmu.so
- target/debug/deps/libmu.a
- target/debug/deps/lib-*
- target/release/deps/libmu.so - target/release/deps/libmu.so
- target/release/deps/libmu.a - target/release/deps/libmu.a
- target/release/deps/lib-* - target/release/deps/lib-*
...@@ -28,22 +34,22 @@ build: ...@@ -28,22 +34,22 @@ build:
test:cargo:api: test:cargo:api:
stage: test stage: test
script: script:
- rustup run 1.30.1-x86_64-unknown-linux-gnu cargo test test_api --release 2> /dev/null - cargo test test_api $ZEBU_CARGO_ARG 2> /dev/null
test:cargo:ir: test:cargo:ir:
stage: test stage: test
script: script:
- rustup run 1.30.1-x86_64-unknown-linux-gnu cargo test test_ir --release 2> /dev/null - cargo test test_ir $ZEBU_CARGO_ARG 2> /dev/null
test:cargo:compiler: test:cargo:compiler:
stage: test stage: test
script: script:
- rustup run 1.30.1-x86_64-unknown-linux-gnu cargo test test_compiler --release 2> /dev/null - cargo test test_compiler $ZEBU_CARGO_ARG 2> /dev/null
test:cargo:runtime: test:cargo:runtime:
stage: test stage: test
script: script:
- rustup run 1.30.1-x86_64-unknown-linux-gnu cargo test test_runtime --release 2> /dev/null - cargo test test_runtime $ZEBU_CARGO_ARG 2> /dev/null
.build_muc: &build_muc | .build_muc: &build_muc |
if [ -d "tests/test_muc/mu-tool-compiler" ]; then rm -Rf tests/test_muc/mu-tool-compiler; fi if [ -d "tests/test_muc/mu-tool-compiler" ]; then rm -Rf tests/test_muc/mu-tool-compiler; fi
...@@ -53,7 +59,7 @@ test:cargo:runtime: ...@@ -53,7 +59,7 @@ test:cargo:runtime:
export ANTLR_HOME=/home/gitlab-runner/antlr4/runtime/Cpp/run export ANTLR_HOME=/home/gitlab-runner/antlr4/runtime/Cpp/run
mkdir lib mkdir lib
cp -r $ANTLR_HOME/usr/local/lib/* $PWD/lib/ cp -r $ANTLR_HOME/usr/local/lib/* $PWD/lib/
cp -r $MU_ZEBU/target/release/deps/* $PWD/lib/ cp -r $MU_ZEBU/target/$ZEBU_BUILD/deps/* $PWD/lib/
export CC=clang export CC=clang
export CXX=clang++ export CXX=clang++
make make
...@@ -159,7 +165,7 @@ testjit:som: ...@@ -159,7 +165,7 @@ testjit:som:
mubench: mubench:
stage: mubench stage: mubench
script: script:
- cp ./target/release/deps/libmu.so ./target/release/libmu.so - cp $MU_ZEBU/target/$ZEBU_BUILD/deps/libmu.so ./target/$ZEBU_BUILD/libmu.so
- deactivate - deactivate
- git clone https://gitlab.anu.edu.au/mu/mu-perf-benchmarks.git - git clone https://gitlab.anu.edu.au/mu/mu-perf-benchmarks.git
- git clone https://gitlab.anu.edu.au/mu/mu-client-pypy.git - git clone https://gitlab.anu.edu.au/mu/mu-client-pypy.git
...@@ -179,3 +185,4 @@ rustfmt: ...@@ -179,3 +185,4 @@ rustfmt:
stage: rustfmt stage: rustfmt
script: script:
- cargo-fmt -- --check --verbose -- src/lib.rs src/ast/src/lib.rs src/gc/src/lib.rs src/utils/src/lib.rs - cargo-fmt -- --check --verbose -- src/lib.rs src/ast/src/lib.rs src/gc/src/lib.rs src/utils/src/lib.rs
allow_failure: true
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
[package] [package]
name = "mu" name = "mu"
version = "0.0.1" version = "0.0.1"
authors = [ "Your name <you@example.com>" ] authors = [ "Your name <you@example.com>", "Javad Amiri <javad.amiri@anu.edu.au>" ]
build = "build.rs" build = "build.rs"
[lib] [lib]
...@@ -26,6 +26,7 @@ doctest = false ...@@ -26,6 +26,7 @@ doctest = false
default = ["aot"] default = ["aot"]
aot = [] aot = []
jit = [] jit = []
realtime = ["mu_ast/realtime", "mu_utils/realtime", "mu_gc/realtime"]
[build-dependencies] [build-dependencies]
cc = "*" cc = "*"
...@@ -34,7 +35,7 @@ built = "*" ...@@ -34,7 +35,7 @@ built = "*"
[dependencies] [dependencies]
mu_ast = {path = "src/ast"} mu_ast = {path = "src/ast"}
mu_utils = {path = "src/utils"} mu_utils = {path = "src/utils"}
rodal = { git = "https://gitlab.anu.edu.au/mu/rodal", branch = "rust-1.30.1", version = "^0.3.18" } rodal = { git = "https://gitlab.anu.edu.au/mu/rodal", branch = "master", version = "^0.4.0" }
libc="*" libc="*"
field-offset = "*" field-offset = "*"
...@@ -46,7 +47,8 @@ num = "*" ...@@ -46,7 +47,8 @@ num = "*"
hprof = "*" hprof = "*"
memmap = "*" memmap = "*"
memsec = "0.1.9" memsec = "0.1.9"
serde = "*" serde = { version = "*", features = ["derive"]}
bincode = "*"
serde_derive = "*" serde_derive = "*"
time = "*" time = "*"
maplit = "*" maplit = "*"
...@@ -56,3 +58,4 @@ extprim = "*" ...@@ -56,3 +58,4 @@ extprim = "*"
num-traits = "*" num-traits = "*"
built = "*" built = "*"
mu_gc = { path = "src/gc"} mu_gc = { path = "src/gc"}
cfg-if = "*"
...@@ -53,5 +53,6 @@ fn main() { ...@@ -53,5 +53,6 @@ fn main() {
} }
fn built() { fn built() {
built::write_built_file().expect("Failed to acquire build-time information"); built::write_built_file()
.expect("Failed to acquire build-time information");
} }
#trailing_comma = "Never" max_width = 80
wrap_comments = true
trailing_comma = "Never"
...@@ -15,16 +15,22 @@ ...@@ -15,16 +15,22 @@
[package] [package]
name = "mu_ast" name = "mu_ast"
version = "0.0.1" version = "0.0.1"
authors = ["qinsoon <qinsoon@gmail.com>"] authors = ["qinsoon <qinsoon@gmail.com>", "Javad Amiri <javad.amiri@anu.edu.au>"]
[features]
realtime = []
[lib] [lib]
crate-type = ["rlib"] crate-type = ["rlib"]
[build-dependencies]
log = "*"
[dependencies] [dependencies]
mu_utils = {path = "../utils"} mu_utils = {path = "../utils"}
lazy_static = "0.2.11" lazy_static = "0.2.11"
log = "*" log = "*"
simple_logger = "*" simple_logger = "*"
regex = "0.2.2" regex = "0.2.2"
rodal = { git = "https://gitlab.anu.edu.au/mu/rodal", branch = "rust-1.30.1", version = "^0.3.18" } rodal = { git = "https://gitlab.anu.edu.au/mu/rodal", branch = "master", version = "^0.4.0" }
#rodal = { path = "../../rodal", version = "*" } libc = "*"
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
// Copyright 2019 The Australian National University
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2019 The Australian National University
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
//! # MuIR AST crate //! # MuIR AST crate
//! //!
//! This crate provides data structures to allow construct MuIR in Rust code, including: //! This crate provides data structures to allow construct MuIR in Rust code,
//! including:
//! //!
//! * types //! * types
//! * ir //! * ir
...@@ -78,3 +79,9 @@ pub mod inst; ...@@ -78,3 +79,9 @@ pub mod inst;
pub mod op; pub mod op;
pub mod ptr; pub mod ptr;
pub mod types; pub mod types;
#[cfg(feature = "realtime")]
pub mod ir_rt;
#[cfg(all(feature = "realtime", target_os = "linux"))]
pub mod ir_rt_posix;
...@@ -36,7 +36,7 @@ pub enum BinOp { ...@@ -36,7 +36,7 @@ pub enum BinOp {
FSub, FSub,
FMul, FMul,
FDiv, FDiv,
FRem, FRem
} }
impl fmt::Display for BinOp { impl fmt::Display for BinOp {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
...@@ -49,7 +49,7 @@ impl BinOp { ...@@ -49,7 +49,7 @@ impl BinOp {
use op::BinOp::*; use op::BinOp::*;
match self { match self {
FAdd | FSub | FMul | FDiv | FRem => true, FAdd | FSub | FMul | FDiv | FRem => true,
_ => false, _ => false
} }
} }
} }
...@@ -83,7 +83,7 @@ pub enum CmpOp { ...@@ -83,7 +83,7 @@ pub enum CmpOp {
FULT, FULT,
FULE, FULE,
FUNE, FUNE,
FUNO, FUNO
} }
impl fmt::Display for CmpOp { impl fmt::Display for CmpOp {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
...@@ -92,7 +92,8 @@ impl fmt::Display for CmpOp { ...@@ -92,7 +92,8 @@ impl fmt::Display for CmpOp {
} }
impl CmpOp { impl CmpOp {
/// returns the CmpOp X for CmpOp Y, such that (a Y b) is equivalent to (b X a) /// returns the CmpOp X for CmpOp Y, such that (a Y b) is equivalent to (b X
/// a)
pub fn swap_operands(self) -> CmpOp { pub fn swap_operands(self) -> CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
...@@ -116,11 +117,12 @@ impl CmpOp { ...@@ -116,11 +117,12 @@ impl CmpOp {
FUGT => FULT, FUGT => FULT,
FULT => FUGT, FULT => FUGT,
_ => self, // all other comparisons are symmetric _ => self // all other comparisons are symmetric
} }
} }
/// returns the CmpOp X for CmpOp Y, such that (a Y b) is equivalent to NOT(a X b) /// returns the CmpOp X for CmpOp Y, such that (a Y b) is equivalent to
/// NOT(a X b)
pub fn invert(self) -> CmpOp { pub fn invert(self) -> CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
...@@ -161,7 +163,7 @@ impl CmpOp { ...@@ -161,7 +163,7 @@ impl CmpOp {
FONE => FUEQ, FONE => FUEQ,
FFALSE => FTRUE, FFALSE => FTRUE,
FTRUE => FFALSE, FTRUE => FFALSE
} }
} }
...@@ -173,7 +175,7 @@ impl CmpOp { ...@@ -173,7 +175,7 @@ impl CmpOp {
SLT => ULT, SLT => ULT,
SGT => UGT, SGT => UGT,
SLE => ULE, SLE => ULE,
_ => self, _ => self
} }
} }
...@@ -181,7 +183,7 @@ impl CmpOp { ...@@ -181,7 +183,7 @@ impl CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
SGE | SLT | SGT | SLE => true, SGE | SLT | SGT | SLE => true,
_ => false, _ => false
} }
} }
...@@ -189,7 +191,7 @@ impl CmpOp { ...@@ -189,7 +191,7 @@ impl CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
EQ | NE | SGE | SGT | SLE | SLT | UGE | UGT | ULE | ULT => true, EQ | NE | SGE | SGT | SLE | SLT | UGE | UGT | ULE | ULT => true,
_ => false, _ => false
} }
} }
...@@ -200,14 +202,14 @@ impl CmpOp { ...@@ -200,14 +202,14 @@ impl CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
EQ | NE => true, EQ | NE => true,
_ => false, _ => false
} }
} }
pub fn is_ult_cmp(self) -> bool { pub fn is_ult_cmp(self) -> bool {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
UGE | UGT | ULE | ULT => true, UGE | UGT | ULE | ULT => true,
_ => false, _ => false
} }
} }
...@@ -215,7 +217,7 @@ impl CmpOp { ...@@ -215,7 +217,7 @@ impl CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
EQ | NE | FORD | FUNO | FUNE | FUEQ | FONE | FOEQ => true, EQ | NE | FORD | FUNO | FUNE | FUEQ | FONE | FOEQ => true,
_ => false, _ => false
} }
} }
} }
...@@ -233,7 +235,7 @@ pub enum ConvOp { ...@@ -233,7 +235,7 @@ pub enum ConvOp {
SITOFP, SITOFP,
BITCAST, BITCAST,
REFCAST, REFCAST,
PTRCAST, PTRCAST
} }
impl fmt::Display for ConvOp { impl fmt::Display for ConvOp {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
...@@ -253,7 +255,7 @@ pub enum AtomicRMWOp { ...@@ -253,7 +255,7 @@ pub enum AtomicRMWOp {
MAX, MAX,
MIN, MIN,
UMAX, UMAX,
UMIN, UMIN
} }
impl fmt::Display for AtomicRMWOp { impl fmt::Display for AtomicRMWOp {
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
use std::sync::Arc; use std::sync::Arc;
/// P<T> is alias type for sharable Mu AST components (such as Value, MuFuncSig, MuType, etc) /// P<T> is alias type for sharable Mu AST components (such as Value, MuFuncSig,
/// MuType, etc)
// This design is similar to P<T> in rustc compiler. // This design is similar to P<T> in rustc compiler.
// However, instead of using Box<T>, we use Arc<T> to encourage sharing // However, instead of using Box<T>, we use Arc<T> to encourage sharing
pub type P<T> = Arc<T>; pub type P<T> = Arc<T>;
......
This diff is collapsed.
This diff is collapsed.
...@@ -12,7 +12,7 @@ pub enum CallConvResult { ...@@ -12,7 +12,7 @@ pub enum CallConvResult {
GPR(P<Value>), GPR(P<Value>),
GPREX(P<Value>, P<Value>), GPREX(P<Value>, P<Value>),
FPR(P<Value>), FPR(P<Value>),
STACK, STACK
} }
pub mod mu { pub mod mu {
...@@ -55,10 +55,12 @@ pub mod c { ...@@ -55,10 +55,12 @@ pub mod c {
ret.push(CallConvResult::STACK); ret.push(CallConvResult::STACK);
} }
} else if arg_reg_group == RegGroup::GPREX { } else if arg_reg_group == RegGroup::GPREX {
// need two regsiters for this, otherwise, we need to pass on stack // need two regsiters for this, otherwise, we need to pass on
// stack
if gpr_arg_count + 1 < x86_64::ARGUMENT_GPRS.len() { if gpr_arg_count + 1 < x86_64::ARGUMENT_GPRS.len() {
let arg_gpr1 = x86_64::ARGUMENT_GPRS[gpr_arg_count].clone(); let arg_gpr1 = x86_64::ARGUMENT_GPRS[gpr_arg_count].clone();
let arg_gpr2 = x86_64::ARGUMENT_GPRS[gpr_arg_count + 1].clone(); let arg_gpr2 =
x86_64::ARGUMENT_GPRS[gpr_arg_count + 1].clone();
ret.push(CallConvResult::GPREX(arg_gpr1, arg_gpr2)); ret.push(CallConvResult::GPREX(arg_gpr1, arg_gpr2));
gpr_arg_count += 2; gpr_arg_count += 2;
...@@ -83,7 +85,10 @@ pub mod c { ...@@ -83,7 +85,10 @@ pub mod c {
ret ret
} }
pub fn compute_stack_args(tys: &Vec<P<MuType>>, vm: &VM) -> (ByteSize, Vec<ByteSize>) { pub fn compute_stack_args(
tys: &Vec<P<MuType>>,
vm: &VM
) -> (ByteSize, Vec<ByteSize>) {
let callconv = compute_arguments(tys); let callconv = compute_arguments(tys);
let mut stack_arg_tys = vec![]; let mut stack_arg_tys = vec![];
...@@ -124,7 +129,8 @@ pub mod c { ...@@ -124,7 +129,8 @@ pub mod c {
} else if RegGroup::get_from_ty(ty) == RegGroup::GPREX { } else if RegGroup::get_from_ty(ty) == RegGroup::GPREX {
if gpr_ret_count + 1 < x86_64::RETURN_GPRS.len() { if gpr_ret_count + 1 < x86_64::RETURN_GPRS.len() {
let ret_gpr1 = x86_64::RETURN_GPRS[gpr_ret_count].clone(); let ret_gpr1 = x86_64::RETURN_GPRS[gpr_ret_count].clone();
let ret_gpr2 = x86_64::RETURN_GPRS[gpr_ret_count + 1].clone(); let ret_gpr2 =
x86_64::RETURN_GPRS[gpr_ret_count + 1].clone();
ret.push(CallConvResult::GPREX(ret_gpr1, ret_gpr2)); ret.push(CallConvResult::GPREX(ret_gpr1, ret_gpr2));
} else { } else {
...@@ -149,14 +155,19 @@ pub mod c { ...@@ -149,14 +155,19 @@ pub mod c {
ret ret
} }
pub fn compute_stack_retvals(tys: &Vec<P<MuType>>, vm: &VM) -> (ByteSize, Vec<ByteSize>) { pub fn compute_stack_retvals(
tys: &Vec<P<MuType>>,
vm: &VM
) -> (ByteSize, Vec<ByteSize>) {
let callconv = compute_return_values(tys); let callconv = compute_return_values(tys);
let mut stack_ret_val_tys = vec![]; let mut stack_ret_val_tys = vec![];
for i in 0..callconv.len() { for i in 0..callconv.len() {
let ref cc = callconv[i]; let ref cc = callconv[i];
match cc { match cc {
&CallConvResult::STACK => stack_ret_val_tys.push(tys[i].clone()), &CallConvResult::STACK => {
stack_ret_val_tys.push(tys[i].clone())
}
_ => {} _ => {}
} }
} }
...@@ -164,11 +175,11 @@ pub mod c { ...@@ -164,11 +175,11 @@ pub mod c {
compute_stack_locations(&stack_ret_val_tys, vm) compute_stack_locations(&stack_ret_val_tys, vm)
} }
/// computes the area on the stack for a list of types that need to put on stack, /// computes the area on the stack for a list of types that need to put on
/// returns a tuple of (size, offset for each values on stack) /// stack, returns a tuple of (size, offset for each values on stack)
pub fn compute_stack_locations( pub fn compute_stack_locations(
stack_val_tys: &Vec<P<MuType>>, stack_val_tys: &Vec<P<MuType>>,
vm: &VM, vm: &VM
) -> (ByteSize, Vec<ByteSize>) { ) -> (ByteSize, Vec<ByteSize>) {
let (stack_arg_size, _, stack_arg_offsets) = let (stack_arg_size, _, stack_arg_offsets) =
BackendType::sequential_layout(stack_val_tys, vm); BackendType::sequential_layout(stack_val_tys, vm);
...@@ -176,7 +187,8 @@ pub mod c { ...@@ -176,7 +187,8 @@ pub mod c {
// "The end of the input argument area shall be aligned on a 16 // "The end of the input argument area shall be aligned on a 16
// (32, if __m256 is passed on stack) byte boundary." - x86 ABI // (32, if __m256 is passed on stack) byte boundary." - x86 ABI
// if we need to special align the args, we do it now // if we need to special align the args, we do it now
// (then the args will be put to stack following their regular alignment) // (then the args will be put to stack following their regular
// alignment)
let mut stack_arg_size_with_padding = stack_arg_size; let mut stack_arg_size_with_padding = stack_arg_size;
if stack_arg_size % 16 == 0 { if stack_arg_size % 16 == 0 {
......
...@@ -19,17 +19,21 @@ use runtime::ValueLocation; ...@@ -19,17 +19,21 @@ use runtime::ValueLocation;
use compiler::backend::{Mem, Reg}; use compiler::backend::{Mem, Reg};
use compiler::machine_code::MachineCode; use compiler::machine_code::MachineCode;
/// CodeGenerator provides an interface to emit x86_64 code for instruction selection. /// CodeGenerator provides an interface to emit x86_64 code for instruction
/// This allows us to implement the other parts of the compiler (mostly instruction selection) /// selection. This allows us to implement the other parts of the compiler
/// without assuming code generator. Currently there is only an assembly backend /// (mostly instruction selection) without assuming code generator. Currently
/// that implements this interface for ahead-of-time compilation. We plan to add /// there is only an assembly backend that implements this interface for
/// a binary backend for just-in-time compilation. /// ahead-of-time compilation. We plan to add a binary backend for just-in-time
/// compilation.
pub trait CodeGenerator { pub trait CodeGenerator {
/// starts code for a function /// starts code for a function
fn start_code(&mut self, func_name: MuName, entry: MuName) -> ValueLocation; fn start_code(&mut self, func_name: MuName, entry: MuName)
-> ValueLocation;
/// finishes code for a function /// finishes code for a function
fn finish_code(&mut self, func_name: MuName) fn finish_code(
-> (Box<MachineCode + Sync + Send>, ValueLocation); &mut self,
func_name: MuName
) -> (Box<MachineCode + Sync + Send>, ValueLocation);
/// starts a sequence of linear code (no branch) /// starts a sequence of linear code (no branch)
fn start_code_sequence(&mut self); fn start_code_sequence(&mut self);
...@@ -43,7 +47,8 @@ pub trait CodeGenerator { ...@@ -43,7 +47,8 @@ pub trait CodeGenerator {
fn start_block(&mut self, block_name: MuName); fn start_block(&mut self, block_name: MuName);
/// starts an exceptional block, and returns its code address /// starts an exceptional block, and returns its code address
fn start_exception_block(&mut self, block_name: MuName) -> ValueLocation; fn start_exception_block(&mut self, block_name: MuName) -> ValueLocation;
/// finishes a block (must have called start_block() or start_excpetion_block() first) /// finishes a block (must have called start_block() or
/// start_excpetion_block() first)
fn end_block(&mut self, block_name: MuName); fn end_block(&mut self, block_name: MuName);
// adds CFI info