Skip to content

Commit 28b91fe

Browse files
igorban-inteligcbot
authored andcommitted
Refactor current VisaRegalloc and corresponding CisaBuilder-calls
* VisaRegalloc::getSigned must be constant * VisaRegalloc::getRegForValue method not really needed
1 parent d00c640 commit 28b91fe

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4248,8 +4248,8 @@ GenXKernelBuilder::getRegForValueOrNullAndSaveAlias(Args &&... args) {
42484248
*/
42494249
template <typename... Args>
42504250
GenXKernelBuilder::Register *
4251-
GenXKernelBuilder::getRegForValueAndSaveAlias(Args &&... args) {
4252-
Register *R = RegAlloc->getRegForValue(std::forward<Args>(args)...);
4251+
GenXKernelBuilder::getRegForValueAndSaveAlias(Args &&...args) {
4252+
Register *R = RegAlloc->getOrCreateRegForValue(std::forward<Args>(args)...);
42534253
SimpleValue SV = std::get<0>(std::make_tuple(args...));
42544254
IGC_ASSERT_MESSAGE(R, "getRegForValue must return non-nullptr register");
42554255
LastUsedAliasMap[SV.getValue()] = R;

IGC/VectorCompiler/lib/GenXCodeGen/GenXVisaRegAlloc.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,7 @@ GenXVisaRegAlloc::getOrCreateRegForValue(SimpleValue V, Signedness Signed,
792792
* different signedness between source and destination can make the jitter
793793
* generate less efficient code.
794794
*/
795-
genx::Signedness GenXVisaRegAlloc::getSigned(Reg* R)
796-
{
795+
genx::Signedness GenXVisaRegAlloc::getSigned(const Reg *R) const {
797796
return (R && R->Category == vc::RegCategory::General) ? R->Signed
798797
: DONTCARESIGNED;
799798
}

IGC/VectorCompiler/lib/GenXCodeGen/GenXVisaRegAlloc.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,6 @@ namespace llvm {
186186
std::list<Reg>& getRegStorage() {
187187
return RegStorage;
188188
}
189-
// Get the vISA virtual register for a value (assertion failure if none).
190-
Reg *getRegForValue(genx::SimpleValue V,
191-
genx::Signedness Signed = genx::DONTCARESIGNED,
192-
Type *OverrideType = nullptr, bool IsBF = false) {
193-
Reg *R = getOrCreateRegForValue(V, Signed, OverrideType, IsBF);
194-
IGC_ASSERT_MESSAGE(R, "no register allocated for this value");
195-
return R;
196-
}
197189
// Get the vISA virtual register for a value or nullptr if there is no
198190
// register associated with given value.
199191
Reg *getRegForValueOrNull(genx::SimpleValue V,
@@ -213,7 +205,7 @@ namespace llvm {
213205
Reg *getRegForValueUntyped(genx::SimpleValue V) const;
214206

215207
// Get the signedness of a register.
216-
genx::Signedness getSigned(Reg* R);
208+
genx::Signedness getSigned(const Reg *R) const;
217209

218210
// Set callback that will be called each time new register is created.
219211
// It is used in CisaBuilder when new aliases are created.

0 commit comments

Comments
 (0)