Skip to content

Commit c23bc78

Browse files
committed
---
yaml --- r: 85999 b: refs/heads/dist-snap c: ba5f101 h: refs/heads/master i: 85997: d43647b 85995: f42d827 85991: f0567b5 85983: 6642fa3 v: v3
1 parent f7ac8b7 commit c23bc78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+723
-357
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 0983ebe5310d4eb6d289f636f7ed0536c08bbc0e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 6655b3c4620714e1a043be3b47f581719cefa12d
9+
refs/heads/dist-snap: ba5f101fa9fd426d673868ebb903a709528a66d1
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libextra/json.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -1164,9 +1164,6 @@ impl Ord for Json {
11641164
}
11651165
}
11661166
}
1167-
fn le(&self, other: &Json) -> bool { !(*other).lt(&(*self)) }
1168-
fn ge(&self, other: &Json) -> bool { !(*self).lt(other) }
1169-
fn gt(&self, other: &Json) -> bool { (*other).lt(&(*self)) }
11701167
}
11711168

11721169
/// A trait for converting values to JSON

branches/dist-snap/src/libextra/semver.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -37,18 +37,6 @@ impl cmp::Ord for Identifier {
3737
(&AlphaNumeric(_), _) => false
3838
}
3939
}
40-
#[inline]
41-
fn le(&self, other: &Identifier) -> bool {
42-
! (other < self)
43-
}
44-
#[inline]
45-
fn gt(&self, other: &Identifier) -> bool {
46-
other < self
47-
}
48-
#[inline]
49-
fn ge(&self, other: &Identifier) -> bool {
50-
! (self < other)
51-
}
5240
}
5341

