clang  6.0.0svn
MSP430.h
Go to the documentation of this file.
1 //===--- MSP430.h - Declare MSP430 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 MSP430 TargetInfo objects.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_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 MSP430TargetInfo : public TargetInfo {
26  static const char *const GCCRegNames[];
27 
28 public:
29  MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
30  : TargetInfo(Triple) {
31  TLSSupported = false;
32  IntWidth = 16;
33  IntAlign = 16;
34  LongWidth = 32;
35  LongLongWidth = 64;
36  LongAlign = LongLongAlign = 16;
37  PointerWidth = 16;
38  PointerAlign = 16;
39  SuitableAlign = 16;
40  SizeType = UnsignedInt;
41  IntMaxType = SignedLongLong;
42  IntPtrType = SignedInt;
43  PtrDiffType = SignedInt;
44  SigAtomicType = SignedLong;
45  resetDataLayout("e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16");
46  }
47  void getTargetDefines(const LangOptions &Opts,
48  MacroBuilder &Builder) const override;
49 
51  // FIXME: Implement.
52  return None;
53  }
54 
55  bool hasFeature(StringRef Feature) const override {
56  return Feature == "msp430";
57  }
58 
59  ArrayRef<const char *> getGCCRegNames() const override;
60 
62  // No aliases.
63  return None;
64  }
65 
66  bool validateAsmConstraint(const char *&Name,
67  TargetInfo::ConstraintInfo &info) const override {
68  // FIXME: implement
69  switch (*Name) {
70  case 'K': // the constant 1
71  case 'L': // constant -1^20 .. 1^19
72  case 'M': // constant 1-4:
73  return true;
74  }
75  // No target constraints for now.
76  return false;
77  }
78 
79  const char *getClobbers() const override {
80  // FIXME: Is this really right?
81  return "";
82  }
83 
85  // FIXME: implement
87  }
88 };
89 
90 } // namespace targets
91 } // namespace clang
92 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_MSP430_H
Options for controlling the target.
Definition: TargetOptions.h:26
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition: MSP430.h:55
static const char *const GCCRegNames[]
Definition: X86.cpp:42
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition: MSP430.h:61
Exposes information about the current target.
Definition: TargetInfo.h:54
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition: MSP430.h:50
MSP430TargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: MSP430.h:29
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
Definition: MSP430.h:66
Defines the clang::TargetOptions class.
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: MSP430.h:79
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: MSP430.h:84
Dataflow Directional Tag Classes.
typedef char* __builtin_va_list;
Definition: TargetInfo.h:154
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:152
Defines the clang::TargetInfo interface.