Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: src/IceTargetLowering.cpp

Issue 1385433002: Subzero: Use register availability during lowering to improve the code. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) \
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698