Jlm
TypeConverter.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2025 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_LLVM_IR_TYPECONVERTER_HPP
7 #define JLM_LLVM_IR_TYPECONVERTER_HPP
8 
9 #include <jlm/llvm/ir/types.hpp>
11 
12 namespace llvm
13 {
14 class ArrayType;
15 class FunctionType;
16 class IntegerType;
17 class LLVMContext;
18 class PointerType;
19 class StructType;
20 class Type;
21 }
22 
23 namespace jlm::rvsdg
24 {
25 class BitType;
26 class ControlType;
27 class FunctionType;
28 class Type;
29 }
30 
31 namespace jlm::llvm
32 {
33 
37 class TypeConverter final
38 {
39 public:
40  TypeConverter() = default;
41 
42  TypeConverter(const TypeConverter &) = delete;
43 
44  TypeConverter(const TypeConverter &&) = delete;
45 
47  operator=(const TypeConverter &) = delete;
48 
50  operator=(const TypeConverter &&) = delete;
51 
52  static fpsize
53  ExtractFloatingPointSize(const ::llvm::Type & type);
54 
55  static ::llvm::IntegerType *
56  ConvertBitType(const rvsdg::BitType & bitType, ::llvm::LLVMContext & context);
57 
58  ::llvm::FunctionType *
59  ConvertFunctionType(const rvsdg::FunctionType & functionType, ::llvm::LLVMContext & context);
60 
61  static ::llvm::PointerType *
62  ConvertPointerType(const PointerType & type, ::llvm::LLVMContext & context);
63 
65  ConvertStructType(const StructType & type, ::llvm::LLVMContext & context);
66 
68  ConvertArrayType(const ArrayType & type, ::llvm::LLVMContext & context);
69 
70  ::llvm::Type *
71  ConvertJlmType(const rvsdg::Type & type, ::llvm::LLVMContext & context);
72 
73  std::shared_ptr<const rvsdg::FunctionType>
74  ConvertFunctionType(const ::llvm::FunctionType & functionType);
75 
76  static std::shared_ptr<const PointerType>
77  ConvertPointerType(const ::llvm::PointerType & pointerType);
78 
79  std::shared_ptr<const rvsdg::Type>
80  ConvertLlvmType(::llvm::Type & type);
81 
82 private:
83  static ::llvm::Type *
84  ConvertFloatingPointType(const FloatingPointType & type, ::llvm::LLVMContext & context);
85 
87 };
88 
89 }
90 
91 #endif // JLM_LLVM_IR_TYPECONVERTER_HPP
PointerType class.
Definition: types.hpp:25
StructType class.
Definition: types.hpp:184
::llvm::ArrayType * ConvertArrayType(const ArrayType &type, ::llvm::LLVMContext &context)
::llvm::PointerType * ConvertPointerType(const PointerType &type, ::llvm::LLVMContext &context)
::llvm::IntegerType * ConvertBitType(const rvsdg::BitType &bitType, ::llvm::LLVMContext &context)
::llvm::FunctionType * ConvertFunctionType(const rvsdg::FunctionType &functionType, ::llvm::LLVMContext &context)
TypeConverter & operator=(const TypeConverter &&)=delete
std::shared_ptr< const rvsdg::Type > ConvertLlvmType(::llvm::Type &type)
::llvm::Type * ConvertFloatingPointType(const FloatingPointType &type, ::llvm::LLVMContext &context)
TypeConverter(const TypeConverter &&)=delete
static fpsize ExtractFloatingPointSize(const ::llvm::Type &type)
util::BijectiveMap<::llvm::StructType *, std::shared_ptr< const StructType > > StructTypeMap_
::llvm::StructType * ConvertStructType(const StructType &type, ::llvm::LLVMContext &context)
TypeConverter(const TypeConverter &)=delete
TypeConverter & operator=(const TypeConverter &)=delete
::llvm::Type * ConvertJlmType(const rvsdg::Type &type, ::llvm::LLVMContext &context)
Function type class.
Global memory state passed between functions.
static std::string type(const Node *n)
Definition: view.cpp:255