Skip to content

Conversation

@topperc
Copy link
Collaborator

@topperc topperc commented Aug 21, 2025

raw_ostream is capable of printing unsigned or uint64_t directly.

@llvmbot
Copy link
Member

llvmbot commented Aug 21, 2025

@llvm/pr-subscribers-tablegen

Author: Craig Topper (topperc)

Changes

raw_ostream is capable of printing unsigned or uint64_t directly.


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

1 Files Affected:

  • (modified) llvm/utils/TableGen/CodeEmitterGen.cpp (+3-4)
diff --git a/llvm/utils/TableGen/CodeEmitterGen.cpp b/llvm/utils/TableGen/CodeEmitterGen.cpp
index d7b5e21c3f1fb..a58fa9f79a8f0 100644
--- a/llvm/utils/TableGen/CodeEmitterGen.cpp
+++ b/llvm/utils/TableGen/CodeEmitterGen.cpp
@@ -154,9 +154,9 @@ bool CodeEmitterGen::addCodeToMergeInOperand(const Record *R,
     raw_string_ostream CaseOS(Case);
     CaseOS << indent(6);
     if (UseAPInt) {
-      CaseOS << EncoderMethodName << "(MI, " + utostr(OpIdx) << ", op";
+      CaseOS << EncoderMethodName << "(MI, " << OpIdx << ", op";
     } else {
-      CaseOS << "op = " << EncoderMethodName << "(MI, " << utostr(OpIdx);
+      CaseOS << "op = " << EncoderMethodName << "(MI, " << OpIdx;
     }
     CaseOS << ", Fixups, STI);\n";
   } else {
@@ -388,8 +388,7 @@ void CodeEmitterGen::addInstructionCasesForEncoding(
 
 static void emitInstBits(raw_ostream &OS, const APInt &Bits) {
   for (unsigned I = 0; I < Bits.getNumWords(); ++I)
-    OS << ((I > 0) ? ", " : "") << "UINT64_C(" << utostr(Bits.getRawData()[I])
-       << ")";
+    OS << ((I > 0) ? ", " : "") << "UINT64_C(" << Bits.getRawData()[I] << ")";
 }
 
 void CodeEmitterGen::emitInstructionBaseValues(

Copy link
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

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

LGTM

@topperc topperc merged commit 6167b1e into llvm:main Aug 22, 2025
9 checks passed
@topperc topperc deleted the pr/utostr branch August 22, 2025 00:44
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