A small collection for VS Code

Closer to
the machine.

RISC-V assembly, LLVM IR and LLVM MIR.
Focused editor extensions that make low-level code a little easier to read, write and explore.

From intermediate representation to assembly Fine blue lines connect LLVM IR, LLVM MIR and RISC-V assembly: three ways to read a program as it moves closer to the machine. LLVM IR %sum = add i64 %a, %b the shape of a computation LLVM MIR %2:gpr = ADD %0, %1 instructions take their form RISC-V add a0, a0, a1 a little closer to the hardware
IR → MIR → ASSEMBLY · A COMPILER STUDY

The extensions

Read the details.
Follow the logic.

Three independent extensions, each with its own language support. Choose the one that fits the file in front of you.

RISC-V · Assembly language

Every instruction, legible.

Bring structure to RISC-V assembly with syntax highlighting and snippets, from familiar integer instructions to vector and system extensions.

  • Instruction, register and directive highlighting
  • Assembly snippets for everyday editing
  • GCC and LLVM assembler syntax
sum.sRISC-V
# Two arguments. One result.    .text    .globl sum sum:    add     a0, a0, a1    ret 
Assembly · illustrative syntaxsum(a, b)
code --install-extension sunshaoce.RISC-V

Run in a terminal with the VS Code CLI available. Preview colors are illustrative.

LLVM IR · Intermediate representation

Find your way through IR.

Read LLVM’s intermediate representation with syntax highlighting, instruction snippets and navigation between functions and basic blocks.

  • Highlight types, instructions and SSA values
  • Snippets for operations such as alloca, br and call
  • Go to Definition within the current file

Ctrl/Cmd-click follows function and block references. Navigation does not resolve SSA values or cross-file declarations.

sum.llLLVM IR
; The same addition, in LLVM IR. define i64 @sum(i64 %a, i64 %b) {entry:  %sum = add i64 %a, %b  ret i64 %sum} 
LLVM IR · illustrative syntaxsum(a, b)
code --install-extension sunshaoce.llvmir

Run in a terminal with the VS Code CLI available. Preview colors are illustrative.

LLVM MIR · Machine representation

Look inside code generation.

Make machine-level IR easier to inspect, with highlighting for the YAML document and the machine instructions inside it.

  • YAML properties and embedded LLVM IR
  • Machine blocks, instructions and registers
  • Register flags, memory operands and debug attachments

Built for reading MIR files and code-generation tests, with distinct syntax scopes that work with your editor theme.

sum.mirLLVM MIR · RISC-V
--- # RISC-V machine functionname: sumtracksRegLiveness: truebody: |  bb.0:    liveins: $x10, $x11    $x10 = ADD $x10, $x11    PseudoRET implicit $x10...
Machine IR · illustrative syntaxsum(a, b)
code --install-extension sunshaoce.llvmmir

Run in a terminal with the VS Code CLI available. Preview colors are illustrative.

Inside the RISC-V extension

A broad instruction vocabulary.

Browse the full support list

Integer & bit operations

Base instructions, multiplication and bit manipulation.

IMBZbaZbbZbs

Floating point

Single, double and half-precision instruction families.

FDQZfhZfaZfinx

Compressed instructions

Compact encodings and the Zc extension family.

CZcaZcbZcmpZcmt

Atomics & ordering

Atomic operations, compare-and-swap and memory ordering.

AZaamoZalrscZacasZtso

Vector operations

Vector instructions and embedded vector subsets.

VZve32xZve64dZvfhZvbb

System & privileged

CSRs, instruction fences and hypervisor support.

ZicsrZifenceiHSvinvalSstc
Assembler syntax, beyond instructions

The grammar recognizes lowercase and uppercase instructions, GCC and LLVM assembler directives, .insn, preprocessors such as #include and #define, and #, // and /* … */ comments.

Selected supported families, not an exhaustive ISA list. See the extension’s Marketplace documentation for the published support list.

A place to begin

Open a file.
See it more clearly.

Install only the languages you work with. Each extension is available separately in the Visual Studio Marketplace.

VS Code installation guide
  1. Choose your extension

    Use a Marketplace link above, or open the Extensions view in VS Code and search for the full extension ID, such as sunshaoce.RISC-V.

  2. Install in VS Code

    Select Install, or run the extension’s code --install-extension command in a terminal with the VS Code CLI on your PATH.

  3. Open your assembly or IR file

    If the language is not detected, use the language mode selector in the status bar to choose RISC-V, LLVM IR or LLVM MIR. Highlight colors follow your active theme.