<?xml version="1.0" encoding="utf-8"?>

<!-- asmjit visualizer for Visual Studio (natvis) -->

<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="asmjit::String">
    <Intrinsic Name="isSmall" Expression="(_type &lt; 0x1F)"/>
    <DisplayString Condition="isSmall()">{_small.data, s8}</DisplayString>
    <DisplayString Condition="!isSmall()">{_large.data, s8}</DisplayString>
    <Expand HideRawView="true">
      <Synthetic Name="_type">
        <DisplayString Condition="(_type &lt; 0x1F)">Small</DisplayString>
        <DisplayString Condition="(_type == 0x1F)">Large</DisplayString>
        <DisplayString Condition="(_type &gt; 0x1F)">External</DisplayString>
      </Synthetic>
      <Item Name="_size" Condition="isSmall()" ExcludeView="simple">(int)_small.type, d</Item>
      <Item Name="_size" Condition="!isSmall()" ExcludeView="simple">_large.size, d</Item>
      <Item Name="_capacity" Condition="isSmall()" ExcludeView="simple">asmjit::String::kSSOCapacity, d</Item>
      <Item Name="_capacity" Condition="!isSmall()" ExcludeView="simple">_large.capacity, d</Item>
      <Item Name="_data" Condition="isSmall()" ExcludeView="simple">_small.data, s8</Item>
      <Item Name="_data" Condition="!isSmall()" ExcludeView="simple">_large.data, s8</Item>
    </Expand>
  </Type>

  <Type Name="asmjit::ZoneVector&lt;*&gt;">
    <DisplayString>{{ [size={_size, d} capacity={_capacity, d}] }}</DisplayString>
    <Expand>
      <Item Name="_size" ExcludeView="simple">_size, d</Item>
      <Item Name="_capacity" ExcludeView="simple">_capacity, d</Item>
      <ArrayItems>
        <Size>_size</Size>
        <ValuePointer>(($T1*)_data)</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>

  <Type Name="asmjit::OperandSignature">
    <Intrinsic Name="opType" Expression="(asmjit::OperandType)(_bits &amp; 0x7)" />
    <Intrinsic Name="opSize" Expression="(_bits &gt;&gt; 24) &amp; 0xFF" />
    <Intrinsic Name="regType" Expression="(asmjit::RegType)((_bits &gt;&gt; 3) &amp; 0x1F)" />
    <Intrinsic Name="regGroup" Expression="(asmjit::RegGroup)((_bits &gt;&gt; 8) &amp; 0xF)" />
    <Intrinsic Name="memBaseType" Expression="(asmjit::RegType)((_bits &gt;&gt; 3) &amp; 0x1F)" />
    <Intrinsic Name="memIndexType" Expression="(asmjit::RegType)((_bits &gt;&gt; 8) &amp; 0x1F)" />
    <Intrinsic Name="memRegHome" Expression="(bool)((_bits &gt;&gt; 13) &amp; 0x1)" />
    <Intrinsic Name="memX86Segment" Expression="(asmjit::x86::SReg::Id)((_bits &gt;&gt; 18) &amp; 0x7)" />
    <Intrinsic Name="memX86AddrType" Expression="(asmjit::x86::Mem::AddrType)((_bits &gt;&gt; 14) &amp; 0x3)" />
    <Intrinsic Name="memX86ShiftValue" Expression="((_bits &gt;&gt; 16) &amp; 0x3)" />
    <Intrinsic Name="memX86Broadcast" Expression="(asmjit::x86::Mem::Broadcast)((_bits &gt;&gt; 21) &amp; 0x7)" />
    <Intrinsic Name="immType" Expression="(asmjit::ImmType)((_bits &gt;&gt; 3) &amp; 0x1)" />

    <DisplayString Condition="opType() == asmjit::OperandType::kNone">[None]</DisplayString>
    <DisplayString Condition="opType() == asmjit::OperandType::kReg">[Reg] {{ type={regType()} group={regGroup()} size={opSize(), d} }}</DisplayString>
    <DisplayString Condition="opType() == asmjit::OperandType::kMem">[Mem] {{ base={memBaseType()} index={memIndexType()} }}</DisplayString>
    <DisplayString Condition="opType() == asmjit::OperandType::kImm">[Imm] {{ type={immType()} }}</DisplayString>
    <DisplayString Condition="opType() == asmjit::OperandType::kLabel">[Label]</DisplayString>
    <DisplayString Condition="opType() &gt; asmjit::OperandType::kMaxValue">[Unknown]</DisplayString>

    <Expand HideRawView="true">
      <Item Name="bits">_bits, X</Item>
      <Item Name="op.type">opType()</Item>
      <Item Name="reg.type" Condition="opType() == asmjit::OperandType::kReg">regType()</Item>
      <Item Name="reg.group" Condition="opType() == asmjit::OperandType::kReg">regGroup()</Item>
      <Item Name="reg.size" Condition="opType() == asmjit::OperandType::kReg">opSize(), d</Item>
      <Item Name="mem.baseType" Condition="opType() == asmjit::OperandType::kMem">memBaseType()</Item>
      <Item Name="mem.indexType" Condition="opType() == asmjit::OperandType::kMem">memIndexType()</Item>
      <Item Name="mem.regHome" Condition="opType() == asmjit::OperandType::kMem">memRegHome()</Item>
      <Item Name="mem.size" Condition="opType() == asmjit::OperandType::kMem">opSize(), d</Item>
      <Item Name="mem.x86.segment" Condition="opType() == asmjit::OperandType::kMem">memX86Segment()</Item>
      <Item Name="mem.x86.addrType" Condition="opType() == asmjit::OperandType::kMem">memX86AddrType()</Item>
      <Item Name="mem.x86.shift" Condition="opType() == asmjit::OperandType::kMem">memX86ShiftValue()</Item>
      <Item Name="mem.x86.broadcast" Condition="opType() == asmjit::OperandType::kMem">memX86Broadcast()</Item>
      <Item Name="imm.type" Condition="opType() == asmjit::OperandType::kImm">immType()</Item>
    </Expand>
  </Type>
 
  <Type Name="asmjit::Operand_">
    <Intrinsic Name="opType" Expression="(asmjit::OperandType)(_signature._bits &amp; 0x7)" />
    <Intrinsic Name="opSize" Expression="(_signature._bits &gt;&gt; 24) &amp; 0xFF" />
    <Intrinsic Name="regType" Expression="(asmjit::RegType)((_signature._bits &gt;&gt; 3) &amp; 0x1F)" />
    <Intrinsic Name="regGroup" Expression="(asmjit::RegGroup)((_signature._bits &gt;&gt; 8) &amp; 0xF)" />
    <Intrinsic Name="memBaseType" Expression="(asmjit::RegType)((_signature._bits &gt;&gt; 3) &amp; 0x1F)" />
    <Intrinsic Name="memIndexType" Expression="(asmjit::RegType)((_signature._bits &gt;&gt; 8) &amp; 0x1F)" />
    <Intrinsic Name="memRegHome" Expression="(bool)((_signature._bits &gt;&gt; 13) &amp; 0x1)" />
    <Intrinsic Name="memX86Segment" Expression="(asmjit::x86::SReg::Id)((_signature._bits &gt;&gt; 18) &amp; 0x7)" />
    <Intrinsic Name="memX86AddrType" Expression="(asmjit::x86::Mem::AddrType)((_signature._bits &gt;&gt; 14) &amp; 0x3)" />
    <Intrinsic Name="memX86ShiftValue" Expression="((_signature._bits &gt;&gt; 16) &amp; 0x3)" />
    <Intrinsic Name="memX86Broadcast" Expression="(asmjit::x86::Mem::Broadcast)((_signature._bits &gt;&gt; 21) &amp; 0x7)" />
    <Intrinsic Name="memBaseId" Expression="_baseId" />
    <Intrinsic Name="memIndexId" Expression="_data[0]" />
    <Intrinsic Name="memOffset32b" Expression="(__int64)int(_data[1])" />
    <Intrinsic Name="memOffset64b" Expression="(__int64) ((unsigned __int64)_baseId &lt;&lt; 32) | ((unsigned __int64)_data[1])" />
    <Intrinsic Name="memOffset" Expression="memBaseType() != asmjit::RegType::kNone ? memOffset32b() : memOffset64b()" />
    <Intrinsic Name="immType" Expression="(asmjit::ImmType)((_signature._bits &gt;&gt; 3) &amp; 0x1)" />
    <Intrinsic Name="immValue" Expression="((__int64)_data[1] &lt;&lt; 32) | (__int64)_data[0]" />

    <DisplayString Condition="opType() == asmjit::OperandType::kNone">[None]</DisplayString>
    <DisplayString Condition="opType() == asmjit::OperandType::kReg">[Reg] {{ id={_baseId, d} group={regGroup(), d} type={regType(), d} size={opSize(), d} }}</DisplayString>
    <DisplayString Condition="opType() == asmjit::OperandType::kMem">[Mem] {{ baseId={memBaseId(), d} indexId={memIndexId(), d} offset={(__int64)memOffset(), d} }}</DisplayString>
    <DisplayString Condition="opType() == asmjit::OperandType::kImm">[Imm] {{ val={immValue(), d} hex={immValue(), X} }}</DisplayString>
    <DisplayString Condition="opType() == asmjit::OperandType::kLabel">[Label] {{ id={_baseId} }}</DisplayString>
    <DisplayString Condition="opType() &gt; 4">[Unknown]</DisplayString>
    <Expand HideRawView="true">
      <Item Name="_signature">_signature._bits, X</Item>
      <Item Name="op.type">opType()</Item>
      <Item Name="op.size">opSize(), d</Item>
      <Item Name="reg.type" Condition="opType() == asmjit::OperandType::kReg">regType()</Item>
      <Item Name="reg.group" Condition="opType() == asmjit::OperandType::kReg">regGroup()</Item>
      <Item Name="reg.id" Condition="opType() == asmjit::OperandType::kReg">_baseId, d</Item>
      <Item Name="mem.baseType" Condition="opType() == asmjit::OperandType::kMem">memBaseType()</Item>
      <Item Name="mem.baseId" Condition="opType() == asmjit::OperandType::kMem &amp;&amp; memBaseType() != asmjit::RegType::kNone">memBaseId()</Item>
      <Item Name="mem.indexType" Condition="opType() == asmjit::OperandType::kMem">memIndexType()</Item>
      <Item Name="mem.indexId" Condition="opType() == asmjit::OperandType::kMem &amp;&amp; memIndexType() != asmjit::RegType::kNone">memIndexId()</Item>
      <Item Name="mem.regHome" Condition="opType() == asmjit::OperandType::kMem">memRegHome()</Item>
      <Item Name="mem.offset" Condition="opType() == asmjit::OperandType::kMem">memOffset(), d</Item>
      <Item Name="mem.x86.segment" Condition="opType() == asmjit::OperandType::kMem">memX86Segment()</Item>
      <Item Name="mem.x86.addrType" Condition="opType() == asmjit::OperandType::kMem">memX86AddrType()</Item>
      <Item Name="mem.x86.shift" Condition="opType() == asmjit::OperandType::kMem">memX86ShiftValue()</Item>
      <Item Name="mem.x86.broadcast" Condition="opType() == asmjit::OperandType::kMem">memX86Broadcast()</Item>
      <Item Name="imm.type" Condition="opType() == asmjit::OperandType::kImm">immType()</Item>
      <Item Name="imm.value" Condition="opType() == asmjit::OperandType::kImm">immValue(), X</Item>
      <Item Name="label.id" Condition="opType() == asmjit::OperandType::kLabel">_baseId, d</Item>
      <Item Name="raw.baseId">_baseId</Item>
      <Item Name="raw.data[0]">_data[0]</Item>
      <Item Name="raw.data[1]">_data[1]</Item>
    </Expand>
  </Type>

  <Type Name="asmjit::FuncValue">
    <Intrinsic Name="isReg" Expression="(_data &amp; asmjit::FuncValue::kFlagIsReg) != 0" />
    <Intrinsic Name="isStack" Expression="(_data &amp; asmjit::FuncValue::kFlagIsStack) != 0" />
    <Intrinsic Name="isIndirect" Expression="(_data &amp; asmjit::FuncValue::kFlagIsIndirect) != 0" />
    <Intrinsic Name="isDone" Expression="(_data &amp; asmjit::FuncValue::kFlagIsDone) != 0" />

    <Intrinsic Name="typeId" Expression="((_data &amp; asmjit::FuncValue::kTypeIdMask) &gt;&gt; asmjit::FuncValue::kTypeIdShift)" />
    <Intrinsic Name="regId" Expression="((_data &amp; asmjit::FuncValue::kRegIdMask) &gt;&gt; asmjit::FuncValue::kRegIdShift)" />
    <Intrinsic Name="regType" Expression="((_data &amp; asmjit::FuncValue::kRegTypeMask) &gt;&gt; asmjit::FuncValue::kRegTypeShift)" />
    <Intrinsic Name="stackOffset" Expression="((_data &amp; asmjit::FuncValue::kStackOffsetMask) &gt;&gt; asmjit::FuncValue::kStackOffsetShift)" />

    <DisplayString Condition="isReg()">[RegValue {{ regType={regType()} indirect={isIndirect()} done={isDone()} }}]</DisplayString>
    <DisplayString Condition="isStack()">[StackValue {{ indirect={isIndirect()} done={isDone()} }}]</DisplayString>
    <DisplayString Condition="!isReg() &amp;&amp; !isStack()">[Unknown]</DisplayString>

    <Expand HideRawView="true">
      <Item Name="data">_data</Item>
      <Item Name="typeId">(asmjit::TypeId)(typeId())</Item>
      <Item Name="regType" Condition="isReg()">(asmjit::BaseReg::RegType)regType()</Item>
      <Item Name="regId" Condition="isReg()">regId()</Item>
      <Item Name="stackOffset" Condition="isStack()">stackOffset()</Item>
    </Expand>
  </Type>

  <Type Name="asmjit::BaseNode">
    <Intrinsic Name="nodeType" Expression="_any._nodeType" />

    <Intrinsic Name="isInst" Expression="nodeType() == asmjit::NodeType::kInst"></Intrinsic>
    <Intrinsic Name="isSection" Expression="nodeType() == asmjit::NodeType::kSection"></Intrinsic>
    <Intrinsic Name="isLabel" Expression="nodeType() == asmjit::NodeType::kLabel"></Intrinsic>
    <Intrinsic Name="isAlign" Expression="nodeType() == asmjit::NodeType::kAlign"></Intrinsic>
    <Intrinsic Name="isEmbedData" Expression="nodeType() == asmjit::NodeType::kEmbedData"></Intrinsic>
    <Intrinsic Name="isEmbedLabel" Expression="nodeType() == asmjit::NodeType::kEmbedLabel"></Intrinsic>
    <Intrinsic Name="isEmbedLabelDelta" Expression="nodeType() == asmjit::NodeType::kEmbedLabelDelta"></Intrinsic>
    <Intrinsic Name="isConstPool" Expression="nodeType() == asmjit::NodeType::kConstPool"></Intrinsic>
    <Intrinsic Name="isComment" Expression="nodeType() == asmjit::NodeType::kComment"></Intrinsic>
    <Intrinsic Name="isSentinel" Expression="nodeType() == asmjit::NodeType::kSentinel"></Intrinsic>
    <Intrinsic Name="isJump" Expression="nodeType() == asmjit::NodeType::kJump"></Intrinsic>
    <Intrinsic Name="isFunc" Expression="nodeType() == asmjit::NodeType::kFunc"></Intrinsic>
    <Intrinsic Name="isFuncRet" Expression="nodeType() == asmjit::NodeType::kFuncRet"></Intrinsic>
    <Intrinsic Name="isInvoke" Expression="nodeType() == asmjit::NodeType::kInvoke"></Intrinsic>

    <Intrinsic Name="actsAsInst" Expression="isInst() || isJump() || isFunc() || isFuncRet() || isInvoke()" />
    <Intrinsic Name="actsAsLabel" Expression="isLabel() || isFunc()" />

    <DisplayString Condition="isInst()">[InstNode]</DisplayString>
    <DisplayString Condition="isSection()">[SectionNode]</DisplayString>
    <DisplayString Condition="isLabel()">[LabelNode]</DisplayString>
    <DisplayString Condition="isAlign()">[AlignNode]</DisplayString>
    <DisplayString Condition="isEmbedData()">[EmbedDataNode]</DisplayString>
    <DisplayString Condition="isEmbedLabel()">[EmbedLabelNode]</DisplayString>
    <DisplayString Condition="isEmbedLabelDelta()">[EmbedLabelDeltaNode]</DisplayString>
    <DisplayString Condition="isConstPool()">[ConstPoolNode]</DisplayString>
    <DisplayString Condition="isComment()">[CommentNode]</DisplayString>
    <DisplayString Condition="isSentinel()">[SentinelNode]</DisplayString>
    <DisplayString Condition="isJump()">[JumpNode]</DisplayString>
    <DisplayString Condition="isFunc()">[FuncNode]</DisplayString>
    <DisplayString Condition="isFuncRet()">[FuncRetNode]</DisplayString>
    <DisplayString Condition="isInvoke()">[InvokeNode]</DisplayString>
    <DisplayString Condition="nodeType() == asmjit::NodeType::kNone || nodeType() &gt; 18">[UnknownNode {nodeType(), d}]</DisplayString>

    <Expand HideRawView="true">
      <Item Name="prev">_prev</Item>
      <Item Name="next">_next</Item>

      <Item Name="nodeType">_any._nodeType</Item>
      <Item Name="nodeFlags">_any._nodeFlags</Item>

      <Item Name="position">_position</Item>
      <Item Name="userData.u64">_userDataU64</Item>
      <Item Name="userData.ptr">_userDataPtr</Item>
      <Item Name="passData">_passData</Item>
      <Item Name="inlineComment">_inlineComment, s8</Item>

      <Item Name="baseInst" Condition="actsAsInst()">((asmjit::InstNode*)this)-&gt;_baseInst</Item>
      <Item Name="opCount" Condition="actsAsInst()">_inst._opCount</Item>
      <Item Name="opCapacity" Condition="actsAsInst()">_inst._opCapacity</Item>
      <Item Name="opArray" Condition="actsAsInst()">((asmjit::InstNode*)this)-&gt;_opArray, [_inst._opCount]</Item>

      <Item Name="sectionId" Condition="isSection()">((asmjit::SectionNode*)this)-&gt;_id</Item>
      <Item Name="nextSection" Condition="isSection()">((asmjit::SectionNode*)this)-&gt;_nextSection</Item>

      <Item Name="labelId" Condition="isLabel()">((asmjit::LabelNode*)this)-&gt;_labelId</Item>

      <Item Name="alignMode" Condition="isAlign()">((asmjit::AlignNode*)this)-&gt;_alignData._alignMode</Item>
      <Item Name="alignment" Condition="isAlign()">((asmjit::AlignNode*)this)-&gt;_alignment</Item>

      <Item Name="typeId" Condition="isEmbedData()">_embed._typeId, d</Item>
      <Item Name="typeSize" Condition="isEmbedData()">_embed._typeSize, d</Item>
      <Item Name="itemCount" Condition="isEmbedData()">((asmjit::EmbedDataNode*)this)-&gt;_itemCount</Item>
      <Item Name="repeatCount" Condition="isEmbedData()">((asmjit::EmbedDataNode*)this)-&gt;_repeatCount</Item>
      <Item Name="inlineData" Condition="isEmbedData()">((asmjit::EmbedDataNode*)this)-&gt;_inlineData</Item>
      <Item Name="externalData" Condition="isEmbedData()">((asmjit::EmbedDataNode*)this)-&gt;_externalData</Item>

      <Item Name="labelId" Condition="isEmbedLabel()">((asmjit::EmbedLabelNode*)this)-&gt;_labelId</Item>

      <Item Name="labelId" Condition="isEmbedLabelDelta()">((asmjit::EmbedLabelDeltaNode*)this)-&gt;_labelId</Item>
      <Item Name="baseLabelId" Condition="isEmbedLabelDelta()">((asmjit::EmbedLabelDeltaNode*)this)-&gt;_baseLabelId</Item>
      <Item Name="dataSize" Condition="isEmbedLabelDelta()">((asmjit::EmbedLabelDeltaNode*)this)-&gt;_dataSize</Item>

      <Item Name="constPool" Condition="isConstPool()">((asmjit::ConstPoolNode*)this)-&gt;_constPool</Item>

      <Item Name="sentinel.sentinelType" Condition="isSentinel()">_sentinel._sentinelType</Item>

      <Item Name="annotation" Condition="isJump()">((asmjit::JumpNode*)this)-&gt;_annotation</Item>

      <Item Name="funcDetail" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_funcDetail</Item>
      <Item Name="frame" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_frame</Item>
      <Item Name="exitNode" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_exitNode</Item>
      <Item Name="end" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_end</Item>
      <Item Name="args" Condition="isFunc()">((asmjit::FuncNode*)this)-&gt;_args, [((asmjit::FuncNode*)this)-&gt;_funcDetail._argCount]</Item>

      <Item Name="funcDetail" Condition="isInvoke()">((asmjit::InvokeNode*)this)-&gt;_funcDetail</Item>
      <Item Name="rets" Condition="isInvoke()">((asmjit::InvokeNode*)this)-&gt;_rets</Item>
      <Item Name="args" Condition="isInvoke()">((asmjit::InvokeNode*)this)-&gt;_args, [((asmjit::InvokeNode*)this)-&gt;_funcDetail._argCount]</Item>
    </Expand>
  </Type>
</AutoVisualizer>
