blob: a66c30b6cb89cc7d3758a18322b5bf3a3e76c790 [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 Lattner30609102007-12-29 20:37:13 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Chris Lattner9e493cf2006-03-03 02:32:46 +00007//
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 {
Reid Spencerc4de3de2007-04-01 07:20:02 +000027 Record *TheDef; // The actual record defining this intrinsic.
Chris Lattner9e493cf2006-03-03 02:32:46 +000028 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.
Duncan Sands83ec4b62008-06-06 12:08:01 +000032
33 /// ArgVTs - The MVT::SimpleValueType for each argument type. Note that
34 /// this list is only populated when in the context of a target .td file.
35 /// When building Intrinsics.td, this isn't available, because we don't know
36 /// the target pointer size.
37 std::vector<MVT::SimpleValueType> 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
Reid Spencerc4de3de2007-04-01 07:20:02 +000048 // This is set to true if the intrinsic is overloaded by its argument
49 // types.
50 bool isOverloaded;
51
Dan Gohmanee4fa192008-04-03 00:02:49 +000052 CodeGenIntrinsic(Record *R);
Chris Lattner9e493cf2006-03-03 02:32:46 +000053 };
54
55 /// LoadIntrinsics - Read all of the intrinsics defined in the specified
56 /// .td file.
57 std::vector<CodeGenIntrinsic> LoadIntrinsics(const RecordKeeper &RC);
58}
59
60#endif