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 | |
| parent | 6a99757a50df5cff5a69c9cc9d590f8fe097adba (diff) | |
Add C++ APIs to get SSA and non-SSA forms of HLIL instructions
| -rw-r--r-- | highlevelilinstruction.cpp | 33 | ||||
| -rw-r--r-- | highlevelilinstruction.h | 6 |
2 files changed, 39 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); diff --git a/highlevelilinstruction.h b/highlevelilinstruction.h index 497cf122..763c8221 100644 --- a/highlevelilinstruction.h +++ b/highlevelilinstruction.h @@ -318,6 +318,12 @@ namespace BinaryNinja _STD_SET<BNDataFlowQueryOption>()) const; Confidence<Ref<Type>> GetType() const; + size_t GetSSAExprIndex() const; + size_t GetNonSSAExprIndex() const; + + HighLevelILInstruction GetSSAForm() const; + HighLevelILInstruction GetNonSSAForm() const; + size_t GetMediumLevelILExprIndex() const; bool HasMediumLevelIL() const; MediumLevelILInstruction GetMediumLevelIL() const; |
