Compile time constants in the IR?

Hello everyone,

this might seem like a silly question, but I really wanted to ask it.

So I was thinking about compile time constants (constexpr) - you set them once, compile the code and they will be hard coded. Now I wonder, is there something like that for the IR language too?

The use-case I think off is, that the runtime, which will jit the IR, can set compile time constant values for the modules, because the runtime may decide that certain values will be constant for the module and isn’t jit a form of compiling?

But when I think about it, how would I declare such a value with clang? I really don’t think that “extern constexpr” are a thing…

I just wondered…

Kind greetings

Björn

This would be useful for SpecConstants for SPIR-V (should it get upstreamed).

Nic