Skip to content

Commit 8b58ea4

Browse files
committed
---
yaml --- r: 53944 b: refs/heads/dist-snap c: 0a34a3f h: refs/heads/master v: v3
1 parent 60927cf commit 8b58ea4

File tree

6 files changed

+51
-82
lines changed

6 files changed

+51
-82
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: c1cacc36672e2c6a581848c2909c7bb8a1b01f33
10+
refs/heads/dist-snap: 0a34a3f0f52cc353bb08efa2005bf92cb7d4921f
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

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

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,15 @@ pub mod write {
167167
use back::link::{output_type_assembly, output_type_bitcode};
168168
use back::link::{output_type_exe, output_type_llvm_assembly};
169169
use back::link::{output_type_object};
170-
use back::link::output_type;
171170
use driver::session::Session;
172171
use driver::session;
173172
use lib::llvm::llvm;
174173
use lib::llvm::{False, True, ModuleRef, mk_pass_manager, mk_target_data};
175174
use lib;
176175

177-
use core::prelude::*;
178176
use core::libc::{c_char, c_int, c_uint};
179177
use core::path::Path;
180178
use core::str;
181-
use core::run;
182179

183180
pub fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
184181
if ot == output_type_assembly || ot == output_type_object ||
@@ -188,8 +185,7 @@ pub mod write {
188185
return false;
189186
}
190187

191-
pub fn run_passes(sess: Session, llmod: ModuleRef,
192-
output_type: output_type, output: &Path) {
188+
pub fn run_passes(sess: Session, llmod: ModuleRef, output: &Path) {
193189
unsafe {
194190
let opts = sess.opts;
195191
if sess.time_llvm_passes() { llvm::LLVMRustEnableTimePasses(); }
@@ -205,7 +201,7 @@ pub mod write {
205201

206202

207203
if opts.save_temps {
208-
match output_type {
204+
match opts.output_type {
209205
output_type_bitcode => {
210206
if opts.optimize != session::No {
211207
let filename = output.with_filetype("no-opt.bc");
@@ -266,7 +262,7 @@ pub mod write {
266262
llvm::LLVMPassManagerBuilderDispose(MPMB);
267263
}
268264
if !sess.no_verify() { llvm::LLVMAddVerifierPass(pm.llpm); }
269-
if is_object_or_assembly_or_exe(output_type) || opts.jit {
265+
if is_object_or_assembly_or_exe(opts.output_type) || opts.jit {
270266
let LLVMOptNone = 0 as c_int; // -O0
271267
let LLVMOptLess = 1 as c_int; // -O1
272268
let LLVMOptDefault = 2 as c_int; // -O2, -Os
@@ -294,8 +290,8 @@ pub mod write {
294290
}
295291

296292
let mut FileType;
297-
if output_type == output_type_object ||
298-
output_type == output_type_exe {
293+
if opts.output_type == output_type_object ||
294+
opts.output_type == output_type_exe {
299295
FileType = lib::llvm::ObjectFile;
300296
} else { FileType = lib::llvm::AssemblyFile; }
301297
// Write optimized bitcode if --save-temps was on.
@@ -311,7 +307,7 @@ pub mod write {
311307
pm = mk_pass_manager();
312308
// Save the assembly file if -S is used
313309

314-
if output_type == output_type_assembly {
310+
if opts.output_type == output_type_assembly {
315311
let _: () = str::as_c_str(
316312
sess.targ_cfg.target_strs.target_triple,
317313
|buf_t| {
@@ -332,8 +328,8 @@ pub mod write {
332328

333329
// Save the object file for -c or --save-temps alone
334330
// This .o is needed when an exe is built
335-
if output_type == output_type_object ||
336-
output_type == output_type_exe {
331+
if opts.output_type == output_type_object ||
332+
opts.output_type == output_type_exe {
337333
let _: () = str::as_c_str(
338334
sess.targ_cfg.target_strs.target_triple,
339335
|buf_t| {
@@ -379,7 +375,7 @@ pub mod write {
379375
return;
380376
}
381377

382-
if output_type == output_type_llvm_assembly {
378+
if opts.output_type == output_type_llvm_assembly {
383379
// Given options "-S --emit-llvm": output LLVM assembly
384380
str::as_c_str(output.to_str(), |buf_o| {
385381
llvm::LLVMRustAddPrintModulePass(pm.llpm, llmod, buf_o)});
@@ -395,34 +391,6 @@ pub mod write {
395391
if sess.time_llvm_passes() { llvm::LLVMRustPrintPassTimings(); }
396392
}
397393
}
398-
399-
pub fn run_ndk(sess: Session, assembly: &Path, object: &Path) {
400-
let cc_prog: ~str = match &sess.opts.android_cross_path {
401-
&Some(copy path) => {
402-
fmt!("%s/bin/arm-linux-androideabi-gcc", path)
403-
}
404-
&None => {
405-
sess.fatal(~"need Android NDK path for building \
406-
(--android-cross-path)")
407-
}
408-
};
409-
let mut cc_args = ~[];
410-
cc_args.push(~"-c");
411-
cc_args.push(~"-o");
412-
cc_args.push(object.to_str());
413-
cc_args.push(assembly.to_str());
414-
415-
let prog = run::program_output(cc_prog, cc_args);
416-
417-
if prog.status != 0 {
418-
sess.err(fmt!("building with `%s` failed with code %d",
419-
cc_prog, prog.status));
420-
sess.note(fmt!("%s arguments: %s",
421-
cc_prog, str::connect(cc_args, ~" ")));
422-
sess.note(prog.err + prog.out);
423-
sess.abort_if_errors();
424-
}
425-
}
426394
}
427395

428396

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

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ pub fn build_configuration(sess: Session, +argv0: ~str, input: input) ->
132132
}
133133

134134
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
135-
pub fn parse_cfgspecs(cfgspecs: ~[~str]) -> ast::crate_cfg {
136-
// FIXME (#2399): It would be nice to use the parser to parse all
137-
// varieties of meta_item here. At the moment we just support the
138-
// meta_word variant.
139-
let mut words = ~[];
135+
fn parse_cfgspecs(cfgspecs: ~[~str],
136+
demitter: diagnostic::Emitter) -> ast::crate_cfg {
137+
let mut meta = ~[];
140138
for cfgspecs.each |s| {
141-
words.push(attr::mk_word_item(@/*bad*/copy *s));
139+
let sess = parse::new_parse_sess(Some(demitter));
140+
let m = parse::parse_meta_from_source_str(~"cfgspec", @/*bad*/ copy *s, ~[], sess);
141+
meta.push(m)
142142
}
143-
return words;
143+
return meta;
144144
}
145145

146146
pub enum input {
@@ -323,23 +323,9 @@ pub fn compile_rest(sess: Session, cfg: ast::crate_cfg,
323323

324324
};
325325

326-
// NOTE: Android hack
327-
if sess.targ_cfg.arch == session::arch_arm &&
328-
(sess.opts.output_type == link::output_type_object ||
329-
sess.opts.output_type == link::output_type_exe) {
330-
let output_type = link::output_type_assembly;
331-
let obj_filename = outputs.obj_filename.with_filetype("s");
332-
333-
time(time_passes, ~"LLVM passes", ||
334-
link::write::run_passes(sess, llmod, output_type,
335-
&obj_filename));
336-
337-
link::write::run_ndk(sess, &obj_filename, &outputs.obj_filename);
338-
} else {
339-
time(time_passes, ~"LLVM passes", ||
340-
link::write::run_passes(sess, llmod, sess.opts.output_type,
326+
time(time_passes, ~"LLVM passes", ||
327+
link::write::run_passes(sess, llmod,
341328
&outputs.obj_filename));
342-
}
343329

344330
let stop_after_codegen =
345331
sess.opts.output_type != link::output_type_exe ||
@@ -653,7 +639,7 @@ pub fn build_session_options(+binary: ~str,
653639
let addl_lib_search_paths =
654640
getopts::opt_strs(matches, ~"L")
655641
.map(|s| Path(*s));
656-
let cfg = parse_cfgspecs(getopts::opt_strs(matches, ~"cfg"));
642+
let cfg = parse_cfgspecs(getopts::opt_strs(matches, ~"cfg"), demitter);
657643
let test = opt_present(matches, ~"test");
658644
let android_cross_path = getopts::opt_maybe_str(
659645
matches, ~"android-cross-path");

branches/dist-snap/src/libsyntax/parse/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,22 @@ pub fn parse_item_from_source_str(
139139
maybe_aborted(p.parse_item(attrs),p)
140140
}
141141

142+
pub fn parse_meta_from_source_str(
143+
name: ~str,
144+
source: @~str,
145+
+cfg: ast::crate_cfg,
146+
sess: @mut ParseSess
147+
) -> @ast::meta_item {
148+
let p = new_parser_from_source_str(
149+
sess,
150+
cfg,
151+
/*bad*/ copy name,
152+
codemap::FssNone,
153+
source
154+
);
155+
maybe_aborted(p.parse_meta_item(),p)
156+
}
157+
142158
pub fn parse_stmt_from_source_str(
143159
name: ~str,
144160
source: @~str,

branches/dist-snap/src/rt/arch/arm/ccall.S

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,23 @@
55

66
.globl __morestack
77
.hidden __morestack
8-
.type __morestack, %function
98
__morestack:
10-
.fnstart
11-
.save {r4, fp, lr}
12-
push {r4, fp, lr}
13-
.movsp r4
14-
mov r4, sp
9+
mov r3, sp
1510
mov sp, r2
16-
mov fp, sp
11+
12+
str r3, [sp]
13+
str lr, [sp, #-4]
14+
15+
sub sp, #8
16+
1717
blx r1
18-
mov sp, r4
19-
pop {r4, fp, lr}
18+
19+
add sp, #8
20+
21+
ldr lr, [sp, #-4]
22+
ldr r3, [sp]
23+
24+
mov sp, r3
2025
mov pc, lr
21-
.fnend
26+
2227

branches/dist-snap/src/rustllvm/RustWrapper.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "llvm/ADT/DenseSet.h"
2828
#include "llvm/Assembly/Parser.h"
2929
#include "llvm/Assembly/PrintModulePass.h"
30-
#include "llvm/Support/CommandLine.h"
3130
#include "llvm/Support/FormattedStream.h"
3231
#include "llvm/Support/Timer.h"
3332
#include "llvm/Support/raw_ostream.h"
@@ -429,11 +428,6 @@ LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
429428

430429
LLVMRustInitializeTargets();
431430

432-
int argc = 3;
433-
const char* argv[] = {"rustc", "-arm-enable-ehabi",
434-
"-arm-enable-ehabi-descriptors"};
435-
cl::ParseCommandLineOptions(argc, argv);
436-
437431
TargetOptions Options;
438432
Options.NoFramePointerElim = true;
439433
Options.EnableSegmentedStacks = EnableSegmentedStacks;

0 commit comments

Comments
 (0)