[llvm] 2e30d32 - [Visualizers] Add natvis visualizers for various internal llvm classes
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 8 12:45:08 PST 2022
Author: Trass3r
Date: 2022-11-08T20:44:46Z
New Revision: 2e30d326de4ba11a77d5ccd132c155ad72923c5e
URL: https://github.com/llvm/llvm-project/commit/2e30d326de4ba11a77d5ccd132c155ad72923c5e
DIFF: https://github.com/llvm/llvm-project/commit/2e30d326de4ba11a77d5ccd132c155ad72923c5e.diff
LOG: [Visualizers] Add natvis visualizers for various internal llvm classes
Also improve DisplayStrings for array and string types.
Differential Revision: https://reviews.llvm.org/D135685
Added:
Modified:
llvm/utils/LLVMVisualizers/llvm.natvis
Removed:
################################################################################
diff --git a/llvm/utils/LLVMVisualizers/llvm.natvis b/llvm/utils/LLVMVisualizers/llvm.natvis
index 622ea7788c54b..2a34702709019 100644
--- a/llvm/utils/LLVMVisualizers/llvm.natvis
+++ b/llvm/utils/LLVMVisualizers/llvm.natvis
@@ -2,25 +2,16 @@
<!--
Visual Studio Native Debugging Visualizers for LLVM
-For Visual Studio 2013 only, put this file into
+For Visual Studio 2013 only, put this file into
"%USERPROFILE%\Documents\Visual Studio 2013\Visualizers" or create a symbolic link so it updates automatically.
For later versions of Visual Studio, no setup is required.
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="llvm::SmallVectorImpl<*>">
- <DisplayString IncludeView ="elt0" Condition="Size == 0"></DisplayString>
- <DisplayString IncludeView ="elt0">{((value_type*)BeginX)[0]}{*this,view(elt1)}</DisplayString>
- <DisplayString IncludeView ="elt1" Condition="Size == 1"></DisplayString>
- <DisplayString IncludeView ="elt1">, {((value_type*)BeginX)[1]}{*this,view(elt2)}</DisplayString>
- <DisplayString IncludeView ="elt2" Condition="Size == 2"></DisplayString>
- <DisplayString IncludeView ="elt2">, {((value_type*)BeginX)[2]}{*this,view(elt3)}</DisplayString>
- <DisplayString IncludeView ="elt3" Condition="Size == 3"></DisplayString>
- <DisplayString IncludeView ="elt3">, {((value_type*)BeginX)[3]}{*this,view(elt4)}</DisplayString>
- <DisplayString IncludeView ="elt4" Condition="Size == 4"></DisplayString>
- <DisplayString IncludeView ="elt4">, /* {Size - 4} more*/ </DisplayString>
<DisplayString Condition="Size == 0">empty</DisplayString>
- <DisplayString Condition="Size != 0">{{{*this,view(elt0)}}}</DisplayString>
+ <DisplayString Condition="Size && Size < 4">{(value_type*)BeginX,[Size]}</DisplayString>
+ <DisplayString Condition="Size > 3">{Size} elements</DisplayString>
<DisplayString>Uninitialized</DisplayString>
<Expand>
<Item Name="[size]">Size</Item>
@@ -37,8 +28,9 @@ For later versions of Visual Studio, no setup is required.
<DisplayString>Cannot visualize APInts longer than 64 bits</DisplayString>
</Type>
<Type Name="llvm::ArrayRef<*>">
- <DisplayString Condition="Length == 0">empty</DisplayString>
- <DisplayString Condition="Length != 0">{{ size={Length} }}</DisplayString>
+ <DisplayString Condition="Length < 4">{Data,[Length]}</DisplayString>
+ <DisplayString Condition="Length > 3">{Length} elements</DisplayString>
+ <DisplayString>Uninitialized</DisplayString>
<Expand>
<Item Name="[size]">Length</Item>
<ArrayItems>
@@ -48,7 +40,7 @@ For later versions of Visual Studio, no setup is required.
</Expand>
</Type>
<Type Name="llvm::SmallString<*>">
- <DisplayString>{(const char*)BeginX,[Size] na}</DisplayString>
+ <DisplayString>{(const char*)BeginX,[Size]s8}</DisplayString>
<StringView>(const char*)BeginX,[Size]</StringView>
<Expand>
<Item Name="[size]">Size</Item>
@@ -61,12 +53,12 @@ For later versions of Visual Studio, no setup is required.
</Type>
<Type Name="StringView">
- <DisplayString>{First,[Last - First]s}</DisplayString>
+ <DisplayString>{First,[Last - First]s8}</DisplayString>
</Type>
-
+
<Type Name="llvm::StringRef">
- <DisplayString>{Data,[Length]s}</DisplayString>
- <StringView>Data,[Length]s</StringView>
+ <DisplayString>{Data,[Length]s8}</DisplayString>
+ <StringView>Data,[Length]s8</StringView>
<Expand>
<Item Name="[size]">Length</Item>
<ArrayItems>
@@ -121,7 +113,7 @@ For later versions of Visual Studio, no setup is required.
</Item>
</Expand>
</Type>
-
+
<Type Name="llvm::iplist<*,*>">
<DisplayString Condition="Head == 0">{{ empty }}</DisplayString>
<DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString>
@@ -184,7 +176,7 @@ For later versions of Visual Studio, no setup is required.
<Type Name="llvm::StringMapEntry<*>">
<DisplayString Condition="StrLen == 0">empty</DisplayString>
- <DisplayString Condition="StrLen != 0">({this+1,s}, {second})</DisplayString>
+ <DisplayString Condition="StrLen != 0">({this+1,s8}, {second})</DisplayString>
<Expand>
<Item Name="[key]">this+1,s</Item>
<Item Name="[value]" Condition="StrLen != 0">second</Item>
@@ -194,7 +186,7 @@ For later versions of Visual Studio, no setup is required.
<Type Name="llvm::Triple">
<DisplayString>{Data}</DisplayString>
</Type>
-
+
<Type Name="llvm::Optional<*>">
<DisplayString Condition="!Storage.hasVal">None</DisplayString>
<DisplayString Condition="Storage.hasVal">{Storage.value}</DisplayString>
@@ -227,24 +219,24 @@ For later versions of Visual Studio, no setup is required.
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
</Expand>
</Type>
-
+
<!-- Now handle the hard case of big endian. We need to do the swizzling here, but
we need to specialize it based on the size of the value type. -->
<Type Name="llvm::support::detail::packed_endian_specific_integral<*,0,1>">
<DisplayString Condition="sizeof($T1)==1">{{ big endian value = {*(unsigned char *)Value.buffer} }}</DisplayString>
- <DisplayString Condition="sizeof($T1)==2">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 8)
+ <DisplayString Condition="sizeof($T1)==2">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 8)
| ($T1)(*((unsigned char *)Value.buffer+1))} }}</DisplayString>
- <DisplayString Condition="sizeof($T1)==4">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 24)
- | (($T1)(*((unsigned char *)Value.buffer+1)) << 16)
- | (($T1)(*((unsigned char *)Value.buffer+2)) << 8)
+ <DisplayString Condition="sizeof($T1)==4">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 24)
+ | (($T1)(*((unsigned char *)Value.buffer+1)) << 16)
+ | (($T1)(*((unsigned char *)Value.buffer+2)) << 8)
| ($T1)(*((unsigned char *)Value.buffer+3))} }}</DisplayString>
- <DisplayString Condition="sizeof($T1)==8">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 56)
- | (($T1)(*((unsigned char *)Value.buffer+1)) << 48)
- | (($T1)(*((unsigned char *)Value.buffer+2)) << 40)
- | (($T1)(*((unsigned char *)Value.buffer+3)) << 32)
- | (($T1)(*((unsigned char *)Value.buffer+4)) << 24)
- | (($T1)(*((unsigned char *)Value.buffer+5)) << 16)
- | (($T1)(*((unsigned char *)Value.buffer+6)) << 8)
+ <DisplayString Condition="sizeof($T1)==8">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 56)
+ | (($T1)(*((unsigned char *)Value.buffer+1)) << 48)
+ | (($T1)(*((unsigned char *)Value.buffer+2)) << 40)
+ | (($T1)(*((unsigned char *)Value.buffer+3)) << 32)
+ | (($T1)(*((unsigned char *)Value.buffer+4)) << 24)
+ | (($T1)(*((unsigned char *)Value.buffer+5)) << 16)
+ | (($T1)(*((unsigned char *)Value.buffer+6)) << 8)
| ($T1)(*((unsigned char *)Value.buffer+7))} }}</DisplayString>
<Expand>
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
@@ -304,4 +296,107 @@ For later versions of Visual Studio, no setup is required.
<Item Name="Context">Context</Item>
</Expand>
</Type>
+
+ <Type Name="llvm::ConstantSDNode">
+ <DisplayString>$(Type) {*Value}</DisplayString>
+ </Type>
+
+ <Type Name="llvm::SDNode">
+ <DisplayString>$(Type) {(llvm::ISD::NodeType)this->NodeType}</DisplayString>
+ <Expand>
+ <ArrayItems>
+ <Size>NumOperands</Size>
+ <ValuePointer>OperandList</ValuePointer>
+ </ArrayItems>
+ </Expand>
+ </Type>
+
+ <Type Name="llvm::ConstantInt">
+ <DisplayString>i{Val.BitWidth} {Val.VAL}</DisplayString>
+ </Type>
+
+ <Type Name="llvm::IntegerType">
+ <DisplayString>{IDAndSubclassData >> 8}bit integer type</DisplayString>
+ </Type>
+
+ <Type Name="llvm::Value">
+ <DisplayString Condition="HasName">$(Type) {*VTy} {this->getName()} {SubclassData}</DisplayString>
+ <DisplayString Condition="!HasName">$(Type) {*VTy} anon {SubclassData}</DisplayString>
+ <Expand>
+ <Item Name="[Inst]" Condition="SubclassID > InstructionVal">(Instruction*)this</Item>
+ <Item Name="Operands">(User*)this</Item>
+ <LinkedListItems>
+ <HeadPointer>UseList</HeadPointer>
+ <NextPointer>Next</NextPointer>
+ <ValueNode>Prev.Value & 3 == 3 ? (User*)(this + 1) : (User*)(this + 2)</ValueNode>
+ </LinkedListItems>
+ </Expand>
+ </Type>
+
+ <Type Name="llvm::Use">
+ <Expand>
+ <Item Name="Value">Val</Item>
+ <!--
+ <LinkedListItems>
+ <HeadPointer>this</HeadPointer>
+ <NextPointer>Next</NextPointer>
+ <ValueNode>Prev.Value & 3 == 3 ? (User*)(this + 1) : (User*)(this + 2)</ValueNode>
+ </LinkedListItems>
+ -->
+ </Expand>
+ </Type>
+
+ <!-- uses other values, like Operands -->
+ <Type Name="llvm::User">
+ <DisplayString Condition="HasName">$(Type) {*VTy} {this->getName()} {SubclassData}</DisplayString>
+ <DisplayString Condition="!HasName">$(Type) {*VTy} anon {SubclassData}</DisplayString>
+ <Expand>
+ <Item Name="[Value]">(Value*)this,nd</Item>
+ <Item Name="[Type]">*VTy</Item>
+ <ArrayItems Condition="!HasHungOffUses">
+ <Size>NumUserOperands</Size>
+ <ValuePointer>(llvm::Use*)this - NumUserOperands</ValuePointer>
+ </ArrayItems>
+ <ArrayItems Condition="HasHungOffUses">
+ <Size>NumUserOperands</Size>
+ <ValuePointer>*((llvm::Use**)this - 1)</ValuePointer>
+ </ArrayItems>
+ </Expand>
+ </Type>
+
+ <Type Name="llvm::Instruction">
+ <DisplayString>{getOpcodeName(SubclassID - InstructionVal)}</DisplayString>
+ <Expand>
+ <Item Name="[User]">(User*)this,nd</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="llvm::GlobalValue">
+ <DisplayString>{this->getName()} {(LinkageTypes)Linkage} {(VisibilityTypes)Visibility} {(DLLStorageClassTypes)DllStorageClass} {(llvm::GlobalValue::ThreadLocalMode) ThreadLocal}</DisplayString>
+ </Type>
+
+ <!-- TODO doesn't work cause it doesn't know the dynamic type -->
+ <Type Name="llvm::ilist_node">
+ <Expand>
+ <LinkedListItems>
+ <HeadPointer>this</HeadPointer>
+ <NextPointer>Next</NextPointer>
+ <ValueNode>this</ValueNode>
+ </LinkedListItems>
+ </Expand>
+ </Type>
+
+ <Type Name="llvm::LLVMContext">
+ <Expand>
+ <ExpandedItem>pImpl</ExpandedItem>
+ </Expand>
+ </Type>
+
+ <Type Name="llvm::Module">
+ <DisplayString>{ModuleID,s8} {TargetTriple}</DisplayString>
+ </Type>
+
+ <Type Name="llvm::Pass">
+ <DisplayString>$(Type) {PassID} {Kind}</DisplayString>
+ </Type>
</AutoVisualizer>
More information about the llvm-commits
mailing list