Skip to content

Commit bd11b83

Browse files
committed
---
yaml --- r: 57126 b: refs/heads/try c: 81110c5 h: refs/heads/master v: v3
1 parent ae6c268 commit bd11b83

File tree

7 files changed

+73
-212
lines changed

7 files changed

+73
-212
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: 773f7e75603a0bb99682a761d5b77577bb876c3c
5+
refs/heads/try: 81110c55e89e22ba8da3d049c62f3f048c67ec02
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/back/link.rs

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,23 @@ pub fn llvm_err(sess: Session, msg: ~str) -> ! {
6161
6262
pub fn WriteOutputFile(sess: Session,
6363
PM: lib::llvm::PassManagerRef, M: ModuleRef,
64-
Triple: &str,
65-
Feature: &str,
66-
Output: &str,
64+
Triple: *c_char,
6765
// FIXME: When #2334 is fixed, change
6866
// c_uint to FileType
69-
FileType: c_uint,
67+
Output: *c_char, FileType: c_uint,
7068
OptLevel: c_int,
7169
EnableSegmentedStacks: bool) {
7270
unsafe {
73-
do str::as_c_str(Triple) |Triple| {
74-
do str::as_c_str(Feature) |Feature| {
75-
do str::as_c_str(Output) |Output| {
76-
let result = llvm::LLVMRustWriteOutputFile(
77-
PM,
78-
M,
79-
Triple,
80-
Feature,
81-
Output,
82-
FileType,
83-
OptLevel,
84-
EnableSegmentedStacks);
85-
if (!result) {
86-
llvm_err(sess, ~"Could not write output");
87-
}
88-
}
89-
}
71+
let result = llvm::LLVMRustWriteOutputFile(
72+
PM,
73+
M,
74+
Triple,
75+
Output,
76+
FileType,
77+
OptLevel,
78+
EnableSegmentedStacks);
79+
if (!result) {
80+
llvm_err(sess, ~"Could not write output");
9081
}
9182
}
9283
}
@@ -319,49 +310,66 @@ pub mod write {
319310
llvm::LLVMWriteBitcodeToFile(llmod, buf)
320311
});
321312
pm = mk_pass_manager();
322-
323313
// Save the assembly file if -S is used
314+
324315
if output_type == output_type_assembly {
325-
WriteOutputFile(
326-
sess,
327-
pm.llpm,
328-
llmod,
316+
let _: () = str::as_c_str(
329317
sess.targ_cfg.target_strs.target_triple,
330-
opts.target_feature,
331-
output.to_str(),
332-
lib::llvm::AssemblyFile as c_uint,
333-
CodeGenOptLevel,
334-
true);
318+
|buf_t| {
319+
str::as_c_str(output.to_str(), |buf_o| {
320+
WriteOutputFile(
321+
sess,
322+
pm.llpm,
323+
llmod,
324+
buf_t,
325+
buf_o,
326+
lib::llvm::AssemblyFile as c_uint,
327+
CodeGenOptLevel,
328+
true)
329+
})
330+
});
335331
}
336332

333+
337334
// Save the object file for -c or --save-temps alone
338335
// This .o is needed when an exe is built
339336
if output_type == output_type_object ||
340337
output_type == output_type_exe {
341-
WriteOutputFile(
342-
sess,
343-
pm.llpm,
344-
llmod,
338+
let _: () = str::as_c_str(
345339
sess.targ_cfg.target_strs.target_triple,
346-
opts.target_feature,
347-
output.to_str(),
348-
lib::llvm::ObjectFile as c_uint,
349-
CodeGenOptLevel,
350-
true);
340+
|buf_t| {
341+
str::as_c_str(output.to_str(), |buf_o| {
342+
WriteOutputFile(
343+
sess,
344+
pm.llpm,
345+
llmod,
346+
buf_t,
347+
buf_o,
348+
lib::llvm::ObjectFile as c_uint,
349+
CodeGenOptLevel,
350+
true)
351+
})
352+
});
351353
}
352354
} else {
353355
// If we aren't saving temps then just output the file
354356
// type corresponding to the '-c' or '-S' flag used
355-
WriteOutputFile(
356-
sess,
357-
pm.llpm,
358-
llmod,
357+
358+
let _: () = str::as_c_str(
359359
sess.targ_cfg.target_strs.target_triple,
360-
opts.target_feature,
361-
output.to_str(),
362-
FileType as c_uint,
363-
CodeGenOptLevel,
364-
true);
360+
|buf_t| {
361+
str::as_c_str(output.to_str(), |buf_o| {
362+
WriteOutputFile(
363+
sess,
364+
pm.llpm,
365+
llmod,
366+
buf_t,
367+
buf_o,
368+
FileType as c_uint,
369+
CodeGenOptLevel,
370+
true)
371+
})
372+
});
365373
}
366374
// Clean up and return
367375

