[llvm] r251222 - [X86] Add support for elfiamcu triple

Kuperstein, Michael M via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 25 16:06:27 PDT 2015


Hi H.J,

I expected it to behave similarly to gnux32.
Just to make sure I understand correctly - are you saying elfiamcu - which, to the best of my understanding, specifies an object file format an and ABI, but not an OS - consumes the entire OS part of the triple?

Michael

-----Original Message-----
From: H.J. Lu [mailto:hjl.tools at gmail.com] 
Sent: Sunday, October 25, 2015 16:30
To: Kuperstein, Michael M
Cc: llvm-commits
Subject: Re: [llvm] r251222 - [X86] Add support for elfiamcu triple

On Sun, Oct 25, 2015 at 1:07 AM, Michael Kuperstein via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> Author: mkuper
> Date: Sun Oct 25 03:07:37 2015
> New Revision: 251222
>
> URL: http://llvm.org/viewvc/llvm-project?rev=251222&view=rev
> Log:
> [X86] Add support for elfiamcu triple
>
> This adds support for the i?86-*-elfiamcu triple, which indicates the IAMCU psABI is used.
>
> Differential Revision: http://reviews.llvm.org/D13977
>
> Modified:
>     llvm/trunk/include/llvm/ADT/Triple.h
>     llvm/trunk/lib/Support/Triple.cpp
>     llvm/trunk/lib/Target/X86/X86Subtarget.h
>     llvm/trunk/unittests/ADT/TripleTest.cpp
>
> Modified: llvm/trunk/include/llvm/ADT/Triple.h
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple
> .h?rev=251222&r1=251221&r2=251222&view=diff
> ======================================================================
> ========
> --- llvm/trunk/include/llvm/ADT/Triple.h (original)
> +++ llvm/trunk/include/llvm/ADT/Triple.h Sun Oct 25 03:07:37 2015
> @@ -174,7 +174,8 @@ public:
>      Cygnus,
>      AMDOpenCL,
>      CoreCLR,
> -    LastEnvironmentType = CoreCLR
> +    ELFIAMCU,
> +    LastEnvironmentType = ELFIAMCU
>    };
>    enum ObjectFormatType {
>      UnknownObjectFormat,
> @@ -431,6 +432,10 @@ public:
>      return getOS() == Triple::Bitrig;
>    }
>
> +  bool isEnvironmentIAMCU() const {
> +    return getEnvironment() == Triple::ELFIAMCU;  }
> +
>    bool isWindowsMSVCEnvironment() const {
>      return getOS() == Triple::Win32 &&
>             (getEnvironment() == Triple::UnknownEnvironment ||
>
> Modified: llvm/trunk/lib/Support/Triple.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?
> rev=251222&r1=251221&r2=251222&view=diff
> ======================================================================
> ========
> --- llvm/trunk/lib/Support/Triple.cpp (original)
> +++ llvm/trunk/lib/Support/Triple.cpp Sun Oct 25 03:07:37 2015
> @@ -202,6 +202,7 @@ const char *Triple::getEnvironmentTypeNa
>    case Cygnus: return "cygnus";
>    case AMDOpenCL: return "amdopencl";
>    case CoreCLR: return "coreclr";
> +  case ELFIAMCU: return "elfiamcu";
>    }
>
>    llvm_unreachable("Invalid EnvironmentType!"); @@ -453,6 +454,7 @@ 
> static Triple::EnvironmentType parseEnvi
>      .StartsWith("cygnus", Triple::Cygnus)
>      .StartsWith("amdopencl", Triple::AMDOpenCL)
>      .StartsWith("coreclr", Triple::CoreCLR)
> +    .StartsWith("elfiamcu", Triple::ELFIAMCU)
>      .Default(Triple::UnknownEnvironment);
>  }
>
>
> Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subta
> rget.h?rev=251222&r1=251221&r2=251222&view=diff
> ======================================================================
> ========
> --- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
> +++ llvm/trunk/lib/Target/X86/X86Subtarget.h Sun Oct 25 03:07:37 2015
> @@ -418,6 +418,7 @@ public:
>    bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
>    bool isTargetNaCl32() const { return isTargetNaCl() && !is64Bit(); }
>    bool isTargetNaCl64() const { return isTargetNaCl() && is64Bit(); }
> +  bool isTargetMCU() const { return 
> + TargetTriple.isEnvironmentIAMCU(); }
>
>    bool isTargetWindowsMSVC() const {
>      return TargetTriple.isWindowsMSVCEnvironment();
>
> Modified: llvm/trunk/unittests/ADT/TripleTest.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTes
> t.cpp?rev=251222&r1=251221&r2=251222&view=diff
> ======================================================================
> ========
> --- llvm/trunk/unittests/ADT/TripleTest.cpp (original)
> +++ llvm/trunk/unittests/ADT/TripleTest.cpp Sun Oct 25 03:07:37 2015
> @@ -81,6 +81,12 @@ TEST(TripleTest, ParsedIDs) {
>    EXPECT_EQ(Triple::Darwin, T.getOS());
>    EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
>
> +  T = Triple("i386-pc-linux-elfiamcu");

This isn't a valid target triple.  linux and elfiamcu can't be used together in a target triple.  It must be either linux or elfiamcu:

[hjl at gnu-6 build-x86_64-linux]$
/export/gnu/import/git/sources/gcc/config.sub i386-pc-linux-elfiamcu Invalid configuration `i386-pc-linux-elfiamcu': machine `i386-pc-linux' not recognized
[hjl at gnu-6 build-x86_64-linux]$
/export/gnu/import/git/sources/gcc/config.sub i386-pc-linux i386-pc-linux-gnu
[hjl at gnu-6 build-x86_64-linux]$
/export/gnu/import/git/sources/gcc/config.sub i386-pc-elfiamcu i386-pc-elfiamcu
[hjl at gnu-6 build-x86_64-linux]$

> +  EXPECT_EQ(Triple::x86, T.getArch());  EXPECT_EQ(Triple::PC, 
> + T.getVendor());  EXPECT_EQ(Triple::Linux, T.getOS());  
> + EXPECT_EQ(Triple::ELFIAMCU, T.getEnvironment());
> +



--
H.J.
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the llvm-commits mailing list