AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Code Generation And Backends

skill-mohitmishra786-low-level-dev-skills-code-generation-and-backends · by mohitmishra786

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.

No reviews yet
0 installs
3 views
0.0% view→install

Install

$ agentstack add skill-mohitmishra786-low-level-dev-skills-code-generation-and-backends

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-mohitmishra786-low-level-dev-skills-code-generation-and-backends)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Code Generation And Backends? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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

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)

def ADD32rr : Pat;

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

clang --target=arm-none-eabi -c -O2 foo.c
llc -mtriple=thumbv7em-none-eabi foo.bc

Mismatch between triple and CPU features (+neon, +crc) causes legalizer failures or suboptimal code.

6. Adding a target (outline)

  1. Define register classes and instr formats in TableGen
  2. Implement lowering hooks (TargetLowering)
  3. AsmPrinter and MC layer for relocations
  4. Builtin calling convention and ELF/COFF object writer

Full port is large — reuse existing backend closest to arch.

7. Agent usage

/code-generation-and-backends Trace how this IR add becomes AArch64 ADD instruction

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 IR
  • skills/compiler-internals/compiler-optimizations-deep — RA intuition
  • skills/compilers/cross-gcc — embedded triples
  • skills/computer-architecture/abi-and-calling-conventions — call lowering
  • skills/low-level-programming/assembly-arm — read emitted asm

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.