auto merge of #14963 : w3ln4/rust/master, r=alexcrichton
The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
This commit is contained in:
commit
82ec1aef29
21 changed files with 331 additions and 16 deletions
72
src/librustc/back/mipsel.rs
Normal file
72
src/librustc/back/mipsel.rs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use back::target_strs;
|
||||
use syntax::abi;
|
||||
|
||||
pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t {
|
||||
return target_strs::t {
|
||||
module_asm: "".to_string(),
|
||||
|
||||
data_layout: match target_os {
|
||||
abi::OsMacos => {
|
||||
"e-p:32:32:32\
|
||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||
-f32:32:32-f64:64:64\
|
||||
-v64:64:64-v128:64:128\
|
||||
-a0:0:64-n32".to_string()
|
||||
}
|
||||
|
||||
abi::OsiOS => {
|
||||
"e-p:32:32:32\
|
||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||
-f32:32:32-f64:64:64\
|
||||
-v64:64:64-v128:64:128\
|
||||
-a0:0:64-n32".to_string()
|
||||
}
|
||||
|
||||
abi::OsWin32 => {
|
||||
"e-p:32:32:32\
|
||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||
-f32:32:32-f64:64:64\
|
||||
-v64:64:64-v128:64:128\
|
||||
-a0:0:64-n32".to_string()
|
||||
}
|
||||
|
||||
abi::OsLinux => {
|
||||
"e-p:32:32:32\
|
||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||
-f32:32:32-f64:64:64\
|
||||
-v64:64:64-v128:64:128\
|
||||
-a0:0:64-n32".to_string()
|
||||
}
|
||||
|
||||
abi::OsAndroid => {
|
||||
"e-p:32:32:32\
|
||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||
-f32:32:32-f64:64:64\
|
||||
-v64:64:64-v128:64:128\
|
||||
-a0:0:64-n32".to_string()
|
||||
}
|
||||
|
||||
abi::OsFreebsd => {
|
||||
"e-p:32:32:32\
|
||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||
-f32:32:32-f64:64:64\
|
||||
-v64:64:64-v128:64:128\
|
||||
-a0:0:64-n32".to_string()
|
||||
}
|
||||
},
|
||||
|
||||
target_triple: target_triple,
|
||||
|
||||
cc_args: Vec::new(),
|
||||
};
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ use driver::session::Session;
|
|||
use back;
|
||||
use back::link;
|
||||
use back::target_strs;
|
||||
use back::{arm, x86, x86_64, mips};
|
||||
use back::{arm, x86, x86_64, mips, mipsel};
|
||||
use middle::lint;
|
||||
|
||||
use syntax::abi;
|
||||
|
|
@ -373,7 +373,8 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
|
|||
abi::X86 => ("little", "x86", "32"),
|
||||
abi::X86_64 => ("little", "x86_64", "64"),
|
||||
abi::Arm => ("little", "arm", "32"),
|
||||
abi::Mips => ("big", "mips", "32")
|
||||
abi::Mips => ("big", "mips", "32"),
|
||||
abi::Mipsel => ("little", "mipsel", "32")
|
||||
};
|
||||
|
||||
let fam = match sess.targ_cfg.os {
|
||||
|
|
@ -452,6 +453,7 @@ static architecture_abis : &'static [(&'static str, abi::Architecture)] = &'stat
|
|||
("xscale", abi::Arm),
|
||||
("thumb", abi::Arm),
|
||||
|
||||
("mipsel", abi::Mipsel),
|
||||
("mips", abi::Mips)];
|
||||
|
||||
pub fn build_target_config(sopts: &Options) -> Config {
|
||||
|
|
@ -470,14 +472,16 @@ pub fn build_target_config(sopts: &Options) -> Config {
|
|||
abi::X86 => (ast::TyI32, ast::TyU32),
|
||||
abi::X86_64 => (ast::TyI64, ast::TyU64),
|
||||
abi::Arm => (ast::TyI32, ast::TyU32),
|
||||
abi::Mips => (ast::TyI32, ast::TyU32)
|
||||
abi::Mips => (ast::TyI32, ast::TyU32),
|
||||
abi::Mipsel => (ast::TyI32, ast::TyU32)
|
||||
};
|
||||
let target_triple = sopts.target_triple.clone();
|
||||
let target_strs = match arch {
|
||||
abi::X86 => x86::get_target_strs(target_triple, os),
|
||||
abi::X86_64 => x86_64::get_target_strs(target_triple, os),
|
||||
abi::Arm => arm::get_target_strs(target_triple, os),
|
||||
abi::Mips => mips::get_target_strs(target_triple, os)
|
||||
abi::Mips => mips::get_target_strs(target_triple, os),
|
||||
abi::Mipsel => mipsel::get_target_strs(target_triple, os)
|
||||
};
|
||||
Config {
|
||||
os: os,
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ pub mod back {
|
|||
pub mod link;
|
||||
pub mod lto;
|
||||
pub mod mips;
|
||||
pub mod mipsel;
|
||||
pub mod rpath;
|
||||
pub mod svh;
|
||||
pub mod target_strs;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ use middle::trans::type_::Type;
|
|||
use middle::trans::type_of;
|
||||
use middle::ty;
|
||||
use middle::ty::Disr;
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips};
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::attr::IntType;
|
||||
|
|
@ -365,6 +365,7 @@ fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntTyp
|
|||
// corresponding to `choose_shortest`. However, we don't run on those yet...?
|
||||
Arm => at_least_32,
|
||||
Mips => at_least_32,
|
||||
Mipsel => at_least_32,
|
||||
}
|
||||
}
|
||||
attr::ReprAny => {
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
|
|||
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(target_arch = "mips")]
|
||||
#[cfg(target_arch = "mipsel")]
|
||||
fn get_clobbers() -> String {
|
||||
"".to_string()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ use std::cell::{Cell, RefCell};
|
|||
use std::rc::Rc;
|
||||
use std::{i8, i16, i32, i64};
|
||||
use std::gc::Gc;
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic};
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel, Rust, RustIntrinsic};
|
||||
use syntax::ast_util::{local_def, is_local};
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
use syntax::attr;
|
||||
|
|
@ -1006,7 +1006,7 @@ pub fn call_memcpy(cx: &Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef,
|
|||
let _icx = push_ctxt("call_memcpy");
|
||||
let ccx = cx.ccx();
|
||||
let key = match ccx.sess().targ_cfg.arch {
|
||||
X86 | Arm | Mips => "llvm.memcpy.p0i8.p0i8.i32",
|
||||
X86 | Arm | Mips | Mipsel => "llvm.memcpy.p0i8.p0i8.i32",
|
||||
X86_64 => "llvm.memcpy.p0i8.p0i8.i64"
|
||||
};
|
||||
let memcpy = ccx.get_intrinsic(&key);
|
||||
|
|
@ -1050,7 +1050,7 @@ fn memzero(b: &Builder, llptr: ValueRef, ty: Type) {
|
|||
let ccx = b.ccx;
|
||||
|
||||
let intrinsic_key = match ccx.sess().targ_cfg.arch {
|
||||
X86 | Arm | Mips => "llvm.memset.p0i8.i32",
|
||||
X86 | Arm | Mips | Mipsel => "llvm.memset.p0i8.i32",
|
||||
X86_64 => "llvm.memset.p0i8.i64"
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use middle::trans::cabi_x86_64;
|
|||
use middle::trans::cabi_arm;
|
||||
use middle::trans::cabi_mips;
|
||||
use middle::trans::type_::Type;
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips};
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
pub enum ArgKind {
|
||||
|
|
@ -110,5 +110,6 @@ pub fn compute_abi_info(ccx: &CrateContext,
|
|||
X86_64 => cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def),
|
||||
Arm => cabi_arm::compute_abi_info(ccx, atys, rty, ret_def),
|
||||
Mips => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
|
||||
Mipsel => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use lib::llvm::{Float, Double, X86_FP80, PPC_FP128, FP128};
|
|||
use middle::trans::context::CrateContext;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips};
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
|
||||
|
||||
use std::c_str::ToCStr;
|
||||
use std::mem;
|
||||
|
|
@ -106,7 +106,7 @@ impl Type {
|
|||
|
||||
pub fn int(ccx: &CrateContext) -> Type {
|
||||
match ccx.tcx.sess.targ_cfg.arch {
|
||||
X86 | Arm | Mips => Type::i32(ccx),
|
||||
X86 | Arm | Mips | Mipsel => Type::i32(ccx),
|
||||
X86_64 => Type::i64(ccx)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue