Add signatures and ext_funcs tables to DataFlowGraph.

These two tables are used to keep track of type signatures of function
calls as well as external function references used in direct function
calls.

Also add an ExtFuncData struct representing an external function that
can be called directly.
This commit is contained in:
Jakob Stoklund Olesen
2016-10-18 10:07:44 -07:00
parent bdc95990d4
commit 1bcb8e25a2
4 changed files with 41 additions and 3 deletions

View File

@@ -6,7 +6,7 @@
//! This module declares the data types used to represent external functions and call signatures.
use std::fmt::{self, Display, Formatter};
use ir::Type;
use ir::{Type, FunctionName, SigRef};
/// Function signature.
///
@@ -104,6 +104,21 @@ pub enum ArgumentExtension {
Sext,
}
/// An external function.
///
/// Information about a function that can be called directly with a direct `call` instruction.
#[derive(Clone, Debug)]
pub struct ExtFuncData {
pub name: FunctionName,
pub signature: SigRef,
}
impl Display for ExtFuncData {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "{} {}", self.signature, self.name)
}
}
#[cfg(test)]
mod tests {
use super::*;