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).
Sourcepub fn from_bc_path(path: impl AsRef<Path>) -> Result<Self, String>
pub fn from_bc_path(path: impl AsRef<Path>) -> Result<Self, String>
Parse the LLVM bitcode (.bc) file at the given path to create a Module
Sourcepub fn from_ir_path(path: impl AsRef<Path>) -> Result<Self, String>
pub fn from_ir_path(path: impl AsRef<Path>) -> Result<Self, String>
Parse the LLVM text IR (.ll) file at the given path to create a Module
Sourcepub fn from_ir_str(str: &str) -> Result<Self, String>
pub fn from_ir_str(str: &str) -> Result<Self, String>
Parse the given string as LLVM text IR by copying to create a Module
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more