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

Side by Side Diff: src/IceInstX86BaseImpl.h

Issue 1221643012: Subzero: Add -Wshadow to the build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 5 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
OLDNEW
1 //===- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*=// 1 //==- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*-=//
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
11 /// This file implements the InstX86Base class and its descendants. 11 /// This file implements the InstX86Base class and its descendants.
(...skipping 28 matching lines...) Expand all
40 } 40 }
41 41
42 template <class Machine> 42 template <class Machine>
43 typename InstX86Base<Machine>::Traits::Cond::BrCond 43 typename InstX86Base<Machine>::Traits::Cond::BrCond
44 InstX86Base<Machine>::getOppositeCondition(typename Traits::Cond::BrCond Cond) { 44 InstX86Base<Machine>::getOppositeCondition(typename Traits::Cond::BrCond Cond) {
45 return Traits::InstBrAttributes[Cond].Opposite; 45 return Traits::InstBrAttributes[Cond].Opposite;
46 } 46 }
47 47
48 template <class Machine> 48 template <class Machine>
49 InstX86FakeRMW<Machine>::InstX86FakeRMW(Cfg *Func, Operand *Data, Operand *Addr, 49 InstX86FakeRMW<Machine>::InstX86FakeRMW(Cfg *Func, Operand *Data, Operand *Addr,
50 InstArithmetic::OpKind Op, 50 InstArithmetic::OpKind MyOp,
51 Variable *Beacon) 51 Variable *Beacon)
52 : InstX86Base<Machine>(Func, InstX86Base<Machine>::FakeRMW, 3, nullptr), 52 : InstX86Base<Machine>(Func, InstX86Base<Machine>::FakeRMW, 3, nullptr),
53 Op(Op) { 53 Op(MyOp) {
54 this->addSource(Data); 54 this->addSource(Data);
55 this->addSource(Addr); 55 this->addSource(Addr);
56 this->addSource(Beacon); 56 this->addSource(Beacon);
57 } 57 }
58 58
59 template <class Machine> 59 template <class Machine>
60 InstX86AdjustStack<Machine>::InstX86AdjustStack(Cfg *Func, SizeT Amount, 60 InstX86AdjustStack<Machine>::InstX86AdjustStack(Cfg *Func, SizeT MyAmount,
61 Variable *Esp) 61 Variable *Esp)
62 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Adjuststack, 1, Esp), 62 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Adjuststack, 1, Esp),
63 Amount(Amount) { 63 Amount(MyAmount) {
64 this->addSource(Esp); 64 this->addSource(Esp);
65 } 65 }
66 66
67 template <class Machine> 67 template <class Machine>
68 InstX86Mul<Machine>::InstX86Mul(Cfg *Func, Variable *Dest, Variable *Source1, 68 InstX86Mul<Machine>::InstX86Mul(Cfg *Func, Variable *Dest, Variable *Source1,
69 Operand *Source2) 69 Operand *Source2)
70 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Mul, 2, Dest) { 70 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Mul, 2, Dest) {
71 this->addSource(Source1); 71 this->addSource(Source1);
72 this->addSource(Source2); 72 this->addSource(Source2);
73 } 73 }
(...skipping 22 matching lines...) Expand all
96 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Label, 0, nullptr), 96 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Label, 0, nullptr),
97 Number(Target->makeNextLabelNumber()) {} 97 Number(Target->makeNextLabelNumber()) {}
98 98
99 template <class Machine> 99 template <class Machine>
100 IceString InstX86Label<Machine>::getName(const Cfg *Func) const { 100 IceString InstX86Label<Machine>::getName(const Cfg *Func) const {
101 return ".L" + Func->getFunctionName() + "$local$__" + std::to_string(Number); 101 return ".L" + Func->getFunctionName() + "$local$__" + std::to_string(Number);
102 } 102 }
103 103
104 template <class Machine> 104 template <class Machine>
105 InstX86Br<Machine>::InstX86Br( 105 InstX86Br<Machine>::InstX86Br(
106 Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse, 106 Cfg *Func, const CfgNode *MyTargetTrue, const CfgNode *MyTargetFalse,
107 const InstX86Label<Machine> *Label, 107 const InstX86Label<Machine> *MyLabel,
108 typename InstX86Base<Machine>::Traits::Cond::BrCond Condition) 108 typename InstX86Base<Machine>::Traits::Cond::BrCond MyCondition)
109 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Br, 0, nullptr), 109 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Br, 0, nullptr),
110 Condition(Condition), TargetTrue(TargetTrue), TargetFalse(TargetFalse), 110 Condition(MyCondition), TargetTrue(MyTargetTrue),
111 Label(Label) {} 111 TargetFalse(MyTargetFalse), Label(MyLabel) {}
112 112
113 template <class Machine> 113 template <class Machine>
114 bool InstX86Br<Machine>::optimizeBranch(const CfgNode *NextNode) { 114 bool InstX86Br<Machine>::optimizeBranch(const CfgNode *NextNode) {
115 // If there is no next block, then there can be no fallthrough to 115 // If there is no next block, then there can be no fallthrough to
116 // optimize. 116 // optimize.
117 if (NextNode == nullptr) 117 if (NextNode == nullptr)
118 return false; 118 return false;
119 // Intra-block conditional branches can't be optimized. 119 // Intra-block conditional branches can't be optimized.
120 if (Label) 120 if (Label)
121 return false; 121 return false;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 InstX86Call<Machine>::InstX86Call(Cfg *Func, Variable *Dest, 173 InstX86Call<Machine>::InstX86Call(Cfg *Func, Variable *Dest,
174 Operand *CallTarget) 174 Operand *CallTarget)
175 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Call, 1, Dest) { 175 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Call, 1, Dest) {
176 this->HasSideEffects = true; 176 this->HasSideEffects = true;
177 this->addSource(CallTarget); 177 this->addSource(CallTarget);
178 } 178 }
179 179
180 template <class Machine> 180 template <class Machine>
181 InstX86Cmov<Machine>::InstX86Cmov( 181 InstX86Cmov<Machine>::InstX86Cmov(
182 Cfg *Func, Variable *Dest, Operand *Source, 182 Cfg *Func, Variable *Dest, Operand *Source,
183 typename InstX86Base<Machine>::Traits::Cond::BrCond Condition) 183 typename InstX86Base<Machine>::Traits::Cond::BrCond MyCondition)
184 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Cmov, 2, Dest), 184 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Cmov, 2, Dest),
185 Condition(Condition) { 185 Condition(MyCondition) {
186 // The final result is either the original Dest, or Source, so mark 186 // The final result is either the original Dest, or Source, so mark
187 // both as sources. 187 // both as sources.
188 this->addSource(Dest); 188 this->addSource(Dest);
189 this->addSource(Source); 189 this->addSource(Source);
190 } 190 }
191 191
192 template <class Machine> 192 template <class Machine>
193 InstX86Cmpps<Machine>::InstX86Cmpps( 193 InstX86Cmpps<Machine>::InstX86Cmpps(
194 Cfg *Func, Variable *Dest, Operand *Source, 194 Cfg *Func, Variable *Dest, Operand *Source,
195 typename InstX86Base<Machine>::Traits::Cond::CmppsCond Condition) 195 typename InstX86Base<Machine>::Traits::Cond::CmppsCond MyCondition)
196 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Cmpps, 2, Dest), 196 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Cmpps, 2, Dest),
197 Condition(Condition) { 197 Condition(MyCondition) {
198 this->addSource(Dest); 198 this->addSource(Dest);
199 this->addSource(Source); 199 this->addSource(Source);
200 } 200 }
201 201
202 template <class Machine> 202 template <class Machine>
203 InstX86Cmpxchg<Machine>::InstX86Cmpxchg(Cfg *Func, Operand *DestOrAddr, 203 InstX86Cmpxchg<Machine>::InstX86Cmpxchg(Cfg *Func, Operand *DestOrAddr,
204 Variable *Eax, Variable *Desired, 204 Variable *Eax, Variable *Desired,
205 bool Locked) 205 bool Locked)
206 : InstX86BaseLockable<Machine>(Func, InstX86Base<Machine>::Cmpxchg, 3, 206 : InstX86BaseLockable<Machine>(Func, InstX86Base<Machine>::Cmpxchg, 3,
207 llvm::dyn_cast<Variable>(DestOrAddr), 207 llvm::dyn_cast<Variable>(DestOrAddr),
(...skipping 21 matching lines...) Expand all
229 InstX86Base<Machine>::Traits::RegisterSet::Reg_ebx); 229 InstX86Base<Machine>::Traits::RegisterSet::Reg_ebx);
230 this->addSource(Addr); 230 this->addSource(Addr);
231 this->addSource(Edx); 231 this->addSource(Edx);
232 this->addSource(Eax); 232 this->addSource(Eax);
233 this->addSource(Ecx); 233 this->addSource(Ecx);
234 this->addSource(Ebx); 234 this->addSource(Ebx);
235 } 235 }
236 236
237 template <class Machine> 237 template <class Machine>
238 InstX86Cvt<Machine>::InstX86Cvt(Cfg *Func, Variable *Dest, Operand *Source, 238 InstX86Cvt<Machine>::InstX86Cvt(Cfg *Func, Variable *Dest, Operand *Source,
239 CvtVariant Variant) 239 CvtVariant MyVariant)
240 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Cvt, 1, Dest), 240 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Cvt, 1, Dest),
241 Variant(Variant) { 241 Variant(MyVariant) {
242 this->addSource(Source); 242 this->addSource(Source);
243 } 243 }
244 244
245 template <class Machine> 245 template <class Machine>
246 InstX86Icmp<Machine>::InstX86Icmp(Cfg *Func, Operand *Src0, Operand *Src1) 246 InstX86Icmp<Machine>::InstX86Icmp(Cfg *Func, Operand *Src0, Operand *Src1)
247 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Icmp, 2, nullptr) { 247 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Icmp, 2, nullptr) {
248 this->addSource(Src0); 248 this->addSource(Src0);
249 this->addSource(Src1); 249 this->addSource(Src1);
250 } 250 }
251 251
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 template <class Machine> 294 template <class Machine>
295 InstX86StoreQ<Machine>::InstX86StoreQ( 295 InstX86StoreQ<Machine>::InstX86StoreQ(
296 Cfg *Func, Variable *Value, 296 Cfg *Func, Variable *Value,
297 typename InstX86Base<Machine>::Traits::X86OperandMem *Mem) 297 typename InstX86Base<Machine>::Traits::X86OperandMem *Mem)
298 : InstX86Base<Machine>(Func, InstX86Base<Machine>::StoreQ, 2, nullptr) { 298 : InstX86Base<Machine>(Func, InstX86Base<Machine>::StoreQ, 2, nullptr) {
299 this->addSource(Value); 299 this->addSource(Value);
300 this->addSource(Mem); 300 this->addSource(Mem);
301 } 301 }
302 302
303 template <class Machine> 303 template <class Machine>
304 InstX86Nop<Machine>::InstX86Nop(Cfg *Func, InstX86Nop::NopVariant Variant) 304 InstX86Nop<Machine>::InstX86Nop(Cfg *Func, InstX86Nop::NopVariant MyVariant)
305 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Nop, 0, nullptr), 305 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Nop, 0, nullptr),
306 Variant(Variant) {} 306 Variant(MyVariant) {}
307 307
308 template <class Machine> 308 template <class Machine>
309 InstX86Fld<Machine>::InstX86Fld(Cfg *Func, Operand *Src) 309 InstX86Fld<Machine>::InstX86Fld(Cfg *Func, Operand *Src)
310 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Fld, 1, nullptr) { 310 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Fld, 1, nullptr) {
311 this->addSource(Src); 311 this->addSource(Src);
312 } 312 }
313 313
314 template <class Machine> 314 template <class Machine>
315 InstX86Fstp<Machine>::InstX86Fstp(Cfg *Func, Variable *Dest) 315 InstX86Fstp<Machine>::InstX86Fstp(Cfg *Func, Variable *Dest)
316 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Fstp, 0, Dest) {} 316 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Fstp, 0, Dest) {}
(...skipping 2836 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 Type Ty = this->getSrc(0)->getType(); 3153 Type Ty = this->getSrc(0)->getType();
3154 Str << "xchg." << Ty << " "; 3154 Str << "xchg." << Ty << " ";
3155 this->dumpSources(Func); 3155 this->dumpSources(Func);
3156 } 3156 }
3157 3157
3158 } // end of namespace X86Internal 3158 } // end of namespace X86Internal
3159 3159
3160 } // end of namespace Ice 3160 } // end of namespace Ice
3161 3161
3162 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H 3162 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H
OLDNEW
« src/IceInst.h ('K') | « src/IceInstX86Base.h ('k') | src/IceLiveness.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698