Parse basic blocks and instructions.
Create map entries for ebbs and values as they are defined, but leave ebb and value operands unresolved on instructions as they are parsed. Instruction operands can refer to ebbs and values that may not have been defined yet. Don't infer or check result types yet.
This commit is contained in:
@@ -105,6 +105,12 @@ pub enum ExpandedValue {
|
||||
}
|
||||
|
||||
impl Value {
|
||||
pub fn direct_from_number(n: u32) -> Value {
|
||||
let encoding = n * 2;
|
||||
assert!(encoding < u32::MAX);
|
||||
Value(encoding)
|
||||
}
|
||||
|
||||
pub fn new_direct(i: Inst) -> Value {
|
||||
let encoding = i.index() * 2;
|
||||
assert!(encoding < u32::MAX as usize);
|
||||
|
||||
@@ -19,6 +19,9 @@ pub struct Function {
|
||||
/// Signature of this function.
|
||||
signature: Signature,
|
||||
|
||||
/// The entry block.
|
||||
pub entry_block: Ebb,
|
||||
|
||||
/// Stack slots allocated in this function.
|
||||
stack_slots: Vec<StackSlotData>,
|
||||
|
||||
@@ -45,6 +48,7 @@ impl Function {
|
||||
Function {
|
||||
name: name,
|
||||
signature: sig,
|
||||
entry_block: NO_EBB,
|
||||
stack_slots: Vec::new(),
|
||||
instructions: Vec::new(),
|
||||
extended_basic_blocks: Vec::new(),
|
||||
|
||||
Reference in New Issue
Block a user