Browse Source

Update llvm build workflows (#1906)

* Add debug configurations to llvm workflows

* Update build scripts to build LLVM debug config

* Enable debug builds for all configurations

* Export/import clang/llvm natvis files

* Remove downloaded llvm archive after extracting it

* Fix broken DebugOpt build on linux

* Use checkout action instead of manual command

* Fix incorrect configuration mapping

* Fix working directory after checkout method update

* Remove working directory overrides

* Fix incorrect llvm package name fetching
pull/1888/head
Jelle 4 months ago committed by GitHub
parent
commit
d53dfedd5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 36
      .github/workflows/llvm-win.yml
  2. 29
      .github/workflows/llvm.yml
  3. 5
      .github/workflows/main.yml
  4. 35
      build/LLVM.lua
  5. 16
      build/llvm/LLVM.lua
  6. 2
      build/premake5.lua
  7. 1089
      clang.natvis
  8. 408
      llvm.natvis

36
.github/workflows/llvm-win.yml

@ -8,28 +8,21 @@ jobs: @@ -8,28 +8,21 @@ jobs:
strategy:
fail-fast: false
matrix:
config:
- { os: windows-2022, platform: x64, configuration : Debug, vs: "Program Files/Microsoft Visual Studio/2022" }
- { os: windows-2022, platform: x64, configuration : RelWithDebInfo, vs: "Program Files/Microsoft Visual Studio/2022" }
os: [windows-2022]
platform: [x64]
build-cfg: [Debug, DebugOpt, Release]
runs-on: ${{ matrix.config.os }}
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
VS_VERSION: ${{ matrix.config.vs }}
PLATFORM: ${{ matrix.config.platform }}
CONFIGURATION: ${{ matrix.config.configuration }}
VS_VERSION: "Program Files/Microsoft Visual Studio/2022"
PLATFORM: ${{ matrix.platform }}
BUILD_CONFIGURATION: ${{ matrix.build-cfg }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Check out
shell: cmd
run: |
git clone -b ${{ env.GITHUB_REF_SLUG }} https://github.com/mono/CppSharp.git C:\CppSharp
uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
@ -48,20 +41,17 @@ jobs: @@ -48,20 +41,17 @@ jobs:
- name: Clone LLVM
shell: bash
run: build/build.sh clone_llvm
working-directory: C:\CppSharp
- name: Build LLVM
shell: bash
run: build/build.sh build_llvm -platform $PLATFORM -configuration $CONFIGURATION
working-directory: C:\CppSharp
run: build/build.sh build_llvm -platform $PLATFORM -configuration $BUILD_CONFIGURATION
- name: Package LLVM
shell: bash
run: build/build.sh package_llvm -platform $PLATFORM -configuration $CONFIGURATION
working-directory: C:\CppSharp
run: build/build.sh package_llvm -platform $PLATFORM -configuration $BUILD_CONFIGURATION
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: llvm
path: C:\CppSharp\build\llvm\llvm-*-*.*
name: llvm-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.build-cfg }}
path: build/llvm/llvm-*-*.*

29
.github/workflows/llvm.yml

@ -8,19 +8,17 @@ jobs: @@ -8,19 +8,17 @@ jobs:
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-22.04, platform: x64, cxx: g++-11, cc: gcc-11 }
- { os: ubuntu-22.04, platform: arm64, cxx: g++-11, cc: gcc-11 }
- { os: macos-11, platform: x64, cxx: clang++, cc: clang }
- { os: macos-12, platform: x64, cxx: clang++, cc: clang }
- { os: macos-12, platform: arm64, cxx: clang++, cc: clang }
os: [ubuntu-22.04, macos-13]
platform: [x64, arm64]
build-cfg: [Debug, DebugOpt, Release]
runs-on: ${{ matrix.config.os }}
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
PLATFORM: ${{ matrix.config.platform }}
CC: ${{ startsWith(matrix.os, 'ubuntu') && 'gcc-11' || 'clang' }}
CXX: ${{ startsWith(matrix.os, 'ubuntu') && 'g++-11' || 'clang++' }}
PLATFORM: ${{ matrix.platform }}
BUILD_CONFIGURATION: ${{ matrix.build-cfg }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
@ -28,7 +26,7 @@ jobs: @@ -28,7 +26,7 @@ jobs:
- uses: lukka/get-cmake@latest
- name: Install cross compilers
if: startsWith(matrix.config.os, 'ubuntu') && startsWith(matrix.config.platform, 'arm64')
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.platform, 'arm64')
run: sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
- name: Clone LLVM
@ -37,14 +35,15 @@ jobs: @@ -37,14 +35,15 @@ jobs:
- name: Build LLVM
shell: bash
run: build/build.sh build_llvm -platform $PLATFORM
run: build/build.sh build_llvm -platform $PLATFORM -configuration $BUILD_CONFIGURATION
- name: Package LLVM
shell: bash
run: build/build.sh package_llvm -platform $PLATFORM
run: build/build.sh package_llvm -platform $PLATFORM -configuration $BUILD_CONFIGURATION
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: llvm
name: llvm-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.build-cfg }}
overwrite: true
path: build/llvm/llvm-*-*.*

