Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --soft-float option #9617

Merged
merged 1 commit into from
Oct 1, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mk/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ CFG_PATH_MUNGE_mips-unknown-linux-gnu := true
CFG_LDPATH_mips-unknown-linux-gnu :=
CFG_RUN_mips-unknown-linux-gnu=
CFG_RUN_TARG_mips-unknown-linux-gnu=
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32 -Z soft-float

# i686-pc-mingw32 configuration
CC_i686-pc-mingw32=$(CC)
Expand Down
4 changes: 3 additions & 1 deletion src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ pub mod write {
session::Default => lib::llvm::CodeGenLevelDefault,
session::Aggressive => lib::llvm::CodeGenLevelAggressive,
};
let use_softfp = sess.opts.debugging_opts & session::use_softfp != 0;

let tm = do sess.targ_cfg.target_strs.target_triple.with_c_str |T| {
do sess.opts.target_cpu.with_c_str |CPU| {
Expand All @@ -273,7 +274,8 @@ pub mod write {
lib::llvm::CodeModelDefault,
lib::llvm::RelocPIC,
OptLevel,
true
true,
use_softfp
)
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub static print_llvm_passes: uint = 1 << 26;
pub static no_vectorize_loops: uint = 1 << 27;
pub static no_vectorize_slp: uint = 1 << 28;
pub static no_prepopulate_passes: uint = 1 << 29;
pub static use_softfp: uint = 1 << 30;

pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
Expand Down Expand Up @@ -135,6 +136,7 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
(~"no-vectorize-slp",
~"Don't run LLVM's SLP vectorization passes",
no_vectorize_slp),
(~"soft-float", ~"Generate software floating point library calls", use_softfp),
]
}

Expand Down
3 changes: 2 additions & 1 deletion src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,8 @@ pub mod llvm {
Model: CodeGenModel,
Reloc: RelocMode,
Level: CodeGenOptLevel,
EnableSegstk: bool) -> TargetMachineRef;
EnableSegstk: bool,
UseSoftFP: bool) -> TargetMachineRef;
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
PM: PassManagerRef,
Expand Down
7 changes: 6 additions & 1 deletion src/rustllvm/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ LLVMRustCreateTargetMachine(const char *triple,
CodeModel::Model CM,
Reloc::Model RM,
CodeGenOpt::Level OptLevel,
bool EnableSegmentedStacks) {
bool EnableSegmentedStacks,
bool UseSoftFloat) {
std::string Error;
Triple Trip(Triple::normalize(triple));
const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Trip.getTriple(),
Expand All @@ -84,6 +85,10 @@ LLVMRustCreateTargetMachine(const char *triple,
Options.FloatABIType =
(Trip.getEnvironment() == Triple::GNUEABIHF) ? FloatABI::Hard :
FloatABI::Default;
Options.UseSoftFloat = UseSoftFloat;
if (UseSoftFloat) {
Options.FloatABIType = FloatABI::Soft;
}

TargetMachine *TM = TheTarget->createTargetMachine(Trip.getTriple(),
cpu,
Expand Down