daphne-project/daphne

Constant folding for cast from number to string

開放

#931 建立於 2024年12月6日

 (1 則留言) (0 個反應) (0 位負責人)C++ (84 個分叉)auto 404
good first issue

倉庫指標

星標
 (80 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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.

貢獻者指南