| OLD | NEW |
| 1 //===- subzero/src/IceTypeConverter.h - Convert ICE/LLVM Types --*- C++ -*-===// | 1 //===- subzero/src/IceTypeConverter.h - Convert ICE/LLVM Types --*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| 11 /// This file defines how to convert LLVM types to ICE types, and ICE types | 11 /// This file defines how to convert LLVM types to ICE types, and ICE types to |
| 12 /// to LLVM types. | 12 /// LLVM types. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #ifndef SUBZERO_SRC_ICETYPECONVERTER_H | 16 #ifndef SUBZERO_SRC_ICETYPECONVERTER_H |
| 17 #define SUBZERO_SRC_ICETYPECONVERTER_H | 17 #define SUBZERO_SRC_ICETYPECONVERTER_H |
| 18 | 18 |
| 19 #include "IceDefs.h" | 19 #include "IceDefs.h" |
| 20 #include "IceTypes.h" | 20 #include "IceTypes.h" |
| 21 #pragma clang diagnostic push | 21 #pragma clang diagnostic push |
| 22 #pragma clang diagnostic ignored "-Wunused-parameter" | 22 #pragma clang diagnostic ignored "-Wunused-parameter" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 /// Converts LLVM types to ICE types, and ICE types to LLVM types. | 33 /// Converts LLVM types to ICE types, and ICE types to LLVM types. |
| 34 class TypeConverter { | 34 class TypeConverter { |
| 35 TypeConverter() = delete; | 35 TypeConverter() = delete; |
| 36 TypeConverter(const TypeConverter &) = delete; | 36 TypeConverter(const TypeConverter &) = delete; |
| 37 TypeConverter &operator=(const TypeConverter &) = delete; | 37 TypeConverter &operator=(const TypeConverter &) = delete; |
| 38 | 38 |
| 39 public: | 39 public: |
| 40 /// Context is the context to use to build llvm types. | 40 /// Context is the context to use to build llvm types. |
| 41 explicit TypeConverter(llvm::LLVMContext &Context); | 41 explicit TypeConverter(llvm::LLVMContext &Context); |
| 42 | 42 |
| 43 /// Converts LLVM type LLVMTy to an ICE type. Returns | 43 /// Converts LLVM type LLVMTy to an ICE type. Returns Ice::IceType_NUM if |
| 44 /// Ice::IceType_NUM if unable to convert. | 44 /// unable to convert. |
| 45 Type convertToIceType(llvm::Type *LLVMTy) const { | 45 Type convertToIceType(llvm::Type *LLVMTy) const { |
| 46 auto Pos = LLVM2IceMap.find(LLVMTy); | 46 auto Pos = LLVM2IceMap.find(LLVMTy); |
| 47 if (Pos == LLVM2IceMap.end()) | 47 if (Pos == LLVM2IceMap.end()) |
| 48 return convertToIceTypeOther(LLVMTy); | 48 return convertToIceTypeOther(LLVMTy); |
| 49 return Pos->second; | 49 return Pos->second; |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 /// The mapping from LLVM types to corresopnding Ice types. | 53 /// The mapping from LLVM types to corresopnding Ice types. |
| 54 std::map<llvm::Type *, Type> LLVM2IceMap; | 54 std::map<llvm::Type *, Type> LLVM2IceMap; |
| 55 | 55 |
| 56 /// Add LLVM/ICE pair to internal tables. | 56 /// Add LLVM/ICE pair to internal tables. |
| 57 void addLLVMType(Type Ty, llvm::Type *LLVMTy); | 57 void addLLVMType(Type Ty, llvm::Type *LLVMTy); |
| 58 | 58 |
| 59 /// Converts types not in LLVM2IceMap. | 59 /// Converts types not in LLVM2IceMap. |
| 60 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; | 60 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // end of namespace Ice | 63 } // end of namespace Ice |
| 64 | 64 |
| 65 #endif // SUBZERO_SRC_ICETYPECONVERTER_H | 65 #endif // SUBZERO_SRC_ICETYPECONVERTER_H |
| OLD | NEW |