Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 595834 | Differences between
and this patch

Collapse All | Expand All

(-)a/include/llvm/ADT/Triple.h (-1 / +4 lines)
Lines 139-145 public: Link Here
139
    Myriad,
139
    Myriad,
140
    AMD,
140
    AMD,
141
    Mesa,
141
    Mesa,
142
    LastVendorType = Mesa
142
    // special values used on Gentoo to indicate ARM softfloat/hardfloat
143
    SoftFloat,
144
    HardFloat,
145
    LastVendorType = HardFloat
143
  };
146
  };
144
  enum OSType {
147
  enum OSType {
145
    UnknownOS,
148
    UnknownOS,
(-)a/lib/Support/Triple.cpp (-6 / +31 lines)
Lines 161-166 StringRef Triple::getVendorTypeName(VendorType Kind) { Link Here
161
  case Myriad: return "myriad";
161
  case Myriad: return "myriad";
162
  case AMD: return "amd";
162
  case AMD: return "amd";
163
  case Mesa: return "mesa";
163
  case Mesa: return "mesa";
164
  case SoftFloat: return "softfloat";
165
  case HardFloat: return "hardfloat";
164
  }
166
  }
165
167
166
  llvm_unreachable("Invalid VendorType!");
168
  llvm_unreachable("Invalid VendorType!");
Lines 443-448 static Triple::VendorType parseVendor(StringRef VendorName) { Link Here
443
    .Case("myriad", Triple::Myriad)
445
    .Case("myriad", Triple::Myriad)
444
    .Case("amd", Triple::AMD)
446
    .Case("amd", Triple::AMD)
445
    .Case("mesa", Triple::Mesa)
447
    .Case("mesa", Triple::Mesa)
448
    .Case("softfloat", Triple::SoftFloat)
449
    .Case("hardfloat", Triple::HardFloat)
446
    .Default(Triple::UnknownVendor);
450
    .Default(Triple::UnknownVendor);
447
}
451
}
448
452
Lines 482-489 static Triple::OSType parseOS(StringRef OSName) { Link Here
482
    .Default(Triple::UnknownOS);
486
    .Default(Triple::UnknownOS);
483
}
487
}
484
488
485
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
489
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName,
486
  return StringSwitch<Triple::EnvironmentType>(EnvironmentName)