branches/try/src/librustc/driver/driver.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ pub fn build_session_options(binary: @~str,
599599
let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
600600
let sysroot_opt = sysroot_opt.map(|m| Path(*m));
601601
let target_opt = getopts::opt_maybe_str(matches, ~"target");
602-
let target_feature_opt = getopts::opt_maybe_str(matches, ~"target-feature");
603602
let save_temps = getopts::opt_present(matches, ~"save-temps");
604603
match output_type {
605604
// unless we're emitting huamn-readable assembly, omit comments.
@@ -638,10 +637,6 @@ pub fn build_session_options(binary: @~str,
638637
None => host_triple(),
639638
Some(s) => s
640639
};
641-
let target_feature = match target_feature_opt {
642-
None => ~"",
643-
Some(s) => s
644-
};
645640
646641
let addl_lib_search_paths =
647642
getopts::opt_strs(matches, ~"L")
@@ -664,7 +659,6 @@ pub fn build_session_options(binary: @~str,
664659
addl_lib_search_paths: addl_lib_search_paths,
665660
maybe_sysroot: sysroot_opt,
666661
target_triple: target,
667-
target_feature: target_feature,
668662
cfg: cfg,
669663
binary: binary,
670664
test: test,
@@ -775,9 +769,6 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
775769
~"Target triple cpu-manufacturer-kernel[-os]
776770
to compile for (see chapter 3.4 of http://www.sourceware.org/autobook/
777771
for detail)", ~"TRIPLE"),
778-
optopt(~"", ~"target-feature",
779-
~"Target specific attributes (llc -mattr=help
780-
for detail)", ~"FEATURE"),
781772
optopt(~"", ~"android-cross-path",
782773
~"The path to the Android NDK", "PATH"),
783774
optmulti(~"W", ~"warn",

branches/try/src/librustc/driver/session.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ pub struct options {
126126
addl_lib_search_paths: ~[Path],
127127
maybe_sysroot: Option<Path>,
128128
target_triple: ~str,
129-
target_feature: ~str,
130129
// User-specified cfg meta items. The compiler itself will add additional
131130
// items to the crate config, and during parsing the entire crate config
132131
// will be added to the crate AST node. This should not be used for
@@ -303,7 +302,6 @@ pub fn basic_options() -> @options {
303302
addl_lib_search_paths: ~[],
304303
maybe_sysroot: None,
305304
target_triple: host_triple(),
306-
target_feature: ~"",
307305
cfg: ~[],
308306
binary: @~"rustc",
309307
test: false,

branches/try/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,10 +1799,9 @@ pub mod llvm {
17991799
pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef,
18001800
M: ModuleRef,
18011801
Triple: *c_char,
1802-
Feature: *c_char,
1803-
Output: *c_char,
18041802
// FIXME: When #2334 is fixed,
18051803
// change c_uint to FileType
1804+
Output: *c_char,
18061805
FileType: c_uint,
18071806
OptLevel: c_int,
18081807
EnableSegmentedStacks: bool)

0 commit comments

Comments
 (0)