[LLParser] Support symbolic address space numbers
authorAlex Richardson <alexrichardson@google.com>
Thu, 8 Dec 2022 20:31:44 +0000 (20:31 +0000)
committerAlex Richardson <alexrichardson@google.com>
Thu, 8 Dec 2022 20:44:40 +0000 (20:44 +0000)
commitf850035493e6f055182b443083a04a1d80bfd5c8
tree8b8141854a06005fbe5656dd00a68643a1c841e4
parent5131f444ee7045d58f72fc99e2ac69792e8b7158
[LLParser] Support symbolic address space numbers

This allows the LLParser to also accept "A", "G", and "P" in `addrspace`
usages. "A" will be replaced by the alloca address space defined in the
globals, "G" by the default globals address space and "P" by the program
address space. This makes it easier to write tests that use different
address space and only only vary the RUN: lines. Currently, the only
alternative is to pre-process the sources with a tool such as `sed`

Importantly, these new string values are only accepted in .ll files and
not stored in the bitcode format, so it does not round-trip via llvm-as
and llvm-dis (see newly added test).

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D138789
llvm/docs/LangRef.rst
llvm/lib/AsmParser/LLParser.cpp
llvm/test/Assembler/symbolic-addrspace.ll [new file with mode: 0644]