[llvm-dev] Diff to add ARMv6L to Target parser

William Dillon via llvm-dev llvm-dev at lists.llvm.org
Sun Jan 3 14:28:35 PST 2016


Hi all.

I’ve been working with Swift on ARMv6 and v7.  While working with ARMv6 on linux, I noticed that my arm architecture canonicalization code didn’t produce the expected result.  The code that I had been using (within Swift’s Driver.cpp the following:

static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple) {
  llvm::Triple triple = llvm::Triple(DefaultTargetTriple);

  // Canonicalization of all armv6 sub architectures to armv6
  if (triple.getArch() == llvm::Triple::ArchType::arm) {
    if (triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6  ||
        triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m ||
        triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6k ||
        triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6t2) {
      triple.setArchName("armv6");
    }
  }

  // Canonicalization of all armv7 sub architectures to armv7
  if (triple.getArch() == llvm::Triple::ArchType::arm) {
    if (triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v7   ||
        triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v7em ||
        triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v7m  ||
        triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v7s  ||
        triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v7k) {
      triple.setArchName("armv7");
    }
  }

  return triple;
}
However, because the DefaultTargetTriple is armv6l-unknown-linux-gnueabihf, and llvm didn’t know about v6l, it would fail to match and canonicalize to armv6.  I added the notion of v6l to llvm to address this.

Thoughts/comments?
- Will

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: llvm-diff.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160103/0027af19/attachment.txt>


More information about the llvm-dev mailing list