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

Unified 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: Fix memmove and add tests 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 side-by-side diff with in-line comments
Download patch
Index: src/IceTargetLoweringX86Base.h
diff --git a/src/IceTargetLoweringX86Base.h b/src/IceTargetLoweringX86Base.h
index 342c97b2da5d2d7bb574a2793cf7b916f2b5a104..ff03642a1e3a7bc6d8a11e8025f5bc5c0e00e3e2 100644
--- a/src/IceTargetLoweringX86Base.h
+++ b/src/IceTargetLoweringX86Base.h
@@ -153,9 +153,17 @@ protected:
Operand *Val);
void lowerCountZeros(bool Cttz, Type Ty, Variable *Dest, Operand *FirstVal,
Operand *SecondVal);
- /// Replace a call to memcpy with inline instructions.
+ // Load from memory for a given type.
jvoung (off chromium) 2015/08/18 17:18:22 Did you intend to doxygenize this (and typedStore)
ascull 2015/08/18 18:38:01 Done.
+ void typedLoad(Type Ty, Variable *Dest, Variable *Base, Constant *Offset);
+ // Store to memory for a given type.
+ void typedStore(Type Ty, Variable *Value, Variable *Base, Constant *Offset);
+ /// Copy memory of given type from Src to Dest using OffsetAmt on both.
+ void copyMemory(Type Ty, Variable *Dest, Variable *Src, int32_t OffsetAmt);
+ /// Replace some calls to memcpy with inline instructions.
void lowerMemcpy(Operand *Dest, Operand *Src, Operand *Count);
- /// Replace a call to memset with inline instructions.
+ /// Replace some calls to memmove with inline instructions.
+ void lowerMemmove(Operand *Dest, Operand *Src, Operand *Count);
+ /// Replace some calls to memset with inline instructions.
void lowerMemset(Operand *Dest, Operand *Val, Operand *Count);
/// Lower an indirect jump adding sandboxing when needed.
@@ -212,6 +220,19 @@ protected:
Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister);
static Type stackSlotType();
+ static constexpr uint32_t NoSizeLimit = 0;
+ static const Type TypeForSize[];
+ /// Returns the largest type which is equal to or larger than Size bytes. The
+ /// type is suitable for copying memory i.e. a load and store will be a
+ /// single instruction (for example x86 will get f64 not i64).
+ static Type largestTypeInSize(uint32_t Size, uint32_t MaxSize = NoSizeLimit);
+ /// Returns the smallest type which is equal to or larger than Size bytes. If
+ /// one doesn't exist then the largest type smaller than Size bytes is
+ /// returned. The type is suitable for memory copies as described at
+ /// largestTypeInSize.
+ static Type firstTypeThatFitsSize(uint32_t Size,
+ uint32_t MaxSize = NoSizeLimit);
+
Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister);
/// \name Returns a vector in a register with the given constant entries.

Powered by Google App Engine
This is Rietveld 408576698