forked from OSchip/llvm-project
add mblaze target support, patch by Wesley Peck!
llvm-svn: 97890
This commit is contained in:
parent
4b5e95426d
commit
5178f56255
|
@ -597,6 +597,134 @@ public:
|
|||
};
|
||||
} // end anonymous namespace.
|
||||
|
||||
namespace {
|
||||
// MBlaze abstract base class
|
||||
class MBlazeTargetInfo : public TargetInfo {
|
||||
static const char * const GCCRegNames[];
|
||||
static const TargetInfo::GCCRegAlias GCCRegAliases[];
|
||||
|
||||
public:
|
||||
MBlazeTargetInfo(const std::string& triple) : TargetInfo(triple) {
|
||||
DescriptionString = "E-p:32:32-i8:8:8-i16:16:16-i64:32:32-f64:32:32-"
|
||||
"v64:32:32-v128:32:32-n32";
|
||||
}
|
||||
|
||||
virtual void getTargetBuiltins(const Builtin::Info *&Records,
|
||||
unsigned &NumRecords) const {
|
||||
// FIXME: Implement.
|
||||
Records = 0;
|
||||
NumRecords = 0;
|
||||
}
|
||||
|
||||
virtual void getTargetDefines(const LangOptions &Opts,
|
||||
MacroBuilder &Builder) const;
|
||||
|
||||
virtual const char *getVAListDeclaration() const {
|
||||
return "typedef char* __builtin_va_list;";
|
||||
}
|
||||
virtual const char *getTargetPrefix() const {
|
||||
return "mblaze";
|
||||
}
|
||||
virtual void getGCCRegNames(const char * const *&Names,
|
||||
unsigned &NumNames) const;
|
||||
virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
|
||||
unsigned &NumAliases) const;
|
||||
virtual bool validateAsmConstraint(const char *&Name,
|
||||
TargetInfo::ConstraintInfo &Info) const {
|
||||
switch (*Name) {
|
||||
default: return false;
|
||||
case 'O': // Zero
|
||||
return true;
|
||||
case 'b': // Base register
|
||||
case 'f': // Floating point register
|
||||
Info.setAllowsRegister();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
virtual const char *getClobbers() const {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
/// MBlazeTargetInfo::getTargetDefines - Return a set of the MBlaze-specific
|
||||
/// #defines that are not tied to a specific subtarget.
|
||||
void MBlazeTargetInfo::getTargetDefines(const LangOptions &Opts,
|
||||
MacroBuilder &Builder) const {
|
||||
// Target identification.
|
||||
Builder.defineMacro("__microblaze__");
|
||||
Builder.defineMacro("_ARCH_MICROBLAZE");
|
||||
Builder.defineMacro("__MICROBLAZE__");
|
||||
|
||||
// Target properties.
|
||||
Builder.defineMacro("_BIG_ENDIAN");
|
||||
Builder.defineMacro("__BIG_ENDIAN__");
|
||||
|
||||
// Subtarget options.
|
||||
Builder.defineMacro("__REGISTER_PREFIX__", "");
|
||||
}
|
||||
|
||||
|
||||
const char * const MBlazeTargetInfo::GCCRegNames[] = {
|
||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
||||
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
|
||||
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
|
||||
"$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7",
|
||||
"$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15",
|
||||
"$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",
|
||||
"$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31",
|
||||
"hi", "lo", "accum","rmsr", "$fcc1","$fcc2","$fcc3","$fcc4",
|
||||
"$fcc5","$fcc6","$fcc7","$ap", "$rap", "$frp"
|
||||
};
|
||||
|
||||
void MBlazeTargetInfo::getGCCRegNames(const char * const *&Names,
|
||||
unsigned &NumNames) const {
|
||||
Names = GCCRegNames;
|
||||
NumNames = llvm::array_lengthof(GCCRegNames);
|
||||
}
|
||||
|
||||
const TargetInfo::GCCRegAlias MBlazeTargetInfo::GCCRegAliases[] = {
|
||||
{ {"f0"}, "r0" },
|
||||
{ {"f1"}, "r1" },
|
||||
{ {"f2"}, "r2" },
|
||||
{ {"f3"}, "r3" },
|
||||
{ {"f4"}, "r4" },
|
||||
{ {"f5"}, "r5" },
|
||||
{ {"f6"}, "r6" },
|
||||
{ {"f7"}, "r7" },
|
||||
{ {"f8"}, "r8" },
|
||||
{ {"f9"}, "r9" },
|
||||
{ {"f10"}, "r10" },
|
||||
{ {"f11"}, "r11" },
|
||||
{ {"f12"}, "r12" },
|
||||
{ {"f13"}, "r13" },
|
||||
{ {"f14"}, "r14" },
|
||||
{ {"f15"}, "r15" },
|
||||
{ {"f16"}, "r16" },
|
||||
{ {"f17"}, "r17" },
|
||||
{ {"f18"}, "r18" },
|
||||
{ {"f19"}, "r19" },
|
||||
{ {"f20"}, "r20" },
|
||||
{ {"f21"}, "r21" },
|
||||
{ {"f22"}, "r22" },
|
||||
{ {"f23"}, "r23" },
|
||||
{ {"f24"}, "r24" },
|
||||
{ {"f25"}, "r25" },
|
||||
{ {"f26"}, "r26" },
|
||||
{ {"f27"}, "r27" },
|
||||
{ {"f28"}, "r28" },
|
||||
{ {"f29"}, "r29" },
|
||||
{ {"f30"}, "r30" },
|
||||
{ {"f31"}, "r31" },
|
||||
};
|
||||
|
||||
void MBlazeTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
|
||||
unsigned &NumAliases) const {
|
||||
Aliases = GCCRegAliases;
|
||||
NumAliases = llvm::array_lengthof(GCCRegAliases);
|
||||
}
|
||||
} // end anonymous namespace.
|
||||
|
||||
namespace {
|
||||
// Namespace for x86 abstract base class
|
||||
const Builtin::Info BuiltinInfo[] = {
|
||||
|
@ -2159,6 +2287,9 @@ static TargetInfo *AllocateTarget(const std::string &T) {
|
|||
return new FreeBSDTargetInfo<PPC64TargetInfo>(T);
|
||||
return new PPC64TargetInfo(T);
|
||||
|
||||
case llvm::Triple::mblaze:
|
||||
return new MBlazeTargetInfo(T);
|
||||
|
||||
case llvm::Triple::sparc:
|
||||
if (os == llvm::Triple::AuroraUX)
|
||||
return new AuroraUXSparcV8TargetInfo(T);
|
||||
|
|
Loading…
Reference in New Issue