Add bzero builtin; this should help codegen quality for code using this

function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94320 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman 2010-01-23 19:00:10 +00:00
Родитель c07b8c02f7
Коммит e6dddfd907
2 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -277,7 +277,7 @@ BUILTIN(__builtin_va_copy, "vAA", "n")
BUILTIN(__builtin_stdarg_start, "vA.", "n") BUILTIN(__builtin_stdarg_start, "vA.", "n")
BUILTIN(__builtin_bcmp, "iv*v*z", "n") BUILTIN(__builtin_bcmp, "iv*v*z", "n")
BUILTIN(__builtin_bcopy, "vv*v*z", "n") BUILTIN(__builtin_bcopy, "vv*v*z", "n")
BUILTIN(__builtin_bzero, "vv*z", "n") BUILTIN(__builtin_bzero, "vv*z", "nF")
BUILTIN(__builtin_memchr, "v*vC*iz", "nF") BUILTIN(__builtin_memchr, "v*vC*iz", "nF")
BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF") BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF")
BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF") BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF")
@ -527,6 +527,7 @@ LIBBUILTIN(strndup, "c*cC*z", "f", "string.h")
// POSIX strings.h // POSIX strings.h
LIBBUILTIN(index, "c*cC*i", "f", "strings.h") LIBBUILTIN(index, "c*cC*i", "f", "strings.h")
LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h") LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h")
LIBBUILTIN(bzero, "vv*z", "f", "strings.h")
// POSIX unistd.h // POSIX unistd.h
LIBBUILTIN(_exit, "vi", "fr", "unistd.h") LIBBUILTIN(_exit, "vi", "fr", "unistd.h")
// POSIX setjmp.h // POSIX setjmp.h

Просмотреть файл

@ -304,6 +304,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
Size = Builder.CreateIntCast(Size, llvm::Type::getInt32Ty(VMContext), false, "tmp"); Size = Builder.CreateIntCast(Size, llvm::Type::getInt32Ty(VMContext), false, "tmp");
return RValue::get(Builder.CreateAlloca(llvm::Type::getInt8Ty(VMContext), Size, "tmp")); return RValue::get(Builder.CreateAlloca(llvm::Type::getInt8Ty(VMContext), Size, "tmp"));
} }
case Builtin::BIbzero:
case Builtin::BI__builtin_bzero: { case Builtin::BI__builtin_bzero: {
Value *Address = EmitScalarExpr(E->getArg(0)); Value *Address = EmitScalarExpr(E->getArg(0));
Builder.CreateCall4(CGM.getMemSetFn(), Address, Builder.CreateCall4(CGM.getMemSetFn(), Address,