5
.github/workflows/main.yml

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
name: CI
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]
# Cancel any previous workflows if the pull request was updated
concurrency:
@ -15,8 +15,7 @@ jobs: @@ -15,8 +15,7 @@ jobs:
matrix:
os: [ubuntu-22.04, windows-2022]
platform: [x64]
build-cfg: [DebugOpt, Release]
#build-cfg: [Debug, DebugOpt, Release] # our local copy of clang isn't build for debug on linux/macos currently
build-cfg: [Debug, DebugOpt, Release]
include:
- os: windows-2022
platform: x64

35
build/LLVM.lua

@ -5,18 +5,21 @@ LLVMRootDir = builddir .. "/llvm/llvm-project" @@ -5,18 +5,21 @@ LLVMRootDir = builddir .. "/llvm/llvm-project"
local LLVMDirPerConfiguration = false
local LLVMRootDirDebug = ""
local LLVMRootDirRelWithDebInfo = ""
local LLVMRootDirRelease = ""
require "llvm/LLVM"
function SearchLLVM()
LLVMRootDirDebug = builddir .. "/llvm/" .. get_llvm_package_name(nil, "Debug")
LLVMRootDirRelease = builddir .. "/llvm/" .. get_llvm_package_name()
LLVMRootDirRelWithDebInfo = builddir .. "/llvm/" .. get_llvm_package_name(nil, "RelWithDebInfo")
LLVMRootDirRelease = builddir .. "/llvm/" .. get_llvm_package_name(nil, "Release")
if os.isdir(LLVMRootDirDebug) or os.isdir(LLVMRootDirRelease) then
if os.isdir(LLVMRootDirDebug) or os.isdir(LLVMRootDirRelWithDebInfo) or os.isdir(LLVMRootDirRelease) then
LLVMDirPerConfiguration = true
print("Using debug LLVM build: " .. LLVMRootDirDebug)
print("Using release LLVM build: " .. LLVMRootDirRelease)
print("Using cached LLVM 'Debug' build: " .. LLVMRootDirDebug)
print("Using cached LLVM 'RelWithDebInfo' build: " .. LLVMRootDirRelWithDebInfo)
print("Using cached LLVM 'Release' build: " .. LLVMRootDirRelease)
elseif os.isdir(LLVMRootDir) then
print("Using LLVM build: " .. LLVMRootDir)
else
@ -41,13 +44,13 @@ function SetupLLVMIncludes() @@ -41,13 +44,13 @@ function SetupLLVMIncludes()
filter { "configurations:DebugOpt" }
includedirs
{
path.join(LLVMRootDirRelease, "include"),
path.join(LLVMRootDirRelease, "llvm/include"),
path.join(LLVMRootDirRelease, "lld/include"),
path.join(LLVMRootDirRelease, "clang/include"),
path.join(LLVMRootDirRelease, "clang/lib"),
path.join(LLVMRootDirRelease, "build/include"),
path.join(LLVMRootDirRelease, "build/clang/include"),
path.join(LLVMRootDirRelWithDebInfo, "include"),
path.join(LLVMRootDirRelWithDebInfo, "llvm/include"),
path.join(LLVMRootDirRelWithDebInfo, "lld/include"),
path.join(LLVMRootDirRelWithDebInfo, "clang/include"),
path.join(LLVMRootDirRelWithDebInfo, "clang/lib"),
path.join(LLVMRootDirRelWithDebInfo, "build/include"),
path.join(LLVMRootDirRelWithDebInfo, "build/clang/include"),
}
filter { "configurations:Debug" }
@ -95,12 +98,17 @@ function CopyClangIncludes() @@ -95,12 +98,17 @@ function CopyClangIncludes()
if LLVMDirPerConfiguration then
local clangBuiltinDebug = path.join(LLVMRootDirDebug, "lib")
local clangBuiltinRelWithDebInfo = path.join(LLVMRootDirRelWithDebInfo, "lib")
local clangBuiltinRelease = path.join(LLVMRootDirRelease, "lib")
if os.isdir(path.join(clangBuiltinDebug, "clang")) then
clangBuiltinIncludeDir = clangBuiltinDebug
end
if os.isdir(path.join(clangBuiltinRelWithDebInfo, "clang")) then
clangBuiltinIncludeDir = clangBuiltinRelWithDebInfo
end
if os.isdir(path.join(clangBuiltinRelease, "clang")) then
clangBuiltinIncludeDir = clangBuiltinRelease
end
@ -134,7 +142,7 @@ function SetupLLVMLibs() @@ -134,7 +142,7 @@ function SetupLLVMLibs()
if LLVMDirPerConfiguration then
filter { "configurations:DebugOpt" }
libdirs { path.join(LLVMRootDirRelease, "build/lib") }
libdirs { path.join(LLVMRootDirRelWithDebInfo, "build/lib") }
filter { "configurations:Debug" }
libdirs { path.join(LLVMRootDirDebug, "build/lib") }
@ -150,9 +158,6 @@ function SetupLLVMLibs() @@ -150,9 +158,6 @@ function SetupLLVMLibs()
filter { "configurations:Debug", "toolset:msc*" }
libdirs { path.join(LLVMBuildDir, "Debug/lib") }
filter { "configurations:Release", "toolset:msc*" }
libdirs { path.join(LLVMBuildDir, "RelWithDebInfo/lib") }
end
filter {}

