Hi,
I added the comment as requested in llvm-commits list. Patch adds
support to Clang for compiling C code with TCE compatible type sizes and
alignments. TCE further uses the bitcode to generate target program and
processor description. TCE is publicly (currently with MIT licence)
available ASP design environment.
Mikael Lepistö
Tampere University of Technology
http://tce.cs.tut.fi
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp (revision 79230)
+++ lib/Basic/Targets.cpp (working copy)
@@ -1404,6 +1404,71 @@
}
}
+namespace {
+
+ // LLVM and Clang cannot be used directly to output native binaries for
+ // target, but is used to compile C code to llvm bitcode with correct
+ // type and alignment information.
+ //
+ // TCE uses the llvm bitcode as input and uses it for generating customized
+ // target processor and program binary. TCE co-design environment is
+ // publicly available in http://tce.cs.tut.fi
+
+ class TCETargetInfo : public TargetInfo{
+ public:
+ TCETargetInfo(const std::string& triple) : TargetInfo(triple) {
+ TLSSupported = false;
+ IntWidth = 32;
+ LongWidth = LongLongWidth = 32;
+ IntMaxTWidth = 32;
+ PointerWidth = 32;
+ IntAlign = 32;
+ LongAlign = LongLongAlign = 32;
+ PointerAlign = 32;
+ SizeType = UnsignedInt;
+ IntMaxType = SignedLong;
+ UIntMaxType = UnsignedLong;
+ IntPtrType = SignedInt;
+ PtrDiffType = SignedInt;
+ FloatWidth = 32;
+ FloatAlign = 32;
+ DoubleWidth = 32;
+ DoubleAlign = 32;
+ LongDoubleWidth = 32;
+ LongDoubleAlign = 32;
+ FloatFormat = &llvm::APFloat::IEEEsingle;
+ DoubleFormat = &llvm::APFloat::IEEEsingle;
+ LongDoubleFormat = &llvm::APFloat::IEEEsingle;
+ DescriptionString = "E-p:32:32:32-a0:32:32"
+ "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64"
+ "-f32:32:32-f64:32:64";
+ }
+
+ virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return 32; }
+ virtual uint64_t getPointerAlignV(unsigned AddrSpace) const { return 32; }
+ virtual void getTargetDefines(const LangOptions &Opts,
+ std::vector<char> &Defines) const {
+ Define(Defines, "tce");
+ Define(Defines, "__TCE__");
+ Define(Defines, "__TCE_V1__");
+ }
+ virtual void getTargetBuiltins(const Builtin::Info *&Records,
+ unsigned &NumRecords) const {}
+ virtual const char *getVAListDeclaration() const { return "";}
+ virtual const char *getClobbers() const {return "";}
+ virtual const char *getTargetPrefix() const {return "tce";}
+ virtual void getGCCRegNames(const char * const *&Names,
+ unsigned &NumNames) const {}
+ virtual bool validateAsmConstraint(const char *&Name,
+ TargetInfo::ConstraintInfo &info) const {
+ return true;
+ }
+ virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
+ unsigned &NumAliases) const {}
+ virtual bool useGlobalsForAutomaticVariables() const {return true;}
+ };
+}
+
//===----------------------------------------------------------------------===//
// Driver code
//===----------------------------------------------------------------------===//
@@ -1480,6 +1545,9 @@
if (T.find("s390x-") == 0)
return new SystemZTargetInfo(T);
+ if (T.find("tce-") == 0)
+ return new TCETargetInfo(T);
+
if (IsX86(T)) {
if (isDarwin)
return new DarwinI386TargetInfo(T);
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits