[Lldb-commits] [PATCH] D155107: Add support for llvm::MCInstPrinter::setPrintBranchImmAsAddress

Ted Woodward via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 22 12:16:29 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG523110d654a2: Add support for llvm::MCInstPrinter::setPrintBranchImmAsAddress (authored by ted).

Changed prior to commit:
  https://reviews.llvm.org/D155107?vs=539679&id=552465#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155107/new/

https://reviews.llvm.org/D155107

Files:
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp


Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
===================================================================
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -60,8 +60,8 @@
 
   uint64_t GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len,
                      lldb::addr_t pc, llvm::MCInst &mc_inst) const;
-  void PrintMCInst(llvm::MCInst &mc_inst, std::string &inst_string,
-                   std::string &comments_string);
+  void PrintMCInst(llvm::MCInst &mc_inst, lldb::addr_t pc,
+                   std::string &inst_string, std::string &comments_string);
   void SetStyle(bool use_hex_immed, HexImmediateStyle hex_style);
   bool CanBranch(llvm::MCInst &mc_inst) const;
   bool HasDelaySlot(llvm::MCInst &mc_inst) const;
@@ -607,7 +607,7 @@
 
         if (inst_size > 0) {
           mc_disasm_ptr->SetStyle(use_hex_immediates, hex_style);
-          mc_disasm_ptr->PrintMCInst(inst, out_string, comment_string);
+          mc_disasm_ptr->PrintMCInst(inst, pc, out_string, comment_string);
 
           if (!comment_string.empty()) {
             AppendComment(comment_string);
@@ -1290,6 +1290,8 @@
   if (!instr_printer_up)
     return Instance();
 
+  instr_printer_up->setPrintBranchImmAsAddress(true);
+
   // Not all targets may have registered createMCInstrAnalysis().
   std::unique_ptr<llvm::MCInstrAnalysis> instr_analysis_up(
       curr_target->createMCInstrAnalysis(instr_info_up.get()));
@@ -1337,13 +1339,13 @@
 }
 
 void DisassemblerLLVMC::MCDisasmInstance::PrintMCInst(
-    llvm::MCInst &mc_inst, std::string &inst_string,
+    llvm::MCInst &mc_inst, lldb::addr_t pc, std::string &inst_string,
     std::string &comments_string) {
   llvm::raw_string_ostream inst_stream(inst_string);
   llvm::raw_string_ostream comments_stream(comments_string);
 
   m_instr_printer_up->setCommentStream(comments_stream);
-  m_instr_printer_up->printInst(&mc_inst, 0, llvm::StringRef(),
+  m_instr_printer_up->printInst(&mc_inst, pc, llvm::StringRef(),
                                 *m_subtarget_info_up, inst_stream);
   m_instr_printer_up->setCommentStream(llvm::nulls());
   comments_stream.flush();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155107.552465.patch
Type: text/x-patch
Size: 2240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230822/1665e8d3/attachment.bin>


More information about the lldb-commits mailing list