blob: f986ed1995bfba351dcc90c674f5e1d22d5744e3 [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;
Chris Lattner8850a1b2006-03-27 22:48:18 +000024 class CodeGenTarget;
Chris Lattner9e493cf2006-03-03 02:32:46 +000025
26 struct CodeGenIntrinsic {
27 Record *TheDef; // The actual record defining this instruction.
28 std::string Name; // The name of the LLVM function "llvm.bswap.i32"
29 std::string EnumName; // The name of the enum "bswap_i32"
Chris Lattner022f64f2006-03-13 23:08:44 +000030 std::string GCCBuiltinName;// Name of the corresponding GCC builtin, or "".
Chris Lattner3f8b8912006-03-15 01:33:26 +000031 std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics.
Chris Lattner022f64f2006-03-13 23:08:44 +000032
Chris Lattnerf97a00e2006-03-09 22:05:04 +000033 /// ArgTypes - The type primitive enum value for the return value and all
34 /// of the arguments. These are things like Type::UIntTyID.
35 std::vector<std::string> ArgTypes;
36
Chris Lattner43fbbc32006-03-24 19:49:31 +000037 /// ArgVTs - The MVT::ValueType for each argument type.
38 std::vector<MVT::ValueType> ArgVTs;
39
Chris Lattner18faf5d2006-03-13 22:38:57 +000040 /// ArgTypeDefs - The records for each argument type.
41 ///
42 std::vector<Record*> ArgTypeDefs;
43
Chris Lattner9e493cf2006-03-03 02:32:46 +000044 // Memory mod/ref behavior of this intrinsic.
45 enum {
46 NoMem, ReadArgMem, ReadMem, WriteArgMem, WriteMem
47 } ModRef;
48
Chris Lattner76f8c7c2006-03-28 00:03:08 +000049 CodeGenIntrinsic(Record *R, CodeGenTarget *CGT);
Chris Lattner9e493cf2006-03-03 02:32:46 +000050 };
51
52 /// LoadIntrinsics - Read all of the intrinsics defined in the specified
53 /// .td file.
54 std::vector<CodeGenIntrinsic> LoadIntrinsics(const RecordKeeper &RC);
55}
56
57#endif