Struct rupta::builder::fpag_builder::FuncPAGBuilder
source · pub struct FuncPAGBuilder<'pta, 'tcx, 'compilation> { /* private fields */ }Expand description
A visitor that traverses the MIR associated with a particular function’s body and build the function’s pointer assignment graph.
Implementations§
source§impl<'pta, 'tcx, 'compilation> FuncPAGBuilder<'pta, 'tcx, 'compilation>
impl<'pta, 'tcx, 'compilation> FuncPAGBuilder<'pta, 'tcx, 'compilation>
pub fn new( acx: &'pta mut AnalysisContext<'tcx, 'compilation>, func_id: FuncId, mir: &'tcx Body<'tcx>, fpag: &'pta mut FuncPAG ) -> FuncPAGBuilder<'pta, 'tcx, 'compilation>
pub fn visit_body(&mut self)
sourcepub fn inline_indirectly_called_function(
&mut self,
callee_def_id: &DefId,
gen_args: &GenericArgsRef<'tcx>,
args: Vec<Rc<Path>>,
destination: Rc<Path>,
location: Location
)
pub fn inline_indirectly_called_function( &mut self, callee_def_id: &DefId, gen_args: &GenericArgsRef<'tcx>, args: Vec<Rc<Path>>, destination: Rc<Path>, location: Location )
Fn::call, FnMut::call_mut, FnOnce::call_once all receive two arguments:
- An operand of any type that implements
Fn|FnMut|FnOnce, including function items, function pointers and closures. - A tuple of argument values for the call. The tuple is unpacked and the callee is then invoked with its normal function signature. In the case of calling a closure, the closure is included as the first argument.
All of this happens in code that is not encoded as MIR, so we need built in support for it.
sourcepub fn add_internal_edges(
&mut self,
src_path: Rc<Path>,
src_type: Ty<'tcx>,
dst_path: Rc<Path>,
dst_type: Ty<'tcx>
)
pub fn add_internal_edges( &mut self, src_path: Rc<Path>, src_type: Ty<'tcx>, dst_path: Rc<Path>, dst_type: Ty<'tcx> )
If the source path and the destination path are both of pointer types, add a direct edge between them. Otherwise, get their pointer type fields if exist and add internal edges between these fields.
sourcepub fn create_aux_local(&mut self, ty: Ty<'tcx>) -> Rc<Path>
pub fn create_aux_local(&mut self, ty: Ty<'tcx>) -> Rc<Path>
Creates an auxiliary local variable with the given type.
sourcepub fn get_param_env(&self) -> ParamEnv<'tcx>
pub fn get_param_env(&self) -> ParamEnv<'tcx>
Returns the parameter environment for the current function.
sourcepub fn copy_and_transmute(
&mut self,
source_path: Rc<Path>,
source_rustc_type: Ty<'tcx>,
target_path: Rc<Path>,
target_rustc_type: Ty<'tcx>
)
pub fn copy_and_transmute( &mut self, source_path: Rc<Path>, source_rustc_type: Ty<'tcx>, target_path: Rc<Path>, target_rustc_type: Ty<'tcx> )
Copy the value at source_path to a value at target_path.
If the type of source_path is different from that at target_path, the value is transmuted.
pub fn add_addr_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)
pub fn add_direct_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)
sourcepub fn add_store_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)
pub fn add_store_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)
Adds a store edge from src to dst.
Given a store statement (*p).f1.f2...fn = q, a store edge of format q --STORE(f1.f2...fn)--> p is added.
sourcepub fn add_load_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)
pub fn add_load_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)
Adds a load edge from src to dst.
Given a load statement p = (*q).f1.f2...fn, a Load edge q --LOAD(f1.f2...fn)--> p is added.
sourcepub fn add_gep_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)
pub fn add_gep_edge(&mut self, src: Rc<Path>, dst: Rc<Path>)
Adds a gep edge from src to dst.
Given a gep statement p = &((*q).f1.f2...fn), a gep edge q --GEP(f1.f2...fn)--> p is added.