16
build/llvm/LLVM.lua

@ -49,6 +49,10 @@ function clone_llvm() @@ -49,6 +49,10 @@ function clone_llvm()
extract(archive, '.')
os.rename('llvm-project-'..llvm_release, llvm)
-- delete the extracted archive
print("Cleaning up downloaded artifacts...")
os.remove(archive)
end
function get_vs_version()
@ -138,12 +142,12 @@ end @@ -138,12 +142,12 @@ end
function get_llvm_configuration_name(debug)
if string.find(_OPTIONS["configuration"], "DebugOpt") then
return os.istarget("windows") and "RelWithDebInfo" or "Release"
return "RelWithDebInfo"
end
if string.find(_OPTIONS["configuration"], "Debug") then
return "Debug"
end
return os.istarget("windows") and "RelWithDebInfo" or "Release"
return "Release"
end
function get_7z_path()
@ -219,6 +223,10 @@ function download_llvm() @@ -219,6 +223,10 @@ function download_llvm()
else
extract_tar_xz(archive, pkg_name)
end
-- delete the extracted archive
print("Cleaning up downloaded artifacts...")
os.remove(archive)
end
function cmake(gen, conf, builddir, options)
@ -511,6 +519,10 @@ function package_llvm(conf, llvm_base, llvm_build) @@ -511,6 +519,10 @@ function package_llvm(conf, llvm_base, llvm_build)
os.copydir(llvm_build_libdir, out .. "/build/lib", "*.a")
end
-- Copy natvis visualizers for a better debugging experience
os.copyfile(llvm_base .. "/clang/utils/ClangVisualizers/clang.natvis", out .. "/utils/clang.natvis")
os.copyfile(llvm_base .. "/llvm/utils/LLVMVisualizers/llvm.natvis", out .. "/utils/llvm.natvis")
os.copydir(llvm_base .. "/clang/include", out .. "/clang/include")
os.copydir(llvm_build .. "/tools/clang/include", out .. "/build/clang/include")

2
build/premake5.lua

