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

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: r1 == rax 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
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 /// Naive lowering of cmpxchg. 146 /// Naive lowering of cmpxchg.
147 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, 147 void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected,
148 Operand *Desired); 148 Operand *Desired);
149 /// Attempt a more optimized lowering of cmpxchg. Returns true if optimized. 149 /// Attempt a more optimized lowering of cmpxchg. Returns true if optimized.
150 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr, 150 bool tryOptimizedCmpxchgCmpBr(Variable *DestPrev, Operand *Ptr,
151 Operand *Expected, Operand *Desired); 151 Operand *Expected, Operand *Desired);
152 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, 152 void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr,
153 Operand *Val); 153 Operand *Val);
154 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal, 154 void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal,
155 Operand *SecondVal); 155 Operand *SecondVal);
156 /// Replace a call to memcpy with inline instructions. 156 /// Load from memory for a given type.
157 void typedLoad(Type Ty, Variable *Dest, Variable *Base, Constant *Offset);
158 /// Store to memory for a given type.
159 void typedStore(Type Ty, Variable *Value, Variable *Base, Constant *Offset);
160 /// Copy memory of given type from Src to Dest using OffsetAmt on both.
161 void copyMemory(Type Ty, Variable *Dest, Variable *Src, int32_t OffsetAmt);
162 /// Replace some calls to memcpy with inline instructions.
157 void lowerMemcpy(Operand *Dest, Operand *Src, Operand *Count); 163 void lowerMemcpy(Operand *Dest, Operand *Src, Operand *Count);
158 /// Replace a call to memset with inline instructions. 164 /// Replace some calls to memmove with inline instructions.
165 void lowerMemmove(Operand *Dest, Operand *Src, Operand *Count);
166 /// Replace some calls to memset with inline instructions.
159 void lowerMemset(Operand *Dest, Operand *Val, Operand *Count); 167 void lowerMemset(Operand *Dest, Operand *Val, Operand *Count);
160 168
161 /// Lower an indirect jump adding sandboxing when needed. 169 /// Lower an indirect jump adding sandboxing when needed.
162 void lowerIndirectJump(Variable *Target); 170 void lowerIndirectJump(Variable *Target);
163 171
164 /// Check the comparison is in [Min,Max]. The flags register will be modified 172 /// Check the comparison is in [Min,Max]. The flags register will be modified
165 /// with: 173 /// with:
166 /// - below equal, if in range 174 /// - below equal, if in range
167 /// - above, set if not in range 175 /// - above, set if not in range
168 /// The index into the range is returned. 176 /// The index into the range is returned.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 Operand *legalizeSrc0ForCmp(Operand *Src0, Operand *Src1); 213 Operand *legalizeSrc0ForCmp(Operand *Src0, Operand *Src1);
206 /// Turn a pointer operand into a memory operand that can be 214 /// Turn a pointer operand into a memory operand that can be
207 /// used by a real load/store operation. Legalizes the operand as well. 215 /// used by a real load/store operation. Legalizes the operand as well.
208 /// This is a nop if the operand is already a legal memory operand. 216 /// This is a nop if the operand is already a legal memory operand.
209 typename Traits::X86OperandMem *formMemoryOperand(Operand *Ptr, Type Ty, 217 typename Traits::X86OperandMem *formMemoryOperand(Operand *Ptr, Type Ty,
210 bool DoLegalize = true); 218 bool DoLegalize = true);
211 219
212 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); 220 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister);
213 static Type stackSlotType(); 221 static Type stackSlotType();
214 222
223 static constexpr uint32_t NoSizeLimit = 0;
224 static const Type TypeForSize[];
225 /// Returns the largest type which is equal to or larger than Size bytes. The
226 /// type is suitable for copying memory i.e. a load and store will be a
227 /// single instruction (for example x86 will get f64 not i64).
228 static Type largestTypeInSize(uint32_t Size, uint32_t MaxSize = NoSizeLimit);
229 /// Returns the smallest type which is equal to or larger than Size bytes. If
230 /// one doesn't exist then the largest type smaller than Size bytes is
231 /// returned. The type is suitable for memory copies as described at
232 /// largestTypeInSize.
233 static Type firstTypeThatFitsSize(uint32_t Size,
234 uint32_t MaxSize = NoSizeLimit);
235
215 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister); 236 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister);
216 237
217 /// \name Returns a vector in a register with the given constant entries. 238 /// \name Returns a vector in a register with the given constant entries.
218 /// @{ 239 /// @{
219 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister); 240 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister);
220 Variable *makeVectorOfOnes(Type Ty, int32_t RegNum = Variable::NoRegister); 241 Variable *makeVectorOfOnes(Type Ty, int32_t RegNum = Variable::NoRegister);
221 Variable *makeVectorOfMinusOnes(Type Ty, 242 Variable *makeVectorOfMinusOnes(Type Ty,
222 int32_t RegNum = Variable::NoRegister); 243 int32_t RegNum = Variable::NoRegister);
223 Variable *makeVectorOfHighOrderBits(Type Ty, 244 Variable *makeVectorOfHighOrderBits(Type Ty,
224 int32_t RegNum = Variable::NoRegister); 245 int32_t RegNum = Variable::NoRegister);
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 676 }
656 677
657 BoolFolding FoldingInfo; 678 BoolFolding FoldingInfo;
658 }; 679 };
659 } // end of namespace X86Internal 680 } // end of namespace X86Internal
660 } // end of namespace Ice 681 } // end of namespace Ice
661 682
662 #include "IceTargetLoweringX86BaseImpl.h" 683 #include "IceTargetLoweringX86BaseImpl.h"
663 684
664 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 685 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698