aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/NeonEmitter.cpp
blob: ce754a78188dd9125ea64cc64a87e0452e9adc63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//===- NeonEmitter.cpp - 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.
//
//===----------------------------------------------------------------------===//

#include "NeonEmitter.h"
#include "Record.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include <string>

using namespace llvm;

void NeonEmitter::run(raw_ostream &OS) {
  EmitSourceFileHeader("ARM NEON Header", OS);
  
  // FIXME: emit license into file?
  
  OS << "#ifndef __ARM_NEON_H\n";
  OS << "#define __ARM_NEON_H\n\n";
  
  OS << "#ifndef __ARM_NEON__\n";
  OS << "#error \"NEON support not enabled\"\n";
  OS << "#endif\n\n";

  OS << "#include <stdint.h>\n\n";
  
  // EmitTypedefs(OS);
  
  // Process Records
  
  std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
  
  // Unique the pattern types, and assign them 
  
  // emit #define directives for uniq'd prototypes
  
  // emit record directives
  
  for (unsigned i = 0, e = RV.size(); i != e; ++i) {
    Record *R = RV[i];
    
    OS << LowercaseString(R->getName()) << "\n";

    std::string Types = R->getValueAsString("Types");
    //std::string Pattern = R->getValueAsString("Pattern");
    //OS << Types << "\n" << Pattern << "\n\n";
  }
  
  OS << "#endif /* __ARM_NEON_H */\n";
}