[PATCH] D108319: [doc][GlobalISel]Improving generic opcodes for memory operations

PoojaYadav via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 18 12:16:26 PDT 2021


pooja2299 created this revision.
pooja2299 added reviewers: gandhi21299, kbarton, paquette.
Herald added a subscriber: rovka.
pooja2299 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Adding examples for each of the generic opcodes involved in memory operations. Yet to add examples for some of the opcodes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108319

Files:
  llvm/docs/GlobalISel/GenericOpcode.rst


Index: llvm/docs/GlobalISel/GenericOpcode.rst
===================================================================
--- llvm/docs/GlobalISel/GenericOpcode.rst
+++ llvm/docs/GlobalISel/GenericOpcode.rst
@@ -653,10 +653,15 @@
 G_LOAD, G_SEXTLOAD, G_ZEXTLOAD
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-Generic load. Expects a MachineMemOperand in addition to explicit
+Generic load expects a MachineMemOperand in addition to explicit
 operands. If the result size is larger than the memory size, the
 high bits are undefined, sign-extended, or zero-extended respectively.
 
+.. code-block:: none
+
+  %dst(s8) = G_LOAD %ptr
+  %dst(s32) = G_ZEXT %dst(s8)
+
 Only G_LOAD is valid if the result is a vector type. If the result is larger
 than the memory size, the high elements are undefined (i.e. this is not a
 per-element, vector anyextload)
@@ -664,9 +669,20 @@
 G_INDEXED_LOAD
 ^^^^^^^^^^^^^^
 
-Generic indexed load. Combines a GEP with a load. $newaddr is set to $base + $offset.
+Generic indexed load opcode combines a GEP with a load. 
+
+.. code-block:: none
+
+  $addr = G_PTR_ADD $base, $offset
+  [...]
+  $val = G_LOAD $addr
+  [...]
+
+  $val, $addr = G_INDEXED_LOAD $base, $offset, 1 (IsPre)   
+
+$addr is set to $base + $offset.
 If $am is 0 (post-indexed), then the value is loaded from $base; if $am is 1 (pre-indexed)
-then the value is loaded from $newaddr.
+then the value is loaded from $addr. 
 
 G_INDEXED_SEXTLOAD
 ^^^^^^^^^^^^^^^^^^
@@ -692,6 +708,15 @@
 
 Combines a store with a GEP. See description of G_INDEXED_LOAD for indexing behaviour.
 
+.. code:: none
+
+  G_STORE $val, $base
+  [...]
+  $addr = G_PTR_ADD $base, $offset
+  [...]
+
+  $addr = G_INDEXED_STORE $val, $base, $offset 
+
 G_ATOMIC_CMPXCHG_WITH_SUCCESS
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108319.367298.patch
Type: text/x-patch
Size: 1771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210818/240baea0/attachment.bin>


More information about the llvm-commits mailing list