diff options
| author | Rusty Wagner <rusty@vector35.com> | 2020-06-25 21:45:34 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2020-06-25 21:45:34 -0400 |
| commit | f609ea22f31177777009263c3d41af3015b8c953 (patch) | |
| tree | 688b9e08f17285ac3bac8f36daa3af21aae9e1a6 /highlevelilinstruction.cpp | |
| parent | 6a99757a50df5cff5a69c9cc9d590f8fe097adba (diff) | |
Add C++ APIs to get SSA and non-SSA forms of HLIL instructions
Diffstat (limited to 'highlevelilinstruction.cpp')
| -rw-r--r-- | highlevelilinstruction.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
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<Ref<Type>> 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<HighLevelILFunction> ssa = function->GetSSAForm().GetPtr(); + if (!ssa) + return *this; + size_t expr = GetSSAExprIndex(); + return ssa->GetExpr(expr); +} + + +HighLevelILInstruction HighLevelILInstructionBase::GetNonSSAForm() const +{ + Ref<HighLevelILFunction> nonSsa = function->GetNonSSAForm(); + if (!nonSsa) + return *this; + size_t expr = GetNonSSAExprIndex(); + return nonSsa->GetExpr(expr); +} + + size_t HighLevelILInstructionBase::GetMediumLevelILExprIndex() const { return function->GetMediumLevelILExprIndex(exprIndex); |
