1 //===- NeonEmitter.h - Generate arm_neon.h for use with clang ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This tablegen backend is responsible for emitting arm_neon.h, which includes
11 // a declaration and definition of each function specified by the ARM NEON
12 // compiler interface. See ARM document DUI0348B.
14 //===----------------------------------------------------------------------===//
16 #ifndef NEON_EMITTER_H
17 #define NEON_EMITTER_H
20 #include "TableGenBackend.h"
21 #include "llvm/ADT/DenseMap.h"
22 #include "llvm/ADT/StringMap.h"
63 ClassI, // generic integer instruction, e.g., "i8" suffix
64 ClassS, // signed/unsigned/poly, e.g., "s8", "u8" or "p8" suffix
65 ClassW, // width-specific instruction, e.g., "8" suffix
66 ClassB // bitcast arguments with enum argument to specify type
71 class NeonEmitter : public TableGenBackend {
72 RecordKeeper &Records;
73 StringMap<OpKind> OpMap;
74 DenseMap<Record*, ClassKind> ClassMap;
77 NeonEmitter(RecordKeeper &R) : Records(R) {
78 OpMap["OP_NONE"] = OpNone;
79 OpMap["OP_ADD"] = OpAdd;
80 OpMap["OP_SUB"] = OpSub;
81 OpMap["OP_MUL"] = OpMul;
82 OpMap["OP_MLA"] = OpMla;
83 OpMap["OP_MLS"] = OpMls;
84 OpMap["OP_MUL_N"] = OpMulN;
85 OpMap["OP_MLA_N"] = OpMlaN;
86 OpMap["OP_MLS_N"] = OpMlsN;
87 OpMap["OP_MUL_LN"]= OpMulLane;
88 OpMap["OP_MLA_LN"]= OpMlaLane;
89 OpMap["OP_MLS_LN"]= OpMlsLane;
90 OpMap["OP_EQ"] = OpEq;
91 OpMap["OP_GE"] = OpGe;
92 OpMap["OP_LE"] = OpLe;
93 OpMap["OP_GT"] = OpGt;
94 OpMap["OP_LT"] = OpLt;
95 OpMap["OP_NEG"] = OpNeg;
96 OpMap["OP_NOT"] = OpNot;
97 OpMap["OP_AND"] = OpAnd;
98 OpMap["OP_OR"] = OpOr;
99 OpMap["OP_XOR"] = OpXor;
100 OpMap["OP_ANDN"] = OpAndNot;
101 OpMap["OP_ORN"] = OpOrNot;
102 OpMap["OP_CAST"] = OpCast;
103 OpMap["OP_CONC"] = OpConcat;
104 OpMap["OP_HI"] = OpHi;
105 OpMap["OP_LO"] = OpLo;
106 OpMap["OP_DUP"] = OpDup;
107 OpMap["OP_SEL"] = OpSelect;
108 OpMap["OP_REV16"] = OpRev16;
109 OpMap["OP_REV32"] = OpRev32;
110 OpMap["OP_REV64"] = OpRev64;
111 OpMap["OP_REINT"] = OpReinterpret;
113 Record *SI = R.getClass("SInst");
114 Record *II = R.getClass("IInst");
115 Record *WI = R.getClass("WInst");
116 ClassMap[SI] = ClassS;
117 ClassMap[II] = ClassI;
118 ClassMap[WI] = ClassW;
121 // run - Emit arm_neon.h.inc
122 void run(raw_ostream &o);
124 // runHeader - Emit all the __builtin prototypes used in arm_neon.h
125 void runHeader(raw_ostream &o);
128 } // End llvm namespace