rust/src/librustc/middle/trans
Daniel Micay f2932e4661 make small (<= size_of::<int>()) enums immediate
C-like enums are excluded from this for now, because the code paths
specific to them need to be changed.

    fn foo() -> Option<~int> { Some(~5) }

Before:

    ; Function Attrs: uwtable
    define void @_ZN3foo18hdec6e36682b87eeaf4v0.0E(%"enum.std::option::Option<~int>[#1]"* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %2 = tail call %"enum.std::libc::types::common::c95::c_void[#1]"* @"_ZN2rt11global_heap10malloc_raw17h56c543b77f9b78aY11v0.9$x2dpreE"({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
      %3 = bitcast %"enum.std::libc::types::common::c95::c_void[#1]"* %2 to i64*
      store i64 5, i64* %3, align 8
      %4 = getelementptr inbounds %"enum.std::option::Option<~int>[#1]"* %0, i64 0, i32 0
      store i64* %3, i64** %4, align 8
      ret void
    }

After:

    ; Function Attrs: uwtable
    define %"enum.std::option::Option<~int>[#1]" @_ZN3foo18h2cbf6557a3143edah4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %1 = tail call %"enum.std::libc::types::common::c95::c_void[#1]"* @"_ZN2rt11global_heap10malloc_raw18hb1e9dd1beab35edau11v0.9$x2dpreE"({ i64, %tydesc*, i8*, i8*, i8 }* undef, i64 8)
      %2 = bitcast %"enum.std::libc::types::common::c95::c_void[#1]"* %1 to i64*
      store i64 5, i64* %2, align 8
      %oldret = insertvalue %"enum.std::option::Option<~int>[#1]" undef, i64* %2, 0
      ret %"enum.std::option::Option<~int>[#1]" %oldret
    }
2013-10-02 10:02:52 -04:00
..
_match.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
adt.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
asm.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
base.rs treat uninhabited enums as voidish 2013-10-02 10:02:52 -04:00
basic_block.rs
build.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
builder.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
cabi_arm.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
cabi_mips.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
cabi_x86_64.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
cabi_x86.rs
cabi.rs
callee.rs treat uninhabited enums as voidish 2013-10-02 10:02:52 -04:00
closure.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
common.rs make small (<= size_of::<int>()) enums immediate 2013-10-02 10:02:52 -04:00
consts.rs remove the float type 2013-10-01 14:54:10 -04:00
context.rs remove the float type 2013-10-01 14:54:10 -04:00
controlflow.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
datum.rs treat uninhabited enums as voidish 2013-10-02 10:02:52 -04:00
debuginfo.rs remove the float type 2013-10-01 14:54:10 -04:00
expr.rs treat uninhabited enums as voidish 2013-10-02 10:02:52 -04:00
foreign.rs treat uninhabited enums as voidish 2013-10-02 10:02:52 -04:00
glue.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
inline.rs librustc: Inline cross-crate tuple struct constructors 2013-10-01 14:24:34 -07:00
intrinsic.rs treat uninhabited enums as voidish 2013-10-02 10:02:52 -04:00
llrepr.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
machine.rs
macros.rs
meth.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
mod.rs remove type_use 2013-09-26 17:27:23 -04:00
monomorphize.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
reflect.rs remove the float type 2013-10-01 14:54:10 -04:00
tvec.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
type_.rs remove the float type 2013-10-01 14:54:10 -04:00
type_of.rs treat uninhabited enums as voidish 2013-10-02 10:02:52 -04:00
uniq.rs
value.rs trans::build: Change @mut Block to &Block or &mut Block 2013-09-30 19:37:22 +02:00
write_guard.rs rustc: Remove usage of fmt! 2013-09-30 23:21:19 -07:00