Add FuncRef and SigRef entity references.

These refer to external functions and function signatures declared in
the preamble. Since we're already using the type names 'Signature' and
'Function', these entity references don't folow the usual EntityData /
Entity naming convention.
This commit is contained in:
Jakob Stoklund Olesen
2016-10-12 14:15:29 -07:00
parent b42d85ae24
commit 7cf25a073b
7 changed files with 94 additions and 24 deletions

View File

@@ -10,8 +10,7 @@ use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
use std::ops::{Deref, DerefMut};
use ir::{Value, Type, Ebb, JumpTable};
use ir::entities::NO_VALUE;
use ir::{Value, Type, Ebb, JumpTable, FuncRef};
use ir::immediates::{Imm64, Ieee32, Ieee64};
use ir::condcodes::*;
use ir::types;
@@ -321,7 +320,10 @@ pub struct CallData {
/// Second result value for a call producing multiple return values.
second_result: Value,
// Dynamically sized array containing call argument values.
/// Callee function.
pub func_ref: FuncRef,
/// Dynamically sized array containing call argument values.
pub varargs: VariableArgs,
}
@@ -338,20 +340,6 @@ pub struct ReturnData {
pub varargs: VariableArgs,
}
impl InstructionData {
/// Create data for a call instruction.
pub fn call(opc: Opcode, return_type: Type) -> InstructionData {
InstructionData::Call {
opcode: opc,
ty: return_type,
data: Box::new(CallData {
second_result: NO_VALUE,
varargs: VariableArgs::new(),
}),
}
}
}
/// Analyzing an instruction.
///
/// Avoid large matches on instruction formats by using the methods efined here to examine