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

Side by Side Diff: src/IceTargetLowering.cpp

Issue 417353003: Fix bug when atomic load is fused with an arith op (and not in the entry BB) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: review Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX8632.cpp » ('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,
11 // specifically invoking the appropriate lowering method for a given 11 // specifically invoking the appropriate lowering method for a given
12 // instruction kind and driving global register allocation. It also 12 // instruction kind and driving global register allocation. It also
13 // implements the non-deleted instruction iteration in 13 // implements the non-deleted instruction iteration in
14 // LoweringContext. 14 // LoweringContext.
15 // 15 //
16 //===----------------------------------------------------------------------===// 16 //===----------------------------------------------------------------------===//
17 17
18 #include "IceCfg.h" // setError() 18 #include "IceCfg.h" // setError()
19 #include "IceCfgNode.h" 19 #include "IceCfgNode.h"
20 #include "IceOperand.h" 20 #include "IceOperand.h"
21 #include "IceRegAlloc.h" 21 #include "IceRegAlloc.h"
22 #include "IceTargetLowering.h" 22 #include "IceTargetLowering.h"
23 #include "IceTargetLoweringX8632.h" 23 #include "IceTargetLoweringX8632.h"
24 24
25 namespace Ice { 25 namespace Ice {
26 26
27 void LoweringContext::init(CfgNode *N) { 27 void LoweringContext::init(CfgNode *N) {
28 Node = N; 28 Node = N;
29 Cur = getNode()->getInsts().begin(); 29 Begin = getNode()->getInsts().begin();
30 Cur = Begin;
30 End = getNode()->getInsts().end(); 31 End = getNode()->getInsts().end();
31 skipDeleted(Cur); 32 skipDeleted(Cur);
32 Next = Cur; 33 Next = Cur;
33 advance(Next); 34 advanceForward(Next);
34 } 35 }
35 36
36 void LoweringContext::insert(Inst *Inst) { 37 void LoweringContext::insert(Inst *Inst) {
37 getNode()->getInsts().insert(Next, Inst); 38 getNode()->getInsts().insert(Next, Inst);
38 Inst->updateVars(getNode()); 39 Inst->updateVars(getNode());
39 } 40 }
40 41
41 void LoweringContext::skipDeleted(InstList::iterator &I) const { 42 void LoweringContext::skipDeleted(InstList::iterator &I) const {
42 while (I != End && (*I)->isDeleted()) 43 while (I != End && (*I)->isDeleted())
43 ++I; 44 ++I;
44 } 45 }
45 46
46 void LoweringContext::advance(InstList::iterator &I) const { 47 void LoweringContext::advanceForward(InstList::iterator &I) const {
47 if (I != End) { 48 if (I != End) {
48 ++I; 49 ++I;
49 skipDeleted(I); 50 skipDeleted(I);
50 } 51 }
51 } 52 }
52 53
54 void LoweringContext::advanceBackward(InstList::iterator &I) const {
55 assert(I != Begin);
56 do {
57 --I;
58 } while (I != Begin && (*I)->isDeleted());
59 }
60
61 Inst *LoweringContext::getLastInserted() const {
62 InstList::iterator Cursor = Next;
63 advanceBackward(Cursor);
64 return *Cursor;
65 }
66
53 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { 67 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
54 // These statements can be #ifdef'd to specialize the code generator 68 // These statements can be #ifdef'd to specialize the code generator
55 // to a subset of the available targets. TODO: use CRTP. 69 // to a subset of the available targets. TODO: use CRTP.
56 if (Target == Target_X8632) 70 if (Target == Target_X8632)
57 return TargetX8632::create(Func); 71 return TargetX8632::create(Func);
58 #if 0 72 #if 0
59 if (Target == Target_X8664) 73 if (Target == Target_X8664)
60 return IceTargetX8664::create(Func); 74 return IceTargetX8664::create(Func);
61 if (Target == Target_ARM32) 75 if (Target == Target_ARM32)
62 return IceTargetARM32::create(Func); 76 return IceTargetARM32::create(Func);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (Target == Target_ARM64) 208 if (Target == Target_ARM64)
195 return IceTargetGlobalInitARM64::create(Ctx); 209 return IceTargetGlobalInitARM64::create(Ctx);
196 #endif 210 #endif
197 llvm_unreachable("Unsupported target"); 211 llvm_unreachable("Unsupported target");
198 return NULL; 212 return NULL;
199 } 213 }
200 214
201 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} 215 TargetGlobalInitLowering::~TargetGlobalInitLowering() {}
202 216
203 } // end of namespace Ice 217 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698