2014-06-23 18:00:31 +00:00
|
|
|
//===- AMDGPUIntrinsicInfo.cpp - AMDGPU Intrinsic Information ---*- C++ -*-===//
|
2012-12-11 21:25:42 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//==-----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
/// \brief AMDGPU Implementation of the IntrinsicInfo class.
|
|
|
|
//
|
|
|
|
//===-----------------------------------------------------------------------===//
|
|
|
|
|
2014-06-23 18:00:31 +00:00
|
|
|
#include "AMDGPUIntrinsicInfo.h"
|
2012-12-11 21:25:42 +00:00
|
|
|
#include "AMDGPUSubtarget.h"
|
2013-01-02 11:36:10 +00:00
|
|
|
#include "llvm/IR/DerivedTypes.h"
|
|
|
|
#include "llvm/IR/Intrinsics.h"
|
|
|
|
#include "llvm/IR/Module.h"
|
2012-12-11 21:25:42 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
#define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
|
|
|
|
#include "AMDGPUGenIntrinsics.inc"
|
|
|
|
#undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
|
|
|
|
|
2014-07-25 22:22:39 +00:00
|
|
|
AMDGPUIntrinsicInfo::AMDGPUIntrinsicInfo()
|
2014-06-23 18:00:31 +00:00
|
|
|
: TargetIntrinsicInfo() {}
|
2012-12-11 21:25:42 +00:00
|
|
|
|
2014-06-23 18:00:31 +00:00
|
|
|
std::string AMDGPUIntrinsicInfo::getName(unsigned IntrID, Type **Tys,
|
|
|
|
unsigned numTys) const {
|
|
|
|
static const char *const names[] = {
|
2012-12-11 21:25:42 +00:00
|
|
|
#define GET_INTRINSIC_NAME_TABLE
|
|
|
|
#include "AMDGPUGenIntrinsics.inc"
|
|
|
|
#undef GET_INTRINSIC_NAME_TABLE
|
|
|
|
};
|
|
|
|
|
|
|
|
if (IntrID < Intrinsic::num_intrinsics) {
|
2014-04-25 05:30:21 +00:00
|
|
|
return nullptr;
|
2012-12-11 21:25:42 +00:00
|
|
|
}
|
2014-06-23 18:00:31 +00:00
|
|
|
assert(IntrID < AMDGPUIntrinsic::num_AMDGPU_intrinsics &&
|
|
|
|
"Invalid intrinsic ID");
|
2012-12-11 21:25:42 +00:00
|
|
|
|
|
|
|
std::string Result(names[IntrID - Intrinsic::num_intrinsics]);
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2014-06-23 18:00:31 +00:00
|
|
|
unsigned AMDGPUIntrinsicInfo::lookupName(const char *Name,
|
|
|
|
unsigned Len) const {
|
2013-05-22 14:57:42 +00:00
|
|
|
if (!StringRef(Name, Len).startswith("llvm."))
|
|
|
|
return 0; // All intrinsics start with 'llvm.'
|
|
|
|
|
2012-12-11 21:25:42 +00:00
|
|
|
#define GET_FUNCTION_RECOGNIZER
|
|
|
|
#include "AMDGPUGenIntrinsics.inc"
|
|
|
|
#undef GET_FUNCTION_RECOGNIZER
|
2014-06-23 18:00:31 +00:00
|
|
|
AMDGPUIntrinsic::ID IntrinsicID =
|
|
|
|
(AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic;
|
2012-12-11 21:25:42 +00:00
|
|
|
IntrinsicID = getIntrinsicForGCCBuiltin("AMDGPU", Name);
|
|
|
|
|
|
|
|
if (IntrinsicID != (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic) {
|
|
|
|
return IntrinsicID;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-06-23 18:00:31 +00:00
|
|
|
bool AMDGPUIntrinsicInfo::isOverloaded(unsigned id) const {
|
|
|
|
// Overload Table
|
2012-12-11 21:25:42 +00:00
|
|
|
#define GET_INTRINSIC_OVERLOAD_TABLE
|
|
|
|
#include "AMDGPUGenIntrinsics.inc"
|
|
|
|
#undef GET_INTRINSIC_OVERLOAD_TABLE
|
|
|
|
}
|
|
|
|
|
2014-06-23 18:00:31 +00:00
|
|
|
Function *AMDGPUIntrinsicInfo::getDeclaration(Module *M, unsigned IntrID,
|
|
|
|
Type **Tys,
|
|
|
|
unsigned numTys) const {
|
2012-12-13 19:38:52 +00:00
|
|
|
llvm_unreachable("Not implemented");
|
2012-12-11 21:25:42 +00:00
|
|
|
}
|