Skip to content

Assignments 03 registration

Mugundan edited this page Nov 27, 2026 · 1 revision

Stage 2: Target Registration

Relevant source files

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

Make LLVM know that a `toy` target exists, before it can do anything.

Purpose and Scope

Triple::toy, a data layout, the TargetInfo library and a CMake skeleton.

Read First

Tasks

  1. Add toy to Triple::ArchType and the triple parser/printer; add the data layout string from the overview in TargetDataLayout.cpp.
  2. Add Toy to LLVM_ALL_EXPERIMENTAL_TARGETS; reconfigure with -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=Toy.
  3. Create lib/Target/Toy/CMakeLists.txt with add_llvm_component_group(Toy) and TargetInfo/ with getTheToyTarget() and LLVMInitializeToyTargetInfo().
  4. Add empty LLVMInitializeToyTarget, ...TargetMC, ...AsmPrinter so the init macros link.

Tests

llc --version shows toy - Toy example. A unit test or llc -mtriple=toy-unknown-elf -o - empty.ll reaches "no target machine" instead of "unknown triple".

Done When

  • Triple round-trips (toy-unknown-elf)
  • toy registered
  • Other targets still build

Next: stage 3. 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