@ -44,7 +44,7 @@ workspace "CppSharp" @@ -44,7 +44,7 @@ workspace "CppSharp"
workspacefiles(path.join(builddir, "premake5.lua"))
workspacefiles(path.join(builddir, "*.sh"))
workspacefiles(path.join(rootdir, ".github/workflows/*.yml"))
workspacefiles(path.join(rootdir, "*.natvis"))
workspacefiles(path.join(path.join(get_llvm_build_dir(), "/utils/"), "*.natvis"))
workspacefiles(path.join(testsdir, "Test*.props"))
group "Libraries"

1089
clang.natvis

File diff suppressed because it is too large Load Diff

408
llvm.natvis

@ -1,408 +0,0 @@ @@ -1,408 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Visual Studio Native Debugging Visualizers for LLVM
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&lt;*&gt;">
<DisplayString Condition="Size == 0">empty</DisplayString>
<DisplayString Condition="Size &amp;&amp; Size &lt; 4">{(value_type*)BeginX,[Size]}</DisplayString>
<DisplayString Condition="Size &gt; 3">{Size} elements</DisplayString>
<DisplayString>Uninitialized</DisplayString>
<Expand>
<Item Name="[size]">Size</Item>
<Item Name="[capacity]">Capacity</Item>
<ArrayItems>
<Size>Size</Size>
<ValuePointer>(value_type*)BeginX</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::APInt">
<!-- For now, only handle up to 64-bit unsigned ints -->
<DisplayString Condition="BitWidth &lt;= 64">{U.VAL}</DisplayString>
<DisplayString>Cannot visualize APInts longer than 64 bits</DisplayString>
</Type>
<Type Name="llvm::ArrayRef&lt;*&gt;">
<DisplayString Condition="Length &lt; 4">{Data,[Length]}</DisplayString>
<DisplayString Condition="Length &gt; 3">{Length} elements</DisplayString>
<DisplayString>Uninitialized</DisplayString>
<Expand>
<Item Name="[size]">Length</Item>
<ArrayItems>
<Size>Length</Size>
<ValuePointer>Data</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::SmallString&lt;*&gt;">
<DisplayString>{(const char*)BeginX,[Size]s8}</DisplayString>
<StringView>(const char*)BeginX,[Size]</StringView>
<Expand>
<Item Name="[size]">Size</Item>
<Item Name="[capacity]">Capacity</Item>
<ArrayItems>
<Size>Size</Size>
<ValuePointer>(char*)BeginX</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="StringView">
<DisplayString>{First,[Last - First]s8}</DisplayString>
</Type>
<Type Name="llvm::StringRef">
<DisplayString>{Data,[Length]s8}</DisplayString>
<StringView>Data,[Length]s8</StringView>
<Expand>
<Item Name="[size]">Length</Item>
<ArrayItems>
<Size>Length</Size>
<ValuePointer>Data</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::PunnedPointer">
<DisplayString>{($T1)*(intptr_t *)Data}</DisplayString>
</Type>
<!-- PointerIntPair. In addition to the regular view, it is possible to view
just the pointer or just the int. The same code is duplicated from the
regular viewer to improve the performance of the common case. Note, we
need to specify PointerIntPair<PointerUnion<*>, *> differently because
we need to "look through" the PointerUnion to display it. Otherwise, we
get errors about ambiguous conversion from uintptr_t to PointerUnion.-->
<Type Name="llvm::PointerIntPair&lt;llvm::PointerUnion&lt;*&gt;, *&gt;">
<!-- $T1 is the parameter pack of PointerUnion, $T3 is IntBits,
$T4 is IntType, $T5 is PtrTraits, and $T6 is Info. -->
<DisplayString IncludeView="ptr">{($T1)(*(intptr_t *)Value.Data &amp; $T6::PointerBitMask)}</DisplayString>
<DisplayString IncludeView="int">{($T4)((*(intptr_t *)Value.Data &gt;&gt; $T6::IntShift) &amp; $T6::IntMask)}</DisplayString>
<DisplayString>{$T6::IntMask}: {($T1)(*(intptr_t *)Value.Data &amp; $T6::PointerBitMask)} [{($T4)((*(intptr_t *)Value.Data &gt;&gt; $T6::IntShift) &amp; $T6::IntMask)}]</DisplayString>
<Expand>
<Item Name="[ptr]">($T1)(*(intptr_t *)Value.Data &amp; $T6::PointerBitMask)</Item>
<Item Name="[int]">($T4)((*(intptr_t *)Value.Data &gt;&gt; $T6::IntShift) &amp; $T6::IntMask)</Item>
</Expand>
</Type>
<Type Name="llvm::PointerIntPair&lt;*&gt;">
<DisplayString IncludeView="ptr">{($T1)(*(intptr_t *)Value.Data &amp; $T5::PointerBitMask)}</DisplayString>
<DisplayString IncludeView="int">{((*(intptr_t *)Value.Data &gt;&gt; $T5::IntShift) &amp; $T5::IntMask)}</DisplayString>
<DisplayString>{$T5::IntMask}: {($T1)(*(intptr_t *)Value.Data &amp; $T5::PointerBitMask)} [{((*(intptr_t *)Value.Data &gt;&gt; $T5::IntShift) &amp; $T5::IntMask)}]</DisplayString>
<Expand>
<Item Name="[ptr]">($T1)(*(intptr_t *)Value.Data &amp; $T5::PointerBitMask)</Item>
<Item Name="[int]">((*(intptr_t *)Value.Data &gt;&gt; $T5::IntShift) &amp; $T5::IntMask)</Item>
</Expand>
</Type>
<!-- PointerUnion types -->
<Type Name="llvm::pointer_union_detail::PointerUnionMembers&lt;*&gt;">
<DisplayString Optional="true" Condition="((*(intptr_t *)Val.Value.Data&gt;&gt;$T2::InfoTy::IntShift) &amp; $T2::InfoTy::IntMask) == 0">
{($T4)(*(intptr_t *)Val.Value.Data &amp; $T2::InfoTy::PointerBitMask)}
</DisplayString>
<DisplayString Optional="true" Condition="((*(intptr_t *)Val.Value.Data&gt;&gt;$T2::InfoTy::IntShift) &amp; $T2::InfoTy::IntMask) == 1">
{($T5)(*(intptr_t *)Val.Value.Data &amp; $T2::InfoTy::PointerBitMask)}
</DisplayString>
<DisplayString>Unexpected index in PointerUnion: {(*(intptr_t *)Val.Value.Data&gt;&gt;$T2::InfoTy::IntShift) &amp; $T2::InfoTy::IntMask}</DisplayString>
<Expand>
<Item Name="[Holds]" Condition="((*(intptr_t *)Val.Value.Data&gt;&gt;$T2::InfoTy::IntShift) &amp; $T2::InfoTy::IntMask) == 0">"$T4",s8b</Item>
<Item Name="[Ptr]" Optional="true" Condition="((*(intptr_t *)Val.Value.Data&gt;&gt;$T2::InfoTy::IntShift) &amp; $T2::InfoTy::IntMask) == 0">
($T4)(*(intptr_t *)Val.Value.Data &amp; $T2::InfoTy::PointerBitMask)
</Item>
<Item Name="[Holds]" Condition="((*(intptr_t *)Val.Value.Data&gt;&gt;$T2::InfoTy::IntShift) &amp; $T2::InfoTy::IntMask) == 1">"$T5",s8b</Item>
<Item Name="[Ptr]" Optional="true" Condition="((*(intptr_t *)Val.Value.Data&gt;&gt;$T2::InfoTy::IntShift) &amp; $T2::InfoTy::IntMask) == 1">
($T5)(*(intptr_t *)Val.Value.Data &amp; $T2::InfoTy::PointerBitMask)
</Item>
</Expand>
</Type>
<Type Name="llvm::iplist&lt;*,*&gt;">
<DisplayString Condition="Head == 0">{{ empty }}</DisplayString>
<DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString>
<Expand>
<LinkedListItems>
<HeadPointer>Head</HeadPointer>
<NextPointer>Next</NextPointer>
<ValueNode>this</ValueNode>
</LinkedListItems>
</Expand>
</Type>
<Type Name="llvm::IntrusiveRefCntPtr&lt;*&gt;">
<DisplayString Condition="Obj == 0">empty</DisplayString>
<DisplayString Condition="(Obj != 0) &amp;&amp; (Obj-&gt;RefCount == 1)">RefPtr [1 ref] {*Obj}</DisplayString>
<DisplayString Condition="(Obj != 0) &amp;&amp; (Obj-&gt;RefCount != 1)">RefPtr [{Obj-&gt;RefCount} refs] {*Obj}</DisplayString>
<Expand>
<Item Condition="Obj != 0" Name="[refs]">Obj-&gt;RefCount</Item>
<ExpandedItem Condition="Obj != 0">Obj</ExpandedItem>
</Expand>
</Type>
<Type Name="llvm::SmallPtrSet&lt;*,*&gt;">
<DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString>
<DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumNonEmpty}, capacity={CurArraySize} }}</DisplayString>
<Expand>
<Item Name="[size]">NumNonEmpty</Item>
<Item Name="[capacity]">CurArraySize</Item>
<ArrayItems>
<Size>NumNonEmpty</Size>
<ValuePointer>($T1*)CurArray</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::DenseMap&lt;*,*,*&gt;">
<DisplayString Condition="NumEntries == 0">empty</DisplayString>
<DisplayString Condition="NumEntries != 0">{{ size={NumEntries}, buckets={NumBuckets} }}</DisplayString>
<Expand>
<Item Name="[size]">NumEntries</Item>
<Item Name="[buckets]">NumBuckets</Item>
<ArrayItems>
<Size>NumBuckets</Size>
<ValuePointer>Buckets</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::StringMap&lt;*,*&gt;">
<DisplayString>{{ size={NumItems}, buckets={NumBuckets} }}</DisplayString>
<Expand>
<Item Name="[size]">NumItems</Item>
<Item Name="[buckets]">NumBuckets</Item>
<ArrayItems>
<Size>NumBuckets</Size>
<ValuePointer>(MapEntryTy**)TheTable</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="llvm::StringMapEntry&lt;*&gt;">
<DisplayString Condition="keyLength == 0">empty</DisplayString>
<DisplayString Condition="keyLength != 0">({this+1,s8}, {second})</DisplayString>
<Expand>
<Item Name="[key]">this+1,s</Item>
<Item Name="[value]" Condition="keyLength != 0">second</Item>
</Expand>
</Type>
<Type Name="llvm::Triple">
<DisplayString>{Data}</DisplayString>
</Type>
<Type Name="llvm::Optional&lt;*&gt;">
<DisplayString Condition="!Storage.hasVal">None</DisplayString>
<DisplayString Condition="Storage.hasVal">{Storage.value}</DisplayString>
<Expand>
<Item Name="[underlying]" Condition="Storage.hasVal">Storage.value</Item>
</Expand>
</Type>
<Type Name="llvm::Expected&lt;*&gt;">
<DisplayString Condition="HasError">Error</DisplayString>
<DisplayString Condition="!HasError">{*((storage_type *)TStorage.buffer)}</DisplayString>
<Expand>
<Item Name="[value]" Condition="!HasError">*((storage_type *)TStorage.buffer)</Item>
<Item Name="[error]" Condition="HasError">*((error_type *)ErrorStorage.buffer)</Item>
</Expand>
</Type>
<!-- Since we're in MSVC, we can assume that the system is little endian. Therefore
the little and native cases just require a cast. Handle this easy case first. Use
a wildcard for the second template argument (the endianness), but we will use a
specific value of 0 later on for the big endian to give it priority for being a
better match. -->
<Type Name="llvm::support::detail::packed_endian_specific_integral&lt;*,*,1&gt;">
<DisplayString>{{little endian value = {*(($T1*)(unsigned char *)Value.buffer)} }}</DisplayString>
<Expand>
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item>
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item>
<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&lt;*,0,1&gt;">
<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) &lt;&lt; 8)
| ($T1)(*((unsigned char *)Value.buffer+1))} }}</DisplayString>
<DisplayString Condition="sizeof($T1)==4">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) &lt;&lt; 24)
| (($T1)(*((unsigned char *)Value.buffer+1)) &lt;&lt; 16)
| (($T1)(*((unsigned char *)Value.buffer+2)) &lt;&lt; 8)
| ($T1)(*((unsigned char *)Value.buffer+3))} }}</DisplayString>
<DisplayString Condition="sizeof($T1)==8">{{ big endian value = {(($T1)(*(unsigned char *)Value.buffer) &lt;&lt; 56)
| (($T1)(*((unsigned char *)Value.buffer+1)) &lt;&lt; 48)
| (($T1)(*((unsigned char *)Value.buffer+2)) &lt;&lt; 40)
| (($T1)(*((unsigned char *)Value.buffer+3)) &lt;&lt; 32)
| (($T1)(*((unsigned char *)Value.buffer+4)) &lt;&lt; 24)
| (($T1)(*((unsigned char *)Value.buffer+5)) &lt;&lt; 16)
| (($T1)(*((unsigned char *)Value.buffer+6)) &lt;&lt; 8)
| ($T1)(*((unsigned char *)Value.buffer+7))} }}</DisplayString>
<Expand>
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==1">(unsigned char *)Value.buffer,1</Item>
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==2">(unsigned char *)Value.buffer,2</Item>
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==4">(unsigned char *)Value.buffer,4</Item>
<Item Name="[Raw Bytes]" Condition="sizeof($T1)==8">(unsigned char *)Value.buffer,8</Item>
</Expand>
</Type>
<!-- llvm::Type has two fields, SubclassData and ContainedTys, the meaning of which change depending on the TypeID.
This visualiser decodes those fields based on the value of ID.
-->
<Type Name="llvm::Type">
<DisplayString>{ID}</DisplayString>
<Expand>
<Item Name="ID">ID</Item>
<Item Name="NumBits" Condition="ID == llvm::Type::TypeID::IntegerTyID">SubclassData</Item>
<Item Name="ReturnType" Condition="ID == llvm::Type::TypeID::FunctionTyID">*ContainedTys</Item>
<Synthetic Name="Arguments" Condition="ID == llvm::Type::TypeID::FunctionTyID">
<DisplayString>{NumContainedTys - 1}</DisplayString>
<Expand>
<ArrayItems>
<Size>NumContainedTys - 1</Size>
<ValuePointer>ContainedTys + 1</ValuePointer>
</ArrayItems>
</Expand>
</Synthetic>
<Item Name="IsVarArg" Condition="ID == llvm::Type::TypeID::FunctionTyID">SubclassData == 1</Item>
<Item Name="HasBody" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData &amp; llvm::StructType::SCDB_HasBody) != 0</Item>
<Item Name="Packed" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData &amp; llvm::StructType::SCDB_Packed) != 0</Item>
<Item Name="IsLiteral" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData &amp; llvm::StructType::SCDB_IsLiteral) != 0</Item>
<Item Name="IsSized" Condition="ID == llvm::Type::TypeID::StructTyID">(SubclassData &amp; llvm::StructType::SCDB_IsSized) != 0</Item>
<Synthetic Name="Members" Condition="ID == llvm::Type::TypeID::StructTyID">
<DisplayString>{NumContainedTys}</DisplayString>
<Expand>
<ArrayItems>
<Size>NumContainedTys</Size>
<ValuePointer>ContainedTys</ValuePointer>
</ArrayItems>
</Expand>
</Synthetic>
<Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ArrayTyID">*ContainedTys</Item>
<Item Name="NumElements" Condition="ID == llvm::Type::TypeID::ArrayTyID">((llvm::ArrayType*)this)->NumElements</Item>
<Item Name="ElementType" Condition="ID == llvm::Type::TypeID::FixedVectorTyID">*ContainedTys</Item>
<Item Name="NumElements" Condition="ID == llvm::Type::TypeID::FixedVectorTyID">((llvm::VectorType*)this)->ElementQuantity</Item>
<Item Name="ElementType" Condition="ID == llvm::Type::TypeID::ScalableVectorTyID">*ContainedTys</Item>
<Item Name="MinNumElements" Condition="ID == llvm::Type::TypeID::ScalableVectorTyID">((llvm::VectorType*)this)->ElementQuantity</Item>
<Item Name="AddressSpace" Condition="ID == llvm::Type::TypeID::PointerTyID">SubclassData</Item>
<Item Name="PointeeType" Condition="ID == llvm::Type::TypeID::PointerTyID">*ContainedTys</Item>
<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 &amp; 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 &amp; 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>
Loading…
Cancel
Save