1 //===- NeonEmitter.cpp - 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 #include "NeonEmitter.h"
18 #include "llvm/ADT/StringExtras.h"
19 #include "llvm/ADT/StringMap.h"
24 void NeonEmitter::run(raw_ostream &OS) {
25 EmitSourceFileHeader("ARM NEON Header", OS);
27 // FIXME: emit license into file?
29 OS << "#ifndef __ARM_NEON_H\n";
30 OS << "#define __ARM_NEON_H\n\n";
32 OS << "#ifndef __ARM_NEON__\n";
33 OS << "#error \"NEON support not enabled\"\n";
36 OS << "#include <stdint.h>\n\n";
42 std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
44 // Unique the pattern types, and assign them
46 // emit #define directives for uniq'd prototypes
48 // emit record directives
50 for (unsigned i = 0, e = RV.size(); i != e; ++i) {
53 OS << LowercaseString(R->getName()) << "\n";
55 std::string Types = R->getValueAsString("Types");
56 std::string Pattern = R->getValueAsString("Pattern");
58 OS << Types << "\n" << Pattern << "\n\n";
61 OS << "#endif /* __ARM_NEON_H */\n";