2010-05-28 01:08:32 +00:00
|
|
|
//===- NeonEmitter.h - Generate arm_neon.h for use with clang ---*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This tablegen backend is responsible for emitting arm_neon.h, which includes
|
|
|
|
// a declaration and definition of each function specified by the ARM NEON
|
|
|
|
// compiler interface. See ARM document DUI0348B.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef NEON_EMITTER_H
|
|
|
|
#define NEON_EMITTER_H
|
|
|
|
|
2010-06-04 01:26:15 +00:00
|
|
|
#include "Record.h"
|
2010-05-28 01:08:32 +00:00
|
|
|
#include "TableGenBackend.h"
|
2010-06-04 01:26:15 +00:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
#include "llvm/ADT/StringMap.h"
|
|
|
|
|
|
|
|
enum OpKind {
|
|
|
|
OpNone,
|
|
|
|
OpAdd,
|
|
|
|
OpSub,
|
|
|
|
OpMul,
|
|
|
|
OpMla,
|
|
|
|
OpMls,
|
2010-06-10 00:16:56 +00:00
|
|
|
OpMulN,
|
|
|
|
OpMlaN,
|
|
|
|
OpMlsN,
|
2010-06-04 01:26:15 +00:00
|
|
|
OpEq,
|
|
|
|
OpGe,
|
|
|
|
OpLe,
|
|
|
|
OpGt,
|
|
|
|
OpLt,
|
|
|
|
OpNeg,
|
|
|
|
OpNot,
|
|
|
|
OpAnd,
|
|
|
|
OpOr,
|
|
|
|
OpXor,
|
|
|
|
OpAndNot,
|
|
|
|
OpOrNot,
|
2010-06-08 00:14:42 +00:00
|
|
|
OpCast,
|
|
|
|
OpConcat,
|
2010-06-09 01:09:00 +00:00
|
|
|
OpDup,
|
|
|
|
OpHi,
|
2010-06-12 03:09:49 +00:00
|
|
|
OpLo,
|
|
|
|
OpSelect,
|
|
|
|
OpRev16,
|
|
|
|
OpRev32,
|
|
|
|
OpRev64
|
2010-06-04 01:26:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum ClassKind {
|
|
|
|
ClassNone,
|
|
|
|
ClassI,
|
|
|
|
ClassS,
|
|
|
|
ClassW,
|
|
|
|
ClassB
|
|
|
|
};
|
2010-05-28 01:08:32 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class NeonEmitter : public TableGenBackend {
|
|
|
|
RecordKeeper &Records;
|
2010-06-04 01:26:15 +00:00
|
|
|
StringMap<OpKind> OpMap;
|
|
|
|
DenseMap<Record*, ClassKind> ClassMap;
|
|
|
|
|
2010-05-28 01:08:32 +00:00
|
|
|
public:
|
2010-06-04 01:26:15 +00:00
|
|
|
NeonEmitter(RecordKeeper &R) : Records(R) {
|
2010-06-10 00:16:56 +00:00
|
|
|
OpMap["OP_NONE"] = OpNone;
|
|
|
|
OpMap["OP_ADD"] = OpAdd;
|
|
|
|
OpMap["OP_SUB"] = OpSub;
|
|
|
|
OpMap["OP_MUL"] = OpMul;
|
|
|
|
OpMap["OP_MLA"] = OpMla;
|
|
|
|
OpMap["OP_MLS"] = OpMls;
|
|
|
|
OpMap["OP_MUL_N"] = OpMulN;
|
|
|
|
OpMap["OP_MLA_N"] = OpMlaN;
|
|
|
|
OpMap["OP_MLS_N"] = OpMlsN;
|
|
|
|
OpMap["OP_EQ"] = OpEq;
|
|
|
|
OpMap["OP_GE"] = OpGe;
|
|
|
|
OpMap["OP_LE"] = OpLe;
|
|
|
|
OpMap["OP_GT"] = OpGt;
|
|
|
|
OpMap["OP_LT"] = OpLt;
|
|
|
|
OpMap["OP_NEG"] = OpNeg;
|
|
|
|
OpMap["OP_NOT"] = OpNot;
|
|
|
|
OpMap["OP_AND"] = OpAnd;
|
|
|
|
OpMap["OP_OR"] = OpOr;
|
|
|
|
OpMap["OP_XOR"] = OpXor;
|
|
|
|
OpMap["OP_ANDN"] = OpAndNot;
|
|
|
|
OpMap["OP_ORN"] = OpOrNot;
|
|
|
|
OpMap["OP_CAST"] = OpCast;
|
|
|
|
OpMap["OP_CONC"] = OpConcat;
|
|
|
|
OpMap["OP_HI"] = OpHi;
|
|
|
|
OpMap["OP_LO"] = OpLo;
|
|
|
|
OpMap["OP_DUP"] = OpDup;
|
2010-06-12 03:09:49 +00:00
|
|
|
OpMap["OP_SEL"] = OpSelect;
|
|
|
|
OpMap["OP_REV16"] = OpRev16;
|
|
|
|
OpMap["OP_REV32"] = OpRev32;
|
|
|
|
OpMap["OP_REV64"] = OpRev64;
|
2010-06-04 01:26:15 +00:00
|
|
|
|
|
|
|
Record *SI = R.getClass("SInst");
|
|
|
|
Record *II = R.getClass("IInst");
|
|
|
|
Record *WI = R.getClass("WInst");
|
|
|
|
ClassMap[SI] = ClassS;
|
|
|
|
ClassMap[II] = ClassI;
|
|
|
|
ClassMap[WI] = ClassW;
|
|
|
|
}
|
2010-05-28 01:08:32 +00:00
|
|
|
|
2010-06-04 00:21:41 +00:00
|
|
|
// run - Emit arm_neon.h.inc
|
2010-05-28 01:08:32 +00:00
|
|
|
void run(raw_ostream &o);
|
2010-06-04 00:21:41 +00:00
|
|
|
|
|
|
|
// runHeader - Emit all the __builtin prototypes used in arm_neon.h
|
|
|
|
void runHeader(raw_ostream &o);
|
2010-05-28 01:08:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|