[llvm] e3a9e31 - [MachineInstr] Use unsigned int for opcode (NFC)

Christudasan Devadasan via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 05:45:53 PDT 2022


Author: Christudasan Devadasan
Date: 2022-10-07T18:15:22+05:30
New Revision: e3a9e3172d0edc7990f8656fc70a975bdb651f2a

URL: https://github.com/llvm/llvm-project/commit/e3a9e3172d0edc7990f8656fc70a975bdb651f2a
DIFF: https://github.com/llvm/llvm-project/commit/e3a9e3172d0edc7990f8656fc70a975bdb651f2a.diff

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

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

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D135140

Added: 
    

Modified: 
    llvm/utils/TableGen/InstrInfoEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp
index da8d0a0096fd7..a19ffb2ef2516 100644
--- a/llvm/utils/TableGen/InstrInfoEmitter.cpp
+++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp
@@ -1032,7 +1032,8 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
   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 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
     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


        


More information about the llvm-commits mailing list