From 33ba0d91abdf731e84b49541b4792e701081348f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 9 Jul 2001 00:26:23 +0000 Subject: [PATCH] Updated documentation for load, store & getelementptr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 118 ++++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index bd055edb972..026b6e794f9 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -42,7 +42,6 @@
  • Unary Operations
    1. 'not' Instruction -
    2. 'cast .. to' Instruction
  • Binary Operations
      @@ -68,10 +67,11 @@
    1. 'alloca' Instruction
    2. 'load' Instruction
    3. 'store' Instruction -
    4. 'getfieldptr' Instruction +
    5. 'getelementptr' Instruction
  • Other Operations
      +
    1. 'cast .. to' Instruction
    2. 'call' Instruction
    3. 'icall' Instruction
    4. 'phi' Instruction @@ -321,7 +321,7 @@ Where '<parameter list>' is a comma seperated list of type specif The structure type is used to represent a collection of data members together in memory. Although the runtime is allowed to lay out the data members any way that it would like, they are guaranteed to be "close" to each other.

      -Structures are accessed using 'load and 'store' by getting a pointer to a field with the 'getfieldptr' instruction.

      +Structures are accessed using 'load and 'store' by getting a pointer to a field with the 'getelementptr' instruction.

      Syntax:
      @@ -560,7 +560,7 @@ For a more comprehensive explanation of this instruction look in the llvm/docs/2
       
       Unary operators are used to do a simple operation to a single value.

      -There are two different unary operators: the 'not' instruction and the 'cast' instruction.

      +There is only one unary operators: the 'not' instruction.

      @@ -595,34 +595,6 @@ Note that the 'not' instruction is is not defined over to 'bool -


      'cast .. to' Instruction

         Binary Operations @@ -1044,8 +1016,8 @@ Memory is allocated, a pointer is returned. 'alloca'd memory is automa
      Syntax:
         <result> = load <ty>* <pointer>                 ; yields {ty}:result
      -  <result> = load <ty>* <arrayptr>, uint <idx>    ; yields {ty}:result
      -  <result> = load <ty>* <structptr>{, <idx>}*     ; yields field type
      +  <result> = load <ty>* <arrayptr>{, uint <idx>}+    ; yields {ty}:result
      +  <result> = load <ty>* <structptr>{, ubyte <idx>}+     ; yields field type
       
      Overview:
      @@ -1055,8 +1027,11 @@ The 'load' instruction is used to read from memory.

      There are three forms of the 'load' instruction: one for reading from a general pointer, one for reading from a pointer to an array, and one for reading from a pointer to a structure.

      -In the first form, '<ty>' may be any pointer type. If it is a pointer to an array, the first (zeroth) element is read from). In the second form, '<ty>' must be a pointer to an array. No bounds checking is performed on array reads. In the third form, the pointer must point to a (possibly nested) structure. There shall be one ubyte argument for each level of dereferencing involved.

      +In the first form, '<ty>' must be a pointer to a simple type (a primitive type or another pointer).

      + +In the second form, '<ty>' must be a pointer to an array, and a list of one or more indices is provided as indexes into the (possibly multidimensional) array. No bounds checking is performed on array reads.

      +In the third form, the pointer must point to a (possibly nested) structure. There shall be one ubyte argument for each level of dereferencing involved.

      Semantics:
      ... @@ -1064,12 +1039,11 @@ In the first form, '<ty>' may be any pointer type. If it is a po
      Examples:
         %ptr = alloca int                               ; yields {int*}:ptr
      -         store int* %ptr, int 3                   ; yields {void}
      +  store int 3, int* %ptr                          ; yields {void}
         %val = load int* %ptr                           ; yields {int}:val = int 3
       
         %array = malloc [4 x ubyte]                     ; yields {[4 x ubyte]*}:array
      -           store [4 x ubyte]* %array, 
      -                 uint 4, ubyte 124
      +  store ubyte 124, [4 x ubyte]* %array, uint 4
         %val   = load [4 x ubyte]* %array, uint 4       ; yields {ubyte}:val = ubyte 124
         %val   = load {{int, float}}* %stptr, 0, 1      ; yields {float}:val
       
      @@ -1082,49 +1056,49 @@ In the first form, '<ty>' may be any pointer type. If it is a po
      Syntax:
      -  store <ty>* <pointer>, <ty> <value>              ; yields {void}
      -  store <ty>* <arrayptr>, uint <idx>, <ty> <value> ; yields {void}
      +  store <ty> <value>, <ty>* <pointer>                   ; yields {void}
      +  store <ty> <value>, <ty>* <arrayptr>{, uint <idx>}+   ; yields {void}
      +  store <ty> <value>, <ty>* <structptr>{, ubyte <idx>}+ ; yields {void}e
       
      Overview:
      The 'store' instruction is used to write to memory.

      -

      Arguments:
      -There are two forms of the 'store' instruction: one for writing through a general pointer, and one for writing through a pointer to an array.

      - -In the first form, '<ty>' may be any pointer type. If it is a pointer to an array, the first (zeroth) element is writen to). In the second form, '<ty>' must be a pointer to an array. No bounds checking is performed on array writes.

      +There are three forms of the 'store' instruction: one for writing through a general pointer, one for writing through a pointer to a (possibly multidimensional) array, and one for writing to an element of a (potentially nested) structure.

      +The semantics of this instruction closely match that of the load instruction, except that memory is written to, not read from.

      Semantics:
      ...
      Example:
      -  %ptr =   alloca int                              ; yields {int*}:ptr
      -           store int* %ptr, int 3                  ; yields {void}
      -  %val =   load int* %ptr                          ; yields {int}:val = int 3
      -
      -  %array = malloc [4 x ubyte]                      ; yields {[4 x ubyte]*}:array
      -           store [4 x ubyte]* %array, 
      -                 uint 4, ubyte 124
      -  %val   = load [4 x ubyte]* %array, uint 4        ; yields {ubyte}:val = ubyte 124
      +  %ptr = alloca int                               ; yields {int*}:ptr
      +  store int 3, int* %ptr                          ; yields {void}
      +  %val = load int* %ptr                           ; yields {int}:val = int 3
      +
      +  %array = malloc [4 x ubyte]                     ; yields {[4 x ubyte]*}:array
      +  store ubyte 124, [4 x ubyte]* %array, uint 4
      +  %val   = load [4 x ubyte]* %array, uint 4       ; yields {ubyte}:val = ubyte 124
      +  %val   = load {{int, float}}* %stptr, 0, 1      ; yields {float}:val
       
      -


      'getfieldptr' Instruction

        +


      'getelementptr' Instruction


      'cast .. to' Instruction


      'call' Instruction