@@ -27,23 +27,34 @@ std::unique_ptr<llvm::Module> parse_bitcode_file(llvm::StringRef buf, llvm::LLVM
2727 return result;
2828}
2929
30+ } // namespace
31+ } // namespace Halide
32+
3033#define DECLARE_INITMOD (mod ) \
3134 extern " C" unsigned char halide_internal_initmod_##mod[]; \
3235 extern " C" int halide_internal_initmod_##mod##_length; \
36+ namespace Halide { \
37+ namespace { \
3338 std::unique_ptr<llvm::Module> get_initmod_##mod(llvm::LLVMContext *context) { \
3439 llvm::StringRef sb = llvm::StringRef ((const char *)halide_internal_initmod_##mod, \
3540 halide_internal_initmod_##mod##_length); \
3641 return parse_bitcode_file (sb, context, #mod); \
42+ } \
43+ } \
3744 }
3845
3946#define DECLARE_NO_INITMOD (mod ) \
47+ namespace Halide { \
48+ namespace { \
4049 [[maybe_unused]] std::unique_ptr<llvm::Module> get_initmod_##mod(llvm::LLVMContext *, bool = false , bool = false ) { \
4150 user_error << " Halide was compiled without support for this target\n " ; \
4251 return std::unique_ptr<llvm::Module>(); \
4352 } \
4453 [[maybe_unused]] std::unique_ptr<llvm::Module> get_initmod_##mod##_ll(llvm::LLVMContext *) { \
4554 user_error << " Halide was compiled without support for this target\n " ; \
4655 return std::unique_ptr<llvm::Module>(); \
56+ } \
57+ } \
4758 }
4859
4960#define DECLARE_CPP_INITMOD_LOOKUP_BITS (mod, bits ) \
@@ -56,22 +67,30 @@ std::unique_ptr<llvm::Module> parse_bitcode_file(llvm::StringRef buf, llvm::LLVM
5667 } while (0 )
5768
5869#define DECLARE_CPP_INITMOD_LOOKUP (mod ) \
70+ namespace Halide { \
71+ namespace { \
5972 std::unique_ptr<llvm::Module> get_initmod_##mod(llvm::LLVMContext *context, bool bits_64, bool debug) { \
6073 if (bits_64) { \
6174 DECLARE_CPP_INITMOD_LOOKUP_BITS (mod, 64 ); \
6275 } else { \
6376 DECLARE_CPP_INITMOD_LOOKUP_BITS (mod, 32 ); \
6477 } \
78+ } \
79+ } \
6580 }
6681
6782#define DECLARE_CPP_INITMOD_LOOKUP_64 (mod ) \
83+ namespace Halide { \
84+ namespace { \
6885 std::unique_ptr<llvm::Module> get_initmod_##mod(llvm::LLVMContext *context, bool bits_64, bool debug) { \
6986 if (bits_64) { \
7087 DECLARE_CPP_INITMOD_LOOKUP_BITS (mod, 64 ); \
7188 } else { \
7289 internal_error << " No support for 32-bit initmod: " #mod; \
7390 return nullptr ; /* appease warnings */ \
7491 } \
92+ } \
93+ } \
7594 }
7695
7796#define DECLARE_CPP_INITMOD (mod ) \
@@ -315,6 +334,9 @@ DECLARE_CPP_INITMOD(riscv_cpu_features)
315334DECLARE_NO_INITMOD (riscv_cpu_features)
316335#endif // WITH_RISCV
317336
337+ namespace Halide {
338+ namespace {
339+
318340llvm::DataLayout get_data_layout_for_target (Target target) {
319341 if (target.arch == Target::X86) {
320342 if (target.bits == 32 ) {
0 commit comments