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

Side by Side Diff: src/IceTargetLoweringX86Base.h

Issue 1278173009: Inline memove for small constant sizes and refactor memcpy and memset. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 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/IceTargetLoweringX8664Traits.h ('k') | src/IceTargetLoweringX86BaseImpl.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/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 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 /// \file 10 /// \file
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 /// Naive lowering of cmpxchg. 185 /// Naive lowering of cmpxchg.
186 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, 186 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected,
187 Operand *Desired); 187 Operand *Desired);
188 /// Attempt a more optimized lowering of cmpxchg. Returns true if optimized. 188 /// Attempt a more optimized lowering of cmpxchg. Returns true if optimized.
189 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr, 189 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr,
190 Operand *Expected, Operand *Desired); 190 Operand *Expected, Operand *Desired);
191 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, 191 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr,
192 Operand *Val); 192 Operand *Val);
193 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal, 193 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal,
194 Operand *SecondVal); 194 Operand *SecondVal);
195 /// Replace a call to memcpy with inline instructions. 195 /// Load from memory for a given type.
196 void typedLoad(Type Ty, Variable *Dest, Variable *Base, Constant *Offset);
197 /// Store to memory for a given type.
198 void typedStore(Type Ty, Variable *Value, Variable *Base, Constant *Offset);
199 /// Copy memory of given type from Src to Dest using OffsetAmt on both.
200 void copyMemory(Type Ty, Variable *Dest, Variable *Src, int32_t OffsetAmt);
201 /// Replace some calls to memcpy with inline instructions.
196 void lowerMemcpy(Operand *Dest, Operand *Src, Operand *Count); 202 void lowerMemcpy(Operand *Dest, Operand *Src, Operand *Count);
197 /// Replace a call to memset with inline instructions. 203 /// Replace some calls to memmove with inline instructions.
204 void lowerMemmove(Operand *Dest, Operand *Src, Operand *Count);
205 /// Replace some calls to memset with inline instructions.
198 void lowerMemset(Operand *Dest, Operand *Val, Operand *Count); 206 void lowerMemset(Operand *Dest, Operand *Val, Operand *Count);
199 207
200 /// Lower an indirect jump adding sandboxing when needed. 208 /// Lower an indirect jump adding sandboxing when needed.
201 void lowerIndirectJump(Variable *Target); 209 void lowerIndirectJump(Variable *Target);
202 210
203 /// Check the comparison is in [Min,Max]. The flags register will be modified 211 /// Check the comparison is in [Min,Max]. The flags register will be modified
204 /// with: 212 /// with:
205 /// - below equal, if in range 213 /// - below equal, if in range
206 /// - above, set if not in range 214 /// - above, set if not in range
207 /// The index into the range is returned. 215 /// The index into the range is returned.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 Operand *legalizeSrc0ForCmp(Operand *Src0, Operand *Src1); 252 Operand *legalizeSrc0ForCmp(Operand *Src0, Operand *Src1);
245 /// Turn a pointer operand into a memory operand that can be 253 /// Turn a pointer operand into a memory operand that can be
246 /// used by a real load/store operation. Legalizes the operand as well. 254 /// used by a real load/store operation. Legalizes the operand as well.
247 /// This is a nop if the operand is already a legal memory operand. 255 /// This is a nop if the operand is already a legal memory operand.
248 typename Traits::X86OperandMem *formMemoryOperand(Operand *Ptr, Type Ty, 256 typename Traits::X86OperandMem *formMemoryOperand(Operand *Ptr, Type Ty,
249 bool DoLegalize = true); 257 bool DoLegalize = true);
250 258
251 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); 259 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister);
252 static Type stackSlotType(); 260 static Type stackSlotType();
253 261
262 static constexpr uint32_t NoSizeLimit = 0;
263 static const Type TypeForSize[];
264 /// Returns the largest type which is equal to or larger than Size bytes. The
265 /// type is suitable for copying memory i.e. a load and store will be a
266 /// single instruction (for example x86 will get f64 not i64).
267 static Type largestTypeInSize(uint32_t Size, uint32_t MaxSize = NoSizeLimit);
268 /// Returns the smallest type which is equal to or larger than Size bytes. If
269 /// one doesn't exist then the largest type smaller than Size bytes is
270 /// returned. The type is suitable for memory copies as described at
271 /// largestTypeInSize.
272 static Type firstTypeThatFitsSize(uint32_t Size,
273 uint32_t MaxSize = NoSizeLimit);
274
254 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister); 275 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister);
255 276
256 /// \name Returns a vector in a register with the given constant entries. 277 /// \name Returns a vector in a register with the given constant entries.
257 /// @{ 278 /// @{
258 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister); 279 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister);
259 Variable *makeVectorOfOnes(Type Ty, int32_t RegNum = Variable::NoRegister); 280 Variable *makeVectorOfOnes(Type Ty, int32_t RegNum = Variable::NoRegister);
260 Variable *makeVectorOfMinusOnes(Type Ty, 281 Variable *makeVectorOfMinusOnes(Type Ty,
261 int32_t RegNum = Variable::NoRegister); 282 int32_t RegNum = Variable::NoRegister);
262 Variable *makeVectorOfHighOrderBits(Type Ty, 283 Variable *makeVectorOfHighOrderBits(Type Ty,
263 int32_t RegNum = Variable::NoRegister); 284 int32_t RegNum = Variable::NoRegister);
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 } 715 }
695 716
696 BoolFolding FoldingInfo; 717 BoolFolding FoldingInfo;
697 }; 718 };
698 } // end of namespace X86Internal 719 } // end of namespace X86Internal
699 } // end of namespace Ice 720 } // end of namespace Ice
700 721
701 #include "IceTargetLoweringX86BaseImpl.h" 722 #include "IceTargetLoweringX86BaseImpl.h"
702 723
703 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 724 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8664Traits.h ('k') | src/IceTargetLoweringX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698