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

Side by Side Diff: src/IceTargetLoweringX8632.h

Issue 362463002: Subzero: lower the rest of the atomic operations. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rebase Created 6 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
« no previous file with comments | « src/IceIntrinsics.cpp ('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/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- 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 // This file declares the TargetLoweringX8632 class, which 10 // This file declares the TargetLoweringX8632 class, which
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 virtual void lowerLoad(const InstLoad *Inst); 88 virtual void lowerLoad(const InstLoad *Inst);
89 virtual void lowerPhi(const InstPhi *Inst); 89 virtual void lowerPhi(const InstPhi *Inst);
90 virtual void lowerRet(const InstRet *Inst); 90 virtual void lowerRet(const InstRet *Inst);
91 virtual void lowerSelect(const InstSelect *Inst); 91 virtual void lowerSelect(const InstSelect *Inst);
92 virtual void lowerStore(const InstStore *Inst); 92 virtual void lowerStore(const InstStore *Inst);
93 virtual void lowerSwitch(const InstSwitch *Inst); 93 virtual void lowerSwitch(const InstSwitch *Inst);
94 virtual void lowerUnreachable(const InstUnreachable *Inst); 94 virtual void lowerUnreachable(const InstUnreachable *Inst);
95 virtual void doAddressOptLoad(); 95 virtual void doAddressOptLoad();
96 virtual void doAddressOptStore(); 96 virtual void doAddressOptStore();
97 97
98 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected,
99 Operand *Desired);
98 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, 100 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr,
99 Operand *Val); 101 Operand *Val);
100 102
103 typedef void (TargetX8632::*LowerBinOp)(Variable *, Operand *);
104 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi,
105 Variable *Dest, Operand *Ptr, Operand *Val);
106
101 // Operand legalization helpers. To deal with address mode 107 // Operand legalization helpers. To deal with address mode
102 // constraints, the helpers will create a new Operand and emit 108 // constraints, the helpers will create a new Operand and emit
103 // instructions that guarantee that the Operand kind is one of those 109 // instructions that guarantee that the Operand kind is one of those
104 // indicated by the LegalMask (a bitmask of allowed kinds). If the 110 // indicated by the LegalMask (a bitmask of allowed kinds). If the
105 // input Operand is known to already meet the constraints, it may be 111 // input Operand is known to already meet the constraints, it may be
106 // simply returned as the result, without creating any new 112 // simply returned as the result, without creating any new
107 // instructions or operands. 113 // instructions or operands.
108 enum OperandLegalization { 114 enum OperandLegalization {
109 Legal_None = 0, 115 Legal_None = 0,
110 Legal_Reg = 1 << 0, // physical register, not stack location 116 Legal_Reg = 1 << 0, // physical register, not stack location
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 176 }
171 void _br(InstX8632Br::BrCond Condition, InstX8632Label *Label) { 177 void _br(InstX8632Br::BrCond Condition, InstX8632Label *Label) {
172 Context.insert(InstX8632Br::create(Func, Label, Condition)); 178 Context.insert(InstX8632Br::create(Func, Label, Condition));
173 } 179 }
174 void _cdq(Variable *Dest, Operand *Src0) { 180 void _cdq(Variable *Dest, Operand *Src0) {
175 Context.insert(InstX8632Cdq::create(Func, Dest, Src0)); 181 Context.insert(InstX8632Cdq::create(Func, Dest, Src0));
176 } 182 }
177 void _cmp(Operand *Src0, Operand *Src1) { 183 void _cmp(Operand *Src0, Operand *Src1) {
178 Context.insert(InstX8632Icmp::create(Func, Src0, Src1)); 184 Context.insert(InstX8632Icmp::create(Func, Src0, Src1));
179 } 185 }
186 void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired,
187 bool Locked) {
188 Context.insert(
189 InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked));
190 // Mark eax as possibly modified by cmpxchg.
191 Context.insert(
192 InstFakeDef::create(Func, Eax, llvm::dyn_cast<Variable>(DestOrAddr)));
193 }
194 void _cmpxchg8b(OperandX8632 *Addr, Variable *Edx, Variable *Eax,
195 Variable *Ecx, Variable *Ebx, bool Locked) {
196 Context.insert(
197 InstX8632Cmpxchg8b::create(Func, Addr, Edx, Eax, Ecx, Ebx, Locked));
198 // Mark edx, and eax as possibly modified by cmpxchg8b.
199 Context.insert(InstFakeDef::create(Func, Edx));
200 Context.insert(InstFakeDef::create(Func, Eax));
201 }
180 void _cvt(Variable *Dest, Operand *Src0) { 202 void _cvt(Variable *Dest, Operand *Src0) {
181 Context.insert(InstX8632Cvt::create(Func, Dest, Src0)); 203 Context.insert(InstX8632Cvt::create(Func, Dest, Src0));
182 } 204 }
183 void _div(Variable *Dest, Operand *Src0, Operand *Src1) { 205 void _div(Variable *Dest, Operand *Src0, Operand *Src1) {
184 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1)); 206 Context.insert(InstX8632Div::create(Func, Dest, Src0, Src1));
185 } 207 }
186 void _divps(Variable *Dest, Operand *Src0) { 208 void _divps(Variable *Dest, Operand *Src0) {
187 Context.insert(InstX8632Divps::create(Func, Dest, Src0)); 209 Context.insert(InstX8632Divps::create(Func, Dest, Src0));
188 } 210 }
189 void _divss(Variable *Dest, Operand *Src0) { 211 void _divss(Variable *Dest, Operand *Src0) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 247 }
226 void _mul(Variable *Dest, Variable *Src0, Operand *Src1) { 248 void _mul(Variable *Dest, Variable *Src0, Operand *Src1) {
227 Context.insert(InstX8632Mul::create(Func, Dest, Src0, Src1)); 249 Context.insert(InstX8632Mul::create(Func, Dest, Src0, Src1));
228 } 250 }
229 void _mulps(Variable *Dest, Operand *Src0) { 251 void _mulps(Variable *Dest, Operand *Src0) {
230 Context.insert(InstX8632Mulps::create(Func, Dest, Src0)); 252 Context.insert(InstX8632Mulps::create(Func, Dest, Src0));
231 } 253 }
232 void _mulss(Variable *Dest, Operand *Src0) { 254 void _mulss(Variable *Dest, Operand *Src0) {
233 Context.insert(InstX8632Mulss::create(Func, Dest, Src0)); 255 Context.insert(InstX8632Mulss::create(Func, Dest, Src0));
234 } 256 }
257 void _neg(Variable *SrcDest) {
258 Context.insert(InstX8632Neg::create(Func, SrcDest));
259 }
235 void _or(Variable *Dest, Operand *Src0) { 260 void _or(Variable *Dest, Operand *Src0) {
236 Context.insert(InstX8632Or::create(Func, Dest, Src0)); 261 Context.insert(InstX8632Or::create(Func, Dest, Src0));
237 } 262 }
238 void _pop(Variable *Dest) { 263 void _pop(Variable *Dest) {
239 Context.insert(InstX8632Pop::create(Func, Dest)); 264 Context.insert(InstX8632Pop::create(Func, Dest));
240 } 265 }
241 void _push(Operand *Src0, bool SuppressStackAdjustment = false) { 266 void _push(Operand *Src0, bool SuppressStackAdjustment = false) {
242 Context.insert(InstX8632Push::create(Func, Src0, SuppressStackAdjustment)); 267 Context.insert(InstX8632Push::create(Func, Src0, SuppressStackAdjustment));
243 } 268 }
244 void _pxor(Variable *Dest, Operand *Src0) { 269 void _pxor(Variable *Dest, Operand *Src0) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 Context.insert(InstX8632Test::create(Func, Src0, Src1)); 312 Context.insert(InstX8632Test::create(Func, Src0, Src1));
288 } 313 }
289 void _ucomiss(Operand *Src0, Operand *Src1) { 314 void _ucomiss(Operand *Src0, Operand *Src1) {
290 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1)); 315 Context.insert(InstX8632Ucomiss::create(Func, Src0, Src1));
291 } 316 }
292 void _ud2() { Context.insert(InstX8632UD2::create(Func)); } 317 void _ud2() { Context.insert(InstX8632UD2::create(Func)); }
293 void _xadd(Operand *Dest, Variable *Src, bool Locked) { 318 void _xadd(Operand *Dest, Variable *Src, bool Locked) {
294 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked)); 319 Context.insert(InstX8632Xadd::create(Func, Dest, Src, Locked));
295 // The xadd exchanges Dest and Src (modifying Src). 320 // The xadd exchanges Dest and Src (modifying Src).
296 // Model that update with a FakeDef. 321 // Model that update with a FakeDef.
297 Context.insert(InstFakeDef::create(Func, Src)); 322 Context.insert(
323 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest)));
324 }
325 void _xchg(Operand *Dest, Variable *Src) {
326 Context.insert(InstX8632Xchg::create(Func, Dest, Src));
327 // The xchg modifies Dest and Src -- model that update with a FakeDef.
328 Context.insert(
329 InstFakeDef::create(Func, Src, llvm::dyn_cast<Variable>(Dest)));
298 } 330 }
299 void _xor(Variable *Dest, Operand *Src0) { 331 void _xor(Variable *Dest, Operand *Src0) {
300 Context.insert(InstX8632Xor::create(Func, Dest, Src0)); 332 Context.insert(InstX8632Xor::create(Func, Dest, Src0));
301 } 333 }
302 334
303 bool IsEbpBasedFrame; 335 bool IsEbpBasedFrame;
304 size_t FrameSizeLocals; 336 size_t FrameSizeLocals;
305 size_t LocalsSizeBytes; 337 size_t LocalsSizeBytes;
306 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; 338 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM];
307 llvm::SmallBitVector ScratchRegs; 339 llvm::SmallBitVector ScratchRegs;
(...skipping 29 matching lines...) Expand all
337 virtual ~TargetGlobalInitX8632() {} 369 virtual ~TargetGlobalInitX8632() {}
338 }; 370 };
339 371
340 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; 372 template <> void ConstantInteger::emit(GlobalContext *Ctx) const;
341 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; 373 template <> void ConstantFloat::emit(GlobalContext *Ctx) const;
342 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; 374 template <> void ConstantDouble::emit(GlobalContext *Ctx) const;
343 375
344 } // end of namespace Ice 376 } // end of namespace Ice
345 377
346 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H 378 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H
OLDNEW
« no previous file with comments | « src/IceIntrinsics.cpp ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698