@@ -24,12 +24,10 @@ use middle::trans::expr;
24
24
use middle:: trans:: glue;
25
25
use middle:: trans:: tvec;
26
26
use middle:: trans:: type_of;
27
- use middle:: trans:: write_guard;
28
27
use middle:: ty;
29
28
use util:: ppaux:: { ty_to_str} ;
30
29
31
30
use syntax:: ast;
32
- use syntax:: codemap:: Span ;
33
31
34
32
/**
35
33
* A `Datum` encapsulates the result of evaluating an expression. It
@@ -160,10 +158,6 @@ pub fn rvalue_scratch_datum(bcx: &Block,
160
158
Datum ( scratch, ty, Rvalue ( ByRef ) )
161
159
}
162
160
163
- pub fn is_by_value_type ( ccx : & CrateContext , ty : ty:: t ) -> bool {
164
- appropriate_rvalue_mode ( ccx, ty) == ByValue
165
- }
166
-
167
161
pub fn appropriate_rvalue_mode ( ccx : & CrateContext , ty : ty:: t ) -> RvalueMode {
168
162
/*!
169
163
* Indicates the "appropriate" mode for this value,
@@ -389,10 +383,7 @@ impl Datum<Expr> {
389
383
}
390
384
}
391
385
392
- pub fn is_by_ref ( & self ) -> bool {
393
- self . kind . is_by_ref ( )
394
- }
395
-
386
+ #[ allow( dead_code) ] // potentially useful
396
387
pub fn assert_lvalue ( self , bcx : & Block ) -> Datum < Lvalue > {
397
388
/*!
398
389
* Asserts that this datum *is* an lvalue and returns it.
@@ -632,6 +623,7 @@ impl<K:KindOps> Datum<K> {
632
623
glue:: take_ty ( bcx, dst, self . ty )
633
624
}
634
625
626
+ #[ allow( dead_code) ] // useful for debugging
635
627
pub fn to_str ( & self , ccx : & CrateContext ) -> ~str {
636
628
format ! ( "Datum({}, {}, {:?})" ,
637
629
ccx. tn. val_to_str( self . val) ,
@@ -645,16 +637,6 @@ impl<K:KindOps> Datum<K> {
645
637
appropriate_rvalue_mode ( ccx, self . ty )
646
638
}
647
639
648
- pub fn root_and_write_guard < ' a > (
649
- & self ,
650
- bcx : & ' a Block < ' a > ,
651
- span : Span ,
652
- expr_id : ast:: NodeId ,
653
- derefs : uint )
654
- -> & ' a Block < ' a > {
655
- write_guard:: root_and_write_guard ( self , bcx, span, expr_id, derefs)
656
- }
657
-
658
640
pub fn to_llscalarish < ' a > ( self , bcx : & ' a Block < ' a > ) -> ValueRef {
659
641
/*!
660
642
* Converts `self` into a by-value `ValueRef`. Consumes this
@@ -688,39 +670,13 @@ impl<'a, K:KindOps> DatumBlock<'a, K> {
688
670
}
689
671
690
672
impl < ' a > DatumBlock < ' a , Expr > {
691
- pub fn assert_by_ref ( self ) -> DatumBlock < ' a , Expr > {
692
- assert ! ( self . datum. kind. is_by_ref( ) ) ;
693
- self
694
- }
695
-
696
- pub fn store_to ( self , dst : ValueRef ) -> & ' a Block < ' a > {
697
- let DatumBlock { bcx, datum } = self ;
698
- datum. store_to ( bcx, dst)
699
- }
700
-
701
673
pub fn store_to_dest ( self ,
702
674
dest : expr:: Dest ,
703
675
expr_id : ast:: NodeId ) -> & ' a Block < ' a > {
704
676
let DatumBlock { bcx, datum } = self ;
705
677
datum. store_to_dest ( bcx, dest, expr_id)
706
678
}
707
679
708
- pub fn shallow_copy ( self , dst : ValueRef ) -> & ' a Block < ' a > {
709
- self . datum . shallow_copy ( self . bcx , dst)
710
- }
711
-
712
- pub fn ccx ( & self ) -> & ' a CrateContext {
713
- self . bcx . ccx ( )
714
- }
715
-
716
- pub fn tcx ( & self ) -> & ' a ty:: ctxt {
717
- self . bcx . tcx ( )
718
- }
719
-
720
- pub fn to_str ( & self ) -> ~str {
721
- self . datum . to_str ( self . ccx ( ) )
722
- }
723
-
724
680
pub fn to_llbool ( self ) -> Result < ' a > {
725
681
let DatumBlock { datum, bcx } = self ;
726
682
rslt ( bcx, datum. to_llbool ( bcx) )
0 commit comments