diff options
author | Dan Gohman <sunfish@mozilla.com> | 2014-03-05 18:58:45 -0800 |
---|---|---|
committer | Dan Gohman <sunfish@mozilla.com> | 2014-03-05 19:00:38 -0800 |
commit | 95cd3de38a4d21056e90608b8553e1fda1363c12 (patch) | |
tree | 2db3b0331fa1866781a18c36a371ed00c97516a8 /lib | |
parent | 8346647dd5ddc2d1f379cc530b20494a41e6ef31 (diff) |
Tidy up the output for memset and memcpy, and add a test.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/JSBackend/CallHandlers.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Target/JSBackend/CallHandlers.h b/lib/Target/JSBackend/CallHandlers.h index b8ad71662d..7a2bf4bb86 100644 --- a/lib/Target/JSBackend/CallHandlers.h +++ b/lib/Target/JSBackend/CallHandlers.h @@ -255,8 +255,6 @@ DEF_CALL_HANDLER(llvm_nacl_atomic_store_i32, { #define WRITE_LOOP_MAX 128 DEF_CALL_HANDLER(llvm_memcpy_p0i8_p0i8_i32, { - Declares.insert("memcpy"); - Redirects["llvm_memcpy_p0i8_p0i8_i32"] = "memcpy"; if (CI) { ConstantInt *AlignInt = dyn_cast<ConstantInt>(CI->getOperand(3)); if (AlignInt) { @@ -288,7 +286,7 @@ DEF_CALL_HANDLER(llvm_memcpy_p0i8_p0i8_i32, { } else { // emit a loop UsedVars["dest"] = UsedVars["src"] = UsedVars["stop"] = Type::getInt32Ty(TheModule->getContext())->getTypeID(); - Ret += "dest=" + Dest + "+" + utostr(Pos) + "|0; src=" + Src + "+" + utostr(Pos) + "|0; stop=dest+" + utostr(CurrLen) + "|0; do { " + getHeapAccess("dest", Align) + "=" + getHeapAccess("src", Align) + "|0; dest=dest+" + utostr(Align) + "|0; src=src+" + utostr(Align) + "|0; } while ((dest|0) < (stop|0));"; + Ret += "dest=" + Dest + "+" + utostr(Pos) + "|0; src=" + Src + "+" + utostr(Pos) + "|0; stop=dest+" + utostr(CurrLen) + "|0; do { " + getHeapAccess("dest", Align) + "=" + getHeapAccess("src", Align) + "|0; dest=dest+" + utostr(Align) + "|0; src=src+" + utostr(Align) + "|0; } while ((dest|0) < (stop|0))"; } Pos += CurrLen; Len -= CurrLen; @@ -299,12 +297,12 @@ DEF_CALL_HANDLER(llvm_memcpy_p0i8_p0i8_i32, { } } } + Declares.insert("memcpy"); + Redirects["llvm_memcpy_p0i8_p0i8_i32"] = "memcpy"; return CH___default__(CI, "_memcpy", 3) + "|0"; }) DEF_CALL_HANDLER(llvm_memset_p0i8_i32, { - Declares.insert("memset"); - Redirects["llvm_memset_p0i8_i32"] = "memset"; if (CI) { ConstantInt *AlignInt = dyn_cast<ConstantInt>(CI->getOperand(3)); if (AlignInt) { @@ -343,7 +341,7 @@ DEF_CALL_HANDLER(llvm_memset_p0i8_i32, { } else { // emit a loop UsedVars["dest"] = UsedVars["stop"] = Type::getInt32Ty(TheModule->getContext())->getTypeID(); - Ret += "dest=" + Dest + "+" + utostr(Pos) + "|0; stop=dest+" + utostr(CurrLen) + "|0; do { " + getHeapAccess("dest", Align) + "=" + utostr(FullVal) + "|0; dest=dest+" + utostr(Align) + "|0; } while ((dest|0) < (stop|0));"; + Ret += "dest=" + Dest + "+" + utostr(Pos) + "|0; stop=dest+" + utostr(CurrLen) + "|0; do { " + getHeapAccess("dest", Align) + "=" + utostr(FullVal) + "|0; dest=dest+" + utostr(Align) + "|0; } while ((dest|0) < (stop|0))"; } Pos += CurrLen; Len -= CurrLen; @@ -355,6 +353,8 @@ DEF_CALL_HANDLER(llvm_memset_p0i8_i32, { } } } + Declares.insert("memset"); + Redirects["llvm_memset_p0i8_i32"] = "memset"; return CH___default__(CI, "_memset", 3) + "|0"; }) |