daphne-project/daphne

Constant folding for cast from number to string

Aberta

#931 aberto em 6 de dez. de 2024

 (1 comentário) (0 reação) (0 responsável)C++ (84 forks)auto 404
good first issue

Métricas do repositório

Stars
 (80 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

The DAPHNE compiler can evaluate various operations on constant scalars at compile-time. The respective constant folding implementations can be found in src/ir/daphneir/Fold.cpp. While casts of scalars between various value types can already be folded (see mlir::OpFoldResult mlir::daphne::CastOp::fold(FoldAdaptor adaptor)), casts from numbers to strings are not folded yet. Folding such casts would be useful as it would allow DaphneDSL users to do things like:

X = readMatrix("path/to/file/dataset_" + 123 + ".csv";

Which is currently not possible as the file name cannot be resolved at compile-time.

Guia do colaborador