diff options
| author | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2008-02-19 22:01:01 +0000 |
|---|---|---|
| committer | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2008-02-19 22:01:01 +0000 |
| commit | 91fdb9ec4332446fae505b7ef5ba96b54ea769d9 (patch) | |
| tree | 35698ec7ce75d406cdba12bd065e757fefa637f6 /clang/CodeGen/CodeGenModule.cpp | |
| parent | 9bbd8ebf788bcb7051f296d625c51db08419ec03 (diff) | |
| download | bcm5719-llvm-91fdb9ec4332446fae505b7ef5ba96b54ea769d9.tar.gz bcm5719-llvm-91fdb9ec4332446fae505b7ef5ba96b54ea769d9.zip | |
Implement CodeGenModule::getMemSetFn method.
llvm-svn: 47346
Diffstat (limited to 'clang/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/CodeGen/CodeGenModule.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp index d68fbe616dc..e3181337bfd 100644 --- a/clang/CodeGen/CodeGenModule.cpp +++ b/clang/CodeGen/CodeGenModule.cpp @@ -31,7 +31,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO, llvm::Module &M, const llvm::TargetData &TD, Diagnostic &diags) : Context(C), Features(LO), TheModule(M), TheTargetData(TD), Diags(diags), - Types(C, M, TD), MemCpyFn(0), CFConstantStringClassRef(0) {} + Types(C, M, TD), MemCpyFn(0), MemSetFn(0), CFConstantStringClassRef(0) {} /// WarnUnsupported - Print out a warning that codegen doesn't support the /// specified stmt yet. @@ -329,6 +329,18 @@ llvm::Function *CodeGenModule::getMemCpyFn() { return MemCpyFn = getIntrinsic(IID); } +llvm::Function *CodeGenModule::getMemSetFn() { + if (MemSetFn) return MemSetFn; + llvm::Intrinsic::ID IID; + uint64_t Size; unsigned Align; + Context.Target.getPointerInfo(Size, Align, FullSourceLoc()); + switch (Size) { + default: assert(0 && "Unknown ptr width"); + case 32: IID = llvm::Intrinsic::memset_i32; break; + case 64: IID = llvm::Intrinsic::memset_i64; break; + } + return MemSetFn = getIntrinsic(IID); +} llvm::Constant *CodeGenModule:: GetAddrOfConstantCFString(const std::string &str) { |

