Code Generation and Backends

Code generation and backends skill for LLVM targets. Use when explaining instruction selection, DAG legalization, target lowering, or adding backend support overview. Activates on queries about LLVM backend, instruction selection, target lowering, llc, TableGen, or codegen pipeline.

293 stars 36 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add mohitmishra786/low-level-dev-skills --skill code-generation-and-backends
Manual install
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills.git /tmp/low-level-dev-skills
mkdir -p ~/.claude/skills
cp -r /tmp/low-level-dev-skills/skills/compiler-internals/code-generation-and-backends ~/.claude/skills/code-generation-and-backends

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Code Generation and Backends

## Purpose

Overview LLVM (and general compiler) backend code generation: IR legalization, SelectionDAG instruction selection, register allocation, assembly emission, and what adding a new target entails — complementing IR skills and `skills/compiler-internals/llvm-passes`.

## When to Use

- Reading `llc` output for a specific target
- Understanding why IR type legalizer inserted extra ops
- Evaluating porting compiler to new architecture (high level)
- Debugging wrong code at asm layer (not IR)

## Workflow

### 1. Backend pipeline (LLVM)

```
LLVM IR per function
├── IR legalizer (types/ops target supports)
├── SelectionDAGBuilder
├── LegalizeTypes / LegalizeOps
├── Instruction selection (pattern match TableGen)
├── Scheduling (pre-RA)
├── Register allocation
├── Prolog/epilog insertion
└── AsmPrinter → .s object
```

### 2. llc usage

```bash
clang -c -emit-llvm -O2 -o foo.bc foo.c
llc -march=aarch64 -O2 foo.bc -o foo.s
llc -march=riscv64 -O2 foo.bc -o foo-rv.s
```

### 3. TableGen patterns (conceptual)

```tablegen
def ADD32rr : Pat<(add i32 GPR:$a, GPR:$b),
                  (ADD32rr GPR:$a, GPR:$b)>;
```

Patterns map DAG nodes to machine instructions. `.td` files define registers, calling conv, instr formats.

### 4. Calling convention lowering

ABI rules become `CC_AArch64` / `CC_X86_64` in TableGen — ties to `skills/computer-architecture/abi-and-calling-conventions`.

### 5. Target triple
Read the full skill on GitHub

Details

Skill name
code-generation-and-backends
Path
skills/compiler-internals/code-generation-and-backends/SKILL.md
License
MIT
Repo updated
14 November 2026

FAQ

What does the Code Generation and Backends skill do?

Code generation and backends skill for LLVM targets. Use when explaining instruction selection, DAG legalization, target lowering, or adding backend support overview. Activates on queries about LLVM backend, instruction selection, target lowering, llc, TableGen, or codegen pipeline.

How do I install the Code Generation and Backends skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add mohitmishra786/low-level-dev-skills --skill code-generation-and-backends. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Code Generation and Backends popular?

It lives in mohitmishra786/low-level-dev-skills, which has 293 GitHub stars and 36 forks.

Related skills

Abi and Calling Conventions

293

mohitmishra786/low-level-dev-skills

ABI and calling conventions skill for cross-language boundaries. Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Activates on queries about calling convention, ABI, System V AMD64, AAPCS, stack frame, variadic function, or FFI registers.

Software Development36

Adc Dac Baremetal

293

mohitmishra786/low-level-dev-skills

Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates on queries about ADC bare-metal, sampling time, DMA ADC, or DAC channel setup.

Other36

Af Xdp

293

mohitmishra786/low-level-dev-skills

AF_XDP skill for high-performance XDP sockets. Use when creating AF_XDP sockets, configuring UMEM and XSK rings, XDP_REDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AF_XDP, xsk_umem, XDP_REDIRECT, libbpf xsk, or zero-copy XDP.

Software Development36

Conan Vcpkg

293

mohitmishra786/low-level-dev-skills

C/C++ package manager skill covering Conan and vcpkg. Use when adding third-party library dependencies to C/C++ projects, managing binary compatibility, integrating with CMake, or choosing between Conan and vcpkg. Activates on queries about Conan, vcpkg, C++ dependency management, conanfile.txt, vcpkg.json, CMake package integration, or C++ package managers.

Software Development36

Assembly X86

293

mohitmishra786/low-level-dev-skills

x86-64 assembly skill for reading, writing, and debugging assembly code. Use when reading GCC/Clang assembly output, writing inline asm in C/C++, understanding the System V AMD64 ABI calling convention, or debugging register and stack state. Activates on queries about x86-64 assembly, AT&T vs Intel syntax, inline asm, calling conventions, SIMD intrinsics, or reading disassembly output from objdump or GDB.

Software Development36

Concurrency Debugging

293

mohitmishra786/low-level-dev-skills

Concurrency debugging skill for diagnosing data races and deadlocks. Use when reading TSan race reports, debugging deadlocks with GDB thread inspection, analyzing lock-order graphs with Helgrind, identifying std::atomic misuse patterns, or reasoning about happens-before in C++ and Rust. Activates on queries about data races, TSan reports, deadlocks, Helgrind, lock ordering, thread sanitizer output, or atomic ordering issues.

Software Development36

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.