14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_PPC_H 15 #define LLVM_CLANG_LIB_BASIC_TARGETS_PPC_H 20 #include "llvm/ADT/Triple.h" 21 #include "llvm/ADT/StringSwitch.h" 22 #include "llvm/Support/Compiler.h" 33 ArchDefineName = 1 << 0,
34 ArchDefinePpcgr = 1 << 1,
35 ArchDefinePpcsq = 1 << 2,
36 ArchDefine440 = 1 << 3,
37 ArchDefine603 = 1 << 4,
38 ArchDefine604 = 1 << 5,
39 ArchDefinePwr4 = 1 << 6,
40 ArchDefinePwr5 = 1 << 7,
41 ArchDefinePwr5x = 1 << 8,
42 ArchDefinePwr6 = 1 << 9,
43 ArchDefinePwr6x = 1 << 10,
44 ArchDefinePwr7 = 1 << 11,
45 ArchDefinePwr8 = 1 << 12,
46 ArchDefinePwr9 = 1 << 13,
47 ArchDefineA2 = 1 << 14,
48 ArchDefineA2q = 1 << 15
52 ArchDefineTypes ArchDefs = ArchDefineNone;
59 bool HasAltivec =
false;
61 bool HasP8Vector =
false;
62 bool HasP8Crypto =
false;
63 bool HasDirectMove =
false;
66 bool HasBPERMD =
false;
67 bool HasExtDiv =
false;
68 bool HasP9Vector =
false;
77 SimdDefaultAlign = 128;
78 LongDoubleWidth = LongDoubleAlign = 128;
79 LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble();
89 bool isValidCPUName(StringRef Name)
const override;
92 bool setCPU(
const std::string &Name)
override {
93 bool CPUKnown = isValidCPUName(Name);
99 (ArchDefineTypes)llvm::StringSwitch<int>(CPU)
100 .Case(
"440", ArchDefineName)
101 .Case(
"450", ArchDefineName | ArchDefine440)
102 .Case(
"601", ArchDefineName)
103 .Case(
"602", ArchDefineName | ArchDefinePpcgr)
104 .Case(
"603", ArchDefineName | ArchDefinePpcgr)
105 .Case(
"603e", ArchDefineName | ArchDefine603 | ArchDefinePpcgr)
106 .Case(
"603ev", ArchDefineName | ArchDefine603 | ArchDefinePpcgr)
107 .Case(
"604", ArchDefineName | ArchDefinePpcgr)
108 .Case(
"604e", ArchDefineName | ArchDefine604 | ArchDefinePpcgr)
109 .Case(
"620", ArchDefineName | ArchDefinePpcgr)
110 .Case(
"630", ArchDefineName | ArchDefinePpcgr)
111 .Case(
"7400", ArchDefineName | ArchDefinePpcgr)
112 .Case(
"7450", ArchDefineName | ArchDefinePpcgr)
113 .Case(
"750", ArchDefineName | ArchDefinePpcgr)
114 .Case(
"970", ArchDefineName | ArchDefinePwr4 | ArchDefinePpcgr |
116 .Case(
"a2", ArchDefineA2)
117 .Case(
"a2q", ArchDefineName | ArchDefineA2 | ArchDefineA2q)
118 .Cases(
"power3",
"pwr3", ArchDefinePpcgr)
119 .Cases(
"power4",
"pwr4",
120 ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq)
121 .Cases(
"power5",
"pwr5",
122 ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
124 .Cases(
"power5x",
"pwr5x",
125 ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 |
126 ArchDefinePpcgr | ArchDefinePpcsq)
127 .Cases(
"power6",
"pwr6",
128 ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 |
129 ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq)
130 .Cases(
"power6x",
"pwr6x",
131 ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x |
132 ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
134 .Cases(
"power7",
"pwr7",
135 ArchDefinePwr7 | ArchDefinePwr6x | ArchDefinePwr6 |
136 ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 |
137 ArchDefinePpcgr | ArchDefinePpcsq)
139 .Cases(
"power8",
"pwr8",
"ppc64le",
140 ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6x |
141 ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 |
142 ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq)
143 .Cases(
"power9",
"pwr9",
144 ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 |
145 ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x |
146 ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
148 .Default(ArchDefineNone);
153 StringRef
getABI()
const override {
return ABI; }
165 const std::vector<std::string> &FeaturesVec)
const override;
167 bool handleTargetFeatures(std::vector<std::string> &Features,
170 bool hasFeature(StringRef Feature)
const override;
172 void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
173 bool Enabled)
const override;
285 switch (*Constraint) {
289 R = std::string(
"^") + std::string(Constraint, 2);
310 return LongDoubleWidth == 128 &&
311 LongDoubleFormat == &llvm::APFloat::PPCDoubleDouble() &&
312 getTriple().isOSBinFormatELF();
320 resetDataLayout(
"E-m:e-p:32:32-i64:64-n32");
322 switch (getTriple().getOS()) {
323 case llvm::Triple::Linux:
324 case llvm::Triple::FreeBSD:
325 case llvm::Triple::NetBSD:
326 SizeType = UnsignedInt;
327 PtrDiffType = SignedInt;
328 IntPtrType = SignedInt;
334 switch (getTriple().getOS()) {
335 case llvm::Triple::FreeBSD:
336 case llvm::Triple::NetBSD:
337 case llvm::Triple::OpenBSD:
338 LongDoubleWidth = LongDoubleAlign = 64;
339 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
346 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
361 LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
362 IntMaxType = SignedLong;
363 Int64Type = SignedLong;
365 if ((Triple.getArch() == llvm::Triple::ppc64le)) {
366 resetDataLayout(
"e-m:e-i64:64-n32:64");
369 resetDataLayout(
"E-m:e-i64:64-n32:64");
373 switch (getTriple().getOS()) {
374 case llvm::Triple::FreeBSD:
375 LongDoubleWidth = LongDoubleAlign = 64;
376 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
383 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
391 bool setABI(
const std::string &Name)
override {
392 if (Name ==
"elfv1" || Name ==
"elfv1-qpx" || Name ==
"elfv2") {
414 HasAlignMac68kSupport =
true;
415 BoolWidth = BoolAlign = 32;
416 PtrDiffType = SignedInt;
418 resetDataLayout(
"E-m:o-p:32:32-f64:32:64-n32");
431 HasAlignMac68kSupport =
true;
432 resetDataLayout(
"E-m:o-i64:64-n32:64");
438 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_PPC_H
PPC32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
DarwinPPC64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
static const Builtin::Info BuiltinInfo[]
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...
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Options for controlling the target.
PPC64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool useFloat128ManglingForLongDouble() const override
Return true if the 'long double' type should be mangled like __float128.
Concrete class used by the front-end to report problems and issues.
StringRef getABI() const override
Get the ABI currently in use.
static const char *const GCCRegNames[]
DarwinPPC32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Exposes information about the current target.
bool setABI(const std::string &Name) override
Use the specified ABI.
bool setCPU(const std::string &Name) override
Target the specified CPU.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument...
Defines the clang::TargetOptions class.
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
bool isCLZForZeroUndef() const override
The __builtin_clz* and __builtin_ctz* built-in functions are specified to have undefined results for ...
Dataflow Directional Tag Classes.
typedef char* __builtin_va_list;
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
bool hasSjLjLowering() const override
Controls if __builtin_longjmp / __builtin_setjmp can be lowered to llvm.eh.sjlj.longjmp / llvm...
Defines the clang::TargetInfo interface.
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
PPCTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
std::string convertConstraint(const char *&Constraint) const override
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
virtual std::string convertConstraint(const char *&Constraint) const