LL

llvm-learning

Comprehensive resource hub for learning LLVM internals, Clang tools, and compiler backend development.

Install

mkdir -p .claude/skills/llvm-learning && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4254" && unzip -o skill.zip -d .claude/skills/llvm-learning && rm skill.zip

Installs to .claude/skills/llvm-learning

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Comprehensive learning resources and tutorials for LLVM, Clang, and compiler development. Use this skill when helping users learn LLVM internals, find educational resources, or understand compiler concepts.
206 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Navigate LLVM learning paths by proficiency level
  • Map IR concepts to specific documentation sections
  • Identify official Kaleidoscope tutorial sequences
  • Suggest compiler pass architecture patterns
  • Locate community-maintained LLVM projects

How it works

It organizes official LLVM documentation and external educational resources into structured, sequential learning paths.

Inputs & outputs

You give it
Topic area (e.g., passes, IR, backend)
You get back
Curated documentation links and learning roadmaps

When to use llvm-learning

  • Learn how to write an LLVM pass
  • Study compiler optimization techniques
  • Get started with Clang tools
  • Explore backend code generation

About this skill

LLVM Learning Skill

This skill provides curated learning paths and resources for mastering LLVM, Clang, and compiler development.

Learning Paths

Beginner Path

  1. Start with Kaleidoscope: Official LLVM tutorial building a simple language
  2. Understand LLVM IR: Learn the intermediate representation
  3. Write Simple Passes: Transform IR with custom passes
  4. Explore Clang: Understand C/C++ frontend

Intermediate Path

  1. Deep Dive into Optimization: Study built-in optimization passes
  2. Backend Development: Target code generation
  3. Analysis Frameworks: Pointer analysis, dataflow
  4. Clang Tooling: LibTooling, AST matchers

Advanced Path

  1. MLIR: Multi-level IR for domain-specific compilation
  2. JIT Compilation: ORC JIT framework
  3. Security Features: Sanitizers, CFI implementation
  4. Contribute to LLVM: Patches, reviews, community

Official Resources

Documentation

Tutorials

Community Resources

Books and Guides

  • Learn LLVM 12 by Kai Nacke: Comprehensive practical guide
  • LLVM Techniques, Tips, and Best Practices: Advanced patterns
  • Getting Started with LLVM Core Libraries: Foundation concepts
  • LLVM Essentials: Quick start guide

Video Resources

  • LLVM Developer Meetings: Recorded talks on YouTube
  • LLVM Weekly: Newsletter with latest developments
  • EuroLLVM/US LLVM: Conference recordings

GitHub Learning Projects

# Highly recommended starter projects
banach-space/llvm-tutor     # Comprehensive pass examples
hunterzju/llvm-tutorial     # Step-by-step tutorials
jauhien/iron-kaleidoscope   # Kaleidoscope in Rust
bigconvience/llvm-ir-in-action  # IR examples

LLVM IR Essentials

Basic Structure

; Module level
@global_var = global i32 42

; Function definition
define i32 @add(i32 %a, i32 %b) {
entry:
    %sum = add i32 %a, %b
    ret i32 %sum
}

; External declaration
declare i32 @printf(i8*, ...)

Common Instructions

; Arithmetic
%result = add i32 %a, %b
%result = sub i32 %a, %b
%result = mul i32 %a, %b

; Memory
%ptr = alloca i32
store i32 %value, i32* %ptr
%loaded = load i32, i32* %ptr

; Control flow
br i1 %cond, label %then, label %else
br label %next

; Function calls
%retval = call i32 @function(i32 %arg)

Type System

; Integer types: i1, i8, i16, i32, i64, i128
; Floating point: half, float, double
; Pointers: i32*, [10 x i32]*, { i32, i64 }*
; Arrays: [10 x i32]
; Structs: { i32, i64, i8* }
; Vectors: <4 x i32>

Writing LLVM Passes

New Pass Manager (Recommended)

#include "llvm/Passes/PassPlugin.h"
#include "llvm/Passes/PassBuilder.h"

