コード例 #1
0
ファイル: IRMover.cpp プロジェクト: yxsamliu/llvm
// This function returns true if the triples match.
static bool triplesMatch(const Triple &T0, const Triple &T1) {
  // If vendor is apple, ignore the version number.
  if (T0.getVendor() == Triple::Apple)
    return T0.getArch() == T1.getArch() && T0.getSubArch() == T1.getSubArch() &&
           T0.getVendor() == T1.getVendor() && T0.getOS() == T1.getOS();

  return T0 == T1;
}
コード例 #2
0
/// getDefaultSubtargetFeatures - Return a string listing the features
/// associated with the target triple.
///
/// FIXME: This is an inelegant way of specifying the features of a
/// subtarget. It would be better if we could encode this information
/// into the IR. See <rdar://5972456>.
///
void SubtargetFeatures::getDefaultSubtargetFeatures(const std::string &CPU,
                                                    const Triple& Triple) {
  setCPU(CPU);

  const char *Attrs = 0;

  switch (Triple.getVendor()) {
  case Triple::Apple:
    switch (Triple.getArch()) {
    case Triple::ppc:   // powerpc-apple-*
      Attrs = "altivec";
      break;
    case Triple::ppc64: // powerpc64-apple-*
      Attrs = "64bit,altivec";
      break;
    default:
      break;
    }
    break;
  default:
    break;
  }

  if (!Attrs) return;

  StringRef SR(Attrs);

  while (!SR.empty()) {
    std::pair<StringRef, StringRef> Res = SR.split(',');
    AddFeature(Res.first);
    SR = Res.second;
  }
}
コード例 #3
0
ファイル: IRMover.cpp プロジェクト: yxsamliu/llvm
// This function returns the merged triple.
static std::string mergeTriples(const Triple &SrcTriple,
                                const Triple &DstTriple) {
  // If vendor is apple, pick the triple with the larger version number.
  if (SrcTriple.getVendor() == Triple::Apple)
    if (DstTriple.isOSVersionLT(SrcTriple))
      return SrcTriple.str();

  return DstTriple.str();
}
コード例 #4
0
/// Adds the default features for the specified target triple.
///
/// FIXME: This is an inelegant way of specifying the features of a
/// subtarget. It would be better if we could encode this information
/// into the IR. See <rdar://5972456>.
///
void SubtargetFeatures::getDefaultSubtargetFeatures(const Triple& Triple) {
  if (Triple.getVendor() == Triple::Apple) {
    if (Triple.getArch() == Triple::ppc) {
      // powerpc-apple-*
      AddFeature("altivec");
    } else if (Triple.getArch() == Triple::ppc64) {
      // powerpc64-apple-*
      AddFeature("64bit");
      AddFeature("altivec");
    }
  }
}