backend/arm64/reg_alloc: Argument HostLoc location

This commit is contained in:
Merry 2022-07-22 20:53:41 +01:00 committed by merry
parent fe4e864e4c
commit 98806139a5
2 changed files with 10 additions and 0 deletions

View file

@ -71,6 +71,10 @@ IR::AccType Argument::GetImmediateAccType() const {
return value.GetAccType(); return value.GetAccType();
} }
HostLoc::Kind Argument::CurrentLocationKind() const {
return reg_alloc.ValueLocation(value.GetInst())->kind;
}
bool HostLocInfo::Contains(const IR::Inst* value) const { bool HostLocInfo::Contains(const IR::Inst* value) const {
return std::find(values.begin(), values.end(), value) != values.end(); return std::find(values.begin(), values.end(), value) != values.end();
} }

View file

@ -50,6 +50,11 @@ public:
IR::Cond GetImmediateCond() const; IR::Cond GetImmediateCond() const;
IR::AccType GetImmediateAccType() const; IR::AccType GetImmediateAccType() const;
// Only valid if not immediate
HostLoc::Kind CurrentLocationKind() const;
bool IsInGpr() const { return !IsImmediate() && CurrentLocationKind() == HostLoc::Kind::Gpr; }
bool IsInFpr() const { return !IsImmediate() && CurrentLocationKind() == HostLoc::Kind::Fpr; }
private: private:
friend class RegAlloc; friend class RegAlloc;
explicit Argument(RegAlloc& reg_alloc) explicit Argument(RegAlloc& reg_alloc)
@ -218,6 +223,7 @@ public:
void AssertNoMoreUses() const; void AssertNoMoreUses() const;
private: private:
friend struct Argument;
template<typename> template<typename>
friend struct RAReg; friend struct RAReg;