[llvm] [MC] Reorder TARGETInstrTable to shrink MCInstrDesc::ImplicitOffset (PR #171199)
Carl Ritson via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 22:13:24 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 % "
----------------
perlfu wrote:
I know this is mostly inherited from the existing code, but there seems to be a mix of `sizeof` without brackets and with brackets. Perhaps we can tidy them all up?
(This also applies to many of the lines below.)
https://github.com/llvm/llvm-project/pull/171199
More information about the llvm-commits
mailing list