[PATCH] D135140: [MachineInstr] Use unsigned int for opcode (NFC)

Christudasan Devadasan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 04:24:17 PDT 2022


cdevadas created this revision.
cdevadas added reviewers: MatzeB, arsenm.
Herald added a project: All.
cdevadas requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

The opcode field in most places uses unsigned type.
InstrInfoEmitter still uses signed int for the
custom opcodes like CFSetupOpcode.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135140

Files:
  llvm/utils/TableGen/InstrInfoEmitter.cpp


Index: llvm/utils/TableGen/InstrInfoEmitter.cpp
===================================================================
--- llvm/utils/TableGen/InstrInfoEmitter.cpp
+++ llvm/utils/TableGen/InstrInfoEmitter.cpp
@@ -1032,7 +1032,8 @@
   OS << "namespace llvm {\n";
   OS << "struct " << ClassName << " : public TargetInstrInfo {\n"
      << "  explicit " << ClassName
-     << "(int CFSetupOpcode = -1, int CFDestroyOpcode = -1, int CatchRetOpcode = -1, int ReturnOpcode = -1);\n"
+     << "(unsigned CFSetupOpcode = ~0u, unsigned CFDestroyOpcode = ~0u, "
+        "unsigned CatchRetOpcode = ~0u, unsigned ReturnOpcode = ~0u);\n"
      << "  ~" << ClassName << "() override = default;\n";
 
 
@@ -1065,8 +1066,8 @@
     OS << "extern const MCInstrInfo::ComplexDeprecationPredicate " << TargetName
        << "InstrComplexDeprecationInfos[];\n";
   OS << ClassName << "::" << ClassName
-     << "(int CFSetupOpcode, int CFDestroyOpcode, int CatchRetOpcode, int "
-        "ReturnOpcode)\n"
+     << "(unsigned CFSetupOpcode, unsigned CFDestroyOpcode, unsigned "
+        "CatchRetOpcode, unsigned ReturnOpcode)\n"
      << "  : TargetInstrInfo(CFSetupOpcode, CFDestroyOpcode, CatchRetOpcode, "
         "ReturnOpcode) {\n"
      << "  InitMCInstrInfo(" << TargetName << "Insts, " << TargetName


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135140.464953.patch
Type: text/x-patch
Size: 1287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221004/72234f95/attachment.bin>


More information about the llvm-commits mailing list