Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

llvm-learningLLVM 学习

Agent Skill

llvm-learning 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

599

周安装

24

GitHub Stars

827

下载量

194
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:llvm-learning(LLVM 学习)
来源仓库:https://github.com/gmh5225/awesome-llvm-security
仓库路径:skills/llvm-learning
安装命令:
npx skills add https://github.com/gmh5225/awesome-llvm-security --skill llvm-learning
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/gmh5225/awesome-llvm-security --skill llvm-learning

简介

用于记录任务执行中的错误和经验积累的工具。

  • 适合让 Agent 持续沉淀问题修正和最佳实践。
  • 通过 GitHub 安装,需结合项目文档了解使用方法。
  • 建议在使用前确认是否有写入日志的权限。
  • 注意隐私保护,避免记录敏感用户输入。llvm-learning 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

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

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

31.81%
按下载量换算62

Claude

31.74%
按下载量换算62

Cursor

19.65%
按下载量换算38

Gemini CLI

9.77%
按下载量换算19

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills