build_module_library(const ::llvm::Module &mod,
enum module::section::type section_type);
- std::unique_ptr<::llvm::Module>
+ std::unique_ptr< ::llvm::Module>
parse_module_library(const module &m, ::llvm::LLVMContext &ctx,
std::string &r_log);
return m;
}
-std::unique_ptr<::llvm::Module>
+std::unique_ptr< ::llvm::Module>
clover::llvm::parse_module_library(const module &m, ::llvm::LLVMContext &ctx,
std::string &r_log) {
auto mod = ::llvm::parseBitcodeFile(::llvm::MemoryBufferRef(
fail(r_log, error(CL_INVALID_PROGRAM), s);
});
- return std::unique_ptr<::llvm::Module>(std::move(*mod));
+ return std::unique_ptr< ::llvm::Module>(std::move(*mod));
}
} else {
// Other types.
const auto actual_type =
- isa<::llvm::PointerType>(arg_type) && arg.hasByValAttr() ?
- cast<::llvm::PointerType>(arg_type)->getElementType() : arg_type;
+ isa< ::llvm::PointerType>(arg_type) && arg.hasByValAttr() ?
+ cast< ::llvm::PointerType>(arg_type)->getElementType() : arg_type;
if (actual_type->isPointerTy()) {
const unsigned address_space =
- cast<::llvm::PointerType>(actual_type)->getAddressSpace();
+ cast< ::llvm::PointerType>(actual_type)->getAddressSpace();
if (address_space == address_spaces[clang::LangAS::opencl_local
- compat::lang_as_offset]) {
const target &target) {
std::string log;
try {
- std::unique_ptr<::llvm::Module> cmod { CloneModule(&mod) };
+ std::unique_ptr< ::llvm::Module> cmod { CloneModule(&mod) };
return as_string(emit_code(*cmod, target,
TargetMachine::CGFT_AssemblyFile, log));
} catch (...) {
#endif
}
- inline std::unique_ptr<::llvm::Linker>
+ inline std::unique_ptr< ::llvm::Linker>
create_linker(::llvm::Module &mod) {
#if HAVE_LLVM >= 0x0308
- return std::unique_ptr<::llvm::Linker>(new ::llvm::Linker(mod));
+ return std::unique_ptr< ::llvm::Linker>(new ::llvm::Linker(mod));
#else
- return std::unique_ptr<::llvm::Linker>(new ::llvm::Linker(&mod));
+ return std::unique_ptr< ::llvm::Linker>(new ::llvm::Linker(&mod));
#endif
}
inline bool
link_in_module(::llvm::Linker &linker,
- std::unique_ptr<::llvm::Module> mod) {
+ std::unique_ptr< ::llvm::Module> mod) {
#if HAVE_LLVM >= 0x0308
return linker.linkInModule(std::move(mod));
#else
is_kernel_node_for(const ::llvm::Function &f) {
return [&](const ::llvm::MDNode *n) {
using ::llvm::mdconst::dyn_extract;
- return &f == dyn_extract<::llvm::Function>(n->getOperand(0));
+ return &f == dyn_extract< ::llvm::Function>(n->getOperand(0));
};
}
#endif
}
- inline iterator_range<::llvm::MDNode::op_iterator>
+ inline iterator_range< ::llvm::MDNode::op_iterator>
get_kernel_metadata_operands(const ::llvm::Function &f,
const std::string &name) {
#if HAVE_LLVM >= 0x0309
const auto kernel_node = find(is_kernel_node_for(f),
get_kernel_nodes(*f.getParent()));
- const auto data_node = cast<::llvm::MDNode>(
+ const auto data_node = cast< ::llvm::MDNode>(
find([&](const ::llvm::MDOperand &op) {
- if (auto m = dyn_cast<::llvm::MDNode>(op))
+ if (auto m = dyn_cast< ::llvm::MDNode>(op))
if (m->getNumOperands())
- if (auto m_name = dyn_cast<::llvm::MDString>(
+ if (auto m_name = dyn_cast< ::llvm::MDString>(
m->getOperand(0).get()))
return m_name->getString() == name;
get_argument_metadata(const ::llvm::Function &f,
const ::llvm::Argument &arg,
const std::string &name) {
- return ::llvm::cast<::llvm::MDString>(
+ return ::llvm::cast< ::llvm::MDString>(
detail::get_kernel_metadata_operands(f, name)[arg.getArgNo()])
->getString();
}