Skip to content

Commit 087656a

Browse files
committed
---
yaml --- r: 49881 b: refs/heads/auto c: b5334c3 h: refs/heads/master i: 49879: f501275 v: v3
1 parent 64dc816 commit 087656a

File tree

25 files changed

+115
-301
lines changed

25 files changed

+115
-301
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 18b71a78314505b4dd3816f9662709860aafaf4c
17+
refs/heads/auto: b5334c3095a024f934a91ba82bd88fe2696919d1
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/src/libcore/option.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ let unwrapped_msg = match msg {
4242
*/
4343

4444
use cmp::{Eq,Ord};
45+
use ops::Add;
4546
use kinds::Copy;
4647
use util;
4748
use num::Zero;
@@ -85,6 +86,18 @@ impl<T:Ord> Ord for Option<T> {
8586
}
8687
}
8788

89+
impl<T: Copy + Add<T,T>> Add<Option<T>, Option<T>> for Option<T> {
90+
#[inline(always)]
91+
pure fn add(&self, other: &Option<T>) -> Option<T> {
92+
match (*self, *other) {
93+
(None, None) => None,
94+
(_, None) => *self,
95+
(None, _) => *other,
96+
(Some(ref lhs), Some(ref rhs)) => Some(*lhs + *rhs)
97+
}
98+
}
99+
}
100+
88101
#[inline(always)]
89102
pub pure fn get<T:Copy>(opt: Option<T>) -> T {
90103
/*!

branches/auto/src/libcore/rt/context.rs

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,42 @@ extern {
6565
fn swap_registers(out_regs: *mut Registers, in_regs: *Registers);
6666
}
6767

68-
// Definitions of these registers are in rt/arch/x86_64/regs.h
68+
#[cfg(target_arch = "x86")]
69+
struct Registers {
70+
eax: u32, ebx: u32, ecx: u32, edx: u32,
71+
ebp: u32, esi: u32, edi: u32, esp: u32,
72+
cs: u16, ds: u16, ss: u16, es: u16, fs: u16, gs: u16,
73+
eflags: u32, eip: u32
74+
}
75+
76+
#[cfg(target_arch = "x86")]
77+
fn new_regs() -> ~Registers {
78+
~Registers {
79+
eax: 0, ebx: 0, ecx: 0, edx: 0,
80+
ebp: 0, esi: 0, edi: 0, esp: 0,
81+
cs: 0, ds: 0, ss: 0, es: 0, fs: 0, gs: 0,
82+
eflags: 0, eip: 0
83+
}
84+
}
85+
86+
#[cfg(target_arch = "x86")]
87+
fn initialize_call_frame(regs: &mut Registers,
88+
fptr: *c_void, arg: *c_void, sp: *mut uint) {
89+
90+
let sp = align_down(sp);
91+
let sp = mut_offset(sp, -4); // XXX: -4 words? Needs this be done at all?
92+
93+
unsafe { *sp = arg as uint; }
94+
let sp = mut_offset(sp, -1);
95+
unsafe { *sp = 0; } // The final return address
96+
97+
regs.esp = sp as u32;
98+
regs.eip = fptr as u32;
99+
100+
// Last base pointer on the stack is 0
101+
regs.ebp = 0;
102+
}
103+
69104
#[cfg(target_arch = "x86_64")]
70105
type Registers = [uint * 22];
71106

@@ -101,40 +136,42 @@ fn initialize_call_frame(regs: &mut Registers,
101136
regs[RUSTRT_RBP] = 0;
102137
}
103138

104-
#[cfg(target_arch = "x86")]
105-
struct Registers {
106-
eax: u32, ebx: u32, ecx: u32, edx: u32,
107-
ebp: u32, esi: u32, edi: u32, esp: u32,
108-
cs: u16, ds: u16, ss: u16, es: u16, fs: u16, gs: u16,
109-
eflags: u32, eip: u32
110-
}
139+
#[cfg(target_arch = "arm")]
140+
type Registers = [uint * 32];
111141

112-
#[cfg(target_arch = "x86")]
113-
fn new_regs() -> ~Registers {
114-
~Registers {
115-
eax: 0, ebx: 0, ecx: 0, edx: 0,
116-
ebp: 0, esi: 0, edi: 0, esp: 0,
117-
cs: 0, ds: 0, ss: 0, es: 0, fs: 0, gs: 0,
118-
eflags: 0, eip: 0
119-
}
120-
}
142+
#[cfg(target_arch = "arm")]
143+
fn new_regs() -> ~Registers { ~[0, .. 32] }
121144

122-
#[cfg(target_arch = "x86")]
145+
#[cfg(target_arch = "arm")]
123146
fn initialize_call_frame(regs: &mut Registers,
124147
fptr: *c_void, arg: *c_void, sp: *mut uint) {
148+
let sp = mut_offset(sp, -1);
125149

126-
let sp = align_down(sp);
127-
let sp = mut_offset(sp, -4); // XXX: -4 words? Needs this be done at all?
150+
// The final return address. 0 indicates the bottom of the stack
151+
unsafe { *sp = 0; }
128152

129-
unsafe { *sp = arg as uint; }
153+
regs[0] = arg as uint; // r0
154+
regs[13] = sp as uint; // #53 sp, r13
155+
regs[14] = fptr as uint; // #60 pc, r15 --> lr
156+
}
157+
158+
#[cfg(target_arch = "mips")]
159+
type Registers = [uint * 32];
160+
161+
#[cfg(target_arch = "mips")]
162+
fn new_regs() -> ~Registers { ~[0, .. 32] }
163+
164+
#[cfg(target_arch = "mips")]
165+
fn initialize_call_frame(regs: &mut Registers,
166+
fptr: *c_void, arg: *c_void, sp: *mut uint) {
130167
let sp = mut_offset(sp, -1);
131-
unsafe { *sp = 0; } // The final return address
132168

133-
regs.esp = sp as u32;
134-
regs.eip = fptr as u32;
169+
// The final return address. 0 indicates the bottom of the stack
170+
unsafe { *sp = 0; }
135171

136-
// Last base pointer on the stack is 0
137-
regs.ebp = 0;
172+
regs[4] = arg as uint;
173+
regs[29] = sp as uint;
174+
regs[31] = fptr as uint;
138175
}
139176

140177
fn align_down(sp: *mut uint) -> *mut uint {

branches/auto/src/libcore/rt/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// XXX: Missing some implementation for other architectures
12-
#[cfg(target_os = "linux")];
13-
#[cfg(target_os = "mac")];
14-
#[cfg(target_os = "win32")];
15-
1611
// Some basic logging
1712
macro_rules! rtdebug (
1813
($( $arg:expr),+) => ( {

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,6 @@ pub enum Metadata {
188188
MD_tbaa_struct = 5
189189
}
190190

191-
// Inline Asm Dialect
192-
pub enum AsmDialect {
193-
AD_ATT = 0,
194-
AD_Intel = 1
195-
}
196-
197191
// Opaque pointer types
198192
pub enum Module_opaque {}
199193
pub type ModuleRef = *Module_opaque;
@@ -223,9 +217,9 @@ pub enum SectionIterator_opaque {}
223217
pub type SectionIteratorRef = *SectionIterator_opaque;
224218

225219
pub mod llvm {
226-
use super::{AsmDialect, AtomicBinOp, AtomicOrdering, BasicBlockRef};
227-
use super::{Bool, BuilderRef, ContextRef, MemoryBufferRef, ModuleRef};
228-
use super::{ObjectFileRef, Opcode, PassManagerRef, PassManagerBuilderRef};
220+
use super::{AtomicBinOp, AtomicOrdering, BasicBlockRef, Bool, BuilderRef};
221+
use super::{ContextRef, MemoryBufferRef, ModuleRef, ObjectFileRef};
222+
use super::{Opcode, PassManagerRef, PassManagerBuilderRef};
229223
use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
230224
use super::{ValueRef};
231225

@@ -1439,12 +1433,6 @@ pub mod llvm {
14391433

14401434
/** Enables LLVM debug output. */
14411435
pub unsafe fn LLVMSetDebug(Enabled: c_int);
1442-
1443-
/** Prepares inline assembly. */
1444-
pub unsafe fn LLVMInlineAsm(Ty: TypeRef, AsmString: *c_char,
1445-
Constraints: *c_char, SideEffects: Bool,
1446-
AlignStack: Bool, Dialect: AsmDialect)
1447-
-> ValueRef;
14481436
}
14491437
}
14501438

