14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_NIOS2_H 15 #define LLVM_CLANG_LIB_BASIC_TARGETS_NIOS2_H 19 #include "llvm/ADT/Triple.h" 20 #include "llvm/Support/Compiler.h" 26 void setDataLayout() {
28 resetDataLayout(
"E-p:32:32:32-i8:8:32-i16:16:32-n32");
30 resetDataLayout(
"e-p:32:32:32-i8:8:32-i16:16:32-n32");
39 :
TargetInfo(triple), CPU(opts.CPU), ABI(opts.ABI) {
40 SizeType = UnsignedInt;
41 PtrDiffType = SignedInt;
42 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
46 StringRef
getABI()
const override {
return ABI; }
47 bool setABI(
const std::string &Name)
override {
48 if (Name ==
"o32" || Name ==
"eabi") {
56 return Name ==
"nios2r1" || Name ==
"nios2r2";
60 Values.append({
"nios2r1",
"nios2r2"});
63 bool setCPU(
const std::string &Name)
override {
64 if (isValidCPUName(Name)) {
76 bool isFeatureSupportedByCPU(StringRef Feature, StringRef CPU)
const;
81 const std::vector<std::string> &FeatureVec)
const override {
82 static const char *allFeatures[] = {
"nios2r2mandatory",
"nios2r2bmx",
83 "nios2r2mpx",
"nios2r2cdx" 85 for (
const char *feature : allFeatures) {
86 Features[feature] = isFeatureSupportedByCPU(feature, CPU);
92 return isFeatureSupportedByCPU(Feature, CPU);
103 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
"r8",
"r9",
"r10",
104 "r11",
"r12",
"r13",
"r14",
"r15",
"r16",
"r17",
"r18",
"r19",
"r20",
105 "r21",
"r22",
"r23",
"r24",
"r25",
"r26",
"r27",
"r28",
"r29",
"r30",
108 "ctl0",
"ctl1",
"ctl2",
"ctl3",
"ctl4",
"ctl5",
"ctl6",
"ctl7",
"ctl8",
109 "ctl9",
"ctl10",
"ctl11",
"ctl12",
"ctl13",
"ctl14",
"ctl15" 111 return llvm::makeArrayRef(GCCRegNames);
136 {{
"zero"},
"r0"}, {{
"at"},
"r1"}, {{
"et"},
"r24"},
137 {{
"bt"},
"r25"}, {{
"gp"},
"r26"}, {{
"sp"},
"r27"},
138 {{
"fp"},
"r28"}, {{
"ea"},
"r29"}, {{
"ba"},
"r30"},
139 {{
"ra"},
"r31"}, {{
"status"},
"ctl0"}, {{
"estatus"},
"ctl1"},
140 {{
"bstatus"},
"ctl2"}, {{
"ienable"},
"ctl3"}, {{
"ipending"},
"ctl4"},
141 {{
"cpuid"},
"ctl5"}, {{
"exception"},
"ctl7"}, {{
"pteaddr"},
"ctl8"},
142 {{
"tlbacc"},
"ctl9"}, {{
"tlbmisc"},
"ctl10"}, {{
"badaddr"},
"ctl12"},
143 {{
"config"},
"ctl13"}, {{
"mpubase"},
"ctl14"}, {{
"mpuacc"},
"ctl15"},
145 return llvm::makeArrayRef(aliases);
151 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_NIOS2_H bool isValidCPUName(StringRef Name) const override
brief Determine whether this TargetInfo supports the given CPU name.
static const Builtin::Info BuiltinInfo[]
Options for controlling the target.
bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeatureVec) const override
Initialize the map with the default set of target features for the CPU this should include all legal ...
Nios2TargetInfo(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...
Concrete class used by the front-end to report problems and issues.
static const char *const GCCRegNames[]
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
typedef void* __builtin_va_list;
Exposes information about the current target.
StringRef getABI() const override
Get the ABI currently in use.
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Defines the clang::TargetOptions class.
bool setABI(const std::string &Name) override
Use the specified ABI.
bool setCPU(const std::string &Name) override
Target the specified CPU.
Dataflow Directional Tag Classes.
ArrayRef< const char * > getGCCRegNames() const override
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values to setCPU.
Defines the clang::TargetInfo interface.
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override