5442
impl ToStr for Identifier {

branches/dist-snap/src/librustc/back/link.rs

Lines changed: 75 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ pub mod write {
216216
use lib;
217217

218218
use std::c_str::ToCStr;
219-
use std::libc::c_uint;
219+
use std::libc::{c_uint, c_int};
220220
use std::path::Path;
221221
use std::run;
222222
use std::str;
@@ -257,17 +257,7 @@ pub mod write {
257257
}
258258
}
259259

260-
// Copy what clan does by turning on loop vectorization at O2 and
261-
// slp vectorization at O3
262-
let vectorize_loop = !sess.no_vectorize_loops() &&
263-
(sess.opts.optimize == session::Default ||
264-
sess.opts.optimize == session::Aggressive);
265-
let vectorize_slp = !sess.no_vectorize_slp() &&
266-
sess.opts.optimize == session::Aggressive;
267-
llvm::LLVMRustSetLLVMOptions(sess.print_llvm_passes(),
268-
vectorize_loop,
269-
vectorize_slp,
270-
sess.time_llvm_passes());
260+
configure_llvm(sess);
271261

272262
let OptLevel = match sess.opts.optimize {
273263
session::No => lib::llvm::CodeGenLevelNone,
@@ -293,12 +283,9 @@ pub mod write {
293283
// Create the two optimizing pass managers. These mirror what clang
294284
// does, and are by populated by LLVM's default PassManagerBuilder.
295285
// Each manager has a different set of passes, but they also share
296-
// some common passes. Each one is initialized with the analyis
297-
// passes the target requires, and then further passes are added.
286+
// some common passes.
298287
let fpm = llvm::LLVMCreateFunctionPassManagerForModule(llmod);
299288
let mpm = llvm::LLVMCreatePassManager();
300-
llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
301-
llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
302289

303290
// If we're verifying or linting, add them to the function pass
304291
// manager.
@@ -308,32 +295,11 @@ pub mod write {
308295
if !sess.no_verify() { assert!(addpass("verify")); }
309296
if sess.lint_llvm() { assert!(addpass("lint")); }
310297

311-
// Create the PassManagerBuilder for LLVM. We configure it with
312-
// reasonable defaults and prepare it to actually populate the pass
313-
// manager.
314-
let builder = llvm::LLVMPassManagerBuilderCreate();
315-
match sess.opts.optimize {
316-
session::No => {
317-
// Don't add lifetime intrinsics add O0
318-
llvm::LLVMRustAddAlwaysInlinePass(builder, false);
319-
}
320-
// numeric values copied from clang
321-
session::Less => {
322-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
323-
225);
324-
}
325-
session::Default | session::Aggressive => {
326-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
327-
275);
328-
}
298+
if !sess.no_prepopulate_passes() {
299+
llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
300+
llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
301+
populate_llvm_passess(fpm, mpm, llmod, OptLevel);
329302
}
330-
llvm::LLVMPassManagerBuilderSetOptLevel(builder, OptLevel as c_uint);
331-
llvm::LLVMRustAddBuilderLibraryInfo(builder, llmod);
332-
333-
// Use the builder to populate the function/module pass managers.
334-
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(builder, fpm);
335-
llvm::LLVMPassManagerBuilderPopulateModulePassManager(builder, mpm);
336-
llvm::LLVMPassManagerBuilderDispose(builder);
337303

338304
for pass in sess.opts.custom_passes.iter() {
339305
do pass.with_c_str |s| {
@@ -424,6 +390,74 @@ pub mod write {
424390
sess.abort_if_errors();
425391
}
426392
}
393+
394+
unsafe fn configure_llvm(sess: Session) {
395+
// Copy what clan does by turning on loop vectorization at O2 and
396+
// slp vectorization at O3
397+
let vectorize_loop = !sess.no_vectorize_loops() &&
398+
(sess.opts.optimize == session::Default ||
399+
sess.opts.optimize == session::Aggressive);
400+
let vectorize_slp = !sess.no_vectorize_slp() &&
401+
sess.opts.optimize == session::Aggressive;
402+
403+
let mut llvm_c_strs = ~[];
404+
let mut llvm_args = ~[];
405+
let add = |arg: &str| {
406+
let s = arg.to_c_str();
407+
llvm_args.push(s.with_ref(|p| p));
408+
llvm_c_strs.push(s);
409+
};
410+
add("rustc"); // fake program name
411+
add("-arm-enable-ehabi");
412+
add("-arm-enable-ehabi-descriptors");
413+
if vectorize_loop { add("-vectorize-loops"); }
414+
if vectorize_slp { add("-vectorize-slp"); }
415+
if sess.time_llvm_passes() { add("-time-passes"); }
416+
if sess.print_llvm_passes() { add("-debug-pass=Structure"); }
417+
418+
for arg in sess.opts.llvm_args.iter() {
419+
add(*arg);
420+
}
421+
422+
do llvm_args.as_imm_buf |p, len| {
423+
llvm::LLVMRustSetLLVMOptions(len as c_int, p);
424+
}
425+
}
426+
427+
unsafe fn populate_llvm_passess(fpm: lib::llvm::PassManagerRef,
428+
mpm: lib::llvm::PassManagerRef,
429+
llmod: ModuleRef,
430+
opt: lib::llvm::CodeGenOptLevel) {
431+
// Create the PassManagerBuilder for LLVM. We configure it with
432+
// reasonable defaults and prepare it to actually populate the pass
433+
// manager.
434+
let builder = llvm::LLVMPassManagerBuilderCreate();
435+
match opt {
436+
lib::llvm::CodeGenLevelNone => {
437+
// Don't add lifetime intrinsics add O0
438+
llvm::LLVMRustAddAlwaysInlinePass(builder, false);
439+
}
440+
lib::llvm::CodeGenLevelLess => {
441+
llvm::LLVMRustAddAlwaysInlinePass(builder, true);
442+
}
443+
// numeric values copied from clang
444+
lib::llvm::CodeGenLevelDefault => {
445+
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
446+
225);
447+
}
448+
lib::llvm::CodeGenLevelAggressive => {
449+
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
450+
275);
451+
}
452+
}
453+
llvm::LLVMPassManagerBuilderSetOptLevel(builder, opt as c_uint);
454+
llvm::LLVMRustAddBuilderLibraryInfo(builder, llmod);
455+
456+
// Use the builder to populate the function/module pass managers.
457+
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(builder, fpm);
458+
llvm::LLVMPassManagerBuilderPopulateModulePassManager(builder, mpm);
459+
llvm::LLVMPassManagerBuilderDispose(builder);
460+
}
427461
}
428462

429463

branches/dist-snap/src/librustc/driver/driver.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,13 +737,22 @@ pub fn build_session_options(binary: @str,
737737
}).collect()
738738
}
739739
};
740+
let llvm_args = match getopts::opt_maybe_str(matches, "llvm-args") {
741+
None => ~[],
742+
Some(s) => {
743+
s.split_iter(|c: char| c == ' ' || c == ',').map(|s| {
744+
s.trim().to_owned()
745+
}).collect()
746+
}
747+
};
740748

