1<?xml version="1.0" encoding="utf-8"?> 2<!-- 3Visual Studio Native Debugging Visualizers for LLVM 4 5For Visual Studio 2013 only, put this file into 6"%USERPROFILE%\Documents\Visual Studio 2013\Visualizers" or create a symbolic link so it updates automatically. 7 8For later versions of Visual Studio, no setup is required. 9--> 10<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> 11 <Type Name="llvm::SmallVectorImpl<*>"> 12 <DisplayString Condition="Size == 0">empty</DisplayString> 13 <DisplayString Condition="Size && Size < 4">{(value_type*)BeginX,[Size]}</DisplayString> 14 <DisplayString Condition="Size > 3">{Size} elements</DisplayString> 15 <DisplayString>Uninitialized</DisplayString> 16 <Expand> 17 <Item Name="[size]">Size</Item> 18 <Item Name="[capacity]">Capacity</Item> 19 <ArrayItems> 20 <Size>Size</Size> 21 <ValuePointer>(value_type*)BeginX</ValuePointer> 22 </ArrayItems> 23 </Expand> 24 </Type> 25 <Type Name="llvm::APInt"> 26 <!-- For now, only handle up to 64-bit unsigned ints --> 27 <DisplayString Condition="BitWidth <= 64">{U.VAL}</DisplayString> 28 <DisplayString>Cannot visualize APInts longer than 64 bits</DisplayString> 29 </Type> 30 <Type Name="llvm::ArrayRef<*>"> 31 <DisplayString Condition="Length < 4">{Data,[Length]}</DisplayString> 32 <DisplayString Condition="Length > 3">{Length} elements</DisplayString> 33 <DisplayString>Uninitialized</DisplayString> 34 <Expand> 35 <Item Name="[size]">Length</Item> 36 <ArrayItems> 37 <Size>Length</Size> 38 <ValuePointer>Data</ValuePointer> 39 </ArrayItems> 40 </Expand> 41 </Type> 42 <Type Name="llvm::SmallString<*>"> 43 <DisplayString>{(const char*)BeginX,[Size]s8}</DisplayString> 44 <StringView>(const char*)BeginX,[Size]</StringView> 45 <Expand> 46 <Item Name="[size]">Size</Item> 47 <Item Name="[capacity]">Capacity</Item> 48 <ArrayItems> 49 <Size>Size</Size> 50 <ValuePointer>(char*)BeginX</ValuePointer> 51 </ArrayItems> 52 </Expand> 53 </Type> 54 55 <Type Name="StringView"> 56 <DisplayString>{First,[Last - First]s8}</DisplayString> 57 </Type> 58 59 <Type Name="llvm::StringRef"> 60 <DisplayString>{Data,[Length]s8}</DisplayString> 61 <StringView>Data,[Length]s8</StringView> 62 <Expand> 63 <Item Name="[size]">Length</Item> 64 <ArrayItems> 65 <Size>Length</Size> 66 <ValuePointer>Data</ValuePointer> 67 </ArrayItems> 68 </Expand> 69 </Type> 70 71 <Type Name="llvm::PunnedPointer"> 72 <DisplayString>{($T1)*(intptr_t *)Data}</DisplayString> 73 </Type> 74 75 <!-- PointerIntPair. In addition to the regular view, it is possible to view 76 just the pointer or just the int. The same code is duplicated from the 77 regular viewer to improve the performance of the common case. Note, we 78 need to specify PointerIntPair<PointerUnion<*>, *> differently because 79 we need to "look through" the PointerUnion to display it. Otherwise, we 80 get errors about ambiguous conversion from uintptr_t to PointerUnion.--> 81 <Type Name="llvm::PointerIntPair<llvm::PointerUnion<*>, *>"> 82 <!-- $T1 is the parameter pack of PointerUnion, $T3 is IntBits, 83 $T4 is IntType, $T5 is PtrTraits, and $T6 is Info. --> 84 <DisplayString IncludeView="ptr">{($T1)(*(intptr_t *)Value.Data & $T6::PointerBitMask)}</DisplayString> 85 <DisplayString IncludeView="int">{($T4)((*(intptr_t *)Value.Data >> $T6::IntShift) & $T6::IntMask)}</DisplayString> 86 <DisplayString>{$T6::IntMask}: {($T1)(*(intptr_t *)Value.Data & $T6::PointerBitMask)} [{($T4)((*(intptr_t *)Value.Data >> $T6::IntShift) & $T6::IntMask)}]</DisplayString> 87 <Expand> 88 <Item Name="[ptr]">($T1)(*(intptr_t *)Value.Data & $T6::PointerBitMask)</Item> 89 <Item Name="[int]">($T4)((*(intptr_t *)Value.Data >> $T6::IntShift) & $T6::IntMask)</Item> 90 </Expand> 91 </Type> 92 93 <Type Name="llvm::PointerIntPair<*>"> 94 <DisplayString IncludeView="ptr">{($T1)(*(intptr_t *)Value.Data & $T5::PointerBitMask)}</DisplayString> 95 <DisplayString IncludeView="int">{((*(intptr_t *)Value.Data >> $T5::IntShift) & $T5::IntMask)}</DisplayString> 96 <DisplayString>{$T5::IntMask}: {($T1)(*(intptr_t *)Value.Data & $T5::PointerBitMask)} [{((*(intptr_t *)Value.Data >> $T5::IntShift) & $T5::IntMask)}]</DisplayString> 97 <Expand> 98 <Item Name="[ptr]">($T1)(*(intptr_t *)Value.Data & $T5::PointerBitMask)</Item> 99 <Item Name="[int]">((*(intptr_t *)Value.Data >> $T5::IntShift) & $T5::IntMask)</Item> 100 </Expand> 101 </Type> 102 <!-- PointerUnion types --> 103 <Type Name="llvm::pointer_union_detail::PointerUnionMembers<*>"> 104 <DisplayString Optional="true" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0"> 105 {($T4)(*(intptr_t *)Val.Value.Data & $T2::InfoTy::PointerBitMask)} 106 </DisplayString> 107 <DisplayString Optional="true" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1"> 108 {($T5)(*(intptr_t *)Val.Value.Data & $T2::InfoTy::PointerBitMask)} 109 </DisplayString> 110 <DisplayString>Unexpected index in PointerUnion: {(*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask}</DisplayString> 111 <Expand> 112 <Item Name="[Holds]" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0">"$T4",s8b</Item> 113 <Item Name="[Ptr]" Optional="true" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 0"> 114 ($T4)(*(intptr_t *)Val.Value.Data & $T2::InfoTy::PointerBitMask) 115 </Item> 116 <Item Name="[Holds]" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1">"$T5",s8b</Item> 117 <Item Name="[Ptr]" Optional="true" Condition="((*(intptr_t *)Val.Value.Data>>$T2::InfoTy::IntShift) & $T2::InfoTy::IntMask) == 1"> 118 ($T5)(*(intptr_t *)Val.Value.Data & $T2::InfoTy::PointerBitMask) 119 </Item> 120 </Expand> 121 </Type> 122 123 <Type Name="llvm::iplist<*,*>"> 124 <DisplayString Condition="Head == 0">{{ empty }}</DisplayString> 125 <DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString> 126 <Expand> 127 <LinkedListItems> 128 <HeadPointer>Head</HeadPointer> 129 <NextPointer>Next</NextPointer> 130 <ValueNode>this</ValueNode> 131 </LinkedListItems> 132 </Expand> 133 </Type> 134 135 <Type Name="llvm::IntrusiveRefCntPtr<*>"> 136 <DisplayString Condition="Obj == 0">empty</DisplayString> 137 <DisplayString Condition="(Obj != 0) && (Obj->RefCount == 1)">RefPtr [1 ref] {*Obj}</DisplayString> 138 <DisplayString Condition="(Obj != 0) && (Obj->RefCount != 1)">RefPtr [{Obj->RefCount} refs] {*Obj}</DisplayString> 139 <Expand> 140 <Item Condition="Obj != 0" Name="[refs]">Obj->RefCount</Item> 141 <ExpandedItem Condition="Obj != 0">Obj</ExpandedItem> 142 </Expand> 143 </Type> 144 145 <Type Name="llvm::SmallPtrSet<*,*>"> 146 <DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString> 147 <DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString> 148 <Expand> 149 <Item Name="[size]">NumNonEmpty</Item> 150 <Item Name="[capacity]">CurArraySize</Item> 151 <ArrayItems> 152 <Size>NumNonEmpty</Size> 153 <ValuePointer>($T1*)CurArray</ValuePointer> 154 </ArrayItems> 155 </Expand> 156 </Type> 157 158 <Type Name="llvm::DenseMap<*,*,*>"> 159 <DisplayString Condition="NumEntries == 0">empty</DisplayString> 160 <DisplayString Condition="NumEntries != 0">{{ size={NumEntries}, buckets={NumBuckets} }}</DisplayString> 161 <Expand> 162 <Item Name="[size]">NumEntries</Item> 163 <Item Name="[buckets]">NumBuckets</Item> 164 <ArrayItems> 165 <Size>NumBuckets</Size> 166 <ValuePointer>Buckets</ValuePointer> 167 </ArrayItems> 168 </Expand> 169 </Type> 170 171 <Type Name="llvm::StringMap<*,*>"> 172 <DisplayString>{{ size={NumItems}, buckets={NumBuckets} }}</DisplayString> 173 <Expand> 174 <Item Name="[size]">NumItems</Item> 175 <Item Name="[buckets]">NumBuckets</Item> 176 <ArrayItems> 177 <Size>NumBuckets</Size> 178 <ValuePointer>(MapEntryTy**)TheTable</ValuePointer> 179 </ArrayItems> 180 </Expand> 181 </Type> 182 183 <Type Name="llvm::StringMapEntry<*>"> 184 <DisplayString Condition="keyLength == 0">empty</DisplayString> 185 <DisplayString Condition="keyLength != 0">({this+1,s8}, {second})</DisplayString> 186 <Expand> 187 <Item Name="[key]">this+1,s</Item> 188 <Item Name="[value]" Condition="keyLength != 0">second</Item> 189 </Expand> 190 </Type> 191 192 <Type Name="llvm::Triple"> 193 <DisplayString>{Data}</DisplayString> 194 </Type> 195 196 <Type Name="llvm::Optional<*>"> 197 <DisplayString Condition="!Storage.hasVal">None</DisplayString> 198 <DisplayString Condition="Storage.hasVal">{Storage.value}</DisplayString> 199 <Expand> 200 <Item Name="[underlying]" Condition="Storage.hasVal">Storage.value</Item> 201 </Expand> 202 </Type> 203 204 <Type Name="llvm::Expected<*>"> 205 <DisplayString Condition="HasError">Error</DisplayString> 206 <DisplayString Condition="!HasError">{*((storage_type *)TStorage.buffer)}</DisplayString> 207 <Expand> 208 <Item Name="[value]" Condition="!HasError">*((storage_type *)TStorage.buffer)</Item> 209 <Item Name="[error]" Condition="HasError">*((error_type *)ErrorStorage.buffer)</Item> 210 </Expand> 211 </Type> 212 213 214 <!-- Since we're in MSVC, we can assume that the system is little endian. Therefore 215 the little and native cases just require a cast. Handle this easy case first. Use 216 a wildcard for the second template argument (the endianness), but we will use a 217 specific value of 0 later on for the big endian to give it priority for being a 218 better match. --> 219 <Type Name="llvm::support::detail::packed_endian_specific_integral<*,*,1>"> 220 <DisplayString>{{little endian value = {*(($T1*)(unsigned char *)Value.buffer)} }}</DisplayString> 221 <Expand> 222 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item> 223 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item> 224 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item> 225 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item> 226 </Expand> 227 </Type> 228 229 <!-- Now handle the hard case of big endian. We need to do the swizzling here, but 230 we need to specialize it based on the size of the value type. --> 231 <Type Name="llvm::support::detail::packed_endian_specific_integral<*,0,1>"> 232 <DisplayString Condition="sizeof($T1)==1">{{ big endian value = {*(unsigned char *)Value.buffer} }}</DisplayString> 233 <DisplayString Condition="sizeof($T1)==2">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 8) 234 | ($T1)(*((unsigned char *)Value.buffer+1))} }}</DisplayString> 235 <DisplayString Condition="sizeof($T1)==4">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 24) 236 | (($T1)(*((unsigned char *)Value.buffer+1)) << 16) 237 | (($T1)(*((unsigned char *)Value.buffer+2)) << 8) 238 | ($T1)(*((unsigned char *)Value.buffer+3))} }}</DisplayString> 239 <DisplayString Condition="sizeof($T1)==8">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) << 56) 240 | (($T1)(*((unsigned char *)Value.buffer+1)) << 48) 241 | (($T1)(*((unsigned char *)Value.buffer+2)) << 40) 242 | (($T1)(*((unsigned char *)Value.buffer+3)) << 32) 243 | (($T1)(*((unsigned char *)Value.buffer+4)) << 24) 244 | (($T1)(*((unsigned char *)Value.buffer+5)) << 16) 245 | (($T1)(*((unsigned char *)Value.buffer+6)) << 8) 246 | ($T1)(*((unsigned char *)Value.buffer+7))} }}</DisplayString> 247 <Expand> 248 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item> 249 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item> 250 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item> 251 <Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item> 252 </Expand> 253 </Type> 254 <!-- llvm::Type has two fields, SubclassData and ContainedTys, the meaning of which change depending on the TypeID. 255 This visualiser decodes those fields based on the value of ID. 256 --> 257 <Type Name="llvm::Type"> 258 <DisplayString>{ID}</DisplayString> 259 <Expand> 260 <Item Name="ID">ID</Item> 261 262 <Item Name="NumBits" Condition="ID == llvm::Type::TypeID::IntegerTyID">SubclassData</Item> 263 264 <Item Name="ReturnType" Condition="ID == llvm::Type::TypeID::FunctionTyID">*ContainedTys</Item> 265 <Synthetic Name="Arguments" Condition="ID == llvm::Type::TypeID::FunctionTyID"> 266 <DisplayString>{NumContainedTys - 1}</DisplayString> 267 <Expand> 268 <ArrayItems> 269 <Size>NumContainedTys - 1</Size> 270 <ValuePointer>ContainedTys + 1</ValuePointer> 271 </ArrayItems> 272 </Expand> 273 </Synthetic> 274 <Item Name="IsVarArg" Condition="ID == llvm::Type::TypeID::FunctionTyID">SubclassData == 1</Item> 275 276 <Item Name="HasBody" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData & llvm::StructType::SCDB_HasBody) != 0</Item> 277 <Item Name="Packed" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData & llvm::StructType::SCDB_Packed) != 0</Item> 278 <Item Name="IsLiteral" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData & llvm::StructType::SCDB_IsLiteral) != 0</Item> 279 <Item Name="IsSized" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData & llvm::StructType::SCDB_IsSized) != 0</Item> 280 <Synthetic Name="Members" Condition="ID == llvm::Type::TypeID::StructTyID"> 281 <DisplayString>{NumContainedTys}</DisplayString> 282 <Expand> 283 <ArrayItems> 284 <Size>NumContainedTys</Size> 285 <ValuePointer>ContainedTys</ValuePointer> 286 </ArrayItems> 287 </Expand> 288 </Synthetic> 289 290 <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ArrayTyID">*ContainedTys</Item> 291 <Item Name="NumElements" Condition="ID == llvm::Type::TypeID::ArrayTyID">((llvm::ArrayType*)this)->NumElements</Item> 292 293 <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::FixedVectorTyID">*ContainedTys</Item> 294 <Item Name="NumElements" Condition="ID == llvm::Type::TypeID::FixedVectorTyID">((llvm::VectorType*)this)->ElementQuantity</Item> 295 296 <Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ScalableVectorTyID">*ContainedTys</Item> 297 <Item Name="MinNumElements" Condition="ID == llvm::Type::TypeID::ScalableVectorTyID">((llvm::VectorType*)this)->ElementQuantity</Item> 298 299 <Item Name="AddressSpace" Condition="ID == llvm::Type::TypeID::PointerTyID">SubclassData</Item> 300 <Item Name="PointeeType" Condition="ID == llvm::Type::TypeID::PointerTyID">*ContainedTys</Item> 301 302 <Item Name="Context">Context</Item> 303 </Expand> 304 </Type> 305 306 <Type Name="llvm::ConstantSDNode"> 307 <DisplayString>$(Type) {*Value}</DisplayString> 308 </Type> 309 310 <Type Name="llvm::SDNode"> 311 <DisplayString>$(Type) {(llvm::ISD::NodeType)this->NodeType}</DisplayString> 312 <Expand> 313 <ArrayItems> 314 <Size>NumOperands</Size> 315 <ValuePointer>OperandList</ValuePointer> 316 </ArrayItems> 317 </Expand> 318 </Type> 319 320 <Type Name="llvm::ConstantInt"> 321 <DisplayString>i{Val.BitWidth} {Val.VAL}</DisplayString> 322 </Type> 323 324 <Type Name="llvm::IntegerType"> 325 <DisplayString>{IDAndSubclassData >> 8}bit integer type</DisplayString> 326 </Type> 327 328 <Type Name="llvm::Value"> 329 <DisplayString Condition="HasName">$(Type) {*VTy} {this->getName()} {SubclassData}</DisplayString> 330 <DisplayString Condition="!HasName">$(Type) {*VTy} anon {SubclassData}</DisplayString> 331 <Expand> 332 <Item Name="[Inst]" Condition="SubclassID > InstructionVal">(Instruction*)this</Item> 333 <Item Name="Operands">(User*)this</Item> 334 <LinkedListItems> 335 <HeadPointer>UseList</HeadPointer> 336 <NextPointer>Next</NextPointer> 337 <ValueNode>Prev.Value & 3 == 3 ? (User*)(this + 1) : (User*)(this + 2)</ValueNode> 338 </LinkedListItems> 339 </Expand> 340 </Type> 341 342 <Type Name="llvm::Use"> 343 <Expand> 344 <Item Name="Value">Val</Item> 345 <!-- 346 <LinkedListItems> 347 <HeadPointer>this</HeadPointer> 348 <NextPointer>Next</NextPointer> 349 <ValueNode>Prev.Value & 3 == 3 ? (User*)(this + 1) : (User*)(this + 2)</ValueNode> 350 </LinkedListItems> 351 --> 352 </Expand> 353 </Type> 354 355 <!-- uses other values, like Operands --> 356 <Type Name="llvm::User"> 357 <DisplayString Condition="HasName">$(Type) {*VTy} {this->getName()} {SubclassData}</DisplayString> 358 <DisplayString Condition="!HasName">$(Type) {*VTy} anon {SubclassData}</DisplayString> 359 <Expand> 360 <Item Name="[Value]">(Value*)this,nd</Item> 361 <Item Name="[Type]">*VTy</Item> 362 <ArrayItems Condition="!HasHungOffUses"> 363 <Size>NumUserOperands</Size> 364 <ValuePointer>(llvm::Use*)this - NumUserOperands</ValuePointer> 365 </ArrayItems> 366 <ArrayItems Condition="HasHungOffUses"> 367 <Size>NumUserOperands</Size> 368 <ValuePointer>*((llvm::Use**)this - 1)</ValuePointer> 369 </ArrayItems> 370 </Expand> 371 </Type> 372 373 <Type Name="llvm::Instruction"> 374 <DisplayString>{getOpcodeName(SubclassID - InstructionVal)}</DisplayString> 375 <Expand> 376 <Item Name="[User]">(User*)this,nd</Item> 377 </Expand> 378 </Type> 379 380 <Type Name="llvm::GlobalValue"> 381 <DisplayString>{this->getName()} {(LinkageTypes)Linkage} {(VisibilityTypes)Visibility} {(DLLStorageClassTypes)DllStorageClass} {(llvm::GlobalValue::ThreadLocalMode) ThreadLocal}</DisplayString> 382 </Type> 383 384 <!-- TODO doesn't work cause it doesn't know the dynamic type --> 385 <Type Name="llvm::ilist_node"> 386 <Expand> 387 <LinkedListItems> 388 <HeadPointer>this</HeadPointer> 389 <NextPointer>Next</NextPointer> 390 <ValueNode>this</ValueNode> 391 </LinkedListItems> 392 </Expand> 393 </Type> 394 395 <Type Name="llvm::LLVMContext"> 396 <Expand> 397 <ExpandedItem>pImpl</ExpandedItem> 398 </Expand> 399 </Type> 400 401 <Type Name="llvm::Module"> 402 <DisplayString>{ModuleID,s8} {TargetTriple}</DisplayString> 403 </Type> 404 405 <Type Name="llvm::Pass"> 406 <DisplayString>$(Type) {PassID} {Kind}</DisplayString> 407 </Type> 408</AutoVisualizer> 409