pub struct Module {
pub name: String,
pub source_file_name: String,
pub data_layout: DataLayout,
pub target_triple: Option<String>,
pub functions: Vec<Function>,
pub func_declarations: Vec<FunctionDeclaration>,
pub global_vars: Vec<GlobalVariable>,
pub global_aliases: Vec<GlobalAlias>,
pub global_ifuncs: Vec<GlobalIFunc>,
pub inline_assembly: String,
pub types: Types,
}
Expand description
Fields§
§name: String
The name of the module
source_file_name: String
§data_layout: DataLayout
§target_triple: Option<String>
§functions: Vec<Function>
Functions which are defined (not just declared) in this Module
.
See LLVM 14 docs on Functions
func_declarations: Vec<FunctionDeclaration>
Functions which are declared (but not defined) in this Module
.
See LLVM 14 docs on Functions
global_vars: Vec<GlobalVariable>
§global_aliases: Vec<GlobalAlias>
§global_ifuncs: Vec<GlobalIFunc>
§inline_assembly: String
§types: Types
Holds a reference to all of the Type
s used in the Module
, and
facilitates lookups so you can get a TypeRef
to the Type
you want.
Implementations§
source§impl Module
impl Module
sourcepub fn type_of<T: Typed + ?Sized>(&self, t: &T) -> TypeRef
pub fn type_of<T: Typed + ?Sized>(&self, t: &T) -> TypeRef
Get the type of anything that is Typed
.
sourcepub fn get_func_by_name(&self, name: &str) -> Option<&Function>
pub fn get_func_by_name(&self, name: &str) -> Option<&Function>
Get the Function
having the given name
(if any).
Note that functions are named with String
s and not Name
s.
Note also that this will only find fully defined functions, not
FunctionDeclaration
s.
sourcepub fn get_func_decl_by_name(&self, name: &str) -> Option<&FunctionDeclaration>
pub fn get_func_decl_by_name(&self, name: &str) -> Option<&FunctionDeclaration>
Get the FunctionDeclaration
having the given name
(if any).
Note that functions are named with String
s and not Name
s.
Note also that this will only find function declarations, and will not
find defined functions (use get_func_by_name()
for that).
sourcepub fn get_global_var_by_name(&self, name: &Name) -> Option<&GlobalVariable>
pub fn get_global_var_by_name(&self, name: &Name) -> Option<&GlobalVariable>
Get the GlobalVariable
having the given Name
(if any).
sourcepub fn get_global_alias_by_name(&self, name: &Name) -> Option<&GlobalAlias>
pub fn get_global_alias_by_name(&self, name: &Name) -> Option<&GlobalAlias>
Get the GlobalAlias
having the given Name
(if any).
sourcepub fn get_global_ifunc_by_name(&self, name: &Name) -> Option<&GlobalIFunc>
pub fn get_global_ifunc_by_name(&self, name: &Name) -> Option<&GlobalIFunc>
Get the GlobalIFunc
having the given Name
(if any).