490
                                                Triple::VendorType Vendor) {
491
  auto ET = StringSwitch<Triple::EnvironmentType>(EnvironmentName)
487
    .StartsWith("eabihf", Triple::EABIHF)
492
    .StartsWith("eabihf", Triple::EABIHF)
488
    .StartsWith("eabi", Triple::EABI)
493
    .StartsWith("eabi", Triple::EABI)
489
    .StartsWith("gnuabi64", Triple::GNUABI64)
494
    .StartsWith("gnuabi64", Triple::GNUABI64)
Lines 503-508 static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { Link Here
503
    .StartsWith("coreclr", Triple::CoreCLR)
508
    .StartsWith("coreclr", Triple::CoreCLR)
504
    .StartsWith("opencl", Triple::OpenCL)
509
    .StartsWith("opencl", Triple::OpenCL)
505
    .Default(Triple::UnknownEnvironment);
510
    .Default(Triple::UnknownEnvironment);
511
512
  // Gentoo abuses the vendor field for softfloat/hardfloat ARM
513
  // e.g. arm-softfloat-linux-gnueabi, arm-hardfloat-linux-gnueabi
514
  if (Vendor == Triple::HardFloat) {
515
    switch (ET) {
516
      case Triple::EABI:
517
        ET = Triple::EABIHF;
518
        break;
519
      case Triple::GNUEABI:
520
        ET = Triple::GNUEABIHF;
521
        break;
522
      case Triple::MuslEABI:
523
        ET = Triple::MuslEABIHF;
524
        break;
525
      default:
526
        break;
527
    }
528
  }
529
530
  return ET;
506
}
531
}
507
532
508
static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) {
533
static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName) {
Lines 670-676 Triple::Triple(const Twine &Str) Link Here
670
      if (Components.size() > 2) {
695
      if (Components.size() > 2) {
671
        OS = parseOS(Components[2]);
696
        OS = parseOS(Components[2]);
672
        if (Components.size() > 3) {
697
        if (Components.size() > 3) {
673
          Environment = parseEnvironment(Components[3]);
698
          Environment = parseEnvironment(Components[3], Vendor);
674
          ObjectFormat = parseFormat(Components[3]);
699
          ObjectFormat = parseFormat(Components[3]);
675
        }
700
        }
676
      }
701
      }
Lines 709-715 Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr, Link Here
709
      SubArch(parseSubArch(ArchStr.str())),
734
      SubArch(parseSubArch(ArchStr.str())),
710
      Vendor(parseVendor(VendorStr.str())),
735
      Vendor(parseVendor(VendorStr.str())),
711
      OS(parseOS(OSStr.str())),
736
      OS(parseOS(OSStr.str())),
712
      Environment(parseEnvironment(EnvironmentStr.str())),
737
      Environment(parseEnvironment(EnvironmentStr.str(), Vendor)),
713
      ObjectFormat(parseFormat(EnvironmentStr.str())) {
738
      ObjectFormat(parseFormat(EnvironmentStr.str())) {
714
  if (ObjectFormat == Triple::UnknownObjectFormat)
739
  if (ObjectFormat == Triple::UnknownObjectFormat)
715
    ObjectFormat = getDefaultFormat(*this);
740
    ObjectFormat = getDefaultFormat(*this);
Lines 742-748 std::string Triple::normalize(StringRef Str) { Link Here
742
  }
767
  }
743
  EnvironmentType Environment = UnknownEnvironment;
768
  EnvironmentType Environment = UnknownEnvironment;
744
  if (Components.size() > 3)
769
  if (Components.size() > 3)
745
    Environment = parseEnvironment(Components[3]);
770
    Environment = parseEnvironment(Components[3], Vendor);
746
  ObjectFormatType ObjectFormat = UnknownObjectFormat;
771
  ObjectFormatType ObjectFormat = UnknownObjectFormat;
747
  if (Components.size() > 4)
772
  if (Components.size() > 4)
748
    ObjectFormat = parseFormat(Components[4]);
773
    ObjectFormat = parseFormat(Components[4]);
Lines 787-793 std::string Triple::normalize(StringRef Str) { Link Here
787
        Valid = OS != UnknownOS || IsCygwin || IsMinGW32;
812
        Valid = OS != UnknownOS || IsCygwin || IsMinGW32;
788
        break;
813
        break;
789
      case 3:
814
      case 3:
790
        Environment = parseEnvironment(Comp);
815
        Environment = parseEnvironment(Comp, Vendor);
791
        Valid = Environment != UnknownEnvironment;
816
        Valid = Environment != UnknownEnvironment;
792
        if (!Valid) {
817
        if (!Valid) {
793
          ObjectFormat = parseFormat(Comp);
818
          ObjectFormat = parseFormat(Comp);
(-)a/unittests/ADT/TripleTest.cpp (-1 / +13 lines)
Lines 284-289 TEST(TripleTest, ParsedIDs) { Link Here
284
  EXPECT_EQ(Triple::FreeBSD, T.getOS());
284
  EXPECT_EQ(Triple::FreeBSD, T.getOS());
285
  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
285
  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
286
286
287
  // Triples used for Gentoo ARM targets
288
  T = Triple("armv5tel-softfloat-linux-gnueabi");
289
  EXPECT_EQ(Triple::arm, T.getArch());
290
  EXPECT_EQ(Triple::SoftFloat, T.getVendor());
291
  EXPECT_EQ(Triple::Linux, T.getOS());
292
  EXPECT_EQ(Triple::GNUEABI, T.getEnvironment());
293
294
  T = Triple("armv7a-hardfloat-linux-gnueabi");
295
  EXPECT_EQ(Triple::arm, T.getArch());
296
  EXPECT_EQ(Triple::HardFloat, T.getVendor());
297
  EXPECT_EQ(Triple::Linux, T.getOS());
298
  EXPECT_EQ(Triple::GNUEABIHF, T.getEnvironment());
299
287
  T = Triple("huh");
300
  T = Triple("huh");
288
  EXPECT_EQ(Triple::UnknownArch, T.getArch());
301
  EXPECT_EQ(Triple::UnknownArch, T.getArch());
289
}
302
}
290
- 

Return to bug 595834