struct MyPass : public llvm::PassInfoMixin<MyPass> {
    llvm::PreservedAnalyses run(llvm::Function &F,
                                 llvm::FunctionAnalysisManager &FAM) {
        for (auto &BB : F) {
            for (auto &I : BB) {
                llvm::errs() << I << "\n";
            }
        }
        return llvm::PreservedAnalyses::all();
    }
};

// Plugin registration
extern "C" LLVM_ATTRIBUTE_WEAK ::llvm::PassPluginLibraryInfo
llvmGetPassPluginInfo() {
    return {LLVM_PLUGIN_API_VERSION, "MyPass", LLVM_VERSION_STRING,
            [](llvm::PassBuilder &PB) {
                PB.registerPipelineParsingCallback(
                    [](llvm::StringRef Name, llvm::FunctionPassManager &FPM,
                       llvm::ArrayRef<llvm::PassBuilder::PipelineElement>) {
                        if (Name == "my-pass") {
                            FPM.addPass(MyPass());
                            return true;
                        }
                        return false;
                    });
            }};
}

Running Custom Passes

# Build as shared library
clang++ -shared -fPIC -o MyPass.so MyPass.cpp `llvm-config --cxxflags --ldflags`

# Run with opt
opt -load-pass-plugin=./MyPass.so -passes="my-pass" input.ll -o output.ll

Clang Development

AST Exploration

# Dump AST
clang -Xclang -ast-dump -fsyntax-only source.cpp

# AST as JSON
clang -Xclang -ast-dump=json -fsyntax-only source.cpp

LibTooling Basics

#include "clang/Tooling/Tooling.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"

using namespace clang::ast_matchers;

// Match all function declarations
auto matcher = functionDecl().bind("func");

class Callback : public MatchFinder::MatchCallback {
    void run(const MatchFinder::MatchResult &Result) override {
        if (auto *FD = Result.Nodes.getNodeAs<FunctionDecl>("func")) {
            llvm::outs() << "Found: " << FD->getName() << "\n";
        }
    }
};

AST Matchers Reference

// Common matchers
functionDecl()               // Match function declarations
varDecl()                    // Match variable declarations
binaryOperator()             // Match binary operators
callExpr()                   // Match function calls
ifStmt()                     // Match if statements

// Narrowing matchers
hasName("foo")               // Match by name
hasType(asString("int"))     // Match by type
isPrivate()                  // Match private members

// Traversal matchers
hasDescendant(...)           // Match in subtree
hasAncestor(...)             // Match in parent tree
hasBody(...)                 // Match function body

Development Tools

Essential Commands

# Compile to LLVM IR
clang -S -emit-llvm source.c -o source.ll

# Optimize IR
opt -O2 source.ll -o optimized.ll

# Disassemble bitcode
llvm-dis source.bc -o source.ll

# Assemble to bitcode
llvm-as source.ll -o source.bc

# Generate native code
llc source.ll -o source.s

# View CFG
opt -passes=view-cfg source.ll

Debugging LLVM IR

# With debug info
clang -g -S -emit-llvm source.c

# Debug IR transformation
opt -debug-pass=Structure -O2 source.ll

# Verify IR validity
opt -passes=verify source.ll

Common Analysis APIs

// Dominator Tree
#include "llvm/Analysis/Dominators.h"
DominatorTree &DT = FAM.getResult<DominatorTreeAnalysis>(F);
if (DT.dominates(BB1, BB2)) { /* BB1 dominates BB2 */ }

// Loop Analysis
#include "llvm/Analysis/LoopInfo.h"
LoopInfo &LI = FAM.getResult<LoopAnalysis>(F);
for (Loop *L : LI) { /* process loops */ }

// Alias Analysis
#include "llvm/Analysis/AliasAnalysis.h"
AAResults &AA = FAM.getResult<AAManager>(F);
AliasResult R = AA.alias(Ptr1, Ptr2);

// Call Graph
#include "llvm/Analysis/CallGraph.h"
CallGraph &CG = MAM.getResult<CallGraphAnalysis>(M);

Practice Projects

Beginner

  1. Instruction counter pass
  2. Function call logger
  3. Dead code finder

Intermediate

  1. Simple constant propagation
  2. Branch probability estimator
  3. Memory access pattern analyzer

Advanced

  1. Custom optimization pass
  2. Security vulnerability detector
  3. Domain-specific language frontend

