-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
use super::*; | ||
|
||
#[derive(Debug, Clone)] | ||
pub enum Mir { | ||
/// standard looping over a body of "inner" steps | ||
Loop(MirLoop), | ||
|
||
/// both break and continue are just "jump" | ||
/// | ||
/// * if necessary, you can tell if it was break or continue by the tail of | ||
/// the label it targets. | ||
Jump(MirJump), | ||
|
||
/// call to another function | ||
/// | ||
/// * No actual abi system currently, so basically all calls are total | ||
/// optimization black holes. | ||
Call(MirCall), | ||
|
||
/// go back to the caller | ||
Return(MirReturn), | ||
|
||
/// when a condition holds, do this | ||
If(MirIf), | ||
|
||
/// `inc reg16` | ||
/// | ||
/// * **Flags:** none | ||
Inc16(Reg16), | ||
|
||
/// `dec reg16` | ||
/// | ||
/// * **Flags:** none | ||
Dec16(Reg16), | ||
|
||
/// `inc reg8` | ||
/// | ||
/// * **Flags:** `z` | ||
Inc8(Reg8), | ||
|
||
/// `dec reg8` | ||
/// | ||
/// * **Flags:** `z` | ||
Dec8(Reg8), | ||
|
||
/// `a = [reg16]` | ||
AssignAReg16t(Reg16), | ||
|
||
/// `[reg16] = a` | ||
AssignReg16tA(Reg16), | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct MirLoop { | ||
pub steps: Vec<Mir>, | ||
pub canonical_name: StrID, | ||
pub canonical_start: StrID, | ||
pub canonical_end: StrID, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct MirJump { | ||
pub condition: Condition, | ||
pub target: StrID, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct MirCall { | ||
pub condition: Condition, | ||
pub target: StrID, | ||
pub abi: Abi, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct Abi { | ||
// todo: an ABI system | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct MirReturn { | ||
pub condition: Condition, | ||
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct MirIf { | ||
pub condition: Condition, | ||
pub steps: Vec<Mir>, | ||
pub canonical_name: StrID, | ||
pub canonical_end: StrID, | ||
} |