docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
code_generation_pass.h
Go to the documentation of this file.
1#pragma once
2
4#include <llvm/BinaryFormat/Dwarf.h>
5#include <llvm/Transforms/Utils/ModuleUtils.h>
6
8
12
13namespace docc {
14namespace passes {
15
16class CodeGenerationPass : public llvm::PassInfoMixin<CodeGenerationPass> {
17private:
18 std::vector<std::string> sub_compile_opts_;
19
20 void add_subcomp_opts_from_arg(std::vector<std::string>& out_opts) const;
21
22 std::unique_ptr<llvm::Module> compile_to_ir_in_memory(
23 llvm::LLVMContext& ctx,
24 const std::filesystem::path& source_path,
25 const std::vector<std::string>& compile_args,
26 const std::vector<std::string>& add_compile_args,
27 const llvm::Triple& target_triple
28 );
29
30 bool write_library_snippets_to_files(
31 std::filesystem::path build_path,
32 std::unordered_set<std::string> lib_files,
33 const std::unordered_map<std::string, sdfg::codegen::CodeSnippet>& snippets,
34 std::unordered_map<std::string, std::vector<std::filesystem::path>>& files_for_post_processing
35 );
36
37 bool compile_additional_files(
38 const std::filesystem::path& build_path,
39 const std::vector<std::string>& compile_args,
40 std::set<std::string>& link_2nd_args,
41 std::unordered_map<std::string, std::vector<std::filesystem::path>> files_for_post_processing,
42 const util::DoccPaths& docc_paths
43 );
44
45 bool generate_code(
46 llvm::Module& Mod,
48 const analysis::Attributes& attributes,
49 llvm::dwarf::SourceLanguage& language,
50 const std::vector<std::string>& mod_wide_compile_flags,
51 std::set<std::string>& link_2nd_args,
52 const util::DoccPaths& docc_paths
53 );
54
55 bool link_into_existing_module(
56 llvm::Module& Mod,
57 const std::vector<std::string>& compile_args,
58 const std::vector<std::string>& add_compiler_args,
59 const std::filesystem::path& source_path,
60 const std::string& steal_from
61 );
62
63 std::list<std::unique_ptr<sdfg::StructuredSDFG>>
64 split_sdfg(sdfg::StructuredSDFG& sdfg, const analysis::Attributes& attributes);
65
66public:
68
72
73 llvm::PreservedAnalyses run(llvm::Module& Module, llvm::ModuleAnalysisManager& MAM, analysis::AnalysisManager& AM);
74
76 const std::filesystem::path& source_path,
77 const std::filesystem::path& object_file,
78 const std::vector<std::string>& compile_args
79 );
80};
81
82} // namespace passes
83} // namespace docc
Definition analysis.h:25
static bool is_link_time(AnalysisManager &WPAM)
bool compile_to_object_file(const std::filesystem::path &source_path, const std::filesystem::path &object_file, const std::vector< std::string > &compile_args)
static bool available(analysis::AnalysisManager &AM)
Definition code_generation_pass.h:69
llvm::PreservedAnalyses run(llvm::Module &Module, llvm::ModuleAnalysisManager &MAM, analysis::AnalysisManager &AM)
Definition docc_paths.h:13
Definition structured_sdfg.h:30
Definition code_generation_pass.h:14
Definition targets.h:8
Definition analysis.h:7
Definition attributes.h:25