Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===- CodeGenIntrinsic.h - Intrinsic Class Wrapper ------------*- C++ -*--===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | fd6c2f0 | 2007-12-29 20:37:13 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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 | |
| 21 | namespace 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. |
Duncan Sands | 92c4391 | 2008-06-06 12:08:01 +0000 | [diff] [blame] | 32 | |
| 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 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 39 | /// ArgTypeDefs - The records for each argument type. |
| 40 | /// |
| 41 | std::vector<Record*> ArgTypeDefs; |
| 42 | |
| 43 | // Memory mod/ref behavior of this intrinsic. |
| 44 | enum { |
| 45 | NoMem, ReadArgMem, ReadMem, WriteArgMem, WriteMem |
| 46 | } ModRef; |
| 47 | |
| 48 | // This is set to true if the intrinsic is overloaded by its argument |
| 49 | // types. |
| 50 | bool isOverloaded; |
| 51 | |
Evan Cheng | bb46d26 | 2008-06-16 20:29:38 +0000 | [diff] [blame^] | 52 | // isCommutative - True if the intrinsic is commutative. |
| 53 | // |
| 54 | bool isCommutative; |
| 55 | |
Dan Gohman | 907df57 | 2008-04-03 00:02:49 +0000 | [diff] [blame] | 56 | CodeGenIntrinsic(Record *R); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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 |