mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
compiler,runtime: translate memzero calls to LLVM memset intrinsics
This gives the optimizer a bit more information about what the calls do. This should result in slightly better generated code. Code size sometimes goes up and sometimes goes down. I blame the code size going up on the inliner which inlines more functions, because compiling the smoke tests in the drivers repository with -opt=1 results in a slight code size reduction in all cases.
This commit is contained in:
committed by
Ron Evans
parent
eaa54bc7e3
commit
91d1a23b14
@@ -41,11 +41,9 @@ func memcpy(dst, src unsafe.Pointer, size uintptr)
|
||||
func memmove(dst, src unsafe.Pointer, size uintptr)
|
||||
|
||||
// Set the given number of bytes to zero.
|
||||
func memzero(ptr unsafe.Pointer, size uintptr) {
|
||||
for i := uintptr(0); i < size; i++ {
|
||||
*(*byte)(unsafe.Pointer(uintptr(ptr) + i)) = 0
|
||||
}
|
||||
}
|
||||
// Calls to this function are converted to LLVM intrinsic calls such as
|
||||
// llvm.memset.p0i8.i32(ptr, 0, size, false).
|
||||
func memzero(ptr unsafe.Pointer, size uintptr)
|
||||
|
||||
// Compare two same-size buffers for equality.
|
||||
func memequal(x, y unsafe.Pointer, n uintptr) bool {
|
||||
|
||||
Reference in New Issue
Block a user