Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MC][TableGen] Expand ImplicitOffset field of MCInstrDesc #138127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2025

Conversation

perlfu
Copy link
Contributor

@perlfu perlfu commented May 1, 2025

Increase width of ImplicitOffset to int from short to allow more table capacity.
Reorder the elements to maintain natural alignment.

Increase width of ImplicitOffset to int from short to allow
more table capacity.
Reorder the elements to maintain natural alignment.
@llvmbot
Copy link
Member

llvmbot commented May 1, 2025

@llvm/pr-subscribers-tablegen

Author: Carl Ritson (perlfu)

Changes

Increase width of ImplicitOffset to int from short to allow more table capacity.
Reorder the elements to maintain natural alignment.


Full diff: https://github.com/llvm/llvm-project/pull/138127.diff

2 Files Affected:

  • (modified) llvm/include/llvm/MC/MCInstrDesc.h (+1-1)
  • (modified) llvm/utils/TableGen/InstrInfoEmitter.cpp (+5-3)
diff --git a/llvm/include/llvm/MC/MCInstrDesc.h b/llvm/include/llvm/MC/MCInstrDesc.h
index ef0b3c0a73992..5bb7f18bf2587 100644
--- a/llvm/include/llvm/MC/MCInstrDesc.h
+++ b/llvm/include/llvm/MC/MCInstrDesc.h
@@ -209,8 +209,8 @@ class MCInstrDesc {
   unsigned short SchedClass;     // enum identifying instr sched class
   unsigned char NumImplicitUses; // Num of regs implicitly used
   unsigned char NumImplicitDefs; // Num of regs implicitly defined
-  unsigned short ImplicitOffset; // Offset to start of implicit op list
   unsigned short OpInfoOffset;   // Offset to info about operands
+  unsigned int ImplicitOffset;   // Offset to start of implicit op list
   uint64_t Flags;                // Flags identifying machine instr class
   uint64_t TSFlags;              // Target Specific Flag values
 
diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp
index 377bfb593be5f..f240cab040caa 100644
--- a/llvm/utils/TableGen/InstrInfoEmitter.cpp
+++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp
@@ -1106,12 +1106,14 @@ void InstrInfoEmitter::emitRecord(
   OS << Inst.ImplicitUses.size() << ",\t" << Inst.ImplicitDefs.size() << ",\t";
   std::vector<const Record *> ImplicitOps = Inst.ImplicitUses;
   llvm::append_range(ImplicitOps, Inst.ImplicitDefs);
-  OS << Target.getName() << "ImpOpBase + " << EmittedLists[ImplicitOps]
-     << ",\t";
 
   // Emit the operand info offset.
   OperandInfoTy OperandInfo = GetOperandInfo(Inst);
-  OS << OperandInfoMap.find(OperandInfo)->second << ",\t0";
+  OS << OperandInfoMap.find(OperandInfo)->second << ",\t";
+
+  // Emit implicit operand base.
+  OS << Target.getName() << "ImpOpBase + " << EmittedLists[ImplicitOps]
+     << ",\t0";
 
   // Emit all of the target independent flags...
   if (Inst.isPreISelOpcode)

Copy link
Contributor

@jayfoad jayfoad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This does not change the size of MCInstrDesc, right?

@perlfu
Copy link
Contributor Author

perlfu commented May 3, 2025

This does not change the size of MCInstrDesc, right?

Unless the architecture is packing the structure (unlikely) then it should maintain the MCInstrDesc size.

@perlfu perlfu merged commit c63687c into llvm:main May 3, 2025
13 checks passed
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Increase width of ImplicitOffset to `int` from `short` to allow more
table capacity.
Reorder the elements to maintain natural alignment.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Increase width of ImplicitOffset to `int` from `short` to allow more
table capacity.
Reorder the elements to maintain natural alignment.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Increase width of ImplicitOffset to `int` from `short` to allow more
table capacity.
Reorder the elements to maintain natural alignment.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Increase width of ImplicitOffset to `int` from `short` to allow more
table capacity.
Reorder the elements to maintain natural alignment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants