OLD | NEW |
1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// |
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 Variable *LoweringContext::availabilityGet(Operand *Src) const { | 112 Variable *LoweringContext::availabilityGet(Operand *Src) const { |
113 assert(Src); | 113 assert(Src); |
114 if (Src == LastDest) | 114 if (Src == LastDest) |
115 return LastSrc; | 115 return LastSrc; |
116 return nullptr; | 116 return nullptr; |
117 } | 117 } |
118 | 118 |
119 namespace { | 119 namespace { |
120 | 120 |
121 void printRegisterSet(Ostream &Str, const llvm::SmallBitVector &Bitset, | 121 void printRegisterSet(Ostream &Str, const llvm::SmallBitVector &Bitset, |
122 std::function<IceString(int32_t)> getRegName, | 122 std::function<IceString(RegNumT)> getRegName, |
123 const IceString &LineIndentString) { | 123 const IceString &LineIndentString) { |
124 constexpr size_t RegistersPerLine = 16; | 124 constexpr size_t RegistersPerLine = 16; |
125 size_t Count = 0; | 125 size_t Count = 0; |
126 for (int i = Bitset.find_first(); i != -1; i = Bitset.find_next(i)) { | 126 for (int i = Bitset.find_first(); i != -1; i = Bitset.find_next(i)) { |
127 if (Count == 0) { | 127 if (Count == 0) { |
128 Str << LineIndentString; | 128 Str << LineIndentString; |
129 } else { | 129 } else { |
130 Str << ","; | 130 Str << ","; |
131 } | 131 } |
132 if (Count > 0 && Count % RegistersPerLine == 0) | 132 if (Count > 0 && Count % RegistersPerLine == 0) |
(...skipping 19 matching lines...) Expand all Loading... |
152 *SplitRegClass = RegName.substr(0, Pos); | 152 *SplitRegClass = RegName.substr(0, Pos); |
153 *SplitRegName = RegName.substr(Pos + SeparatorWidth); | 153 *SplitRegName = RegName.substr(Pos + SeparatorWidth); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 } // end of anonymous namespace | 157 } // end of anonymous namespace |
158 | 158 |
159 void TargetLowering::filterTypeToRegisterSet( | 159 void TargetLowering::filterTypeToRegisterSet( |
160 GlobalContext *Ctx, int32_t NumRegs, | 160 GlobalContext *Ctx, int32_t NumRegs, |
161 llvm::SmallBitVector TypeToRegisterSet[], size_t TypeToRegisterSetSize, | 161 llvm::SmallBitVector TypeToRegisterSet[], size_t TypeToRegisterSetSize, |
162 std::function<IceString(int32_t)> getRegName, | 162 std::function<IceString(RegNumT)> getRegName, |
163 std::function<IceString(RegClass)> getRegClassName) { | 163 std::function<IceString(RegClass)> getRegClassName) { |
164 std::vector<llvm::SmallBitVector> UseSet(TypeToRegisterSetSize, | 164 std::vector<llvm::SmallBitVector> UseSet(TypeToRegisterSetSize, |
165 llvm::SmallBitVector(NumRegs)); | 165 llvm::SmallBitVector(NumRegs)); |
166 std::vector<llvm::SmallBitVector> ExcludeSet(TypeToRegisterSetSize, | 166 std::vector<llvm::SmallBitVector> ExcludeSet(TypeToRegisterSetSize, |
167 llvm::SmallBitVector(NumRegs)); | 167 llvm::SmallBitVector(NumRegs)); |
168 | 168 |
169 std::unordered_map<IceString, int32_t> RegNameToIndex; | 169 std::unordered_map<IceString, RegNumT> RegNameToIndex; |
170 for (int32_t RegIndex = 0; RegIndex < NumRegs; ++RegIndex) | 170 for (int32_t RegIndex = 0; RegIndex < NumRegs; ++RegIndex) |
171 RegNameToIndex[getRegName(RegIndex)] = RegIndex; | 171 RegNameToIndex[getRegName(RegIndex)] = RegIndex; |
172 | 172 |
173 ClFlags::StringVector BadRegNames; | 173 ClFlags::StringVector BadRegNames; |
174 | 174 |
175 // The processRegList function iterates across the RegNames vector. Each | 175 // The processRegList function iterates across the RegNames vector. Each |
176 // entry in the vector is a string of the form "<reg>" or "<class>:<reg>". | 176 // entry in the vector is a string of the form "<reg>" or "<class>:<reg>". |
177 // The register class and register number are computed, and the corresponding | 177 // The register class and register number are computed, and the corresponding |
178 // bit is set in RegSet[][]. If "<class>:" is missing, then the bit is set | 178 // bit is set in RegSet[][]. If "<class>:" is missing, then the bit is set |
179 // for all classes. | 179 // for all classes. |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 case Target_##X: \ | 863 case Target_##X: \ |
864 return ::X::createTargetHeaderLowering(Ctx); | 864 return ::X::createTargetHeaderLowering(Ctx); |
865 #include "llvm/Config/SZTargets.def" | 865 #include "llvm/Config/SZTargets.def" |
866 #undef SUBZERO_TARGET | 866 #undef SUBZERO_TARGET |
867 } | 867 } |
868 } | 868 } |
869 | 869 |
870 TargetHeaderLowering::~TargetHeaderLowering() = default; | 870 TargetHeaderLowering::~TargetHeaderLowering() = default; |
871 | 871 |
872 } // end of namespace Ice | 872 } // end of namespace Ice |
OLD | NEW |