[llvm] MCExpr-ify AMDGPU PALMetadata (PR #93236)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 7 05:20:43 PDT 2024
================
@@ -182,6 +193,40 @@ void AMDGPUPALMetadata::setRegister(unsigned Reg, unsigned Val) {
N = N.getDocument()->getNode(Val);
}
+// Set a register in the metadata.
+// In fact this ORs the value into any previous setting of the register.
+void AMDGPUPALMetadata::setRegister(unsigned Reg, const MCExpr *Val,
+ MCContext &Ctx) {
+ if (!isLegacy()) {
+ // In the new MsgPack format, ignore register numbered >= 0x10000000. It
+ // is a PAL ABI pseudo-register in the old non-MsgPack format.
+ if (Reg >= 0x10000000)
+ return;
+ }
+ auto &N = getRegisters()[MsgPackDoc.getNode(Reg)];
+ bool RegSeenInREM = REM.find(Reg) != REM.end();
+
+ if (RegSeenInREM) {
+ Val = MCBinaryExpr::createOr(Val, REM[Reg], Ctx);
----------------
arsenm wrote:
You do the lookup in REM, throw away the iterator, and then do the lookup again several times in the function. Just do the lookup once?
https://github.com/llvm/llvm-project/pull/93236
More information about the llvm-commits
mailing list