This repository was archived by the owner on Jun 26, 2020. It is now read-only.
Binary function names #47
Labels
E-easy
Issues suitable for newcomers to investigate, including Rust newcomers!
Cretonne compiles functions independently, so function names are used differently than in LLVM. They serve two purposes:
.cton
test cases, the function names are all ASCII, and are used to identify individual test cases in the same file.The binary function names are not well supported. They get printed out as quoted ASCII with a bunch of backslash escapes.
v7
orebb4
get printed without quotes, and the lexer recognizes them as value and EB tokens.Alternative function name syntax.
Over in #24, I proposed two new identifier/data tokens:
%nnnn
and#xxxx
. We should use these to represent function names everywhere:_
, use the%nnnn
notation. Note that this also allows for names like%0
. There is no need to give special treatment to the first character.#xxxx
hexadecimal representation of the function name bytes.noname
(no%
).With these changes, the parser should stop accepting unquoted identifiers as function names.
Binary name representation.
Currently, the
FuncName
struct contains aString
:This restricts us to names in UTF-8 form. We should accept any sequence of bytes, so change this to:
Allocation-free representation
For extra credit: Cretonne tries to minimize heap allocations everywhere, so an internal short-string optimization would make a lot of sense:
The text was updated successfully, but these errors were encountered: