mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 12:50:00 +00:00
getelementptr uses long instead of uint indexes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4993 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bfbed6dbb2
commit
3dfa10b5d1
@ -490,7 +490,7 @@ declarations, and merges symbol table entries. Here is an example of the "hello
|
||||
<i>; Definition of main function</i>
|
||||
int "main"() { <i>; int()* </i>
|
||||
<i>; Convert [13x sbyte]* to sbyte *...</i>
|
||||
%cast210 = <a href="#i_getelementptr">getelementptr</a> [13 x sbyte]* %.LC0, uint 0, uint 0 <i>; sbyte*</i>
|
||||
%cast210 = <a href="#i_getelementptr">getelementptr</a> [13 x sbyte]* %.LC0, long 0, long 0 <i>; sbyte*</i>
|
||||
|
||||
<i>; Call puts function to write out the string to stdout...</i>
|
||||
<a href="#i_call">call</a> int %puts(sbyte* %cast210) <i>; int</i>
|
||||
@ -1401,7 +1401,7 @@ operand.<p>
|
||||
|
||||
<h5>Syntax:</h5>
|
||||
<pre>
|
||||
<result> = getelementptr <ty>* <ptrval>{, uint <aidx>|, ubyte <sidx>}*
|
||||
<result> = getelementptr <ty>* <ptrval>{, long <aidx>|, ubyte <sidx>}*
|
||||
</pre>
|
||||
|
||||
<h5>Overview:</h5>
|
||||
@ -1411,7 +1411,7 @@ subelement of an aggregate data structure.<p>
|
||||
|
||||
<h5>Arguments:</h5>
|
||||
|
||||
This instruction takes a list of <tt>uint</tt> values and <tt>ubyte</tt>
|
||||
This instruction takes a list of <tt>long</tt> values and <tt>ubyte</tt>
|
||||
constants that indicate what form of addressing to perform. The actual types of
|
||||
the arguments provided depend on the type of the first pointer argument. The
|
||||
'<tt>getelementptr</tt>' instruction is used to index down through the type
|
||||
@ -1444,7 +1444,7 @@ The LLVM code generated by the GCC frontend is:
|
||||
%ST = type { int, double, %RT }
|
||||
|
||||
int* "foo"(%ST* %s) {
|
||||
%reg = getelementptr %ST* %s, uint 1, ubyte 2, ubyte 1, uint 5, uint 13
|
||||
%reg = getelementptr %ST* %s, long 1, ubyte 2, ubyte 1, long 5, long 13
|
||||
ret int* %reg
|
||||
}
|
||||
</pre>
|
||||
@ -1453,7 +1453,7 @@ int* "foo"(%ST* %s) {
|
||||
|
||||
The index types specified for the '<tt>getelementptr</tt>' instruction depend on
|
||||
the pointer type that is being index into. <a href="t_pointer">Pointer</a> and
|
||||
<a href="t_array">array</a> types require '<tt>uint</tt>' values, and <a
|
||||
<a href="t_array">array</a> types require '<tt>long</tt>' values, and <a
|
||||
href="t_struct">structure</a> types require '<tt>ubyte</tt>'
|
||||
<b>constants</b>.<p>
|
||||
|
||||
@ -1473,11 +1473,11 @@ given testcase is equivalent to:<p>
|
||||
|
||||
<pre>
|
||||
int* "foo"(%ST* %s) {
|
||||
%t1 = getelementptr %ST* %s , uint 1 <i>; yields %ST*:%t1</i>
|
||||
%t2 = getelementptr %ST* %t1, uint 0, ubyte 2 <i>; yields %RT*:%t2</i>
|
||||
%t3 = getelementptr %RT* %t2, uint 0, ubyte 1 <i>; yields [10 x [20 x int]]*:%t3</i>
|
||||
%t4 = getelementptr [10 x [20 x int]]* %t3, uint 0, uint 5 <i>; yields [20 x int]*:%t4</i>
|
||||
%t5 = getelementptr [20 x int]* %t4, uint 0, uint 13 <i>; yields int*:%t5</i>
|
||||
%t1 = getelementptr %ST* %s , long 1 <i>; yields %ST*:%t1</i>
|
||||
%t2 = getelementptr %ST* %t1, long 0, ubyte 2 <i>; yields %RT*:%t2</i>
|
||||
%t3 = getelementptr %RT* %t2, long 0, ubyte 1 <i>; yields [10 x [20 x int]]*:%t3</i>
|
||||
%t4 = getelementptr [10 x [20 x int]]* %t3, long 0, long 5 <i>; yields [20 x int]*:%t4</i>
|
||||
%t5 = getelementptr [20 x int]* %t4, long 0, long 13 <i>; yields int*:%t5</i>
|
||||
ret int* %t5
|
||||
}
|
||||
</pre>
|
||||
@ -1487,7 +1487,7 @@ int* "foo"(%ST* %s) {
|
||||
<h5>Example:</h5>
|
||||
<pre>
|
||||
<i>; yields [12 x ubyte]*:aptr</i>
|
||||
%aptr = getelementptr {int, [12 x ubyte]}* %sptr, uint 0, ubyte 1
|
||||
%aptr = getelementptr {int, [12 x ubyte]}* %sptr, long 0, ubyte 1
|
||||
</pre>
|
||||
|
||||
|
||||
@ -1706,7 +1706,7 @@ more...
|
||||
<address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
|
||||
<!-- Created: Tue Jan 23 15:19:28 CST 2001 -->
|
||||
<!-- hhmts start -->
|
||||
Last modified: Mon Nov 4 18:20:38 CST 2002
|
||||
Last modified: Fri Dec 13 00:00:57 CST 2002
|
||||
<!-- hhmts end -->
|
||||
</font>
|
||||
</body></html>
|
||||
|
Loading…
Reference in New Issue
Block a user