blob: 2698836eccddd4bc6c097b573f0480af783dcabd [file] [log] [blame]
Chris Lattner9e493cf2006-03-03 02:32:46 +00001//===- CodeGenIntrinsic.h - Intrinsic Class Wrapper ------------*- C++ -*--===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerb672d982006-03-03 06:13:41 +00005// This file was developed by Chris Lattner and is distributed under
Chris Lattner9e493cf2006-03-03 02:32:46 +00006// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines a wrapper class for the 'Intrinsic' TableGen class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CODEGEN_INTRINSIC_H
15#define CODEGEN_INTRINSIC_H
16
17#include <string>
18#include <vector>
Chris Lattner43fbbc32006-03-24 19:49:31 +000019#include "llvm/CodeGen/ValueTypes.h"
Chris Lattner9e493cf2006-03-03 02:32:46 +000020
21namespace llvm {
22 class Record;
23 class RecordKeeper;
24
25 struct CodeGenIntrinsic {
26 Record *TheDef; // The actual record defining this instruction.
27 std::string Name; // The name of the LLVM function "llvm.bswap.i32"
28 std::string EnumName; // The name of the enum "bswap_i32"
Chris Lattner022f64f2006-03-13 23:08:44 +000029 std::string GCCBuiltinName;// Name of the corresponding GCC builtin, or "".
Chris Lattner3f8b8912006-03-15 01:33:26 +000030 std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics.
Chris Lattner022f64f2006-03-13 23:08:44 +000031
Chris Lattnerf97a00e2006-03-09 22:05:04 +000032 /// ArgTypes - The type primitive enum value for the return value and all
33 /// of the arguments. These are things like Type::UIntTyID.
34 std::vector<std::string> ArgTypes;
35
Chris Lattner43fbbc32006-03-24 19:49:31 +000036 /// ArgVTs - The MVT::ValueType for each argument type.
37 std::vector<MVT::ValueType> ArgVTs;
38
Chris Lattner18faf5d2006-03-13 22:38:57 +000039 /// ArgTypeDefs - The records for each argument type.
40 ///
41 std::vector<Record*> ArgTypeDefs;
42
Chris Lattner9e493cf2006-03-03 02:32:46 +000043 // Memory mod/ref behavior of this intrinsic.
44 enum {
45 NoMem, ReadArgMem, ReadMem, WriteArgMem, WriteMem
46 } ModRef;
47
48 CodeGenIntrinsic(Record *R);
49 };
50
51 /// LoadIntrinsics - Read all of the intrinsics defined in the specified
52 /// .td file.
53 std::vector<CodeGenIntrinsic> LoadIntrinsics(const RecordKeeper &RC);
54}
55
56#endif