Tom Stellard | f98f2ce | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 1 | //===- AMDILIntrinsicInfo.cpp - AMDGPU Intrinsic Information ------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //==-----------------------------------------------------------------------===// |
| 9 | // |
| 10 | /// \file |
| 11 | /// \brief AMDGPU Implementation of the IntrinsicInfo class. |
| 12 | // |
| 13 | //===-----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "AMDILIntrinsicInfo.h" |
Tom Stellard | f98f2ce | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 16 | #include "AMDGPUSubtarget.h" |
Chandler Carruth | 58a2cbe | 2013-01-02 10:22:59 +0000 | [diff] [blame] | 17 | #include "AMDIL.h" |
Chandler Carruth | 0b8c9a8 | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 18 | #include "llvm/IR/DerivedTypes.h" |
| 19 | #include "llvm/IR/Intrinsics.h" |
| 20 | #include "llvm/IR/Module.h" |
Tom Stellard | f98f2ce | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 21 | |
| 22 | using namespace llvm; |
| 23 | |
| 24 | #define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN |
| 25 | #include "AMDGPUGenIntrinsics.inc" |
| 26 | #undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN |
| 27 | |
| 28 | AMDGPUIntrinsicInfo::AMDGPUIntrinsicInfo(TargetMachine *tm) |
| 29 | : TargetIntrinsicInfo() { |
| 30 | } |
| 31 | |
| 32 | std::string |
| 33 | AMDGPUIntrinsicInfo::getName(unsigned int IntrID, Type **Tys, |
| 34 | unsigned int numTys) const { |
| 35 | static const char* const names[] = { |
| 36 | #define GET_INTRINSIC_NAME_TABLE |
| 37 | #include "AMDGPUGenIntrinsics.inc" |
| 38 | #undef GET_INTRINSIC_NAME_TABLE |
| 39 | }; |
| 40 | |
| 41 | if (IntrID < Intrinsic::num_intrinsics) { |
| 42 | return 0; |
| 43 | } |
| 44 | assert(IntrID < AMDGPUIntrinsic::num_AMDGPU_intrinsics |
| 45 | && "Invalid intrinsic ID"); |
| 46 | |
| 47 | std::string Result(names[IntrID - Intrinsic::num_intrinsics]); |
| 48 | return Result; |
| 49 | } |
| 50 | |
| 51 | unsigned int |
| 52 | AMDGPUIntrinsicInfo::lookupName(const char *Name, unsigned int Len) const { |
| 53 | #define GET_FUNCTION_RECOGNIZER |
| 54 | #include "AMDGPUGenIntrinsics.inc" |
| 55 | #undef GET_FUNCTION_RECOGNIZER |
| 56 | AMDGPUIntrinsic::ID IntrinsicID |
| 57 | = (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic; |
| 58 | IntrinsicID = getIntrinsicForGCCBuiltin("AMDGPU", Name); |
| 59 | |
| 60 | if (IntrinsicID != (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic) { |
| 61 | return IntrinsicID; |
| 62 | } |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | bool |
| 67 | AMDGPUIntrinsicInfo::isOverloaded(unsigned id) const { |
| 68 | // Overload Table |
| 69 | #define GET_INTRINSIC_OVERLOAD_TABLE |
| 70 | #include "AMDGPUGenIntrinsics.inc" |
| 71 | #undef GET_INTRINSIC_OVERLOAD_TABLE |
| 72 | } |
| 73 | |
| 74 | Function* |
| 75 | AMDGPUIntrinsicInfo::getDeclaration(Module *M, unsigned IntrID, |
| 76 | Type **Tys, |
| 77 | unsigned numTys) const { |
Tom Stellard | 08f2d93 | 2012-12-13 19:38:52 +0000 | [diff] [blame] | 78 | llvm_unreachable("Not implemented"); |
Tom Stellard | f98f2ce | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 79 | } |