Skip to content

Instantly share code, notes, and snippets.

export PATH="/c/Program Files/LLVM/bin":$PATH
find include/llvm/IR -name '*.h' | xargs clang-query -p objdir
clang-query -p objdir include\llvm\IR\Value.h include\llvm\IR\Use.h include\llvm\Analysis\CallGraph.h
clang-query -p objdir include\llvm\ADT\SmallVector.h
vs
clang-query -p objdir include\llvm\Support\Allocator.h
m cxxRecordDecl(hasDefinition().bind("d"), hasExternalFormalLinkage(), unless(anyOf(isExpansionInSystemHeader(), isExplicitTemplateSpecialization(), hasParent(classTemplateDecl()), hasParent(classTemplateSpecializationDecl()))))
Index: include/llvm/Analysis/CFGPrinter.h
===================================================================
--- include/llvm/Analysis/CFGPrinter.h (revision 177877)
+++ include/llvm/Analysis/CFGPrinter.h (working copy)
@@ -15,6 +15,7 @@
#ifndef LLVM_ANALYSIS_CFGPRINTER_H
#define LLVM_ANALYSIS_CFGPRINTER_H
+#include "llvm/PassSupport.h"
#include "llvm/Assembly/Writer.h"
#! /bin/sh
awk -- '!/^#/ {
TIMES[$4] += ($2 - $1)/1000
COUNT[$4] += 1
}
END {
for (TGT in TIMES)
AVG[TGT]=TIMES[TGT]/COUNT[TGT]
@Trass3r
Trass3r / preprocessed_code_stats.sh
Last active October 6, 2022 17:16
get statistics on preprocessed C++ code size
set -eux
cd /build/
ninja -k0
export CCACHE_DISABLE=1
# fix CMake deps: https://gitlab.kitware.com/cmake/cmake/-/issues/15555
sed -ri 's/(build .+?\.cpp\.o: .+?) \|\| \S+depends\S+/\1/g' build.ninja
# produce preprocessed sources without #line markers
objdump -M intel --disassemble='__static_initialization_and_destruction_0(int, int)' test -C -S --source-comment --visualize-jumps=on -l
static void foo() asm("myfoo") __attribute__((section("mysect")));
static void foo() {}
static void bar() {}
const void* data[] = {
(void*)&foo,
(void*)&bar
};
struct Data {
void* mine;
unsigned int theirs;
@Trass3r
Trass3r / ObjSeqImport.py
Created July 23, 2022 11:39
Blender addon to import .obj files containing morph targets, based on https://gist.github.com/Marcus-Zhu/6e397f6b5d295ab87602a26aef0673a0
bl_info = {
"name": "Import OBJ with morph targets",
"author": "Trass3r",
"version": (1, 0, 0),
"blender": (3, 2, 0),
"location": "File > Import/Export",
"description": "Import OBJ with morph targets",
"doc_url": "",
"support": "COMMUNITY",
"category": "Import-Export",
<?xml version='1.0' encoding='UTF-8'?>
<com.jme3.scene.Node format_version='2' name='Root' savable_versions='0, 0'>
<lights class='com.jme3.light.LightList' savable_versions='0'>
<lights size='0'/>
</lights>
<overrides size='0'/>
<controlsList size='0'/>
<children size='1'>
<com.jme3.scene.Node name='Piranha_swim' reference_ID='com.jme3.scene.Node@1014984550' savable_versions='0, 0'>
<transform class='com.jme3.math.Transform' savable_versions='0'>
@Trass3r
Trass3r / Dungeon Keeper 2 KMF.bt
Last active April 18, 2023 15:57
for %i in (*.kmf) do start /wait 010Editor -noui -nowarnings "-template:Dungeon Keeper 2 KMF.bt" "-script:Dungeon Keeper 2 KMF2OBJ.1sc" "%i"
// Dungeon Keeper 2 Meshes (static and vertex animated)
local int i;
struct KMSH {
char magic[4];
int size; // size of file incl. header
int version; // = 17
struct KHEAD {
@Trass3r
Trass3r / Win1xHomeMissingFeatures.bat
Created January 13, 2022 13:49
Install Windows Sandbox, Hyper-V, Local Group Policy Editor
REM run in admin console
cd %TEMP%
dir /b %SystemRoot%\servicing\Packages\*Containers*.mum >List.txt
for /f %i in ('findstr /i . List.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%i"
dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt
dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt
for /f %i in ('findstr /i . List.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%i"