From 4d1c2364d62fa932fe55b094fbcf594575226d12 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Tue, 29 Oct 2013 18:30:33 +0000 Subject: [PATCH] [mips] Move setDescriptionString to base class MipsTargetInfoBase and call it at the end of handleTargetFeatures. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193636 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/Targets.cpp | 50 +++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 1b928fe237..669cf91172 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -4787,6 +4787,8 @@ namespace { namespace { class MipsTargetInfoBase : public TargetInfo { + virtual void setDescriptionString() = 0; + static const Builtin::Info BuiltinInfo[]; std::string CPU; bool IsMips16; @@ -4982,6 +4984,8 @@ public: if (it != Features.end()) Features.erase(it); + setDescriptionString(); + return true; } @@ -5072,11 +5076,14 @@ public: }; class Mips32EBTargetInfo : public Mips32TargetInfoBase { + virtual void setDescriptionString() { + DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" + "i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64"; + } + public: Mips32EBTargetInfo(const llvm::Triple &Triple) : Mips32TargetInfoBase(Triple) { - DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" - "i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64"; } virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { @@ -5087,12 +5094,15 @@ public: }; class Mips32ELTargetInfo : public Mips32TargetInfoBase { + virtual void setDescriptionString() { + DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" + "i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64"; + } + public: Mips32ELTargetInfo(const llvm::Triple &Triple) : Mips32TargetInfoBase(Triple) { BigEndian = false; - DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" - "i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64"; } virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { @@ -5103,7 +5113,6 @@ public: }; class Mips64TargetInfoBase : public MipsTargetInfoBase { - virtual void SetDescriptionString(const std::string &Name) = 0; public: Mips64TargetInfoBase(const llvm::Triple &Triple) : MipsTargetInfoBase(Triple, "n64", "mips64") { @@ -5119,7 +5128,6 @@ public: MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; } virtual bool setABI(const std::string &Name) { - SetDescriptionString(Name); if (Name == "n32") { LongWidth = LongAlign = 32; PointerWidth = PointerAlign = 32; @@ -5195,21 +5203,21 @@ public: }; class Mips64EBTargetInfo : public Mips64TargetInfoBase { - virtual void SetDescriptionString(const std::string &Name) { - // Change DescriptionString only if ABI is n32. - if (Name == "n32") + virtual void setDescriptionString() { + if (ABI == "n32") DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" "i64:64:64-f32:32:32-f64:64:64-f128:128:128-" "v64:64:64-n32:64-S128"; + else + DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" + "i64:64:64-f32:32:32-f64:64:64-f128:128:128-" + "v64:64:64-n32:64-S128"; + } + public: Mips64EBTargetInfo(const llvm::Triple &Triple) - : Mips64TargetInfoBase(Triple) { - // Default ABI is n64. - DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" - "i64:64:64-f32:32:32-f64:64:64-f128:128:128-" - "v64:64:64-n32:64-S128"; - } + : Mips64TargetInfoBase(Triple) {} virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { DefineStd(Builder, "MIPSEB", Opts); @@ -5219,21 +5227,21 @@ public: }; class Mips64ELTargetInfo : public Mips64TargetInfoBase { - virtual void SetDescriptionString(const std::string &Name) { - // Change DescriptionString only if ABI is n32. - if (Name == "n32") + virtual void setDescriptionString() { + if (ABI == "n32") DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" "i64:64:64-f32:32:32-f64:64:64-f128:128:128" "-v64:64:64-n32:64-S128"; + else + DescriptionString = "e-p:64:64:64-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" + "i64:64:64-f32:32:32-f64:64:64-f128:128:128-" + "v64:64:64-n32:64-S128"; } public: Mips64ELTargetInfo(const llvm::Triple &Triple) : Mips64TargetInfoBase(Triple) { // Default ABI is n64. BigEndian = false; - DescriptionString = "e-p:64:64:64-i1:8:8-i8:8:32-i16:16:32-i32:32:32-" - "i64:64:64-f32:32:32-f64:64:64-f128:128:128-" - "v64:64:64-n32:64-S128"; } virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { -- 2.40.0