741749
let sopts = @session::options {
742750
crate_type: crate_type,
743751
is_static: statik,
744752
gc: gc,
745753
optimize: opt_level,
746754
custom_passes: custom_passes,
755+
llvm_args: llvm_args,
747756
debuginfo: debuginfo,
748757
extra_debuginfo: extra_debuginfo,
749758
lint_opts: lint_opts,
@@ -851,6 +860,8 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
851860
Appends to the default list of passes to run for the \
852861
specified current optimization level. A value of \
853862
\"list\" will list all of the available passes", "NAMES"),
863+
optopt("", "llvm-args", "A list of arguments to pass to llvm, comma \
864+
separated", "ARGS"),
854865
optopt( "", "out-dir",
855866
"Write output to compiler-chosen filename
856867
in <dir>", "DIR"),

branches/dist-snap/src/librustc/driver/session.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub static once_fns: uint = 1 << 26;
7979
pub static print_llvm_passes: uint = 1 << 27;
8080
pub static no_vectorize_loops: uint = 1 << 28;
8181
pub static no_vectorize_slp: uint = 1 << 29;
82+
pub static no_prepopulate_passes: uint = 1 << 30;
8283

8384
pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
8485
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
@@ -126,6 +127,10 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
126127
(~"print-llvm-passes",
127128
~"Prints the llvm optimization passes being run",
128129
print_llvm_passes),
130+
(~"no-prepopulate-passes",
131+
~"Don't pre-populate the pass managers with a list of passes, only use \
132+
the passes from --passes",
133+
no_prepopulate_passes),
129134
(~"no-vectorize-loops",
130135
~"Don't run the loop vectorization optimization passes",
131136
no_vectorize_loops),
@@ -152,6 +157,7 @@ pub struct options {
152157
gc: bool,
153158
optimize: OptLevel,
154159
custom_passes: ~[~str],
160+
llvm_args: ~[~str],
155161
debuginfo: bool,
156162
extra_debuginfo: bool,
157163
lint_opts: ~[(lint::lint, lint::level)],
@@ -320,6 +326,9 @@ impl Session_ {
320326
pub fn print_llvm_passes(@self) -> bool {
321327
self.debugging_opt(print_llvm_passes)
322328
}
329+
pub fn no_prepopulate_passes(@self) -> bool {
330+
self.debugging_opt(no_prepopulate_passes)
331+
}
323332
pub fn no_vectorize_loops(@self) -> bool {
324333
self.debugging_opt(no_vectorize_loops)
325334
}
@@ -351,6 +360,7 @@ pub fn basic_options() -> @options {
351360
gc: false,
352361
optimize: No,
353362
custom_passes: ~[],
363+
llvm_args: ~[],
354364
debuginfo: false,
355365
extra_debuginfo: false,
356366
lint_opts: ~[],

branches/dist-snap/src/librustc/lib/llvm.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ pub enum AsmDialect {
191191
AD_Intel = 1
192192
}
193193

194+
#[deriving(Eq)]
194195
pub enum CodeGenOptLevel {
195196
CodeGenLevelNone = 0,
196197
CodeGenLevelLess = 1,
@@ -2123,10 +2124,7 @@ pub mod llvm {
21232124
pub fn LLVMRustPrintModule(PM: PassManagerRef,
21242125
M: ModuleRef,
21252126
Output: *c_char);
2126-
pub fn LLVMRustSetLLVMOptions(PrintPasses: bool,
2127-
VectorizeLoops: bool,
2128-
VectorizeSLP: bool,
2129-
TimePasses: bool);
2127+
pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: **c_char);
21302128
pub fn LLVMRustPrintPasses();
21312129
pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *c_char);
21322130
pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef,

branches/dist-snap/src/librustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn check_impl_of_trait(cx: Context, it: @item, trait_ref: &trait_ref, self_type:
129129

130130
// If this trait has builtin-kind supertraits, meet them.
131131
let self_ty: ty::t = ty::node_id_to_type(cx.tcx, it.id);
132-
error!("checking impl with self type %?", ty::get(self_ty).sty);
132+
debug!("checking impl with self type %?", ty::get(self_ty).sty);
133133
do check_builtin_bounds(cx, self_ty, trait_def.bounds) |missing| {
134134
cx.tcx.sess.span_err(self_type.span,
135135
fmt!("the type `%s', which does not fulfill `%s`, cannot implement this \

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,10 +2453,16 @@ pub fn item_path(ccx: &CrateContext, id: &ast::NodeId) -> path {
24532453
}
24542454

24552455
fn exported_name(ccx: @mut CrateContext, path: path, ty: ty::t, attrs: &[ast::Attribute]) -> ~str {
2456-
if attr::contains_name(attrs, "no_mangle") {
2457-
path_elt_to_str(*path.last(), token::get_ident_interner())
2458-
} else {
2459-
mangle_exported_name(ccx, path, ty)
2456+
match attr::first_attr_value_str_by_name(attrs, "export_name") {
2457+
// Use provided name
2458+
Some(name) => name.to_owned(),
2459+
2460+
// Don't mangle
2461+
_ if attr::contains_name(attrs, "no_mangle")
2462+
=> path_elt_to_str(*path.last(), token::get_ident_interner()),
2463+
2464+
// Usual name mangling
2465+
_ => mangle_exported_name(ccx, path, ty)
24602466
}
24612467
}
24622468

branches/dist-snap/src/librustc/middle/trans/reflect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ impl Reflector {
252252
let tcx = bcx.ccx().tcx;
253253
let fields = ty::struct_fields(tcx, did, substs);
254254

255-
let extra = ~[self.c_slice(ty_to_str(tcx, t).to_managed()),
256-
self.c_uint(fields.len())] + self.c_size_and_align(t);
255+
let extra = ~[self.c_uint(fields.len())]
256+
+ self.c_size_and_align(t);
257257
do self.bracketed("class", extra) |this| {
258258
for (i, field) in fields.iter().enumerate() {
259259
let extra = ~[this.c_uint(i),

0 commit comments

Comments
 (0)