[PATCH] D87285: AMDGPU/GlobalISelemitter Support for predicate code that uses operands

Petar Avramovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 07:46:24 PDT 2020


Petar.Avramovic added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h:454
     RecordedMIVector MIs;
+    SmallVector<MachineOperand *, 3> RecordedOperands;
     DenseMap<unsigned, unsigned> TempRegisters;
----------------
arsenm wrote:
> Is this the recorded use or def operand? Can you add a comment here?
As far as I know operands in this list are taken from instruction where they were use operands. Was that the question? 


================
Comment at: llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp:33
+    : Renderers(MaxRenderers), MIs() {
+  RecordedOperands.resize(3);
+}
----------------
arsenm wrote:
> Why arbitrarily resize this here?
Operands are inserted directly into specific index in RecordedOperands, see GIM_RecordNamedOperand.
Magic number 3 is the largest number of operands that any of the patterns with  'let PredicateCodeUsesOperands = 1' has.
I wanted to avoid having to keep additional maps between operand names and indices in final operand list that will be sent as argument to c++ predicate code' (like sdag). Unlike sdag, globalisel emitter first visits the predicate and we can figure out indices right away, sdag visits all operands first and predicate is visited last. 


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

https://reviews.llvm.org/D87285



More information about the llvm-commits mailing list