mohitmishra786/low-level-dev-skills/code-generation-and-backends
Claude Code and agent skill by mohitmishra786/low-level-dev-skills
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install mohitmishra786/low-level-dev-skills/code-generation-and-backendsSKILL.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
llcoutput 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)
2. llc usage
3. TableGen patterns (conceptual)
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
Mismatch between triple and CPU features (+neon, +crc) causes legalizer failures or suboptimal code.
6. Adding a target (outline)
- Define register classes and instr formats in TableGen
- Implement lowering hooks (
TargetLowering) - AsmPrinter and MC layer for relocations
- Builtin calling convention and ELF/COFF object writer
Full port is large — reuse existing backend closest to arch.
7. Agent usage
Common Problems
| Symptom | Cause | Fix | |
|---|---|---|---|
Cannot select fatal | Unsupported IR op on target | Legalize or expand op | |
| Wrong soft-float | ABI mismatch | Set -mfloat-abi / triple | |
| Huge stack frame | Many spills post-RA | IR-level pressure reduction | |
| llc vs clang differ | Different targets passed | Same -mtriple | |
| TableGen build fail | Syntax in .td | llvm-tblgen error line |
Related Skills
skills/compiler-internals/llvm-ir-and-passes— pre-codegen IRskills/compiler-internals/compiler-optimizations-deep— RA intuitionskills/compilers/cross-gcc— embedded triplesskills/computer-architecture/abi-and-calling-conventions— call loweringskills/low-level-programming/assembly-arm— read emitted asm
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/compiler-internals/code-generation-and-backends/SKILL.md
Popularity
- Repository stars
- 237
- Repository forks
- 28
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mohitmishra786/low-level-dev-skills/code-generation-and-backends)