value: Add GetInstRecursive

This commit is contained in:
MerryMage 2020-04-20 16:15:02 +01:00
parent 976edaf2d2
commit 93adcfa5c6
2 changed files with 8 additions and 0 deletions

View file

@ -110,6 +110,13 @@ Inst* Value::GetInst() const {
return inner.inst;
}
Inst* Value::GetInstRecursive() const {
ASSERT(type == Type::Opaque);
if (IsIdentity())
return inner.inst->GetArg(0).GetInstRecursive();
return inner.inst;
}
bool Value::GetU1() const {
if (IsIdentity())
return inner.inst->GetArg(0).GetU1();

View file

@ -55,6 +55,7 @@ public:
Type GetType() const;
Inst* GetInst() const;
Inst* GetInstRecursive() const;
A32::Reg GetA32RegRef() const;
A32::ExtReg GetA32ExtRegRef() const;
A64::Reg GetA64RegRef() const;