blob: 57f85ad422500f6b86203a749716b628816ccc8c [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===- CodeGenIntrinsic.h - Intrinsic Class Wrapper ------------*- C++ -*--===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// 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>
19#include "llvm/CodeGen/ValueTypes.h"
20
21namespace llvm {
22 class Record;
23 class RecordKeeper;
24 class CodeGenTarget;
25
26 struct CodeGenIntrinsic {
27 Record *TheDef; // The actual record defining this intrinsic.
28 std::string Name; // The name of the LLVM function "llvm.bswap.i32"
29 std::string EnumName; // The name of the enum "bswap_i32"
30 std::string GCCBuiltinName;// Name of the corresponding GCC builtin, or "".
31 std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics.
32
33 /// ArgTypes - The type primitive enum value for the return value and all
34 /// of the arguments. These are things like Type::IntegerTyID.
35 std::vector<std::string> ArgTypes;
36
37 /// ArgVTs - The MVT::ValueType for each argument type. Note that this list
38 /// is only populated when in the context of a target .td file. When
39 /// building Intrinsics.td, this isn't available, because we don't know the
40 /// target pointer size.
41 std::vector<MVT::ValueType> ArgVTs;
42
43 /// ArgTypeDefs - The records for each argument type.
44 ///
45 std::vector<Record*> ArgTypeDefs;
46
47 // Memory mod/ref behavior of this intrinsic.
48 enum {
49 NoMem, ReadArgMem, ReadMem, WriteArgMem, WriteMem
50 } ModRef;
51
52 // This is set to true if the intrinsic is overloaded by its argument
53 // types.
54 bool isOverloaded;
55
56 CodeGenIntrinsic(Record *R, CodeGenTarget *CGT);
57 };
58
59 /// LoadIntrinsics - Read all of the intrinsics defined in the specified
60 /// .td file.
61 std::vector<CodeGenIntrinsic> LoadIntrinsics(const RecordKeeper &RC);
62}
63
64#endif