diff options
| author | John Hodge <tpg@ucc.asn.au> | 2017-12-31 12:52:55 +0800 | 
|---|---|---|
| committer | John Hodge <tpg@ucc.asn.au> | 2018-01-07 07:29:31 +0000 | 
| commit | 7e25c57d060e63649fbdf1f4c5810acb83d0b52c (patch) | |
| tree | d11ab1884c1c3f350eedffc48dc60ebb9f52c2fe /src | |
| parent | 7a351fbb2a755c09fda638eeba3735274481ee86 (diff) | |
| download | mrust-7e25c57d060e63649fbdf1f4c5810acb83d0b52c.tar.gz | |
Trans - Draft ARM32 support
Diffstat (limited to 'src')
| -rw-r--r-- | src/hir/deserialise.cpp | 2 | ||||
| -rw-r--r-- | src/main.cpp | 30 | ||||
| -rw-r--r-- | src/trans/target.cpp | 19 | 
3 files changed, 42 insertions, 9 deletions
| diff --git a/src/hir/deserialise.cpp b/src/hir/deserialise.cpp index b7cba83b..326debd7 100644 --- a/src/hir/deserialise.cpp +++ b/src/hir/deserialise.cpp @@ -752,7 +752,7 @@ namespace {          _(Array, {              deserialise_ptr< ::HIR::TypeRef>(),              nullptr, -            m_in.read_u64c() & SIZE_MAX +            static_cast<size_t>(m_in.read_u64c() & SIZE_MAX)              })          _(Slice, {              deserialise_ptr< ::HIR::TypeRef>() diff --git a/src/main.cpp b/src/main.cpp index b23bb9e9..2b5b2234 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,17 +29,31 @@  // Hacky default target  #ifdef _MSC_VER -#define DEFAULT_TARGET_NAME "x86-windows-msvc" -#elif defined(__GNU__) -# if defined(__linux__) -#define DEFAULT_TARGET_NAME "x86_64-linux-gnu" -# elif defined(_WIN64) -#define DEFAULT_TARGET_NAME "x86_64-windows-gnu" +# if defined(_X64) +#  define DEFAULT_TARGET_NAME "x86_64-windows-msvc"  # else -#define DEFAULT_TARGET_NAME "x86_64-windows-gnu" +#  define DEFAULT_TARGET_NAME "x86-windows-msvc" +# endif +#elif defined(__linux__) +# if defined(__amd64__) +#  define DEFAULT_TARGET_NAME "x86_64-linux-gnu" +# elif defined(__aarch64__) +#  define DEFAULT_TARGET_NAME "arm64-linux-gnu" +# elif defined(__arm__) +#  define DEFAULT_TARGET_NAME "arm-linux-gnu" +# elif defined(__i386__) +#  define DEFAULT_TARGET_NAME "i586-linux-gnu" +# else +#  error "Unable to detect a suitable default target (linux-gnu)" +# endif +#elif defined(__MINGW32__) +# if defined(_WIN64) +#  define DEFAULT_TARGET_NAME "x86_64-windows-gnu" +# else +#  define DEFAULT_TARGET_NAME "i586-windows-gnu"  # endif  #else -#define DEFAULT_TARGET_NAME "x86_64-linux-gnu" +# error "Unable to detect a suitable default target"  #endif  int g_debug_indent_level = 0; diff --git a/src/trans/target.cpp b/src/trans/target.cpp index f13b20a3..c4aa5d55 100644 --- a/src/trans/target.cpp +++ b/src/trans/target.cpp @@ -23,6 +23,11 @@ TargetArch ARCH_X86 = {      32, false,      { /*atomic(u8)=*/true, false, true, false,  true }  }; +TargetArch ARCH_ARM32 = { +    "arm32", +    32, false, +    { /*atomic(u8)=*/true, false, true, false,  true } +};  TargetSpec  g_target; @@ -40,6 +45,13 @@ namespace          {              return load_spec_from_file(target_name);          } +        else if(target_name == "i586-linux-gnu") +        { +            return TargetSpec { +                "unix", "linux", "gnu", CodegenMode::Gnu11, +                ARCH_X86 +                }; +        }          else if(target_name == "x86_64-linux-gnu")          {              return TargetSpec { @@ -47,6 +59,13 @@ namespace                  ARCH_X86_64                  };          } +        else if(target_name == "arm-linux-gnu") +        { +            return TargetSpec { +                "unix", "linux", "gnu", CodegenMode::Gnu11, +                ARCH_ARM32 +                }; +        }          else if(target_name == "x86_64-windows-gnu")          {              return TargetSpec { | 
