From e7deb74a84b0968e9b6d8959107f411d0921ec5a Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Thu, 6 Aug 2015 23:01:00 -0400 Subject: [PATCH] Adjust the target and ABI info for WDC65816 in clang. --- tools/clang/lib/Basic/Targets.cpp | 15 +++++++++++---- tools/clang/lib/CodeGen/TargetInfo.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/tools/clang/lib/Basic/Targets.cpp b/tools/clang/lib/Basic/Targets.cpp index 1c328474..5611e0c7 100644 --- a/tools/clang/lib/Basic/Targets.cpp +++ b/tools/clang/lib/Basic/Targets.cpp @@ -5542,13 +5542,20 @@ namespace { public: WDC65816TargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) { BigEndian = false; - NoAsmVariants = true; - LongLongAlign = 8; + TLSSupported = false; + PointerWidth = 32; PointerAlign = 8; + IntWidth = 16; IntAlign = 8; + FloatWidth = 32; FloatAlign = 8; + DoubleWidth = 64; DoubleAlign = 8; + LongWidth = 32; LongAlign = 8; + LongLongWidth = 64; LongLongAlign = 8; SuitableAlign = 8; - DoubleAlign = LongDoubleAlign = 8; + + NoAsmVariants = true; + SizeType = UnsignedLong; PtrDiffType = SignedLong; - IntPtrType = UnsignedLong; + IntPtrType = SignedLong; WCharType = UnsignedChar; WIntType = UnsignedInt; UseZeroLengthBitfieldAlignment = true; diff --git a/tools/clang/lib/CodeGen/TargetInfo.cpp b/tools/clang/lib/CodeGen/TargetInfo.cpp index 76acf871..2f2b4f58 100644 --- a/tools/clang/lib/CodeGen/TargetInfo.cpp +++ b/tools/clang/lib/CodeGen/TargetInfo.cpp @@ -4642,6 +4642,28 @@ void MSP430TargetCodeGenInfo::SetTargetAttributes(const Decl *D, } } +//===----------------------------------------------------------------------===// +// WDC65816 ABI Implementation +//===----------------------------------------------------------------------===// + +namespace { + + class WDC65816TargetCodeGenInfo : public TargetCodeGenInfo { + public: + WDC65816TargetCodeGenInfo(CodeGenTypes &CGT) + : TargetCodeGenInfo(new DefaultABIInfo(CGT)) {} + void SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV, + CodeGen::CodeGenModule &M) const; + }; + +} + +void WDC65816TargetCodeGenInfo::SetTargetAttributes(const Decl *D, + llvm::GlobalValue *GV, + CodeGen::CodeGenModule &M) const { + // WDC_TODO - Do I need anything here? +} + //===----------------------------------------------------------------------===// // MIPS ABI Implementation. This works for both little-endian and // big-endian variants. @@ -5564,6 +5586,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() { case llvm::Triple::msp430: return *(TheTargetCodeGenInfo = new MSP430TargetCodeGenInfo(Types)); + + case llvm::Triple::wdc65816: + return *(TheTargetCodeGenInfo = new WDC65816TargetCodeGenInfo(Types)); case llvm::Triple::systemz: return *(TheTargetCodeGenInfo = new SystemZTargetCodeGenInfo(Types));