VapourSynth-llvmexpr
Loading...
Searching...
No Matches
SingleExprIRGenerator.hpp
Go to the documentation of this file.
1
19
20#ifndef LLVMEXPR_CODEGEN_LLVM_SINGLEEXPRIRGENERATOR_HPP
21#define LLVMEXPR_CODEGEN_LLVM_SINGLEEXPRIRGENERATOR_HPP
22
23#include "IRGeneratorBase.hpp"
24
26 public:
28 const std::vector<Token>& tokens_in, const VSVideoInfo* out_vi,
29 const std::vector<const VSVideoInfo*>& in_vi, bool mirror,
30 const std::map<std::pair<int, std::string>, int>& p_map,
31 const std::vector<std::string>& output_props,
32 const analysis::ExpressionAnalysisResults& analysis_results_in,
33 llvm::LLVMContext& context_ref, llvm::Module& module_ref,
34 llvm::IRBuilder<>& builder_ref, MathLibraryManager& math_mgr,
35 std::string func_name_in, int approx_math_in);
36
37 protected:
38 void defineFunctionSignature() override;
39 void generateLoops() override;
40
41 bool processModeSpecificToken(const Token& token,
42 std::vector<llvm::Value*>& rpn_stack,
43 llvm::Value* x, llvm::Value* y,
44 llvm::Value* x_fp, llvm::Value* y_fp,
45 bool no_x_bounds_check) override;
46
47 void finalizeAndStoreResult(llvm::Value* result_val, llvm::Value* x,
48 llvm::Value* y) override;
49
50 private:
51 llvm::Value* generatePixelLoadPlane(int clip_idx, int plane_idx,
52 llvm::Value* x, llvm::Value* y);
53 void generatePixelStorePlane(llvm::Value* value_to_store, int plane_idx,
54 llvm::Value* x, llvm::Value* y);
55
56 std::vector<std::vector<llvm::Value*>> plane_base_ptrs;
57 std::vector<std::vector<llvm::Value*>> plane_strides;
58 std::map<std::string, llvm::Value*> prop_allocas;
59 const std::vector<std::string>& output_props_list;
60 std::map<std::string, int> output_prop_map;
61
62 // Array
63 llvm::Value* context_arg = nullptr;
64 llvm::Function* llvmexpr_ensure_buffer_func = nullptr;
65 llvm::Function* llvmexpr_get_buffer_size_func = nullptr;
66 std::map<std::string, llvm::Value*> array_ptr_cache;
67
68 std::map<std::string, llvm::Value*> named_arrays;
69};
70
71#endif // LLVMEXPR_CODEGEN_LLVM_SINGLEEXPRIRGENERATOR_HPP
IRGeneratorBase(const std::vector< Token > &tokens_in, const VSVideoInfo *out_vi, const std::vector< const VSVideoInfo * > &in_vi, int width_in, int height_in, bool mirror, const std::map< std::pair< int, std::string >, int > &p_map, const analysis::ExpressionAnalysisResults &analysis_results_in, llvm::LLVMContext &context_ref, llvm::Module &module_ref, llvm::IRBuilder<> &builder_ref, MathLibraryManager &math_mgr, std::string func_name_in, int approx_math_in)
void finalizeAndStoreResult(llvm::Value *result_val, llvm::Value *x, llvm::Value *y) override
bool processModeSpecificToken(const Token &token, std::vector< llvm::Value * > &rpn_stack, llvm::Value *x, llvm::Value *y, llvm::Value *x_fp, llvm::Value *y_fp, bool no_x_bounds_check) override
void defineFunctionSignature() override
SingleExprIRGenerator(const std::vector< Token > &tokens_in, const VSVideoInfo *out_vi, const std::vector< const VSVideoInfo * > &in_vi, bool mirror, const std::map< std::pair< int, std::string >, int > &p_map, const std::vector< std::string > &output_props, const analysis::ExpressionAnalysisResults &analysis_results_in, llvm::LLVMContext &context_ref, llvm::Module &module_ref, llvm::IRBuilder<> &builder_ref, MathLibraryManager &math_mgr, std::string func_name_in, int approx_math_in)