[PATCH] D121731: [X86][NFCI] Remove redundant function

Maksim Panchenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 12:54:55 PDT 2022


maksfb created this revision.
maksfb added reviewers: yota9, skan, Amir, ayermolo, rafauler.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
maksfb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121731

Files:
  llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp


Index: llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
===================================================================
--- llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
+++ llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
@@ -1801,33 +1801,6 @@
   mcInst.addOperand(MCOperand::createReg(llvmRegnum));
 }
 
-/// tryAddingSymbolicOperand - trys to add a symbolic operand in place of the
-/// immediate Value in the MCInst.
-///
-/// @param Value      - The immediate Value, has had any PC adjustment made by
-///                     the caller.
-/// @param isBranch   - If the instruction is a branch instruction
-/// @param Address    - The starting address of the instruction
-/// @param Offset     - The byte offset to this immediate in the instruction
-/// @param Width      - The byte width of this immediate in the instruction
-///
-/// If the getOpInfo() function was set when setupForSymbolicDisassembly() was
-/// called then that function is called to get any symbolic information for the
-/// immediate in the instruction using the Address, Offset and Width.  If that
-/// returns non-zero then the symbolic information it returns is used to create
-/// an MCExpr and that is added as an operand to the MCInst.  If getOpInfo()
-/// returns zero and isBranch is true then a symbol look up for immediate Value
-/// is done and if a symbol is found an MCExpr is created with that, else
-/// an MCExpr with the immediate Value is created.  This function returns true
-/// if it adds an operand to the MCInst and false otherwise.
-static bool tryAddingSymbolicOperand(int64_t Value, bool isBranch,
-                                     uint64_t Address, uint64_t Offset,
-                                     uint64_t Width, MCInst &MI,
-                                     const MCDisassembler *Dis) {
-  return Dis->tryAddingSymbolicOperand(MI, Value, Address, isBranch,
-                                       Offset, Width);
-}
-
 /// tryAddingPcLoadReferenceComment - trys to add a comment as to what is being
 /// referenced by a load instruction with the base register that is the rip.
 /// These can often be addresses in a literal pool.  The Address of the
@@ -1990,9 +1963,9 @@
     break;
   }
 
-  if(!tryAddingSymbolicOperand(immediate + pcrel, isBranch, insn.startLocation,
-                               insn.immediateOffset, insn.immediateSize,
-                               mcInst, Dis))
+  if (!Dis->tryAddingSymbolicOperand(mcInst, immediate + pcrel,
+                                     insn.startLocation, isBranch,
+                                     insn.immediateOffset, insn.immediateSize))
     mcInst.addOperand(MCOperand::createImm(immediate));
 
   if (type == TYPE_MOFFS) {
@@ -2193,9 +2166,9 @@
   mcInst.addOperand(baseReg);
   mcInst.addOperand(scaleAmount);
   mcInst.addOperand(indexReg);
-  if(!tryAddingSymbolicOperand(insn.displacement + pcrel, false,
-                               insn.startLocation, insn.displacementOffset,
-                               insn.displacementSize, mcInst, Dis))
+  if (!Dis->tryAddingSymbolicOperand(
+          mcInst, insn.displacement + pcrel, insn.startLocation, false,
+          insn.displacementOffset, insn.displacementSize))
     mcInst.addOperand(displacement);
   mcInst.addOperand(segmentReg);
   return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121731.415549.patch
Type: text/x-patch
Size: 3328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220315/456ed6e6/attachment.bin>


More information about the llvm-commits mailing list