| 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 // This file defines how to convert LLVM types to ICE types, and ICE types | 10 /// \file |
| 11 // to LLVM types. | 11 /// This file defines how to convert LLVM types to ICE types, and ICE types |
| 12 // | 12 /// to LLVM types. |
| 13 /// |
| 13 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 14 | 15 |
| 15 #ifndef SUBZERO_SRC_ICETYPECONVERTER_H | 16 #ifndef SUBZERO_SRC_ICETYPECONVERTER_H |
| 16 #define SUBZERO_SRC_ICETYPECONVERTER_H | 17 #define SUBZERO_SRC_ICETYPECONVERTER_H |
| 17 | 18 |
| 18 #include "IceDefs.h" | 19 #include "IceDefs.h" |
| 19 #include "IceTypes.h" | 20 #include "IceTypes.h" |
| 20 #include "llvm/IR/DerivedTypes.h" | 21 #include "llvm/IR/DerivedTypes.h" |
| 21 | 22 |
| 22 namespace llvm { | 23 namespace llvm { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 38 /// Converts LLVM type LLVMTy to an ICE type. Returns | 39 /// Converts LLVM type LLVMTy to an ICE type. Returns |
| 39 /// Ice::IceType_NUM if unable to convert. | 40 /// Ice::IceType_NUM if unable to convert. |
| 40 Type convertToIceType(llvm::Type *LLVMTy) const { | 41 Type convertToIceType(llvm::Type *LLVMTy) const { |
| 41 auto Pos = LLVM2IceMap.find(LLVMTy); | 42 auto Pos = LLVM2IceMap.find(LLVMTy); |
| 42 if (Pos == LLVM2IceMap.end()) | 43 if (Pos == LLVM2IceMap.end()) |
| 43 return convertToIceTypeOther(LLVMTy); | 44 return convertToIceTypeOther(LLVMTy); |
| 44 return Pos->second; | 45 return Pos->second; |
| 45 } | 46 } |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 // The mapping from LLVM types to corresopnding Ice types. | 49 /// The mapping from LLVM types to corresopnding Ice types. |
| 49 std::map<llvm::Type *, Type> LLVM2IceMap; | 50 std::map<llvm::Type *, Type> LLVM2IceMap; |
| 50 | 51 |
| 51 // Add LLVM/ICE pair to internal tables. | 52 /// Add LLVM/ICE pair to internal tables. |
| 52 void addLLVMType(Type Ty, llvm::Type *LLVMTy); | 53 void addLLVMType(Type Ty, llvm::Type *LLVMTy); |
| 53 | 54 |
| 54 // Converts types not in LLVM2IceMap. | 55 /// Converts types not in LLVM2IceMap. |
| 55 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; | 56 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 } // end of namespace Ice | 59 } // end of namespace Ice |
| 59 | 60 |
| 60 #endif // SUBZERO_SRC_ICETYPECONVERTER_H | 61 #endif // SUBZERO_SRC_ICETYPECONVERTER_H |
| OLD | NEW |