llir-opt
0.0.1
Low-Level Post-Link Optimiser for OCaml and C
|
#include <passes/pre_eval/symbolic_context.h>
Classes | |
class | frame_iterator |
Iterator over active frames. More... | |
struct | object_iterator |
Iterator over objects. More... | |
Public Types | |
using | ObjectMap = std::unordered_map< ID< SymbolicObject >, std::unique_ptr< SymbolicObject > > |
Mapping from objects to their representation. | |
Public Member Functions | |
SymbolicContext (SymbolicHeap &heap, SymbolicSummary &state) | |
Creates a new heap using values specified in the data segments. | |
SymbolicContext (const SymbolicContext &that) | |
Copies an existing context. | |
~SymbolicContext () | |
Cleanup. | |
SymbolicFrame * | GetActiveFrame () |
Return the top frame. | |
const SymbolicFrame * | GetActiveFrame () const |
Return the top frame. | |
unsigned | GetNumArgs () const |
Return the number of arguments in the topmost frame. | |
unsigned | EnterFrame (Func &func, llvm::ArrayRef< SymbolicValue > args) |
Push a stack frame for a function to the heap. | |
unsigned | EnterFrame (llvm::ArrayRef< std::optional< unsigned >> objects) |
Push the initial stack frame. | |
void | LeaveFrame (Func &func) |
Pop a stack frame for a function from the heap. | |
void | LeaveRoot () |
Pop the root frame. | |
bool | HasFrame (Func &func) |
Checks if a function is already on the stack. | |
void | Taint (const SymbolicValue &taint, const SymbolicValue &tainted) |
Record a tainted value, propagating information along the call stack. | |
SymbolicObject & | GetObject (ID< SymbolicObject > object) |
Returns the model for an object. | |
SymbolicObject & | GetObject (Object *object) |
Returns the model for an object. | |
SymbolicObject & | GetFrame (unsigned frame, unsigned object) |
Returns a frame object to store to. | |
SymbolicPointer::Ref | Pointer (Atom &atom, int64_t offset) |
Create a pointer to an atom. | |
SymbolicPointer::Ref | Pointer (unsigned frame, unsigned object, int64_t offset) |
Create a pointer to a frame object. | |
bool | Store (const SymbolicPointer &addr, const SymbolicValue &val, Type type) |
SymbolicValue | Load (const SymbolicPointer &addr, Type type) |
SymbolicPointer::Ref | Malloc (CallSite &site, std::optional< unsigned > size) |
void | Merge (const SymbolicContext &that) |
std::set< SymbolicFrame * > | GetFrames (Func &func) |
Return all the frames used to execute a function. | |
DAGFunc & | GetSCCFunc (Func &func) |
Return the SCC version of a function. | |
frame_iterator | frame_begin () |
Iterator over active frames. | |
frame_iterator | frame_end () |
llvm::iterator_range< frame_iterator > | frames () |
object_iterator | object_begin () |
Iterator over objects. | |
object_iterator | object_end () |
llvm::iterator_range< object_iterator > | objects () |
Symbolic representation of the heap.
SymbolicValue SymbolicContext::Load | ( | const SymbolicPointer & | addr, |
Type | type | ||
) |
Loads a value from the symbolic heap representation.
SymbolicPointer::Ref SymbolicContext::Malloc | ( | CallSite & | site, |
std::optional< unsigned > | size | ||
) |
Returns a pointer to an allocation site.
void SymbolicContext::Merge | ( | const SymbolicContext & | that | ) |
Merge a prior context into this one.
bool SymbolicContext::Store | ( | const SymbolicPointer & | addr, |
const SymbolicValue & | val, | ||
Type | type | ||
) |
Stores a value to the symbolic heap representation.
If the value is stored to a precise location, the heap is updated to reflect the result of the store. Otherwise, the whole range of addresses is invalidated in order to over-approximate unknown stores.