Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | static Value *fitArgInto64Bits(IRBuilder<> &Builder, Value *Arg) { | ||||
llvm_unreachable("unexpected type"); | llvm_unreachable("unexpected type"); | ||||
} | } | ||||
static Value *callPrintfBegin(IRBuilder<> &Builder, Value *Version) { | static Value *callPrintfBegin(IRBuilder<> &Builder, Value *Version) { | ||||
auto Int64Ty = Builder.getInt64Ty(); | auto Int64Ty = Builder.getInt64Ty(); | ||||
auto M = Builder.GetInsertBlock()->getModule(); | auto M = Builder.GetInsertBlock()->getModule(); | ||||
auto Fn = M->getOrInsertFunction("__ockl_printf_begin", Int64Ty, Int64Ty); | auto Fn = M->getOrInsertFunction("__ockl_printf_begin", Int64Ty, Int64Ty); | ||||
if (!M->getModuleFlag("amdgpu_hostcall")) { | |||||
yaxunl: Should be "Override" since a module needing hostcall overrides a module not needing hostcall. | |||||
M->addModuleFlag(llvm::Module::Override, "amdgpu_hostcall", 1); | M->addModuleFlag(llvm::Module::Override, "amdgpu_hostcall", 1); | ||||
} | |||||
return Builder.CreateCall(Fn, Version); | return Builder.CreateCall(Fn, Version); | ||||
} | } | ||||
static Value *callAppendArgs(IRBuilder<> &Builder, Value *Desc, int NumArgs, | static Value *callAppendArgs(IRBuilder<> &Builder, Value *Desc, int NumArgs, | ||||
Not Done ReplyInline ActionsInstead of emit a function attr, we can emit a module flag, then we can avoid checking func attr for every function later. yaxunl: Instead of emit a function attr, we can emit a module flag, then we can avoid checking func… | |||||
Value *Arg0, Value *Arg1, Value *Arg2, Value *Arg3, | Value *Arg0, Value *Arg1, Value *Arg2, Value *Arg3, | ||||
Value *Arg4, Value *Arg5, Value *Arg6, | Value *Arg4, Value *Arg5, Value *Arg6, | ||||
bool IsLast) { | bool IsLast) { | ||||
auto Int64Ty = Builder.getInt64Ty(); | auto Int64Ty = Builder.getInt64Ty(); | ||||
auto Int32Ty = Builder.getInt32Ty(); | auto Int32Ty = Builder.getInt32Ty(); | ||||
auto M = Builder.GetInsertBlock()->getModule(); | auto M = Builder.GetInsertBlock()->getModule(); | ||||
auto Fn = M->getOrInsertFunction("__ockl_printf_append_args", Int64Ty, | auto Fn = M->getOrInsertFunction("__ockl_printf_append_args", Int64Ty, | ||||
Int64Ty, Int32Ty, Int64Ty, Int64Ty, Int64Ty, | Int64Ty, Int32Ty, Int64Ty, Int64Ty, Int64Ty, | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |
Should be "Override" since a module needing hostcall overrides a module not needing hostcall.
Also the name of the flag better be "amdgpu_hostcall" to avoid conflict with other targets.