| Index: src/IceTargetLowering.cpp
|
| diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
|
| index eb4a54d4fb7ea915198113554503fa6178ba361b..9a8a02ab9ed504efbe3652ca78ae16d2bcfaf6ba 100644
|
| --- a/src/IceTargetLowering.cpp
|
| +++ b/src/IceTargetLowering.cpp
|
| @@ -46,6 +46,7 @@ void LoweringContext::rewind() {
|
| Cur = Begin;
|
| skipDeleted(Cur);
|
| Next = Cur;
|
| + availabilityReset();
|
| }
|
|
|
| void LoweringContext::insert(Inst *Inst) {
|
| @@ -70,6 +71,31 @@ Inst *LoweringContext::getLastInserted() const {
|
| return LastInserted;
|
| }
|
|
|
| +void LoweringContext::availabilityReset() {
|
| + LastDest = nullptr;
|
| + LastSrc = nullptr;
|
| +}
|
| +
|
| +void LoweringContext::availabilityUpdate() {
|
| + availabilityReset();
|
| + Inst *Instr = LastInserted;
|
| + if (Instr == nullptr)
|
| + return;
|
| + if (!Instr->isSimpleAssign())
|
| + return;
|
| + if (auto *SrcVar = llvm::dyn_cast<Variable>(Instr->getSrc(0))) {
|
| + LastDest = Instr->getDest();
|
| + LastSrc = SrcVar;
|
| + }
|
| +}
|
| +
|
| +Variable *LoweringContext::availabilityGet(Operand *Src) const {
|
| + assert(Src);
|
| + if (Src == LastDest)
|
| + return LastSrc;
|
| + return nullptr;
|
| +}
|
| +
|
| TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
|
| #define SUBZERO_TARGET(X) \
|
| if (Target == Target_##X) \
|
|
|