rustc: make llloadenv bb optional, kill 1.5% of emitted llvm insns.
This commit is contained in:
parent
9b6f025eb6
commit
1a2eaed43d
@ -1379,11 +1379,9 @@ fn arrayalloca(cx: block, t: TypeRef, v: ValueRef) -> ValueRef {
|
||||
|
||||
// Creates the standard set of basic blocks for a function
|
||||
fn mk_standard_basic_blocks(llfn: ValueRef) ->
|
||||
{sa: BasicBlockRef, ca: BasicBlockRef, rt: BasicBlockRef} {
|
||||
{sa: BasicBlockRef, rt: BasicBlockRef} {
|
||||
{sa: str::as_c_str(~"static_allocas",
|
||||
|buf| llvm::LLVMAppendBasicBlock(llfn, buf)),
|
||||
ca: str::as_c_str(~"load_env",
|
||||
|buf| llvm::LLVMAppendBasicBlock(llfn, buf)),
|
||||
rt: str::as_c_str(~"return",
|
||||
|buf| llvm::LLVMAppendBasicBlock(llfn, buf))}
|
||||
}
|
||||
@ -1407,7 +1405,7 @@ fn new_fn_ctxt_w_id(ccx: @crate_ctxt,
|
||||
llenv: llvm::LLVMGetParam(llfndecl, 1u as c_uint),
|
||||
llretptr: llvm::LLVMGetParam(llfndecl, 0u as c_uint),
|
||||
mut llstaticallocas: llbbs.sa,
|
||||
mut llloadenv: llbbs.ca,
|
||||
mut llloadenv: None,
|
||||
mut llreturn: llbbs.rt,
|
||||
mut llself: None,
|
||||
mut personality: None,
|
||||
@ -1560,8 +1558,15 @@ fn finish_fn(fcx: fn_ctxt, lltop: BasicBlockRef) {
|
||||
|
||||
fn tie_up_header_blocks(fcx: fn_ctxt, lltop: BasicBlockRef) {
|
||||
let _icx = fcx.insn_ctxt("tie_up_header_blocks");
|
||||
Br(raw_block(fcx, false, fcx.llstaticallocas), fcx.llloadenv);
|
||||
Br(raw_block(fcx, false, fcx.llloadenv), lltop);
|
||||
match fcx.llloadenv {
|
||||
Some(copy ll) => {
|
||||
Br(raw_block(fcx, false, fcx.llstaticallocas), ll);
|
||||
Br(raw_block(fcx, false, ll), lltop);
|
||||
}
|
||||
None => {
|
||||
Br(raw_block(fcx, false, fcx.llstaticallocas), lltop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum self_arg { impl_self(ty::t), impl_owned_self(ty::t), no_self, }
|
||||
|
@ -316,7 +316,20 @@ fn load_environment(fcx: fn_ctxt,
|
||||
load_ret_handle: bool,
|
||||
proto: ast::Proto) {
|
||||
let _icx = fcx.insn_ctxt("closure::load_environment");
|
||||
let bcx = raw_block(fcx, false, fcx.llloadenv);
|
||||
|
||||
let llloadenv = match fcx.llloadenv {
|
||||
Some(ll) => ll,
|
||||
None => {
|
||||
let ll =
|
||||
str::as_c_str(~"load_env",
|
||||
|buf|
|
||||
llvm::LLVMAppendBasicBlock(fcx.llfn, buf));
|
||||
fcx.llloadenv = Some(ll);
|
||||
ll
|
||||
}
|
||||
};
|
||||
|
||||
let bcx = raw_block(fcx, false, llloadenv);
|
||||
|
||||
// Load a pointer to the closure data, skipping over the box header:
|
||||
let llcdata = base::opaque_box_body(bcx, cdata_ty, fcx.llenv);
|
||||
|
@ -228,7 +228,7 @@ type fn_ctxt = @{
|
||||
// already allocated by code in one of the llallocas blocks.
|
||||
// (LLVM requires that arguments be copied to local allocas before
|
||||
// allowing most any operation to be performed on them.)
|
||||
mut llloadenv: BasicBlockRef,
|
||||
mut llloadenv: Option<BasicBlockRef>,
|
||||
mut llreturn: BasicBlockRef,
|
||||
// The 'self' value currently in use in this function, if there
|
||||
// is one.
|
||||
|
Loading…
Reference in New Issue
Block a user