[llvm] [MC] Reorder TARGETInstrTable to shrink MCInstrDesc::ImplicitOffset (PR #171199)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 23:22:00 PST 2025
================
@@ -959,13 +959,19 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
OS << "struct " << TargetName << "InstrTable {\n";
OS << " MCInstrDesc Insts[" << NumberedInstructions.size() << "];\n";
+ OS << " static_assert(alignof(MCInstrDesc) >= alignof(MCPhysReg), "
+ "\"Unwanted padding between Insts and ImplicitOps\");\n";
+ OS << " MCPhysReg ImplicitOps[" << std::max(ImplicitListSize, 1U)
+ << "];\n";
+ // Emit enough padding to make ImplicitOps plus Padding add up to the size
+ // of a whole number of MCOperandInfo structs. This allows us to index into
+ // the OperandInfo array starting from the end of the Insts array, by
+ // biasing the indices by the OpInfoBase value calculated below.
+ OS << " char Padding[sizeof(MCOperandInfo) - sizeof ImplicitOps % "
----------------
jayfoad wrote:
That's how C works - you only need parentheses for sizeof a type, not for sizeof a variable.
https://github.com/llvm/llvm-project/pull/171199
More information about the llvm-commits
mailing list