opencompl / opencompl/veir

LLVM: support parsing omitted `!llvm.` prefix when nested

Open
#952 0 comments 0 reactions 0 assignees View on GitHub
LLVM parser sqlite
Dominant language
Lean
Stars
108
Forks
32
Avg merge
1d 1h
Merged PRs (30d)
155

Description

## Context

LLVM dialect has a custom directive `PrettyLLVMType` that allows one to write types from the LLVM dialect without `!llvm.` prefix when it's already nested inside another LLVM-dialect type. For example, `!llvm.array<2 x struct<...>>` is the same as `!llvm.array<2 x !llvm.struct<...>>`.

This convenience syntax is only available for types wrapped inside the `PrettyLLVMType` custom directive. In practice, this convenience syntax is available wherever a nested type is allowed, so in VeIR, we just always allow it when we know we're parsing inside a `!llvm.` type.

## Status

Since `PrettyLLVMType` applies to all types from the LLVM dialect, `parseLLVMType` needs to handle the shorthand form for all 10 types:
- [x] `void`
- [x] `ptr`
- [x] `array`
- [ ] `func`
- [ ] `struct` #951
- [ ] `target`
- [ ] `x86_amx`
- [ ] `ppc_fp128`
- [ ] `label`
- [ ] `metadata`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the LLVM dialect's PrettyLLVMType directive and the parseLLVMType entry point. Trace how the existing shorthand works for void, ptr, and array, then cover the remaining func, struct, target, x86_amx, ppc_fp128, label, and metadata types. Done means all 10 LLVM types accept an omitted nested !llvm. prefix.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.