[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) {
+ assert(Args.size() == 5 &&
+ "AMDGPUVariadic Argument count incorrect for ExtraSGPRs");
+ uint64_t VCCUsed, FlatScrUsed, MajorVersion, XNACKUsed,
+ hasArchitectedFlatScr, ExtraSGPRs = 0;
+
+ bool Success = true;
+ Success &= TryGetMCExprValue(Args[0], MajorVersion);
----------------
Pierre-vh wrote:
```suggestion
bool Success = TryGetMCExprValue(Args[0], MajorVersion)
```
https://github.com/llvm/llvm-project/pull/88257
More information about the llvm-commits
mailing list