OLD | NEW |
1 //===-- PNaClABISimplify.cpp - Lists PNaCl ABI simplification passes ------===// | 1 //===-- PNaClABISimplify.cpp - Lists PNaCl ABI simplification passes ------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the meta-passes "-pnacl-abi-simplify-preopt" | 10 // This file implements the meta-passes "-pnacl-abi-simplify-preopt" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // atomics: a ``fence seq_cst`` surrounded by ``asm("":::"memory")`` | 144 // atomics: a ``fence seq_cst`` surrounded by ``asm("":::"memory")`` |
145 // has special meaning and is translated differently. | 145 // has special meaning and is translated differently. |
146 PM.add(createRemoveAsmMemoryPass()); | 146 PM.add(createRemoveAsmMemoryPass()); |
147 | 147 |
148 PM.add(createSimplifyAllocasPass()); | 148 PM.add(createSimplifyAllocasPass()); |
149 | 149 |
150 // ReplacePtrsWithInts assumes that getelementptr instructions and | 150 // ReplacePtrsWithInts assumes that getelementptr instructions and |
151 // ConstantExprs have already been expanded out. | 151 // ConstantExprs have already been expanded out. |
152 PM.add(createReplacePtrsWithIntsPass()); | 152 PM.add(createReplacePtrsWithIntsPass()); |
153 | 153 |
| 154 // Convert struct reg function params to struct* byval |
| 155 PM.add(createSimplifyStructRegSignaturesPass()); |
| 156 |
154 // The atomic cmpxchg instruction returns a struct, and is rewritten to an | 157 // The atomic cmpxchg instruction returns a struct, and is rewritten to an |
155 // intrinsic as a post-opt pass, we therefore need to expand struct regs one | 158 // intrinsic as a post-opt pass, we therefore need to expand struct regs one |
156 // last time. | 159 // last time. |
157 PM.add(createExpandStructRegsPass()); | 160 PM.add(createExpandStructRegsPass()); |
158 | 161 |
159 // We place StripAttributes after optimization passes because many | 162 // We place StripAttributes after optimization passes because many |
160 // analyses add attributes to reflect their results. | 163 // analyses add attributes to reflect their results. |
161 // StripAttributes must come after ExpandByVal and | 164 // StripAttributes must come after ExpandByVal and |
162 // ExpandSmallArguments. | 165 // ExpandSmallArguments. |
163 PM.add(createStripAttributesPass()); | 166 PM.add(createStripAttributesPass()); |
164 | 167 |
165 // Strip dead prototytes to appease the intrinsic ABI checks. | 168 // Strip dead prototytes to appease the intrinsic ABI checks. |
166 // ExpandVarArgs leaves around vararg intrinsics, and | 169 // ExpandVarArgs leaves around vararg intrinsics, and |
167 // ReplacePtrsWithInts leaves the lifetime.start/end intrinsics. | 170 // ReplacePtrsWithInts leaves the lifetime.start/end intrinsics. |
168 PM.add(createStripDeadPrototypesPass()); | 171 PM.add(createStripDeadPrototypesPass()); |
169 | 172 |
170 // Eliminate simple dead code that the post-opt passes could have | 173 // Eliminate simple dead code that the post-opt passes could have |
171 // created. | 174 // created. |
172 PM.add(createDeadInstEliminationPass()); | 175 PM.add(createDeadInstEliminationPass()); |
173 PM.add(createDeadCodeEliminationPass()); | 176 PM.add(createDeadCodeEliminationPass()); |
174 } | 177 } |
OLD | NEW |