OLD | NEW |
1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void LoweringContext::availabilityReset() { | 74 void LoweringContext::availabilityReset() { |
75 LastDest = nullptr; | 75 LastDest = nullptr; |
76 LastSrc = nullptr; | 76 LastSrc = nullptr; |
77 } | 77 } |
78 | 78 |
79 void LoweringContext::availabilityUpdate() { | 79 void LoweringContext::availabilityUpdate() { |
80 availabilityReset(); | 80 availabilityReset(); |
81 Inst *Instr = LastInserted; | 81 Inst *Instr = LastInserted; |
82 if (Instr == nullptr) | 82 if (Instr == nullptr) |
83 return; | 83 return; |
84 if (!Instr->isSimpleAssign()) | 84 if (!Instr->isVarAssign()) |
85 return; | 85 return; |
86 if (auto *SrcVar = llvm::dyn_cast<Variable>(Instr->getSrc(0))) { | 86 // Since isVarAssign() is true, the source operand must be a Variable. |
87 LastDest = Instr->getDest(); | 87 LastDest = Instr->getDest(); |
88 LastSrc = SrcVar; | 88 LastSrc = llvm::cast<Variable>(Instr->getSrc(0)); |
89 } | |
90 } | 89 } |
91 | 90 |
92 Variable *LoweringContext::availabilityGet(Operand *Src) const { | 91 Variable *LoweringContext::availabilityGet(Operand *Src) const { |
93 assert(Src); | 92 assert(Src); |
94 if (Src == LastDest) | 93 if (Src == LastDest) |
95 return LastSrc; | 94 return LastSrc; |
96 return nullptr; | 95 return nullptr; |
97 } | 96 } |
98 | 97 |
99 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { | 98 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 if (Target == Target_##X) \ | 625 if (Target == Target_##X) \ |
627 return TargetHeader##X::create(Ctx); | 626 return TargetHeader##X::create(Ctx); |
628 #include "llvm/Config/SZTargets.def" | 627 #include "llvm/Config/SZTargets.def" |
629 | 628 |
630 llvm::report_fatal_error("Unsupported target header lowering"); | 629 llvm::report_fatal_error("Unsupported target header lowering"); |
631 } | 630 } |
632 | 631 |
633 TargetHeaderLowering::~TargetHeaderLowering() = default; | 632 TargetHeaderLowering::~TargetHeaderLowering() = default; |
634 | 633 |
635 } // end of namespace Ice | 634 } // end of namespace Ice |
OLD | NEW |