Community

Getting Help

Contributing

Resources Index

For a comprehensive list of tutorials, books, and example projects, see the LLVM Tutorial and Clang Tutorial sections in the main README.md.

Getting Detailed Information

When you need detailed and up-to-date resource links, tutorials, or learning materials, fetch the latest data from:

https://raw.githubusercontent.com/gmh5225/awesome-llvm-security/refs/heads/main/README.md

This README contains comprehensive curated lists of:

  • LLVM tutorials and learning resources (LLVM Tutorial section)
  • Clang tutorials and AST guides (Clang Tutorial section)
  • C++ modern programming guides (CPP Tutorial section)
  • Compiler and security books

When not to use it

  • When looking for high-level language features instead of compiler internals
  • When needing library-specific documentation for non-LLVM projects

Prerequisites

C++ development environmentLLVM build toolchain

Limitations

  • Information can be dated if not periodically updated
  • Requires steep learning curve for compiler concepts
  • No direct code generation functionality

How it compares

It centralizes fragmented official documentation into a guided, categorized roadmap.

Compared to similar skills

llvm-learning side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
llvm-learning (this skill)46moReviewIntermediate
unity-developer1424moNo flagsAdvanced
unreal-engine-cpp-pro434moNo flagsAdvanced
code-coverage-with-gcov154moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

reverse-engineering-tools

gmh5225

Guide for reverse engineering tools and techniques used in game security research. Use this skill when working with debuggers, disassemblers, memory analysis tools, binary analysis, or decompilers for game security research.

73204

game-hacking-techniques

gmh5225

Guide for game hacking techniques and cheat development. Use this skill when researching memory manipulation, code injection, ESP/aimbot development, overlay rendering, or game exploitation methodologies.

42128

game-engine-resources

gmh5225

Guide for game engine development resources including engine source code, plugins, and development guides. Use this skill when researching game engines (Unreal, Unity, Godot, custom engines), engine architecture, or game development frameworks.

1485

mobile-security

gmh5225

Guide for mobile game security on Android and iOS platforms. Use this skill when working with Android/iOS reverse engineering, mobile game hacking, APK analysis, root/jailbreak detection bypass, or mobile anti-cheat systems.

1469

anti-cheat-systems

gmh5225

Guide for understanding anti-cheat systems and bypass techniques. Use this skill when researching game protection systems (EAC, BattlEye, Vanguard), anti-cheat architecture, detection methods, or bypass strategies.

813

graphics-api-hooking

gmh5225

Guide for graphics API hooking and rendering techniques for DirectX, OpenGL, and Vulkan. Use this skill when working with graphics hooks, overlay rendering, shader manipulation, or game rendering pipeline analysis.

725

You might also like

unity-developer

sickn33

Build Unity games with optimized C# scripts, efficient rendering, and proper asset management. Masters Unity 6 LTS, URP/HDRP pipelines, and cross-platform deployment. Handles gameplay systems, UI implementation, and platform optimization. Use PROACTIVELY for Unity performance issues, game mechanics, or cross-platform builds.

142357

unreal-engine-cpp-pro

sickn33

Expert guide for Unreal Engine 5.x C++ development, covering UObject hygiene, performance patterns, and best practices.

43117

code-coverage-with-gcov

gadievron

Add gcov code coverage instrumentation to C/C++ projects

1599

unity-mcp-orchestrator

CoplayDev

Orchestrate Unity Editor via MCP (Model Context Protocol) tools and resources. Use when working with Unity projects through MCP for Unity - creating/modifying GameObjects, editing scripts, managing scenes, running tests, or any Unity Editor automation. Provides best practices, tool schemas, and workflow patterns for effective Unity-MCP integration.

1795

arm-cortex-expert

sickn33

Senior embedded software engineer specializing in firmware and driver development for ARM Cortex-M microcontrollers (Teensy, STM32, nRF52, SAMD). Decades of experience writing reliable, optimized, and maintainable embedded code with deep expertise in memory barriers, DMA/cache coherency, interrupt-driven I/O, and peripheral drivers.

2975

add-uint-support

pytorch

Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.

1883

Search skills

Search the agent skills registry