| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// | 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 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 /// \file | 10 /// \file |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 createGotPtr(); | 1025 createGotPtr(); |
| 1026 } | 1026 } |
| 1027 genTargetHelperCalls(); | 1027 genTargetHelperCalls(); |
| 1028 findMaxStackOutArgsSize(); | 1028 findMaxStackOutArgsSize(); |
| 1029 | 1029 |
| 1030 // Do not merge Alloca instructions, and lay out the stack. | 1030 // Do not merge Alloca instructions, and lay out the stack. |
| 1031 static constexpr bool SortAndCombineAllocas = true; | 1031 static constexpr bool SortAndCombineAllocas = true; |
| 1032 Func->processAllocas(SortAndCombineAllocas); | 1032 Func->processAllocas(SortAndCombineAllocas); |
| 1033 Func->dump("After Alloca processing"); | 1033 Func->dump("After Alloca processing"); |
| 1034 | 1034 |
| 1035 if (!Ctx->getFlags().getPhiEdgeSplit()) { | 1035 if (!Ctx->getFlags().getEnablePhiEdgeSplit()) { |
| 1036 // Lower Phi instructions. | 1036 // Lower Phi instructions. |
| 1037 Func->placePhiLoads(); | 1037 Func->placePhiLoads(); |
| 1038 if (Func->hasError()) | 1038 if (Func->hasError()) |
| 1039 return; | 1039 return; |
| 1040 Func->placePhiStores(); | 1040 Func->placePhiStores(); |
| 1041 if (Func->hasError()) | 1041 if (Func->hasError()) |
| 1042 return; | 1042 return; |
| 1043 Func->deletePhis(); | 1043 Func->deletePhis(); |
| 1044 if (Func->hasError()) | 1044 if (Func->hasError()) |
| 1045 return; | 1045 return; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 // cleanup, to make the dump cleaner and more useful. | 1093 // cleanup, to make the dump cleaner and more useful. |
| 1094 Func->dump("After initial ARM32 codegen"); | 1094 Func->dump("After initial ARM32 codegen"); |
| 1095 Func->getVMetadata()->init(VMK_All); | 1095 Func->getVMetadata()->init(VMK_All); |
| 1096 regAlloc(RAK_Global); | 1096 regAlloc(RAK_Global); |
| 1097 if (Func->hasError()) | 1097 if (Func->hasError()) |
| 1098 return; | 1098 return; |
| 1099 | 1099 |
| 1100 copyRegAllocFromInfWeightVariable64On32(Func->getVariables()); | 1100 copyRegAllocFromInfWeightVariable64On32(Func->getVariables()); |
| 1101 Func->dump("After linear scan regalloc"); | 1101 Func->dump("After linear scan regalloc"); |
| 1102 | 1102 |
| 1103 if (Ctx->getFlags().getPhiEdgeSplit()) { | 1103 if (Ctx->getFlags().getEnablePhiEdgeSplit()) { |
| 1104 Func->advancedPhiLowering(); | 1104 Func->advancedPhiLowering(); |
| 1105 Func->dump("After advanced Phi lowering"); | 1105 Func->dump("After advanced Phi lowering"); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 ForbidTemporaryWithoutReg _(this); | 1108 ForbidTemporaryWithoutReg _(this); |
| 1109 | 1109 |
| 1110 // Stack frame mapping. | 1110 // Stack frame mapping. |
| 1111 Func->genFrame(); | 1111 Func->genFrame(); |
| 1112 if (Func->hasError()) | 1112 if (Func->hasError()) |
| 1113 return; | 1113 return; |
| 1114 Func->dump("After stack frame mapping"); | 1114 Func->dump("After stack frame mapping"); |
| 1115 | 1115 |
| 1116 postLowerLegalization(); | 1116 postLowerLegalization(); |
| 1117 if (Func->hasError()) | 1117 if (Func->hasError()) |
| 1118 return; | 1118 return; |
| 1119 Func->dump("After postLowerLegalization"); | 1119 Func->dump("After postLowerLegalization"); |
| 1120 | 1120 |
| 1121 Func->contractEmptyNodes(); | 1121 Func->contractEmptyNodes(); |
| 1122 Func->reorderNodes(); | 1122 Func->reorderNodes(); |
| 1123 | 1123 |
| 1124 // Branch optimization. This needs to be done just before code emission. In | 1124 // Branch optimization. This needs to be done just before code emission. In |
| 1125 // particular, no transformations that insert or reorder CfgNodes should be | 1125 // particular, no transformations that insert or reorder CfgNodes should be |
| 1126 // done after branch optimization. We go ahead and do it before nop insertion | 1126 // done after branch optimization. We go ahead and do it before nop insertion |
| 1127 // to reduce the amount of work needed for searching for opportunities. | 1127 // to reduce the amount of work needed for searching for opportunities. |
| 1128 Func->doBranchOpt(); | 1128 Func->doBranchOpt(); |
| 1129 Func->dump("After branch optimization"); | 1129 Func->dump("After branch optimization"); |
| 1130 | 1130 |
| 1131 // Nop insertion | 1131 // Nop insertion |
| 1132 if (Ctx->getFlags().shouldDoNopInsertion()) { | 1132 if (Ctx->getFlags().getShouldDoNopInsertion()) { |
| 1133 Func->doNopInsertion(); | 1133 Func->doNopInsertion(); |
| 1134 } | 1134 } |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 void TargetARM32::translateOm1() { | 1137 void TargetARM32::translateOm1() { |
| 1138 TimerMarker T(TimerStack::TT_Om1, Func); | 1138 TimerMarker T(TimerStack::TT_Om1, Func); |
| 1139 | 1139 |
| 1140 // TODO(stichnot): share passes with other targets? | 1140 // TODO(stichnot): share passes with other targets? |
| 1141 if (SandboxingType == ST_Nonsfi) { | 1141 if (SandboxingType == ST_Nonsfi) { |
| 1142 createGotPtr(); | 1142 createGotPtr(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 if (Func->hasError()) | 1184 if (Func->hasError()) |
| 1185 return; | 1185 return; |
| 1186 Func->dump("After stack frame mapping"); | 1186 Func->dump("After stack frame mapping"); |
| 1187 | 1187 |
| 1188 postLowerLegalization(); | 1188 postLowerLegalization(); |
| 1189 if (Func->hasError()) | 1189 if (Func->hasError()) |
| 1190 return; | 1190 return; |
| 1191 Func->dump("After postLowerLegalization"); | 1191 Func->dump("After postLowerLegalization"); |
| 1192 | 1192 |
| 1193 // Nop insertion | 1193 // Nop insertion |
| 1194 if (Ctx->getFlags().shouldDoNopInsertion()) { | 1194 if (Ctx->getFlags().getShouldDoNopInsertion()) { |
| 1195 Func->doNopInsertion(); | 1195 Func->doNopInsertion(); |
| 1196 } | 1196 } |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 uint32_t TargetARM32::getStackAlignment() const { | 1199 uint32_t TargetARM32::getStackAlignment() const { |
| 1200 return ARM32_STACK_ALIGNMENT_BYTES; | 1200 return ARM32_STACK_ALIGNMENT_BYTES; |
| 1201 } | 1201 } |
| 1202 | 1202 |
| 1203 bool TargetARM32::doBranchOpt(Inst *I, const CfgNode *NextNode) { | 1203 bool TargetARM32::doBranchOpt(Inst *I, const CfgNode *NextNode) { |
| 1204 if (auto *Br = llvm::dyn_cast<InstARM32Br>(I)) { | 1204 if (auto *Br = llvm::dyn_cast<InstARM32Br>(I)) { |
| (...skipping 5591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6796 static constexpr size_t MinimumAlignment = 4; | 6796 static constexpr size_t MinimumAlignment = 4; |
| 6797 SizeT Align = std::max(MinimumAlignment, typeAlignInBytes(Traits::IceType)); | 6797 SizeT Align = std::max(MinimumAlignment, typeAlignInBytes(Traits::IceType)); |
| 6798 assert((Align % 4) == 0 && "Constants should be aligned"); | 6798 assert((Align % 4) == 0 && "Constants should be aligned"); |
| 6799 Ostream &Str = Ctx->getStrEmit(); | 6799 Ostream &Str = Ctx->getStrEmit(); |
| 6800 ConstantList Pool = Ctx->getConstantPool(Traits::IceType); | 6800 ConstantList Pool = Ctx->getConstantPool(Traits::IceType); |
| 6801 | 6801 |
| 6802 Str << "\t.section\t.rodata.cst" << Align << ",\"aM\",%progbits," << Align | 6802 Str << "\t.section\t.rodata.cst" << Align << ",\"aM\",%progbits," << Align |
| 6803 << "\n" | 6803 << "\n" |
| 6804 << "\t.align\t" << Align << "\n"; | 6804 << "\t.align\t" << Align << "\n"; |
| 6805 | 6805 |
| 6806 if (Ctx->getFlags().shouldReorderPooledConstants()) { | 6806 if (Ctx->getFlags().getReorderPooledConstants()) { |
| 6807 // TODO(jpp): add constant pooling. | 6807 // TODO(jpp): add constant pooling. |
| 6808 UnimplementedError(Ctx->getFlags()); | 6808 UnimplementedError(Ctx->getFlags()); |
| 6809 } | 6809 } |
| 6810 | 6810 |
| 6811 for (Constant *C : Pool) { | 6811 for (Constant *C : Pool) { |
| 6812 if (!C->getShouldBePooled()) { | 6812 if (!C->getShouldBePooled()) { |
| 6813 continue; | 6813 continue; |
| 6814 } | 6814 } |
| 6815 | 6815 |
| 6816 emitConstant<T>(Str, llvm::dyn_cast<typename Traits::ConstantType>(C)); | 6816 emitConstant<T>(Str, llvm::dyn_cast<typename Traits::ConstantType>(C)); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6904 // However, for compatibility with current NaCl LLVM, don't claim that. | 6904 // However, for compatibility with current NaCl LLVM, don't claim that. |
| 6905 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; | 6905 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
| 6906 } | 6906 } |
| 6907 | 6907 |
| 6908 SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; | 6908 SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; |
| 6909 SmallBitVector TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; | 6909 SmallBitVector TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; |
| 6910 SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; | 6910 SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; |
| 6911 | 6911 |
| 6912 } // end of namespace ARM32 | 6912 } // end of namespace ARM32 |
| 6913 } // end of namespace Ice | 6913 } // end of namespace Ice |
| OLD | NEW |