2006-03-03 10:32:46 +08:00
|
|
|
//===- CodeGenIntrinsic.h - Intrinsic Class Wrapper ------------*- C++ -*--===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:37:13 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-03-03 10:32:46 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines a wrapper class for the 'Intrinsic' TableGen class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_UTILS_TABLEGEN_CODEGENINTRINSICS_H
|
|
|
|
#define LLVM_UTILS_TABLEGEN_CODEGENINTRINSICS_H
|
2006-03-03 10:32:46 +08:00
|
|
|
|
2014-03-15 17:11:41 +08:00
|
|
|
#include "llvm/CodeGen/MachineValueType.h"
|
2006-03-03 10:32:46 +08:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class Record;
|
|
|
|
class RecordKeeper;
|
2006-03-28 06:48:18 +08:00
|
|
|
class CodeGenTarget;
|
2006-03-03 10:32:46 +08:00
|
|
|
|
|
|
|
struct CodeGenIntrinsic {
|
2007-04-01 15:20:02 +08:00
|
|
|
Record *TheDef; // The actual record defining this intrinsic.
|
2006-03-03 10:32:46 +08:00
|
|
|
std::string Name; // The name of the LLVM function "llvm.bswap.i32"
|
|
|
|
std::string EnumName; // The name of the enum "bswap_i32"
|
2006-03-14 07:08:44 +08:00
|
|
|
std::string GCCBuiltinName;// Name of the corresponding GCC builtin, or "".
|
2014-07-05 02:42:25 +08:00
|
|
|
std::string MSBuiltinName; // Name of the corresponding MS builtin, or "".
|
2006-03-15 09:33:26 +08:00
|
|
|
std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics.
|
2008-06-06 20:08:01 +08:00
|
|
|
|
2008-11-13 17:08:33 +08:00
|
|
|
/// IntrinsicSignature - This structure holds the return values and
|
|
|
|
/// parameter values of an intrinsic. If the number of return values is > 1,
|
|
|
|
/// then the intrinsic implicitly returns a first-class aggregate. The
|
|
|
|
/// numbering of the types starts at 0 with the first return value and
|
2009-03-27 00:17:51 +08:00
|
|
|
/// continues from there through the parameter list. This is useful for
|
2008-11-13 17:08:33 +08:00
|
|
|
/// "matching" types.
|
|
|
|
struct IntrinsicSignature {
|
2009-08-12 04:47:22 +08:00
|
|
|
/// RetVTs - The MVT::SimpleValueType for each return type. Note that this
|
2008-11-13 17:08:33 +08:00
|
|
|
/// list is only populated when in the context of a target .td file. When
|
|
|
|
/// building Intrinsics.td, this isn't available, because we don't know
|
|
|
|
/// the target pointer size.
|
2009-08-12 04:47:22 +08:00
|
|
|
std::vector<MVT::SimpleValueType> RetVTs;
|
2008-11-13 17:08:33 +08:00
|
|
|
|
|
|
|
/// RetTypeDefs - The records for each return type.
|
|
|
|
std::vector<Record*> RetTypeDefs;
|
|
|
|
|
2009-08-12 04:47:22 +08:00
|
|
|
/// ParamVTs - The MVT::SimpleValueType for each parameter type. Note that
|
2008-11-13 17:08:33 +08:00
|
|
|
/// this list is only populated when in the context of a target .td file.
|
|
|
|
/// When building Intrinsics.td, this isn't available, because we don't
|
|
|
|
/// know the target pointer size.
|
2009-08-12 04:47:22 +08:00
|
|
|
std::vector<MVT::SimpleValueType> ParamVTs;
|
2008-11-13 17:08:33 +08:00
|
|
|
|
|
|
|
/// ParamTypeDefs - The records for each parameter type.
|
|
|
|
std::vector<Record*> ParamTypeDefs;
|
|
|
|
};
|
|
|
|
|
|
|
|
IntrinsicSignature IS;
|
2008-06-06 20:08:01 +08:00
|
|
|
|
2006-03-03 10:32:46 +08:00
|
|
|
// Memory mod/ref behavior of this intrinsic.
|
|
|
|
enum {
|
2010-08-06 07:36:21 +08:00
|
|
|
NoMem, ReadArgMem, ReadMem, ReadWriteArgMem, ReadWriteMem
|
2006-03-03 10:32:46 +08:00
|
|
|
} ModRef;
|
|
|
|
|
2009-01-12 09:12:03 +08:00
|
|
|
/// This is set to true if the intrinsic is overloaded by its argument
|
|
|
|
/// types.
|
2007-04-01 15:20:02 +08:00
|
|
|
bool isOverloaded;
|
|
|
|
|
2009-01-12 09:12:03 +08:00
|
|
|
/// isCommutative - True if the intrinsic is commutative.
|
2008-06-17 04:29:38 +08:00
|
|
|
bool isCommutative;
|
2011-05-28 14:31:34 +08:00
|
|
|
|
|
|
|
/// canThrow - True if the intrinsic can throw.
|
|
|
|
bool canThrow;
|
2012-05-28 07:20:41 +08:00
|
|
|
|
2014-03-19 07:51:07 +08:00
|
|
|
/// isNoDuplicate - True if the intrinsic is marked as noduplicate.
|
|
|
|
bool isNoDuplicate;
|
|
|
|
|
2012-05-28 07:20:41 +08:00
|
|
|
/// isNoReturn - True if the intrinsic is no-return.
|
|
|
|
bool isNoReturn;
|
|
|
|
|
2015-05-27 07:48:40 +08:00
|
|
|
/// isConvergent - True if the intrinsic is marked as convergent.
|
|
|
|
bool isConvergent;
|
|
|
|
|
2009-01-12 09:12:03 +08:00
|
|
|
enum ArgAttribute {
|
2013-07-06 08:29:58 +08:00
|
|
|
NoCapture,
|
|
|
|
ReadOnly,
|
|
|
|
ReadNone
|
2009-01-12 09:12:03 +08:00
|
|
|
};
|
|
|
|
std::vector<std::pair<unsigned, ArgAttribute> > ArgumentAttributes;
|
2008-06-17 04:29:38 +08:00
|
|
|
|
2008-04-03 08:02:49 +08:00
|
|
|
CodeGenIntrinsic(Record *R);
|
2006-03-03 10:32:46 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/// LoadIntrinsics - Read all of the intrinsics defined in the specified
|
|
|
|
/// .td file.
|
2009-02-05 09:49:45 +08:00
|
|
|
std::vector<CodeGenIntrinsic> LoadIntrinsics(const RecordKeeper &RC,
|
|
|
|
bool TargetOnly);
|
2006-03-03 10:32:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|