about summary refs log tree commit diff
path: root/src/librustc/back
diff options
context:
space:
mode:
authorLuqman Aden <laden@csclub.uwaterloo.ca>2013-08-08 22:16:00 -0400
committerLuqman Aden <laden@csclub.uwaterloo.ca>2013-08-10 17:03:43 -0400
commitfcfd6e7c798f621f40a3ccf5dd8a7f1b130fdfd4 (patch)
treea7a0adfcd9f65d573857e4811137b4c1fb186f16 /src/librustc/back
parent2ba36ec62934c8b877766a6283633b6407c8d357 (diff)
rustc: Add --target-cpu flag to select a more specific processor instead of the default, 'generic'.
Diffstat (limited to 'src/librustc/back')
-rw-r--r--src/librustc/back/link.rs33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index fbe17fb0d1c..c17c61e9466 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -69,6 +69,7 @@ pub fn llvm_err(sess: Session, msg: ~str) -> ! {
 pub fn WriteOutputFile(sess: Session,
         PM: lib::llvm::PassManagerRef, M: ModuleRef,
         Triple: &str,
+        Cpu: &str,
         Feature: &str,
         Output: &str,
         // FIXME: When #2334 is fixed, change
@@ -78,19 +79,22 @@ pub fn WriteOutputFile(sess: Session,
         EnableSegmentedStacks: bool) {
     unsafe {
         do Triple.to_c_str().with_ref |Triple| {
-            do Feature.to_c_str().with_ref |Feature| {
-                do Output.to_c_str().with_ref |Output| {
-                    let result = llvm::LLVMRustWriteOutputFile(
-                            PM,
-                            M,
-                            Triple,
-                            Feature,
-                            Output,
-                            FileType,
-                            OptLevel,
-                            EnableSegmentedStacks);
-                    if (!result) {
-                        llvm_err(sess, ~"Could not write output");
+            do Cpu.to_c_str().with_ref |Cpu| {
+                do Feature.to_c_str().with_ref |Feature| {
+                    do Output.to_c_str().with_ref |Output| {
+                        let result = llvm::LLVMRustWriteOutputFile(
+                                PM,
+                                M,
+                                Triple,
+                                Cpu,
+                                Feature,
+                                Output,
+                                FileType,
+                                OptLevel,
+                                EnableSegmentedStacks);
+                        if (!result) {
+                            llvm_err(sess, ~"Could not write output");
+                        }
                     }
                 }
             }
@@ -346,6 +350,7 @@ pub mod write {
                             pm.llpm,
                             llmod,
                             sess.targ_cfg.target_strs.target_triple,
+                            opts.target_cpu,
                             opts.target_feature,
                             output.to_str(),
                             lib::llvm::AssemblyFile as c_uint,
@@ -362,6 +367,7 @@ pub mod write {
                             pm.llpm,
                             llmod,
                             sess.targ_cfg.target_strs.target_triple,
+                            opts.target_cpu,
                             opts.target_feature,
                             output.to_str(),
                             lib::llvm::ObjectFile as c_uint,
@@ -376,6 +382,7 @@ pub mod write {
                         pm.llpm,
                         llmod,
                         sess.targ_cfg.target_strs.target_triple,
+                        opts.target_cpu,
                         opts.target_feature,
                         output.to_str(),
                         FileType as c_uint,