4 ms·
constexpr evaluation results are needed in the frontend long before LLVM IR ever comes into the picture. Also, people have done interesting things in constexpr
by bigcheesegs 7y ago
constexpr evaluation results are needed in the frontend long before LLVM IR ever comes into the picture.
Also, people have done interesting things in constexpr that currently suffer from slow compile times: https://github.com/hanickadot/compile-time-regular-expressions https://github.com/hanickadot/compile-time-regular-expressio...
- deleted 7y ago[deleted]
- Someone 7y agoI may not know modern C++ well enough, but I would think that, if you go through a translation unit, discarding everything ”not constexpr”, the result should compile to an object file without any code. Repeat compilation (conceptually, the implementation might be more efficient), replacing anything ”constexpr” by what you got earlier, and you’re done. Or am I overlooking something?
- bigcheesegs 7y agoconstexpr functions aren't restricted to compile time, they can also be used at runtime. Thus constexpr functions can show up in the final executable. Constexpr functions can also control what gets compiled in the first place. For example you can use the result of a constexpr evaluation to instantiate a template.