167 this->architecture = architecture;
168 this->callbacks = callbacks;
178 this->architecture = other.architecture;
179 this->callbacks = other.callbacks;
184 std::list<triton::ast::SharedAbstractNode> worklist;
196 worklist.push_back(snode);
197 while (worklist.size()) {
198 auto ast = worklist.front();
199 worklist.pop_front();
200 bool needs_update =
false;
201 for (
triton::uint32 index = 0; index < ast->getChildren().size(); index++) {
202 auto child = ast->getChildren()[index];
204 if (child->getBitvectorSize()) {
206 ast->setChild(index, schild);
207 needs_update |= !schild->canReplaceNodeWithoutUpdate(child);
208 worklist.push_back(schild);
222 return this->deadStoreElimination(block, padding);
227 std::unordered_map<triton::usize, SharedSymbolicExpression> lifetime;
228 std::map<triton::uint64, triton::arch::Instruction> instructions;
239 tmpctx.setConcreteState(*this->architecture);
242 tmpctx.processing(in);
245 for (
auto& reg : tmpctx.getSymbolicRegisters()) {
246 for (
auto& item : tmpctx.sliceExpressions(reg.second)) {
247 lifetime[item.first] = item.second;
252 for (
auto& mem : tmpctx.getSymbolicMemory()) {
253 for (
auto& item : tmpctx.sliceExpressions(mem.second)) {
254 lifetime[item.first] = item.second;
259 for (
auto& inst : in.getInstructions()) {
260 std::set<std::pair<triton::arch::MemoryAccess, triton::ast::SharedAbstractNode>> access;
261 if (inst.isMemoryWrite()) {
262 access = inst.getStoreAccess();
264 if (inst.isMemoryRead()) {
265 access.insert(inst.getLoadAccess().begin(), inst.getLoadAccess().end());
267 for (
const auto& x : access) {
269 for (
const auto& ref : refs) {
271 auto eid = expr->getId();
272 lifetime[eid] = expr;
274 if (x.first.getLeaAst()) {
276 for (
const auto& ref : refs) {
278 auto eid = expr->getId();
279 lifetime[eid] = expr;
286 for (
auto& se : lifetime) {
287 if (se.second->getDisassembly().empty()) {
290 auto addr = se.second->getAddress();
291 for (
auto& inst : in.getInstructions()) {
292 if (inst.getAddress() == addr) {
293 instructions[addr] = inst;
301 auto nop = tmpctx.getNopInstruction();
302 for (
auto& item : instructions) {
304 while (item.second.getAddress() > lastaddr) {
309 out.
add(item.second);
310 lastaddr = item.second.getNextAddress();
This is the main Triton Context class.
The abstract architecture class.
TRITON_EXPORT triton::arch::architecture_e getArchitecture(void) const
Returns the kind of architecture as triton::arch::architecture_e.
This class is used to represent a basic block.
TRITON_EXPORT triton::usize getSize(void) const
Returns the number of instructions in the block.
TRITON_EXPORT triton::uint64 getFirstAddress(void) const
Returns the first instruction's address.
TRITON_EXPORT void add(const Instruction &instruction)
Add an instruction to the block.
TRITON_EXPORT triton::uint32 getSize(void) const
Returns the size of the instruction.
TRITON_EXPORT bool isDefined(triton::callbacks::callback_e kind) const
Returns true if the callback is defined.
TRITON_EXPORT triton::ast::SharedAbstractNode processCallbacks(triton::callbacks::callback_e kind, triton::ast::SharedAbstractNode node)
Processes callbacks according to the kind and the C++ polymorphism.
The symbolic simplification class.
TRITON_EXPORT SymbolicSimplification(triton::arch::Architecture *architecture, triton::callbacks::Callbacks *callbacks=nullptr)
Constructor.
TRITON_EXPORT triton::ast::SharedAbstractNode simplify(const triton::ast::SharedAbstractNode &node) const
Processes all recorded simplifications. Returns the simplified node.
TRITON_EXPORT SymbolicSimplification & operator=(const SymbolicSimplification &other)
Copies a SymbolicSimplification.
The exception class used by symbolic simplifications.
const triton::arch::Instruction nop
AArch64 NOP instruction.
std::shared_ptr< triton::ast::AbstractNode > SharedAbstractNode
Shared Abstract Node.
std::deque< SharedAbstractNode > search(const SharedAbstractNode &node, triton::ast::ast_e match)
Returns a deque of collected matched nodes via a depth-first pre order traversal.
@ SYMBOLIC_SIMPLIFICATION
std::uint32_t uint32
unisgned 32-bits