emit_arm64_vector: Implement most IR insturctions

This commit is contained in:
Merry 2022-08-02 20:13:17 +01:00 committed by merry
parent 61d509dda2
commit 6306e3462e
2 changed files with 586 additions and 862 deletions

File diff suppressed because it is too large Load diff

View file

@ -37,6 +37,7 @@ struct HostLoc final {
}; };
enum RWType { enum RWType {
Void,
Read, Read,
Write, Write,
ReadWrite, ReadWrite,
@ -47,6 +48,7 @@ public:
using copyable_reference = std::reference_wrapper<Argument>; using copyable_reference = std::reference_wrapper<Argument>;
IR::Type GetType() const; IR::Type GetType() const;
bool IsVoid() const { return GetType() == IR::Type::Void; }
bool IsImmediate() const; bool IsImmediate() const;
bool GetImmediateU1() const; bool GetImmediateU1() const;
@ -104,6 +106,14 @@ public:
const T* operator->() const { return &reg.value(); } const T* operator->() const { return &reg.value(); }
~RAReg(); ~RAReg();
RAReg(RAReg&& other)
: reg_alloc{other.reg_alloc}
, rw{std::exchange(other.rw, RWType::Void)}
, read_value{std::exchange(other.read_value, {})}
, write_value{std::exchange(other.write_value, nullptr)}
, reg{std::exchange(other.reg, std::nullopt)} {
}
RAReg& operator=(RAReg&&) = delete;
private: private:
friend class RegAlloc; friend class RegAlloc;
@ -111,14 +121,12 @@ private:
RAReg(const RAReg&) = delete; RAReg(const RAReg&) = delete;
RAReg& operator=(const RAReg&) = delete; RAReg& operator=(const RAReg&) = delete;
RAReg(RAReg&&) = delete;
RAReg& operator=(RAReg&&) = delete;
void Realize(); void Realize();
RegAlloc& reg_alloc; RegAlloc& reg_alloc;
RWType rw; RWType rw;
const IR::Value read_value; IR::Value read_value;
const IR::Inst* write_value; const IR::Inst* write_value;
std::optional<T> reg; std::optional<T> reg;
}; };