From f609ea22f31177777009263c3d41af3015b8c953 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Thu, 25 Jun 2020 21:45:34 -0400 Subject: Add C++ APIs to get SSA and non-SSA forms of HLIL instructions --- highlevelilinstruction.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'highlevelilinstruction.cpp') diff --git a/highlevelilinstruction.cpp b/highlevelilinstruction.cpp index d7d1c6aa..e4ad6c7b 100644 --- a/highlevelilinstruction.cpp +++ b/highlevelilinstruction.cpp @@ -20,6 +20,7 @@ #ifdef BINARYNINJACORE_LIBRARY #include "highlevelilfunction.h" +#include "highlevelilssafunction.h" #include "mediumlevelilfunction.h" #include "mediumlevelilssafunction.h" using namespace BinaryNinjaCore; @@ -848,6 +849,38 @@ Confidence> HighLevelILInstructionBase::GetType() const } +size_t HighLevelILInstructionBase::GetSSAExprIndex() const +{ + return function->GetSSAExprIndex(exprIndex); +} + + +size_t HighLevelILInstructionBase::GetNonSSAExprIndex() const +{ + return function->GetNonSSAExprIndex(exprIndex); +} + + +HighLevelILInstruction HighLevelILInstructionBase::GetSSAForm() const +{ + Ref ssa = function->GetSSAForm().GetPtr(); + if (!ssa) + return *this; + size_t expr = GetSSAExprIndex(); + return ssa->GetExpr(expr); +} + + +HighLevelILInstruction HighLevelILInstructionBase::GetNonSSAForm() const +{ + Ref nonSsa = function->GetNonSSAForm(); + if (!nonSsa) + return *this; + size_t expr = GetNonSSAExprIndex(); + return nonSsa->GetExpr(expr); +} + + size_t HighLevelILInstructionBase::GetMediumLevelILExprIndex() const { return function->GetMediumLevelILExprIndex(exprIndex); -- cgit v1.3.1