Added classes SolarisTargetInfo and

SolarisSparcV8TargetInfo to be able
to handle "sparc-" triple prefixes.

Please be aware that this is a minimal
kludge, that pretty much duplicates
the features of DarwinPowerPCTargetInfo,
and also incorrectly uses stuff from
the PPC namespace.

But in result "make test" now passes
a lot of tests, the notable exceptions
being the objc rewrite tests and
mandel.c.

llvm-svn: 47436
This commit is contained in:
Gabor Greif 2008-02-21 16:29:08 +00:00
parent 7254826c40
commit 4999168309
1 changed files with 67 additions and 0 deletions

View File

@ -65,6 +65,31 @@ public:
}
};
class SolarisTargetInfo : public TargetInfoImpl {
public:
SolarisTargetInfo(const std::string& triple) : TargetInfoImpl(triple) {}
virtual void getTargetDefines(std::vector<char> &Defs) const {
// FIXME: we need a real target configuration system. For now, only define
// __SUN__ if the host has it.
#ifdef __SUN__
Define(Defs, "__SUN__");
Define(Defs, "__SOLARIS__");
#endif
if (1) {// -fobjc-gc controls this.
Define(Defs, "__weak", "");
Define(Defs, "__strong", "");
} else {
Define(Defs, "__weak", "__attribute__((objc_gc(weak)))");
Define(Defs, "__strong", "__attribute__((objc_gc(strong)))");
Define(Defs, "__OBJC_GC__");
}
}
};
} // end anonymous namespace.
@ -632,6 +657,46 @@ public:
};
} // end anonymous namespace.
namespace {
class SolarisSparcV8TargetInfo : public SolarisTargetInfo {
public:
SolarisSparcV8TargetInfo(const std::string& triple) : SolarisTargetInfo(triple) {}
virtual void getTargetDefines(std::vector<char> &Defines) const {
SolarisTargetInfo::getTargetDefines(Defines);
// getSparcDefines(Defines, false);
Define(Defines, "__sparc");
Define(Defines, "__sparcv8");
}
virtual void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const {
PPC::getBuiltins(Records, NumRecords);
}
virtual const char *getVAListDeclaration() const {
return getPPCVAListDeclaration();
}
virtual const char *getTargetPrefix() const {
return PPC::getTargetPrefix();
}
virtual void getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const {
PPC::getGCCRegNames(Names, NumNames);
}
virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const {
PPC::getGCCRegAliases(Aliases, NumAliases);
}
virtual bool validateAsmConstraint(char c,
TargetInfo::ConstraintInfo &info) const {
return PPC::validateAsmConstraint(c, info);
}
virtual const char *getClobbers() const {
return PPC::getClobbers();
}
};
} // end anonymous namespace.
namespace {
class LinuxTargetInfo : public DarwinTargetInfo {
public:
@ -690,6 +755,8 @@ static TargetInfoImpl *CreateTarget(const std::string& T) {
return new DarwinPPCTargetInfo(T);
else if (T.find("ppc64-") == 0 || T.find("powerpc64-") == 0)
return new DarwinPPC64TargetInfo(T);
else if (T.find("sparc-") == 0)
return new SolarisSparcV8TargetInfo(T); // ugly hack
else if (T.find("x86_64-") == 0)
return new DarwinX86_64TargetInfo(T);
else if (IsX86(T))