[clang] [clang][Interp] Emit const references for Float arguments (PR #79753)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 28 07:20:25 PST 2024


tbaederr wrote:

For reference, the generated code with this patch looks like this:

```c++
#if defined(GET_EVAL_PROTO) || defined(GET_LINK_PROTO)
bool emitConstFloat(const Floating &, const SourceInfo &);
#endif
#ifdef GET_LINK_IMPL
bool ByteCodeEmitter::emitConstFloat(const Floating &A0, const SourceInfo &L) {
  return emitOp<Floating>(OP_ConstFloat, A0, L);
}
#endif
#ifdef GET_EVAL_IMPL
bool EvalEmitter::emitConstFloat(const Floating &A0, const SourceInfo &L) {
  if (!isActive()) return true;
  CurrentSource = L;
  return Const<PT_Float>(S, OpPC, A0);
}
#endif
```

Where all those `const Floating &` arguments were just `Floating` before.


https://github.com/llvm/llvm-project/pull/79753


More information about the cfe-commits mailing list