clang  6.0.0svn
Lanai.h
Go to the documentation of this file.
1 //===--- Lanai.h - Declare Lanai target feature support ---------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares Lanai TargetInfo objects.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
16 
17 #include "clang/Basic/TargetInfo.h"
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/Support/Compiler.h"
21 
22 namespace clang {
23 namespace targets {
24 
25 class LLVM_LIBRARY_VISIBILITY LanaiTargetInfo : public TargetInfo {
26  // Class for Lanai (32-bit).
27  // The CPU profiles supported by the Lanai backend
28  enum CPUKind {
29  CK_NONE,
30  CK_V11,
31  } CPU;
32 
33  static const TargetInfo::GCCRegAlias GCCRegAliases[];
34  static const char *const GCCRegNames[];
35 
36 public:
37  LanaiTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
38  : TargetInfo(Triple) {
39  // Description string has to be kept in sync with backend.
40  resetDataLayout("E" // Big endian
41  "-m:e" // ELF name manging
42  "-p:32:32" // 32 bit pointers, 32 bit aligned
43  "-i64:64" // 64 bit integers, 64 bit aligned
44  "-a:0:32" // 32 bit alignment of objects of aggregate type
45  "-n32" // 32 bit native integer width
46  "-S64" // 64 bit natural stack alignment
47  );
48 
49  // Setting RegParmMax equal to what mregparm was set to in the old
50  // toolchain
51  RegParmMax = 4;
52 
53  // Set the default CPU to V11
54  CPU = CK_V11;
55 
56  // Temporary approach to make everything at least word-aligned and allow for
57  // safely casting between pointers with different alignment requirements.
58  // TODO: Remove this when there are no more cast align warnings on the
59  // firmware.
60  MinGlobalAlign = 32;
61  }
62 
63  void getTargetDefines(const LangOptions &Opts,
64  MacroBuilder &Builder) const override;
65 
66  bool isValidCPUName(StringRef Name) const override;
67 
68  bool setCPU(const std::string &Name) override;
69 
70  bool hasFeature(StringRef Feature) const override;
71 
72  ArrayRef<const char *> getGCCRegNames() const override;
73 
74  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
75 
78  }
79 
80  ArrayRef<Builtin::Info> getTargetBuiltins() const override { return None; }
81 
82  bool validateAsmConstraint(const char *&Name,
83  TargetInfo::ConstraintInfo &info) const override {
84  return false;
85  }
86 
87  const char *getClobbers() const override { return ""; }
88 };
89 } // namespace targets
90 } // namespace clang
91 
92 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_LANAI_H
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature...
Definition: Module.cpp:73
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: Lanai.h:87
Options for controlling the target.
Definition: TargetOptions.h:26
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition: Lanai.h:80
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: Lanai.h:76
LanaiTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: Lanai.h:37
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
Definition: Lanai.h:82
static const char *const GCCRegNames[]
Definition: X86.cpp:42
typedef void* __builtin_va_list;
Definition: TargetInfo.h:157
Exposes information about the current target.
Definition: TargetInfo.h:54
Defines the clang::TargetOptions class.
Dataflow Directional Tag Classes.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:152
Defines the clang::TargetInfo interface.