branches/auto/src/librustc/middle/liveness.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,7 @@ fn visit_expr(expr: @expr, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
620620
expr_do_body(*) | expr_cast(*) | expr_unary(*) | expr_break(_) |
621621
expr_again(_) | expr_lit(_) | expr_ret(*) | expr_block(*) |
622622
expr_assign(*) | expr_swap(*) | expr_assign_op(*) | expr_mac(*) |
623-
expr_struct(*) | expr_repeat(*) | expr_paren(*) |
624-
expr_inline_asm(*) => {
623+
expr_struct(*) | expr_repeat(*) | expr_paren(*) => {
625624
visit::visit_expr(expr, self, vt);
626625
}
627626
}
@@ -1346,7 +1345,6 @@ pub impl Liveness {
13461345
self.propagate_through_expr(e, succ)
13471346
}
13481347
1349-
expr_inline_asm(*) |
13501348
expr_lit(*) => {
13511349
succ
13521350
}
@@ -1620,7 +1618,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
16201618
expr_cast(*) | expr_unary(*) | expr_ret(*) | expr_break(*) |
16211619
expr_again(*) | expr_lit(_) | expr_block(*) | expr_swap(*) |
16221620
expr_mac(*) | expr_addr_of(*) | expr_struct(*) | expr_repeat(*) |
1623-
expr_paren(*) | expr_inline_asm(*) => {
1621+
expr_paren(*) => {
16241622
visit::visit_expr(expr, self, vt);
16251623
}
16261624
}

branches/auto/src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ pub impl mem_categorization_ctxt {
447447
ast::expr_while(*) | ast::expr_block(*) | ast::expr_loop(*) |
448448
ast::expr_match(*) | ast::expr_lit(*) | ast::expr_break(*) |
449449
ast::expr_mac(*) | ast::expr_again(*) | ast::expr_struct(*) |
450-
ast::expr_repeat(*) | ast::expr_inline_asm(*) => {
450+
ast::expr_repeat(*) => {
451451
return self.cat_rvalue(expr, expr_ty);
452452
}
453453
}

branches/auto/src/librustc/middle/moves.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,7 @@ pub impl VisitContext {
560560

561561
expr_break(*) |
562562
expr_again(*) |
563-
expr_lit(*) |
564-
expr_inline_asm(*) => {}
563+
expr_lit(*) => {}
565564

566565
expr_loop(ref blk, _) => {
567566
self.consume_block(blk, visitor);

branches/auto/src/librustc/middle/trans/build.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use lib::llvm::llvm;
12-
use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering, AsmDialect};
12+
use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering};
1313
use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False};
1414
use lib::llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, ModuleRef};
1515
use lib;
@@ -18,7 +18,7 @@ use syntax::codemap::span;
1818

