summaryrefslogtreecommitdiff
path: root/binaryninjaapi.h
diff options
context:
space:
mode:
authorkat <katherine@vector35.com>2022-12-22 12:36:59 -0500
committerkat <katherine@vector35.com>2022-12-22 12:37:22 -0500
commitd0b71355485126d15389f9f2de201cc154e19c69 (patch)
tree903523e2c4393f95d8de0bc4f570b730c22ed501 /binaryninjaapi.h
parente5a616e8bff8408302675534d161211247ae2bc5 (diff)
Add LowLevelILFunction documentation
Arrakis can have a little LowLevelILFunction documentation, as a treat
Diffstat (limited to 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h1109
1 files changed, 1064 insertions, 45 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 93b6bdfb..324f1d07 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -4446,7 +4446,7 @@ namespace BinaryNinja {
``struct Foo m_foo`` will induce a dependency, whereas ``struct Foo* m_pFoo`` will not.
\return Sorted types as defined above
- */
+ */
std::vector<std::pair<QualifiedName, Ref<Type>>> GetDependencySortedTypes();
std::vector<QualifiedName> GetTypeNames(const std::string& matching = "");
Ref<Type> GetTypeByName(const QualifiedName& name);
@@ -4469,18 +4469,18 @@ namespace BinaryNinja {
/*! Make the contents of a type library available for type/import resolution
\param lib library to register with the view
- */
+ */
void AddTypeLibrary(TypeLibrary* lib);
/*! Get the type library with the given name
\param name Library name to lookup
\return The Type Library object, or nullptr if one has not been added with this name
- */
+ */
Ref<TypeLibrary> GetTypeLibrary(const std::string& name);
/*! Get the list of imported type libraries
\return All imported type libraries
- */
+ */
std::vector<Ref<TypeLibrary>> GetTypeLibraries();
/*! Recursively imports a type from the specified type library, or, if no library was explicitly provided,
@@ -4496,7 +4496,7 @@ namespace BinaryNinja {
\param lib
\param name
\return A `NamedTypeReference` to the type, taking into account any renaming performed
- */
+ */
Ref<Type> ImportTypeLibraryType(Ref<TypeLibrary>& lib, const QualifiedName& name);
/*! Recursively imports an object from the specified type library, or, if no library was explicitly provided,
the first type library associated with the current `BinaryView` that provides the name requested.
@@ -4510,7 +4510,7 @@ namespace BinaryNinja {
\param lib
\param name
\return The object type, with any interior `NamedTypeReferences` renamed as necessary to be appropriate for the current view
- */
+ */
Ref<Type> ImportTypeLibraryObject(Ref<TypeLibrary>& lib, const QualifiedName& name);
/*! Recursively exports ``type`` into ``lib`` as a type with name ``name``
@@ -4521,7 +4521,7 @@ namespace BinaryNinja {
\param lib
\param name
\param type
- */
+ */
void ExportTypeToTypeLibrary(TypeLibrary* lib, const QualifiedName& name, Type* type);
/*! Recursively exports ``type`` into ``lib`` as an object with name ``name``
@@ -4531,7 +4531,7 @@ namespace BinaryNinja {
\param lib
\param name
\param type
- */
+ */
void ExportObjectToTypeLibrary(TypeLibrary* lib, const QualifiedName& name, Type* type);
/*! Should be called by custom `BinaryView` implementations when they have successfully imported an object
@@ -4541,14 +4541,14 @@ namespace BinaryNinja {
\param tgtAddr Address of symbol at import site
\param lib Type Library containing the imported type
\param name Name of the object in the type library
- */
+ */
void RecordImportedObjectLibrary(Platform* tgtPlatform, uint64_t tgtAddr, TypeLibrary* lib, const QualifiedName& name);
/*! Gives you details of which type library and name was used to determine the type of a symbol at a given address.
\param tgtPlatform Platform of symbol at import site
\param tgtAddr Address of symbol at import site
\return A pair with the library and name used, or std::nullopt if it was not imported
- */
+ */
std::optional<std::pair<Ref<TypeLibrary>, QualifiedName>> LookupImportedObjectLibrary(Platform* tgtPlatform, uint64_t tgtAddr);
bool FindNextData(
@@ -9289,6 +9289,8 @@ namespace BinaryNinja {
void PrepareToCopyBlock(BasicBlock* block);
BNLowLevelILLabel* GetLabelForSourceInstruction(size_t i);
+ /*! Get the current IL address.
+ */
uint64_t GetCurrentAddress() const;
void SetCurrentAddress(Architecture* arch, uint64_t addr);
size_t GetInstructionStart(Architecture* arch, uint64_t addr);
@@ -9296,9 +9298,26 @@ namespace BinaryNinja {
void ClearIndirectBranches();
void SetIndirectBranches(const std::vector<ArchAndAddr>& branches);
- // Get a list of registers used in the LLIL function
+ /*! Get a list of registers used in the LLIL function
+
+ \see Architecture::GetAllRegisters, Architecture::GetRegisterName, Architecture::GetRegisterInfo
+
+ \return The list of used registers
+ */
std::vector<uint32_t> GetRegisters();
+
+ /*! Get a list of used register stacks used in the LLIL function
+
+ \return List of used register stacks
+ */
std::vector<uint32_t> GetRegisterStacks();
+
+ /*! Get the list of flags used in this LLIL function
+
+ \see Architecture::GetAllFlags, Architecture::GetFlagName, Architecture::GetFlagRole
+
+ \return The list of used flags.
+ */
std::vector<uint32_t> GetFlags();
// Get a list of SSA registers used in the LLIL SSA function, without versions.
@@ -9319,9 +9338,35 @@ namespace BinaryNinja {
uint32_t flags, ExprId a = 0, ExprId b = 0, ExprId c = 0, ExprId d = 0);
ExprId AddInstruction(ExprId expr);
+ /*! No operation, this instruction does nothing.
+
+ \param loc Optional IL Location this instruction was added from.
+ \return
+ */
ExprId Nop(const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Sets the register \c reg of size \c size to the expression \c value
+
+ \param size Size of the register parameter in bytes
+ \param reg The register name
+ \param val An expression to set the register to
+ \param flags Which flags are set by this operation
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression <tt>reg = value</tt>
+ */
ExprId SetRegister(size_t size, uint32_t reg, ExprId val, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Uses \c hi and \c lo as a single extended register setting \c hi:lo to the expression \c value .
+
+ \param size Size of the register parameter in bytes
+ \param high The high register name
+ \param low The low register name
+ \param val An expression to set the split registers to
+ \param flags Which flags are set by this operation
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression <tt>hi:lo = value</tt>
+ */
ExprId SetRegisterSplit(size_t size, uint32_t high, uint32_t low, ExprId val, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
ExprId SetRegisterSSA(
@@ -9330,37 +9375,144 @@ namespace BinaryNinja {
const ILSourceLocation& loc = ILSourceLocation());
ExprId SetRegisterSplitSSA(size_t size, const SSARegister& high, const SSARegister& low, ExprId val,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Sets the top-relative entry \c entry of size \c size in register stack \c reg_stack to the expression
+ \c value
+
+ \param size Size of the register parameter in bytes
+ \param regStack The register stack name
+ \param entry An expression for which stack entry to set
+ \param val An expression to set the entry to
+ \param flags Which flags are set by this operation
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression <tt>reg_stack[entry] = value</tt>
+ */
ExprId SetRegisterStackTopRelative(size_t size, uint32_t regStack, ExprId entry, ExprId val, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Pushes the expression \c value of size \c size onto the top of the register
+ stack \c reg_stack
+
+ \param size Size of the register parameter in bytes
+ \param regStack The register stack name
+ \param val An expression to push
+ \param flags Which flags are set by this operation
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression <tt>reg_stack.push(value)</tt>
+ */
ExprId RegisterStackPush(size_t size, uint32_t regStack, ExprId val, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
+
ExprId SetRegisterStackTopRelativeSSA(size_t size, uint32_t regStack, size_t destVersion, size_t srcVersion,
ExprId entry, const SSARegister& top, ExprId val, const ILSourceLocation& loc = ILSourceLocation());
ExprId SetRegisterStackAbsoluteSSA(size_t size, uint32_t regStack, size_t destVersion, size_t srcVersion,
uint32_t reg, ExprId val, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Sets the flag \c flag to the ExpressionIndex \c value
+
+ \param flag Flag index
+ \param val An expression to set the flag to
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression <tt>FLAG.flag = value</tt>
+ */
ExprId SetFlag(uint32_t flag, ExprId val, const ILSourceLocation& loc = ILSourceLocation());
ExprId SetFlagSSA(const SSAFlag& flag, ExprId val, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Reads \c size bytes from the expression \c addr
+
+ \param size Number of bytes to read
+ \param addr The expression to read memory from
+ \param flags Flags set by this expression
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression \c [addr].size
+ */
ExprId Load(size_t size, ExprId addr, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
ExprId LoadSSA(
size_t size, ExprId addr, size_t sourceMemoryVer, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Writes \c size bytes to expression \c addr read from expression \c val
+
+ \param size Number of bytes to write
+ \param addr The expression to write to
+ \param val The expression to be written
+ \param flags Which flags are set by this operation
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression <tt>[addr].size = value</tt>
+ */
ExprId Store(
size_t size, ExprId addr, ExprId val, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
ExprId StoreSSA(size_t size, ExprId addr, ExprId val, size_t newMemoryVer, size_t prevMemoryVer,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Writes \c size bytes from expression \c value to the stack, adjusting the stack by \c size .
+
+ \param size Number of bytes to write and adjust the stack by
+ \param val The expression to write
+ \param flags Flags set by this expression
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression \c push(value)
+ */
ExprId Push(size_t size, ExprId val, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Reads ``size`` bytes from the stack, adjusting the stack by ``size``.
+
+ \param size Number of bytes to read from the stack
+ \param flags Flags set by this expression
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression \c pop
+ */
ExprId Pop(size_t size, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns a register of size \c size with name \c reg
+
+ \param size The size of the register in bytes
+ \param reg The name of the register
+ \param loc Optional IL Location this instruction was added from.
+ \return A register expression for the given register
+ */
ExprId Register(size_t size, uint32_t reg, const ILSourceLocation& loc = ILSourceLocation());
ExprId RegisterSSA(size_t size, const SSARegister& reg, const ILSourceLocation& loc = ILSourceLocation());
ExprId RegisterSSAPartial(size_t size, const SSARegister& fullReg, uint32_t partialReg,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Combines registers of size ``size`` with names ``hi`` and ``lo``
+
+ \param size The size of the register in bytes
+ \param high Register holding high part of value
+ \param low Register holding low part of value
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression \c hi:lo
+ */
ExprId RegisterSplit(
size_t size, uint32_t high, uint32_t low, const ILSourceLocation& loc = ILSourceLocation());
ExprId RegisterSplitSSA(size_t size, const SSARegister& high, const SSARegister& low,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns a register stack entry of size \c size at top-relative
+ location \c entry in register stack with name \c regStack
+
+ \param size The size of the register in bytes
+ \param regStack The index of the register stack
+ \param entry An expression for which stack entry to fetch
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression \c reg_stack[entry]
+ */
ExprId RegisterStackTopRelative(
size_t size, uint32_t regStack, ExprId entry, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns the top entry of size \c size in register stack with name \c reg_stack , and
+ removes the entry from the stack
+
+ \param size The size of the register in bytes
+ \param regStack The index of the register stack
+ \param flags Any flags set by this expression
+ \param loc Optional IL Location this instruction was added from.
+ \return The expression \c reg_stack.pop
+ */
ExprId RegisterStackPop(
size_t size, uint32_t regStack, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+
ExprId RegisterStackFreeReg(uint32_t reg, const ILSourceLocation& loc = ILSourceLocation());
ExprId RegisterStackFreeTopRelative(
uint32_t regStack, ExprId entry, const ILSourceLocation& loc = ILSourceLocation());
@@ -9372,79 +9524,520 @@ namespace BinaryNinja {
const SSARegister& top, const ILSourceLocation& loc = ILSourceLocation());
ExprId RegisterStackFreeAbsoluteSSA(uint32_t regStack, size_t destVersion, size_t srcVersion, uint32_t reg,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression for the constant integer \c value with size \c size
+
+ \param size The size of the constant in bytes
+ \param val Integer value of the constant
+ \param loc Optional IL Location this instruction was added from.
+ \return A constant expression of given value and size
+ */
ExprId Const(size_t size, uint64_t val, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression for the constant pointer \c value with size \c size
+
+ \param size The size of the pointer in bytes
+ \param val Address referenced by pointer
+ \param loc Optional IL Location this instruction was added from.
+ \return A constant pointer expression of given value and size
+ */
ExprId ConstPointer(size_t size, uint64_t val, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression for the constant relocated pointer ``value`` with size ``size``
+
+ \param size The size of the pointer in bytes
+ \param val Address referenced by pointer
+ \param offset
+ \param loc Optional IL Location this instruction was added from.
+ \return A constant expression of given value and size
+ */
ExprId ExternPointer(
size_t size, uint64_t val, uint64_t offset, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression for the constant raw binary floating point
+ value \c value with size \c size
+
+ To clarify, \c value here is the representation of the float if its bits were instead interpreted as an integer.
+
+ A given float \e could be converted to an integer value like so:
+
+ \code{.cpp}
+ union {
+ float floatValue;
+ uint32_t integerValue;
+ } bits;
+ bits.floatValue = val;
+ uint32_t myIntValueToPassToThisFunction = bits.integerValue;
+ \endcode
+
+ Do note this is exactly how FloatConstSingle and FloatConstDouble perform this conversion
+ (and thus, converting it yourself is \e typically redundant.)
+
+ \param size The size of the constant in bytes
+ \param val Integer value for the raw binary representation of the constant
+ \param loc Optional IL Location this instruction was added from.
+ \return A constant expression of given value and size
+ */
ExprId FloatConstRaw(size_t size, uint64_t val, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression for the single precision floating point value \c value
+
+ \param val Float value for the constant
+ \param loc Optional IL Location this instruction was added from.
+ \return A constant expression of given value and size
+ */
ExprId FloatConstSingle(float val, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression for the double precision floating point value \c value
+
+ \param val Float value for the constant
+ \param loc Optional IL Location this instruction was added from.
+ \return A constant expression of given value and size
+ */
ExprId FloatConstDouble(double val, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns a flag expression for the given flag index.
+
+ \param flag Flag index
+ \param loc Optional IL Location this expression was added from.
+ \return A flag expression for the given flag
+ */
ExprId Flag(uint32_t flag, const ILSourceLocation& loc = ILSourceLocation());
ExprId FlagSSA(const SSAFlag& flag, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Sets the flag with index \c flag and size \c size to the constant integer value \c bit
+
+ \param size The size of the flag
+ \param flag Flag index
+ \param bitIndex Bit of the flag to set
+ \param loc Optional IL Location this expression was added from.
+ \return A constant expression of given value and size <tt>FLAG.reg = bit</tt>
+ */
ExprId FlagBit(size_t size, uint32_t flag, size_t bitIndex, const ILSourceLocation& loc = ILSourceLocation());
ExprId FlagBitSSA(
size_t size, const SSAFlag& flag, size_t bitIndex, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Adds expression \c a to expression \c b potentially setting flags \c flags and returning
+ an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return A constant expression of given value and size <tt>FLAG.reg = bit</tt>
+ */
ExprId Add(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Adds with carry expression \c a to expression \c b potentially setting flags \c flags and
+ returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param carry Carry flag expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>adc.<size>{<flags>}(a, b, carry)</tt>
+ */
ExprId AddCarry(size_t size, ExprId a, ExprId b, ExprId carry, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Subtracts expression \c b from expression \c a potentially setting flags \c flags and returning
+ an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>sub.<size>{<flags>}(a, b)</tt>
+ */
ExprId Sub(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Subtracts with borrow expression \c b from expression \c a potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param carry Carry flag expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>sbb.<size>{<flags>}(a, b, carry)</tt>
+ */
ExprId SubBorrow(size_t size, ExprId a, ExprId b, ExprId carry, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Bitwise and's expression \c a and expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>and.<size>{<flags>}(a, b)</tt>
+ */
ExprId And(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Bitwise or's expression \c a and expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>or.<size>{<flags>}(a, b)</tt>
+ */
ExprId Or(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Xor's expression \c a with expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>xor.<size>{<flags>}(a, b)</tt>
+ */
ExprId Xor(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Shifts left expression \c a by expression \c b from expression \c a potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>lsl.<size>{<flags>}(a, b)</tt>
+ */
ExprId ShiftLeft(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Shifts logically right expression \c a by expression \c b potentially setting flags
+ \c flags and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>lsr.<size>{<flags>}(a, b)</tt>
+ */
ExprId LogicalShiftRight(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Shifts arithmetic right expression \c a by expression \c b potentially setting flags
+ \c flags and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>asr.<size>{<flags>}(a, b)</tt>
+ */
ExprId ArithShiftRight(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Bitwise rotates left expression \c a by expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>rol.<size>{<flags>}(a, b)</tt>
+ */
ExprId RotateLeft(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Bitwise rotates left with carry expression \c a by expression \c b potentially setting
+ flags \c flags and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param carry Carry flag expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>rlc.<size>{<flags>}(a, b, carry)</tt>
+ */
ExprId RotateLeftCarry(size_t size, ExprId a, ExprId b, ExprId carry, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Bitwise rotates right expression \c a by expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>ror.<size>{<flags>}(a, b)</tt>
+ */
ExprId RotateRight(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Bitwise rotates right with carry expression \c a by expression \c b potentially setting
+ flags \c flags and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param carry Carry flag expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>rrc.<size>{<flags>}(a, b, carry)</tt>
+ */
ExprId RotateRightCarry(size_t size, ExprId a, ExprId b, ExprId carry, uint32_t flags = 0,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Multiplies expression \c a by expression \c b potentially setting flags \c flags and returning an
+ expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>sbc.<size>{<flags>}(a, b)</tt>
+ */
ExprId Mult(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Multiplies unsigned with double precision expression \c a by expression \c b
+ potentially setting flags \c flags and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>mulu.dp.<size>{<flags>}(a, b)</tt>
+ */
ExprId MultDoublePrecUnsigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Multiplies signed with double precision expression \c a by expression \c b
+ potentially setting flags \c flags and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>muls.dp.<size>{<flags>}(a, b)</tt>
+ */
ExprId MultDoublePrecSigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Unsigned divide expression \c a by expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>divu.<size>{<flags>}(a, b)</tt>
+ */
ExprId DivUnsigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Unsigned double precision divide using expression \c a as
+ a single double precision register by expression \c b potentially setting flags \c flags and returning an
+ expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>mods.dp.<size>{<flags>}(a, b)</tt>
+ */
ExprId DivDoublePrecUnsigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Signed divide expression \c a by expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>divs.<size>{<flags>}(a, b)</tt>
+ */
ExprId DivSigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Signed double precision divide using expression \c a as a
+ single double precision register by expression \c b potentially setting flags \c flags and returning an
+ expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>divs.dp.<size>{<flags>}(a, b)</tt>
+ */
ExprId DivDoublePrecSigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Unsigned modulus expression \c a by expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>modu.<size>{<flags>}(a, b)</tt>
+ */
ExprId ModUnsigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Unsigned double precision modulus using expression \c a as
+ a single double precision register by expression \c b potentially setting flags \c flags and returning an
+ expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>modu.dp.<size>{<flags>}(a, b)</tt>
+ */
ExprId ModDoublePrecUnsigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Signed modulus expression \c a by expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>mods.<size>{<flags>}(a, b)</tt>
+ */
ExprId ModSigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Signed double precision modulus using expression \c a as a single
+ double precision register by expression \c b potentially setting flags \c flags and returning an expression
+ of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>mods.dp.<size>{<flags>}(a, b)</tt>
+ */
ExprId ModDoublePrecSigned(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Two's complement sign negation of expression \c value of size \c size potentially setting flags
+
+ \param size The size of the result in bytes
+ \param a The expression to negate
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>neg.<size>{<flags>}(value)</tt>
+ */
ExprId Neg(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Bitwise inverse of expression \c value of size \c size potentially setting flags
+
+ \param size The size of the result in bytes
+ \param a The expression to bitwise invert
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>not.<size>{<flags>}(value)</tt>
+ */
ExprId Not(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Two's complement sign-extends the expression in \c value to \c size bytes
+
+ \param size The size of the result in bytes
+ \param a The expression to sign extend
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>sx.<size>(value)</tt>
+ */
ExprId SignExtend(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Zero-extends the expression in \c value to \c size bytes
+
+ \param size The size of the result in bytes
+ \param a The expression to zero extend
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>sx.<size>(value)</tt>
+ */
ExprId ZeroExtend(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Truncates \c value to \c size bytes
+
+ \param size The size of the result in bytes
+ \param a The expression to truncate
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>zx.<size>(value)</tt>
+ */
ExprId LowPart(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression which jumps (branches) to the expression \c dest
+
+ \param dest The expression to jump to
+ \param loc Optional IL Location this expression was added from.
+ \return The expression \c jump(dest)
+ */
ExprId Jump(ExprId dest, const ILSourceLocation& loc = ILSourceLocation());
ExprId JumpTo(ExprId dest, const std::map<uint64_t, BNLowLevelILLabel*>& targets,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression which first pushes the address of the next instruction onto the stack then jumps
+ (branches) to the expression \c dest
+
+ \param dest The expression to call
+ \param loc Optional IL Location this expression was added from.
+ \return The expression \c call(dest)
+ */
ExprId Call(ExprId dest, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression which first pushes the address of the next instruction onto the stack
+ then jumps (branches) to the expression \c dest . After the function exits, \c stack_adjust is added to the
+ stack pointer register.
+
+ \param dest The expression to call
+ \param adjust Stack adjustment
+ \param regStackAdjust Register stack adjustment
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>call(dest), stack += stack_adjust</tt>
+ */
ExprId CallStackAdjust(ExprId dest, int64_t adjust, const std::map<uint32_t, int32_t>& regStackAdjust,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression which jumps (branches) to the expression \c dest
+
+ \param dest The expression to jump to
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>tailcall(dest)</tt>
+ */
ExprId TailCall(ExprId dest, const ILSourceLocation& loc = ILSourceLocation());
ExprId CallSSA(const std::vector<SSARegister>& output, ExprId dest, const std::vector<ExprId>& params,
const SSARegister& stack, size_t newMemoryVer, size_t prevMemoryVer,
@@ -9455,39 +10048,219 @@ namespace BinaryNinja {
ExprId TailCallSSA(const std::vector<SSARegister>& output, ExprId dest, const std::vector<ExprId>& params,
const SSARegister& stack, size_t newMemoryVer, size_t prevMemoryVer,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression which jumps (branches) to the expression \c dest . \c ret is a special alias for
+ jump that makes the disassembler stop disassembling.
+
+ \param dest The expression to jump to
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>jump(dest)</tt>
+ */
ExprId Return(size_t dest, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an expression that halts disassembly
+
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>noreturn</tt>
+ */
ExprId NoReturn(const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns a flag_condition expression for the given LowLevelILFlagCondition
+
+ \param cond Flag condition expression to retrieve
+ \param semClass Optional semantic flag class
+ \param loc Optional IL Location this expression was added from.
+ \return A flag_condition expression
+ */
ExprId FlagCondition(
BNLowLevelILFlagCondition cond, uint32_t semClass = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns a flag_group expression for the given semantic flag group
+
+ \param semGroup Semantic flag group to access
+ \param loc Optional IL Location this expression was added from.
+ \return A flag_group expression
+ */
ExprId FlagGroup(uint32_t semGroup, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is equal to
+ expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is not equal to
+ expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareNotEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is
+ signed less than expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareSignedLessThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is
+ unsigned less than expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareUnsignedLessThan(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is
+ signed less than or equal to expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareSignedLessEqual(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is
+ unsigned less than or equal to expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareUnsignedLessEqual(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is
+ signed greater than or equal to expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareSignedGreaterEqual(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a
+ is unsigned greater than or equal to expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareUnsignedGreaterEqual(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is
+ signed greater than or equal to expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareSignedGreaterThan(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns comparison expression of size \c size checking if expression \c a is
+ unsigned greater than or equal to expression \c b
+
+ \param size Size in bytes
+ \param a LHS of comparison
+ \param b RHS of comparison
+ \param loc Optional IL Location this expression was added from.
+ \return a comparison expression.
+ */
ExprId CompareUnsignedGreaterThan(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
ExprId TestBit(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
ExprId BoolToInt(size_t size, ExprId a, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns a system call expression.
+
+ \param loc Optional IL Location this expression was added from.
+ \return System call expression.
+ */
ExprId SystemCall(const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns an intrinsic expression. 'Intrinsics' are emitted and lifted as if they were builtin functions that
+ do not exist in the binary.
+
+ \param outputs Registers and/or flags set by this intrinsic call.
+ \param intrinsic Index of the intrinsic. <b>See also:</b> Architecture::GetIntrinsicName, Architecture::GetAllIntrinsics
+ \param params Parameter items passed to this intrinsic
+ \param flags Flags
+ \param loc Optional IL Location this expression was added from.
+ \return An intrinsic expression.
+ */
ExprId Intrinsic(const std::vector<RegisterOrFlag>& outputs, uint32_t intrinsic,
const std::vector<ExprId>& params, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
ExprId IntrinsicSSA(const std::vector<SSARegisterOrFlag>& outputs, uint32_t intrinsic,
const std::vector<ExprId>& params, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns a processor breakpoint expression.
+
+ \param loc Optional IL Location this expression was added from.
+ \return A breakpoint expression.
+ */
ExprId Breakpoint(const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns a processor trap (interrupt) expression of the given integer \c value .
+
+ \param num trap (interrupt) number
+ \param loc Optional IL Location this expression was added from.
+ \return A trap expression.
+ */
ExprId Trap(int64_t num, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns the undefined expression. This should be used for instructions which perform functions but
+ aren't important for dataflow or partial emulation purposes.
+
+ \param loc Optional IL Location this expression was added from.
+ \return The Undefined expression
+ */
ExprId Undefined(const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns the unimplemented expression. This should be used for instructions which aren't implemented
+
+ \param loc Optional IL Location this expression was added from.
+ \return The unimplemented expression
+ */
ExprId Unimplemented(const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! A memory reference to expression \c addr of size \c size with unimplemented operation.
+
+ \param size Size in bytes of the memory reference
+ \param addr Expression to reference memory
+ \param loc Optional IL Location this expression was added from.
+ \return The unimplemented memory reference expression.
+ */
ExprId UnimplementedMemoryRef(size_t size, ExprId addr, const ILSourceLocation& loc = ILSourceLocation());
ExprId RegisterPhi(const SSARegister& dest, const std::vector<SSARegister>& sources,
const ILSourceLocation& loc = ILSourceLocation());
@@ -9497,39 +10270,265 @@ namespace BinaryNinja {
const SSAFlag& dest, const std::vector<SSAFlag>& sources, const ILSourceLocation& loc = ILSourceLocation());
ExprId MemoryPhi(
size_t dest, const std::vector<size_t>& sources, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Adds floating point expression \c a to expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>fadd.<size>{<flags>}(a, b)</tt>
+ */
ExprId FloatAdd(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Subtracts floating point expression \c b from expression \c a potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>fsub.<size>{<flags>}(a, b)</tt>
+ */
ExprId FloatSub(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Multiplies floating point expression \c a by expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>fmul.<size>{<flags>}(a, b)</tt>
+ */
ExprId FloatMult(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Divides floating point expression \c a by expression \c b potentially setting flags \c flags
+ and returning an expression of \c size bytes.
+
+ \param size The size of the result in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>fdiv.<size>{<flags>}(a, b)</tt>
+ */
ExprId FloatDiv(
size_t size, ExprId a, ExprId b, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns the square root of floating point expression \c value of size \c size potentially setting flags
+
+ \param size The size of the result in bytes
+ \param a The expression to calculate the square root of
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>sqrt.<size>{<flags>}(value)</tt>
+ */
ExprId FloatSqrt(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns sign negation of floating point expression \c value of size \c size potentially setting flags
+
+ \param size The size of the result in bytes
+ \param a The expression to negate
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>fneg.<size>{<flags>}(value)</tt>
+ */
ExprId FloatNeg(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns absolute value of floating point expression \c value of size \c size potentially setting flags.
+
+ \param size The size of the result in bytes
+ \param a The expression to get the absolute value of
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>fabs.<size>{<flags>}(value)</tt>
+ */
ExprId FloatAbs(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns integer value of floating point expression \c value of size \c size potentially setting flags
+
+ \param size The size of the result in bytes
+ \param a The float expression to convert to an int
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>int.<size>{<flags>}(value)</tt>
+ */
ExprId FloatToInt(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point value of integer expression \c value of size \c size potentially setting flags
+
+ \param size The size of the result in bytes
+ \param a The float expression to convert to a float
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>float.<size>{<flags>}(value)</tt>
+ */
ExprId IntToFloat(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
ExprId FloatConvert(
size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Rounds a floating point value to the nearest integer
+
+ \param size The size of the result in bytes
+ \param a The expression to round to the nearest integer
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>roundint.<size>{<flags>}(value)</tt>
+ */
ExprId RoundToInt(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Rounds a floating point value to an integer, towards negative infinity
+
+ \param size The size of the result in bytes
+ \param a The expression to round down
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>roundint.<size>{<flags>}(value)</tt>
+ */
ExprId Floor(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Rounds a floating point value to an integer, towards positive infinity
+
+ \param size The size of the result in bytes
+ \param a The expression to round up
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>roundint.<size>{<flags>}(value)</tt>
+ */
ExprId Ceil(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Rounds a floating point value to an integer towards zero
+
+ \param size The size of the result in bytes
+ \param a The expression to truncate
+ \param flags Flags to set
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>roundint.<size>{<flags>}(value)</tt>
+ */
ExprId FloatTrunc(size_t size, ExprId a, uint32_t flags = 0, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point comparison expression of size \c size checking if
+ expression \c a is equal to expression \c b
+
+ \param size The size of the operands in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>a f== b</tt>
+ */
ExprId FloatCompareEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point comparison expression of size \c size checking if
+ expression \c a is not equal to expression \c b
+
+ \param size The size of the operands in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>a f!= b</tt>
+ */
ExprId FloatCompareNotEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point comparison expression of size \c size checking if
+ expression \c a is less than expression \c b
+
+ \param size The size of the operands in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>a f< b</tt>
+ */
ExprId FloatCompareLessThan(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point comparison expression of size \c size checking if
+ expression \c a is less than or equal to expression \c b
+
+ \param size The size of the operands in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>a f<= b</tt>
+ */
ExprId FloatCompareLessEqual(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point comparison expression of size \c size checking if
+ expression \c a is greater than or equal to expression \c b
+
+ \param size The size of the operands in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>a f>= b</tt>
+ */
ExprId FloatCompareGreaterEqual(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point comparison expression of size \c size checking if
+ expression \c a is greater than expression \c b
+
+ \param size The size of the operands in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>a f> b</tt>
+ */
ExprId FloatCompareGreaterThan(
size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point comparison expression of size \c size checking if
+ expression \c a is ordered relative to expression \c b
+
+ \param size The size of the operands in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>is_ordered(a, b)</tt>
+ */
ExprId FloatCompareOrdered(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns floating point comparison expression of size \c size checking if
+ expression \c a is unordered relative to expression \c b
+
+ \param size The size of the operands in bytes
+ \param a LHS expression
+ \param b RHS expression
+ \param loc Optional IL Location this expression was added from.
+ \return The expression <tt>is_unordered(a, b)</tt>
+ */
ExprId FloatCompareUnordered(size_t size, ExprId a, ExprId b, const ILSourceLocation& loc = ILSourceLocation());
+ /*! Returns a goto expression which jumps to the provided LowLevelILLabel.
+
+ \param label Label to jump to
+ \param loc Optional IL Location this expression was added from.
+ \return a Goto expression
+ */
ExprId Goto(BNLowLevelILLabel& label, const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Returns the \c if expression which depending on condition \c operand jumps to the LowLevelILLabel
+ \c t when the condition expression \c operand is non-zero and \c f`` when it's zero.
+
+ \param operand Comparison expression to evaluate.
+ \param t Label for the true branch
+ \param f Label for the false branch
+ \param loc Optional IL Location this expression was added from.
+ \return the ExpressionIndex for the if expression
+ */
ExprId If(ExprId operand, BNLowLevelILLabel& t, BNLowLevelILLabel& f,
const ILSourceLocation& loc = ILSourceLocation());
+
+ /*! Assigns a LowLevelILLabel to the current IL address.
+
+ \param label label to mark.
+ */
void MarkLabel(BNLowLevelILLabel& label);
std::vector<uint64_t> GetOperandList(ExprId i, size_t listOperand);
@@ -9565,10 +10564,30 @@ namespace BinaryNinja {
void AddLabelForAddress(Architecture* arch, ExprId addr);
BNLowLevelILLabel* GetLabelForAddress(Architecture* arch, ExprId addr);
+ /*! Ends the function and computes the list of basic blocks.
+ */
void Finalize();
+ /*! Generate SSA form given the current LLIL
+ */
void GenerateSSAForm();
+ /*! Get the list of InstructionTextTokens for a given expression
+
+ \param[in] arch Architecture for the expression
+ \param[in] expr Expression to get the text for
+ \param[out] tokens Output reference to write the instruction tokens to
+ \return True/False on success or failure
+ */
bool GetExprText(Architecture* arch, ExprId expr, std::vector<InstructionTextToken>& tokens);
+
+ /*! Get the list of InstructionTextTokens for a given instruction
+
+ \param[in] func Function containing the instruction
+ \param[in] arch Architecture for the instruction
+ \param[in] i Index of the instruction
+ \param[out] tokens Output reference to write the instruction tokens to
+ \return True/False on success or failure
+ */
bool GetInstructionText(
Function* func, Architecture* arch, size_t i, std::vector<InstructionTextToken>& tokens);
@@ -11750,14 +12769,14 @@ namespace BinaryNinja {
Parse a space-separated string of options into a list
\param optionsText Space-separated options text
\return List of options
- */
+ */
static std::vector<std::string> ParseOptionsText(const std::string& optionsText);
/*!
Format a list of parser errors into a big string
\param errors List of errors
\return String of formatted errors
- */
+ */
static std::string FormatParseErrors(const std::vector<TypeParserError>& errors);
/**
@@ -11766,7 +12785,7 @@ namespace BinaryNinja {
\param value Option value
\param result String representing the option
\return True if the parser supports the option
- */
+ */
virtual bool GetOptionText(BNTypeParserOption option, std::string value, std::string& result) const;
/*!
@@ -12065,7 +13084,7 @@ namespace BinaryNinja {
\param lineWidth Maximum width of lines, in characters
\param escaping Style of escaping literals which may not be parsable
\return All the types in a string
- */
+ */
virtual std::string PrintAllTypes(
const std::vector<std::pair<QualifiedName, Ref<Type>>>& types,
Ref<BinaryView> data,
@@ -12081,7 +13100,7 @@ namespace BinaryNinja {
\param lineWidth Maximum width of lines, in characters
\param escaping Style of escaping literals which may not be parsable
\return All the types in a string
- */
+ */
std::string DefaultPrintAllTypes(
const std::vector<std::pair<QualifiedName, Ref<Type>>>& types,
Ref<BinaryView> data,
@@ -12967,7 +13986,7 @@ namespace BinaryNinja {
template <>
std::vector<std::string> Settings::Get<std::vector<std::string>>(
const std::string& key, Ref<BinaryView> view, BNSettingsScope* scope);
- /*! \endcond */
+ /*! \endcond*/
typedef BNMetadataType MetadataType;
@@ -13621,14 +14640,14 @@ namespace BinaryNinja {
\param arch
\param name
- */
+ */
TypeLibrary(Ref<Architecture> arch, const std::string& name);
/*! Loads a finalized type library instance from file
\param path
\return
- */
+ */
static Ref<TypeLibrary> LoadFromFile(const std::string& path);
/*! Looks up the first type library found with a matching name. Keep in mind that names are
@@ -13637,7 +14656,7 @@ namespace BinaryNinja {
\param arch
\param name
\return
- */
+ */
static Ref<TypeLibrary> LookupByName(Ref<Architecture> arch, const std::string& name);
/*! Attempts to grab a type library associated with the provided Architecture and GUID pair
@@ -13645,37 +14664,37 @@ namespace BinaryNinja {
\param arch
\param guid
\return
- */
+ */
static Ref<TypeLibrary> LookupByGuid(Ref<Architecture> arch, const std::string& guid);
/*! Saves a finalized type library instance to file
\param path
- */
+ */
void WriteToFile(const std::string& path);
/*! The Architecture this type library is associated with
\return
- */
+ */
Ref<Architecture> GetArchitecture();
/*! Returns the GUID associated with the type library
\return
- */
+ */
std::string GetGuid();
/*! The primary name associated with this type library
\return
- */
+ */
std::string GetName();
/*! A list of extra names that will be considered a match by ``Platform::GetTypeLibrariesByName``
\return
- */
+ */
std::set<std::string> GetAlternateNames();
/*! The dependency name of a library is the name used to record dependencies across
@@ -13685,7 +14704,7 @@ namespace BinaryNinja {
as an `alternate_name`.
\return
- */
+ */
std::string GetDependencyName();
/*! Returns a list of all platform names that this type library will register with during platform
@@ -13695,20 +14714,20 @@ namespace BinaryNinja {
Platforms that may not be present.
\return
- */
+ */
std::set<std::string> GetPlatformNames();
/*! Retrieves a metadata associated with the given key stored in the type library
\param key Key to query
\return Metadata associated with the key
- */
+ */
Ref<Metadata> QueryMetadata(const std::string& key);
/*! Sets the GUID of a type library instance that has not been finalized
\param guid
- */
+ */
void SetGuid(const std::string& guid);
/*! Direct extracts a reference to a contained object -- when attempting to extract types from a library
@@ -13716,7 +14735,7 @@ namespace BinaryNinja {
\param name
\return
- */
+ */
Ref<Type> GetNamedObject(const QualifiedName& name);
/*! Direct extracts a reference to a contained type -- when attempting to extract types from a library
@@ -13724,42 +14743,42 @@ namespace BinaryNinja {
\param name
\return
- */
+ */
Ref<Type> GetNamedType(const QualifiedName& name);
/*! A list containing all named objects (functions, exported variables) provided by a type library
\return
- */
+ */
std::vector<QualifiedNameAndType> GetNamedObjects();
/*! A list containing all named types provided by a type library
\return
- */
+ */
std::vector<QualifiedNameAndType> GetNamedTypes();
/*! Sets the name of a type library instance that has not been finalized
\param name
- */
+ */
void SetName(const std::string& name);
/*! Adds an extra name to this type library used during library lookups and dependency resolution
\param alternate
- */
+ */
void AddAlternateName(const std::string& alternate);
/*! Sets the dependency name of a type library instance that has not been finalized
\param depName
- */
+ */
void SetDependencyName(const std::string& depName);
/*! Clears the list of platforms associated with a type library instance that has not been finalized
- */
+ */
void ClearPlatforms();
/*! Associate a platform with a type library instance that has not been finalized.
@@ -13769,7 +14788,7 @@ namespace BinaryNinja {
This does not have side affects until finalization of the type library.
\param platform
- */
+ */
void AddPlatform(Ref<Platform> platform);
/*! Stores an object for the given key in the current type library. Objects stored using StoreMetadata can be
@@ -13780,13 +14799,13 @@ namespace BinaryNinja {
\param key Key value to associate the Metadata object with
\param value Object to store.
- */
+ */
void StoreMetadata(const std::string& key, Ref<Metadata> value);
/*! Removes the metadata associated with key from the current type library.
\param key Key associated with metadata
- */
+ */
void RemoveMetadata(const std::string& key);
/*! Directly inserts a named object into the type library's object store.
@@ -13799,7 +14818,7 @@ namespace BinaryNinja {
\param name
\param type
- */
+ */
void AddNamedObject(const QualifiedName& name, Ref<Type> type);
/*! Directly inserts a named object into the type library's object store.
@@ -13812,7 +14831,7 @@ namespace BinaryNinja {
\param name
\param type
- */
+ */
void AddNamedType(const QualifiedName& name, Ref<Type> type);
/*! Manually flag NamedTypeReferences to the given QualifiedName as originating from another source
@@ -13822,13 +14841,13 @@ namespace BinaryNinja {
\param name
\param source
- */
+ */
void AddNamedTypeSource(const QualifiedName& name, const std::string& source);
/*! Flags a newly created type library instance as finalized and makes it available for Platform and Architecture
type library searches
- */
+ */
void Finalize();
};