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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Expand out computed gotos (indirectbr and blockaddresses) into switches. | 50 // Expand out computed gotos (indirectbr and blockaddresses) into switches. |
51 PM.add(createExpandIndirectBrPass()); | 51 PM.add(createExpandIndirectBrPass()); |
52 | 52 |
53 // LowerExpect converts Intrinsic::expect into branch weights, | 53 // LowerExpect converts Intrinsic::expect into branch weights, |
54 // which can then be removed after BlockPlacement. | 54 // which can then be removed after BlockPlacement. |
55 PM.add(createLowerExpectIntrinsicPass()); | 55 PM.add(createLowerExpectIntrinsicPass()); |
56 // Rewrite unsupported intrinsics to simpler and portable constructs. | 56 // Rewrite unsupported intrinsics to simpler and portable constructs. |
57 PM.add(createRewriteLLVMIntrinsicsPass()); | 57 PM.add(createRewriteLLVMIntrinsicsPass()); |
58 | 58 |
59 // Expand out some uses of struct types. | 59 // Expand out some uses of struct types. |
| 60 PM.add(createExpandVarArgsPass()); |
60 PM.add(createExpandArithWithOverflowPass()); | 61 PM.add(createExpandArithWithOverflowPass()); |
61 // ExpandStructRegs must be run after ExpandArithWithOverflow to | 62 // ExpandStructRegs must be run after ExpandArithWithOverflow to |
62 // expand out the insertvalue instructions that | 63 // expand out the insertvalue instructions that |
63 // ExpandArithWithOverflow introduces. | 64 // ExpandArithWithOverflow introduces. ExpandStructRegs must be run |
| 65 // after ExpandVarArgs so that struct-typed "va_arg" instructions |
| 66 // have been removed. |
64 PM.add(createExpandStructRegsPass()); | 67 PM.add(createExpandStructRegsPass()); |
65 | 68 |
66 PM.add(createExpandVarArgsPass()); | |
67 PM.add(createExpandCtorsPass()); | 69 PM.add(createExpandCtorsPass()); |
68 PM.add(createResolveAliasesPass()); | 70 PM.add(createResolveAliasesPass()); |
69 PM.add(createExpandTlsPass()); | 71 PM.add(createExpandTlsPass()); |
70 // GlobalCleanup needs to run after ExpandTls because | 72 // GlobalCleanup needs to run after ExpandTls because |
71 // __tls_template_start etc. are extern_weak before expansion | 73 // __tls_template_start etc. are extern_weak before expansion |
72 PM.add(createGlobalCleanupPass()); | 74 PM.add(createGlobalCleanupPass()); |
73 } | 75 } |
74 | 76 |
75 void llvm::PNaClABISimplifyAddPostOptPasses(PassManager &PM) { | 77 void llvm::PNaClABISimplifyAddPostOptPasses(PassManager &PM) { |
76 PM.add(createRewritePNaClLibraryCallsPass()); | 78 PM.add(createRewritePNaClLibraryCallsPass()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Strip dead prototytes to appease the intrinsic ABI checks. | 133 // Strip dead prototytes to appease the intrinsic ABI checks. |
132 // ExpandVarArgs leaves around vararg intrinsics, and | 134 // ExpandVarArgs leaves around vararg intrinsics, and |
133 // ReplacePtrsWithInts leaves the lifetime.start/end intrinsics. | 135 // ReplacePtrsWithInts leaves the lifetime.start/end intrinsics. |
134 PM.add(createStripDeadPrototypesPass()); | 136 PM.add(createStripDeadPrototypesPass()); |
135 | 137 |
136 // Eliminate simple dead code that the post-opt passes could have | 138 // Eliminate simple dead code that the post-opt passes could have |
137 // created. | 139 // created. |
138 PM.add(createDeadInstEliminationPass()); | 140 PM.add(createDeadInstEliminationPass()); |
139 PM.add(createDeadCodeEliminationPass()); | 141 PM.add(createDeadCodeEliminationPass()); |
140 } | 142 } |
OLD | NEW |