1919
use core::prelude::*;
2020
use core::cast;
21-
use core::libc::{c_uint, c_int, c_ulonglong, c_char};
21+
use core::libc::{c_uint, c_int, c_ulonglong};
2222
use core::libc;
2323
use core::option::Some;
2424
use core::ptr;
@@ -872,25 +872,6 @@ pub fn add_comment(bcx: block, text: &str) {
872872
}
873873
}
874874
875-
pub fn InlineAsmCall(cx: block, asm: *c_char, cons: *c_char,
876-
volatile: bool, alignstack: bool,
877-
dia: AsmDialect) -> ValueRef {
878-
unsafe {
879-
count_insn(cx, "inlineasm");
880-
881-
let volatile = if volatile { lib::llvm::True }
882-
else { lib::llvm::False };
883-
let alignstack = if alignstack { lib::llvm::True }
884-
else { lib::llvm::False };
885-
886-
let llfty = T_fn(~[], T_void());
887-
let v = llvm::LLVMInlineAsm(llfty, asm, cons, volatile,
888-
alignstack, dia);
889-
890-
Call(cx, v, ~[])
891-
}
892-
}
893-
894875
pub fn Call(cx: block, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef {
895876
if cx.unreachable { return _UndefReturn(cx, Fn); }
896877
unsafe {

branches/auto/src/librustc/middle/trans/expr.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -691,17 +691,6 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
691691
ast::expr_assign_op(op, dst, src) => {
692692
return trans_assign_op(bcx, expr, op, dst, src);
693693
}
694-
ast::expr_inline_asm(asm, cons, volatile, alignstack) => {
695-
// XXX: cons doesn't actual contain ALL the stuff we should
696-
// be passing since the constraints for in/outputs aren't included
697-
do str::as_c_str(*asm) |a| {
698-
do str::as_c_str(*cons) |c| {
699-
InlineAsmCall(bcx, a, c, volatile, alignstack,
700-
lib::llvm::AD_ATT);
701-
}
702-
}
703-
return bcx;
704-
}
705694
_ => {
706695
bcx.tcx().sess.span_bug(
707696
expr.span,

branches/auto/src/librustc/middle/trans/type_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
353353
expr_match(*) | expr_block(_) | expr_if(*) | expr_while(*) |
354354
expr_break(_) | expr_again(_) | expr_unary(_, _) | expr_lit(_) |
355355
expr_mac(_) | expr_addr_of(_, _) | expr_ret(_) | expr_loop(_, _) |
356-
expr_loop_body(_) | expr_do_body(_) | expr_inline_asm(*) => ()
356+
expr_loop_body(_) | expr_do_body(_) => ()
357357
}
358358
}
359359

branches/auto/src/librustc/middle/ty.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3076,7 +3076,6 @@ pub fn expr_kind(tcx: ctxt,
30763076
ast::expr_block(*) |
30773077
ast::expr_copy(*) |
30783078
ast::expr_repeat(*) |
3079-
ast::expr_inline_asm(*) |
30803079
ast::expr_lit(@codemap::spanned {node: lit_str(_), _}) |
30813080
ast::expr_vstore(_, ast::expr_vstore_slice) |
30823081
ast::expr_vstore(_, ast::expr_vstore_mut_slice) |

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,10 +2303,6 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
23032303
let region_lb = ty::re_scope(expr.id);
23042304
instantiate_path(fcx, pth, tpt, expr.span, expr.id, region_lb);
23052305
}
2306-
ast::expr_inline_asm(*) => {
2307-
fcx.require_unsafe(expr.span, ~"use of inline assembly");
2308-
fcx.write_nil(id);
2309-
}
23102306
ast::expr_mac(_) => tcx.sess.bug(~"unexpanded macro"),
23112307
ast::expr_break(_) => { fcx.write_bot(id); bot = true; }
23122308
ast::expr_again(_) => { fcx.write_bot(id); bot = true; }

branches/auto/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,6 @@ pub mod guarantor {
682682

683683
// All of these expressions are rvalues and hence their
684684
// value is not guaranteed by a region pointer.
685-
ast::expr_inline_asm(*) |
686685
ast::expr_mac(*) |
687686
ast::expr_lit(_) |
688687
ast::expr_unary(*) |

branches/auto/src/libsyntax/ast.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,6 @@ pub enum expr_ {
601601
expr_ret(Option<@expr>),
602602
expr_log(log_level, @expr, @expr),
603603
604-
/* asm, clobbers + constraints, volatile, align stack */
605-
expr_inline_asm(@~str, @~str, bool, bool),
606-
607604
expr_mac(mac),
608605
609606
// A struct literal expression.

0 commit comments

Comments
 (0)