| OLD | NEW |
| 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// | 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// |
| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 typename ValueType::PrimType V1 = llvm::cast<ValueType>(Const1)->getValue(); | 103 typename ValueType::PrimType V1 = llvm::cast<ValueType>(Const1)->getValue(); |
| 104 typename ValueType::PrimType V2 = llvm::cast<ValueType>(Const2)->getValue(); | 104 typename ValueType::PrimType V2 = llvm::cast<ValueType>(Const2)->getValue(); |
| 105 return V1 < V2; | 105 return V1 < V2; |
| 106 } | 106 } |
| 107 }; | 107 }; |
| 108 template <typename ValueType> | 108 template <typename ValueType> |
| 109 struct KeyCompareLess< | 109 struct KeyCompareLess< |
| 110 ValueType, typename std::enable_if< | 110 ValueType, typename std::enable_if< |
| 111 std::is_same<ValueType, ConstantRelocatable>::value>::type> { | 111 std::is_same<ValueType, ConstantRelocatable>::value>::type> { |
| 112 bool operator()(const Constant *Const1, const Constant *Const2) const { | 112 bool operator()(const Constant *Const1, const Constant *Const2) const { |
| 113 auto V1 = llvm::cast<ValueType>(Const1); | 113 auto *V1 = llvm::cast<ValueType>(Const1); |
| 114 auto V2 = llvm::cast<ValueType>(Const2); | 114 auto *V2 = llvm::cast<ValueType>(Const2); |
| 115 if (V1->getName() == V2->getName()) | 115 if (V1->getName() == V2->getName()) |
| 116 return V1->getOffset() < V2->getOffset(); | 116 return V1->getOffset() < V2->getOffset(); |
| 117 return V1->getName() < V2->getName(); | 117 return V1->getName() < V2->getName(); |
| 118 } | 118 } |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 // TypePool maps constants of type KeyType (e.g. float) to pointers to | 121 // TypePool maps constants of type KeyType (e.g. float) to pointers to |
| 122 // type ValueType (e.g. ConstantFloat). | 122 // type ValueType (e.g. ConstantFloat). |
| 123 template <Type Ty, typename KeyType, typename ValueType> class TypePool { | 123 template <Type Ty, typename KeyType, typename ValueType> class TypePool { |
| 124 TypePool(const TypePool &) = delete; | 124 TypePool(const TypePool &) = delete; |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 Asm->alignFunction(); | 512 Asm->alignFunction(); |
| 513 IceString MangledName = mangleName(Asm->getFunctionName()); | 513 IceString MangledName = mangleName(Asm->getFunctionName()); |
| 514 switch (getFlags().getOutFileType()) { | 514 switch (getFlags().getOutFileType()) { |
| 515 case FT_Elf: | 515 case FT_Elf: |
| 516 getObjectWriter()->writeFunctionCode(MangledName, Asm->getInternal(), | 516 getObjectWriter()->writeFunctionCode(MangledName, Asm->getInternal(), |
| 517 Asm.get()); | 517 Asm.get()); |
| 518 break; | 518 break; |
| 519 case FT_Iasm: { | 519 case FT_Iasm: { |
| 520 OstreamLocker L(this); | 520 OstreamLocker L(this); |
| 521 Cfg::emitTextHeader(MangledName, this, Asm.get()); | 521 Cfg::emitTextHeader(MangledName, this, Asm.get()); |
| 522 Asm->emitIASBytes(); | 522 Asm->emitIASBytes(this); |
| 523 } break; | 523 } break; |
| 524 case FT_Asm: | 524 case FT_Asm: |
| 525 llvm::report_fatal_error("Unexpected FT_Asm"); | 525 llvm::report_fatal_error("Unexpected FT_Asm"); |
| 526 break; | 526 break; |
| 527 } | 527 } |
| 528 } break; | 528 } break; |
| 529 case EmitterWorkItem::WI_Cfg: { | 529 case EmitterWorkItem::WI_Cfg: { |
| 530 if (!BuildDefs::dump()) | 530 if (!BuildDefs::dump()) |
| 531 llvm::report_fatal_error("WI_Cfg work item created inappropriately"); | 531 llvm::report_fatal_error("WI_Cfg work item created inappropriately"); |
| 532 lowerGlobalsIfNoCodeHasBeenSeen(); | 532 lowerGlobalsIfNoCodeHasBeenSeen(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 } | 776 } |
| 777 | 777 |
| 778 Constant *GlobalContext::getConstantSym(RelocOffsetT Offset, | 778 Constant *GlobalContext::getConstantSym(RelocOffsetT Offset, |
| 779 const IceString &Name, | 779 const IceString &Name, |
| 780 bool SuppressMangling) { | 780 bool SuppressMangling) { |
| 781 return getConstPool()->Relocatables.getOrAdd( | 781 return getConstPool()->Relocatables.getOrAdd( |
| 782 this, RelocatableTuple(Offset, Name, SuppressMangling)); | 782 this, RelocatableTuple(Offset, Name, SuppressMangling)); |
| 783 } | 783 } |
| 784 | 784 |
| 785 Constant *GlobalContext::getConstantExternSym(const IceString &Name) { | 785 Constant *GlobalContext::getConstantExternSym(const IceString &Name) { |
| 786 const RelocOffsetT Offset = 0; | 786 constexpr RelocOffsetT Offset = 0; |
| 787 const bool SuppressMangling = true; | 787 constexpr bool SuppressMangling = true; |
| 788 return getConstPool()->ExternRelocatables.getOrAdd( | 788 return getConstPool()->ExternRelocatables.getOrAdd( |
| 789 this, RelocatableTuple(Offset, Name, SuppressMangling)); | 789 this, RelocatableTuple(Offset, Name, SuppressMangling)); |
| 790 } | 790 } |
| 791 | 791 |
| 792 Constant *GlobalContext::getConstantUndef(Type Ty) { | 792 Constant *GlobalContext::getConstantUndef(Type Ty) { |
| 793 return getConstPool()->Undefs.getOrAdd(this, Ty); | 793 return getConstPool()->Undefs.getOrAdd(this, Ty); |
| 794 } | 794 } |
| 795 | 795 |
| 796 // All locking is done by the getConstant*() target function. | 796 // All locking is done by the getConstant*() target function. |
| 797 Constant *GlobalContext::getConstantZero(Type Ty) { | 797 Constant *GlobalContext::getConstantZero(Type Ty) { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 Ctx = Func->getContext(); | 1005 Ctx = Func->getContext(); |
| 1006 Active = | 1006 Active = |
| 1007 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); | 1007 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); |
| 1008 if (Active) | 1008 if (Active) |
| 1009 Ctx->pushTimer(ID, StackID); | 1009 Ctx->pushTimer(ID, StackID); |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1012 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
| 1013 | 1013 |
| 1014 } // end of namespace Ice | 1014 } // end of namespace Ice |
| OLD | NEW |