[llvm] MCExpr-ify SIProgramInfo (PR #88257)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 00:20:33 PDT 2024
================
@@ -86,6 +105,158 @@ bool AMDGPUVariadicMCExpr::evaluateAsRelocatableImpl(
MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const {
std::optional<int64_t> Total;
+ auto TryGetMCExprValue = [&](const MCExpr *Arg, uint64_t &ConstantValue) {
+ MCValue MCVal;
+ if (!Arg->evaluateAsRelocatable(MCVal, Layout, Fixup) ||
+ !MCVal.isAbsolute())
+ return false;
+
+ ConstantValue = MCVal.getConstant();
+ return true;
+ };
+
+ if (Kind == AGVK_ExtraSGPRs) {
----------------
Pierre-vh wrote:
I think at this point it might be better to create separate functions (static helpers?) for each of these cases and call them in a switch.
It'll make it more readable.
https://github.com/llvm/llvm-project/pull/88257
More information about the llvm-commits
mailing list