llvm.org GIT mirror llvm / 02e2d22
[DOC] Fix `load` instructions' syntax, function definition. Summary: In this patch, I updated `load` instruction syntax and fixed function definition. Besides, I re-named some variables to make them obey SSA rule. Reviewers: MaskRay Reviewed By: MaskRay Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63186 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363142 91177308-0d34-0410-b5e6-96231b3b80d8 Xing GUO a month ago
1 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
7373 P[0].f1 = P[1].f1 + P[2].f2;
7474 }
7575 ...
76 munger_struct Array[3];
76 struct munger_struct Array[3];
7777 ...
7878 munge(Array);
7979
8787
8888 .. code-block:: llvm
8989
90 void %munge(%struct.munger_struct* %P) {
90 define void @munge(%struct.munger_struct* %P) {
9191 entry:
9292 %tmp = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 1, i32 0
93 %tmp = load i32* %tmp
94 %tmp6 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 2, i32 1
95 %tmp7 = load i32* %tmp6
96 %tmp8 = add i32 %tmp7, %tmp
97 %tmp9 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 0, i32 0
98 store i32 %tmp8, i32* %tmp9
93 %tmp1 = load i32, i32* %tmp
94 %tmp2 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 2, i32 1
95 %tmp3 = load i32, i32* %tmp2
96 %tmp4 = add i32 %tmp3, %tmp1
97 %tmp5 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 0, i32 0
98 store i32 %tmp4, i32* %tmp5
9999 ret void
100100 }
101101
198198 .. code-block:: text
199199
200200 %idx = getelementptr { [40 x i32]* }, { [40 x i32]* }* %, i64 0, i32 0
201 %arr = load [40 x i32]** %idx
201 %arr = load [40 x i32]*, [40 x i32]** %idx
202202 %idx = getelementptr [40 x i32], [40 x i32]* %arr, i64 0, i64 17
203203
204204 In this case, we have to load the pointer in the structure with a load