Struct haybale::Project[][src]

pub struct Project { /* fields omitted */ }

A Project is a collection of LLVM code to be explored, consisting of one or more LLVM modules.

Implementations

impl Project[src]

pub fn from_bc_path(path: impl AsRef<Path>) -> Result<Self, String>[src]

Construct a new Project from a path to an LLVM bitcode file

pub fn from_bc_paths<P>(
    paths: impl IntoIterator<Item = P>
) -> Result<Self, String> where
    P: AsRef<Path>, 
[src]

Construct a new Project from multiple LLVM bitcode files

pub fn from_bc_dir(path: impl AsRef<Path>, extn: &str) -> Result<Self, Error>[src]

Construct a new Project from a path to a directory containing LLVM bitcode files.

All files in the directory which have the extension extn will be parsed and added to the Project.

Panics if there are no files in the directory with that extension.

pub fn from_bc_dir_with_blacklist(
    path: impl AsRef<Path>,
    extn: &str,
    exclude: impl Fn(&Path) -> bool
) -> Result<Self, Error>
[src]

Construct a new Project from a path to a directory containing LLVM bitcode files.

All files in the directory which have the extension extn, except those for which the provided exclude closure returns true, will be parsed and added to the Project.

Panics if there are no files in the directory with that extension, or if they were all excluded.

pub fn add_bc_path(&mut self, path: impl AsRef<Path>) -> Result<(), String>[src]

Add the code in the given LLVM bitcode file to the Project

pub fn add_bc_dir(
    &mut self,
    path: impl AsRef<Path>,
    extn: &str
) -> Result<(), Error>
[src]

Add the code in the given directory to the Project. See Project::from_bc_dir().

pub fn add_bc_dir_with_blacklist(
    &mut self,
    path: impl AsRef<Path>,
    extn: &str,
    exclude: impl Fn(&Path) -> bool
) -> Result<(), Error>
[src]

Add the code in the given directory, except for blacklisted files, to the Project. See Project::from_bc_dir_with_blacklist().

pub fn pointer_size_bits(&self) -> u32[src]

Get the pointer size used by the Project, in bits. E.g., this will be 64 if the LLVM bitcode was compiled for a 64-bit platform.

pub fn all_functions(&self) -> impl Iterator<Item = (&Function, &Module)>[src]

Iterate over all Functions in the Project. Gives pairs which also indicate the Module the Function is defined in.

pub fn all_global_vars(
    &self
) -> impl Iterator<Item = (&GlobalVariable, &Module)>
[src]

Iterate over all GlobalVariables in the Project. Gives pairs which also indicate the Module the GlobalVariable comes from.

pub fn all_global_aliases(
    &self
) -> impl Iterator<Item = (&GlobalAlias, &Module)>
[src]

Iterate over all GlobalAliases in the Project. Gives pairs which also indicate the Module the GlobalAlias comes from.

pub fn all_named_struct_types(
    &self
) -> impl Iterator<Item = (&String, &NamedStructDef, &Module)>
[src]

Iterate over all named struct types in the Project. Gives triplets (name, NamedStructDef, Module) which indicate the struct’s name, definition, and which module the definition comes from.

pub fn active_module_names(&self) -> impl Iterator<Item = &String>[src]

Get the names of the LLVM modules which have been parsed and loaded into the Project

pub fn get_func_by_name<'p>(
    &'p self,
    name: &str
) -> Option<(&'p Function, &'p Module)>
[src]

Search the project for a function with the given name. If a matching function is found, return both it and the module it was found in.

For projects containing C++ or Rust code, you can pass either the mangled or demangled function name (fully qualified with namespaces/modules).

If you have a State handy, you may want to use state.get_func_by_name() instead, which will get the appropriate (potentially module-private) definition based on the current LLVM module.

pub fn get_named_struct_def<'p>(
    &'p self,
    name: &str
) -> Result<(&'p NamedStructDef, &'p Module)>
[src]

Get the definition of the named struct with the given name. Returns both the definition, and the module that definition was found in.

Returns Err if neither a definition nor declaration for a named struct type with the given name was found anywhere in the Project.

If the named struct type is defined in multiple modules in the Project, this returns one of them arbitrarily. However, it will only return NamedStructDef::Opaque if all definitions are opaque; that is, it will attempt to return some non-opaque definition if one exists, before returning an opaque definition.

pub fn size_in_bits(&self, ty: &Type) -> Option<u32>[src]

Get the size of the Type, in bits.

Accounts for the Project’s pointer size and named struct definitions.

Note that some types have size 0 bits, and this may return Some(0).

Returns None for structs which have no definition in the entire Project, or for structs/arrays/vectors where one of the elements is a struct with no definition in the entire Project.

pub fn fp_size_in_bits(fpt: FPType) -> u32[src]

Get the size of the FPType, in bits

Auto Trait Implementations

impl RefUnwindSafe for Project

impl Send for Project

impl Sync for Project

impl Unpin for Project

impl UnwindSafe for Project

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.