Skip to content

Assignments 04 tablegen

Mugundan edited this page Nov 27, 2026 · 1 revision

Stage 3: TableGen Skeleton

Relevant source files

The following files were used as context for generating this wiki page:

Describe the registers and an empty instruction set, and get every TableGen backend you need running.

Purpose and Scope

Toy.td, ToyRegisterInfo.td, an empty ToyInstrInfo.td, and the tablegen() lines in CMake.

Read First

Tasks

  1. Define R0–R15 with HWEncoding and DwarfRegNum; alias SP/LR names via AltNames or separate asm names.
  2. Define GPR : RegisterClass<"Toy", [i32], 32, (sequence "R%u", 0, 15)>.
  3. Write Toy.td with includes in dependency order and def Toy : Target.
  4. Add -gen-register-info, -gen-instr-info, -gen-subtarget, -gen-asm-writer, -gen-dag-isel, -gen-callingconv, -gen-emitter to CMake.

Tests

llvm-tblgen -print-records -I llvm/include -I llvm/lib/Target/Toy Toy.td succeeds; ToyGenRegisterInfo.inc contains Toy::R15.

Done When

  • All .inc files generate
  • Register enum has 16 entries plus NoRegister

Next: stage 4. All Toy code and expected output on this page are illustrative, not LLVM source and not tool output; your exact output may differ.

Start here

Computer Organization & Architecture

Hexagon ISA

Operating Systems

C++ for LLVM Development

LLVM IR

SelectionDAG

Backend Assignments

Target Bring-up

Calling Conventions

Frame Lowering

MC Layer

Register Allocation

Scheduling

Clone this wiki locally