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

Side by Side Diff: src/IceTargetLowering.cpp

Issue 672393003: Subzero: Minor refactoring/additions in preparation for phi edge splitting. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove deprecated advanceBackward method Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX8632.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file implements the skeleton of the TargetLowering class, 10 // This file implements the skeleton of the TargetLowering class,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 Begin = getNode()->getInsts().begin(); 47 Begin = getNode()->getInsts().begin();
48 Cur = Begin; 48 Cur = Begin;
49 End = getNode()->getInsts().end(); 49 End = getNode()->getInsts().end();
50 skipDeleted(Cur); 50 skipDeleted(Cur);
51 Next = Cur; 51 Next = Cur;
52 advanceForward(Next); 52 advanceForward(Next);
53 } 53 }
54 54
55 void LoweringContext::insert(Inst *Inst) { 55 void LoweringContext::insert(Inst *Inst) {
56 getNode()->getInsts().insert(Next, Inst); 56 getNode()->getInsts().insert(Next, Inst);
57 LastInserted = Inst;
57 } 58 }
58 59
59 void LoweringContext::skipDeleted(InstList::iterator &I) const { 60 void LoweringContext::skipDeleted(InstList::iterator &I) const {
60 while (I != End && (*I)->isDeleted()) 61 while (I != End && (*I)->isDeleted())
61 ++I; 62 ++I;
62 } 63 }
63 64
64 void LoweringContext::advanceForward(InstList::iterator &I) const { 65 void LoweringContext::advanceForward(InstList::iterator &I) const {
65 if (I != End) { 66 if (I != End) {
66 ++I; 67 ++I;
67 skipDeleted(I); 68 skipDeleted(I);
68 } 69 }
69 } 70 }
70 71
71 void LoweringContext::advanceBackward(InstList::iterator &I) const {
72 assert(I != Begin);
73 do {
74 --I;
75 } while (I != Begin && (*I)->isDeleted());
76 }
77
78 Inst *LoweringContext::getLastInserted() const { 72 Inst *LoweringContext::getLastInserted() const {
79 InstList::iterator Cursor = Next; 73 assert(LastInserted);
80 advanceBackward(Cursor); 74 return LastInserted;
81 return *Cursor;
82 } 75 }
83 76
84 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { 77 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
85 // These statements can be #ifdef'd to specialize the code generator 78 // These statements can be #ifdef'd to specialize the code generator
86 // to a subset of the available targets. TODO: use CRTP. 79 // to a subset of the available targets. TODO: use CRTP.
87 if (Target == Target_X8632) 80 if (Target == Target_X8632)
88 return TargetX8632::create(Func); 81 return TargetX8632::create(Func);
89 #if 0 82 #if 0
90 if (Target == Target_X8664) 83 if (Target == Target_X8664)
91 return IceTargetX8664::create(Func); 84 return IceTargetX8664::create(Func);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 if (Target == Target_ARM64) 249 if (Target == Target_ARM64)
257 return IceTargetGlobalInitARM64::create(Ctx); 250 return IceTargetGlobalInitARM64::create(Ctx);
258 #endif 251 #endif
259 llvm_unreachable("Unsupported target"); 252 llvm_unreachable("Unsupported target");
260 return NULL; 253 return NULL;
261 } 254 }
262 255
263 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} 256 TargetGlobalInitLowering::~TargetGlobalInitLowering() {}
264 257
265 } // end of namespace Ice 258 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698