22 llvm::TargetLibraryInfo& TLI_;
23 llvm::Function& function_;
24 const llvm::DataLayout& DL_;
29 std::map<const llvm::BasicBlock*, std::set<const sdfg::control_flow::State*>> state_mapping_;
30 std::map<const sdfg::control_flow::State*, std::set<const llvm::BasicBlock*>> pred_mapping_;
32 std::unordered_map<const llvm::Value*, std::string> constants_mapping_;
33 std::unordered_map<const llvm::Type*, std::string> anonymous_types_mapping_;
35 static void collect_globals(llvm::Function& function, llvm::Value* V, std::unordered_set<llvm::GlobalObject*>& visited);
39 void visit_arguments();
54 const llvm::BasicBlock* block,
55 const llvm::GetElementPtrInst* instruction,
108 const llvm::BasicBlock* block,
109 const llvm::UnreachableInst* instruction,
115 llvm::TargetLibraryInfo& TLI,
116 llvm::Function& function,
118 const std::string& sdfg_name
120 : TLI_(TLI), function_(function), DL_(function.getParent()->getDataLayout()), target_type_(target_type),
121 builder_(sdfg_name, target_type) {
122 if (this->function_.isVarArg()) {
123 throw NotImplementedException(
124 "FunctionLifting: Vararg functions are not supported",
125 docc::utils::get_debug_info(function),
126 function.getName().str()
132 this->anonymous_types_mapping_,
134 this->function_.getReturnType(),
137 this->builder_.set_return_type(*return_type);
141 :
Lifting(TLI, function, target_type, function.getName().str()) {
145 std::unique_ptr<sdfg::SDFG>
run();
147 static void collect_globals(llvm::Function& function, std::unordered_set<llvm::GlobalObject*>& globals);
std::unique_ptr< sdfg::types::IType > get_type(sdfg::builder::SDFGBuilder &builder, std::unordered_map< const llvm::Type *, std::string > &anonymous_types_mapping, const llvm::DataLayout &DL, llvm::Type *type, sdfg::types::StorageType storage_type, const std::string &initializer="")