Convert a couple hundred ~""s to ""s, in trans functions.

This commit is contained in:
Graydon Hoare 2012-08-14 16:45:43 -07:00
parent c1fad07758
commit 4c16ff516d
9 changed files with 280 additions and 280 deletions

View file

@ -41,7 +41,7 @@ enum opt_result {
range_result(result, result),
}
fn trans_opt(bcx: block, o: opt) -> opt_result {
let _icx = bcx.insn_ctxt(~"alt::trans_opt");
let _icx = bcx.insn_ctxt("alt::trans_opt");
let ccx = bcx.ccx();
let mut bcx = bcx;
match o {
@ -303,7 +303,7 @@ fn get_options(ccx: @crate_ctxt, m: match_, col: uint) -> ~[opt] {
fn extract_variant_args(bcx: block, pat_id: ast::node_id,
vdefs: {enm: def_id, var: def_id}, val: ValueRef) ->
{vals: ~[ValueRef], bcx: block} {
let _icx = bcx.insn_ctxt(~"alt::extract_variant_args");
let _icx = bcx.insn_ctxt("alt::extract_variant_args");
let ccx = bcx.fcx.ccx;
let enum_ty_substs = match check ty::get(node_id_type(bcx, pat_id))
.struct {
@ -449,7 +449,7 @@ fn compile_submatch(bcx: block, m: match_, vals: ~[ValueRef],
For an empty match, a fall-through case must exist
*/
assert(m.len() > 0u || is_some(chk));
let _icx = bcx.insn_ctxt(~"alt::compile_submatch");
let _icx = bcx.insn_ctxt("alt::compile_submatch");
let mut bcx = bcx;
let tcx = bcx.tcx(), dm = tcx.def_map;
if m.len() == 0u { Br(bcx, option::get(chk)()); return; }
@ -735,7 +735,7 @@ fn make_phi_bindings(bcx: block,
map: ~[exit_node],
ids: pat_util::pat_id_map)
-> option<phi_bindings_list> {
let _icx = bcx.insn_ctxt(~"alt::make_phi_bindings");
let _icx = bcx.insn_ctxt("alt::make_phi_bindings");
let our_block = bcx.llbb as uint;
let mut phi_bindings = ~[];
for ids.each |name, node_id| {
@ -815,7 +815,7 @@ fn trans_alt(bcx: block,
arms: ~[ast::arm],
mode: ast::alt_mode,
dest: dest) -> block {
let _icx = bcx.insn_ctxt(~"alt::trans_alt");
let _icx = bcx.insn_ctxt("alt::trans_alt");
do with_scope(bcx, alt_expr.info(), ~"alt") |bcx| {
trans_alt_inner(bcx, expr, arms, mode, dest)
}
@ -823,7 +823,7 @@ fn trans_alt(bcx: block,
fn trans_alt_inner(scope_cx: block, expr: @ast::expr, arms: ~[ast::arm],
mode: ast::alt_mode, dest: dest) -> block {
let _icx = scope_cx.insn_ctxt(~"alt::trans_alt_inner");
let _icx = scope_cx.insn_ctxt("alt::trans_alt_inner");
let bcx = scope_cx, tcx = bcx.tcx();
let mut bodies = ~[], matches = ~[];
@ -897,7 +897,7 @@ fn trans_alt_inner(scope_cx: block, expr: @ast::expr, arms: ~[ast::arm],
// Not alt-related, but similar to the pattern-munging code above
fn bind_irrefutable_pat(bcx: block, pat: @ast::pat, val: ValueRef,
make_copy: bool) -> block {
let _icx = bcx.insn_ctxt(~"alt::bind_irrefutable_pat");
let _icx = bcx.insn_ctxt("alt::bind_irrefutable_pat");
let ccx = bcx.fcx.ccx;
let mut bcx = bcx;

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,7 @@ fn B(cx: block) -> BuilderRef {
return b;
}
fn count_insn(cx: block, category: ~str) {
fn count_insn(cx: block, category: &str) {
if cx.ccx().sess.count_llvm_insns() {
let h = cx.ccx().stats.llvm_insns;
@ -70,7 +70,7 @@ fn RetVoid(cx: block) {
if cx.unreachable { return; }
assert (!cx.terminated);
cx.terminated = true;
count_insn(cx, ~"retvoid");
count_insn(cx, "retvoid");
llvm::LLVMBuildRetVoid(B(cx));
}
@ -78,7 +78,7 @@ fn Ret(cx: block, V: ValueRef) {
if cx.unreachable { return; }
assert (!cx.terminated);
cx.terminated = true;
count_insn(cx, ~"ret");
count_insn(cx, "ret");
llvm::LLVMBuildRet(B(cx), V);
}
@ -96,7 +96,7 @@ fn Br(cx: block, Dest: BasicBlockRef) {
if cx.unreachable { return; }
assert (!cx.terminated);
cx.terminated = true;
count_insn(cx, ~"br");
count_insn(cx, "br");
llvm::LLVMBuildBr(B(cx), Dest);
}
@ -105,7 +105,7 @@ fn CondBr(cx: block, If: ValueRef, Then: BasicBlockRef,
if cx.unreachable { return; }
assert (!cx.terminated);
cx.terminated = true;
count_insn(cx, ~"condbr");
count_insn(cx, "condbr");
llvm::LLVMBuildCondBr(B(cx), If, Then, Else);
}
@ -126,7 +126,7 @@ fn IndirectBr(cx: block, Addr: ValueRef, NumDests: uint) {
if cx.unreachable { return; }
assert (!cx.terminated);
cx.terminated = true;
count_insn(cx, ~"indirectbr");
count_insn(cx, "indirectbr");
llvm::LLVMBuildIndirectBr(B(cx), Addr, NumDests as c_uint);
}
@ -147,7 +147,7 @@ fn Invoke(cx: block, Fn: ValueRef, Args: ~[ValueRef],
str::connect(vec::map(Args, |a| val_str(cx.ccx().tn, a)),
~", ")};
unsafe {
count_insn(cx, ~"invoke");
count_insn(cx, "invoke");
llvm::LLVMBuildInvoke(B(cx), Fn, vec::unsafe::to_ptr(Args),
Args.len() as c_uint, Then, Catch,
noname());
@ -160,7 +160,7 @@ fn FastInvoke(cx: block, Fn: ValueRef, Args: ~[ValueRef],
assert (!cx.terminated);
cx.terminated = true;
unsafe {
count_insn(cx, ~"fastinvoke");
count_insn(cx, "fastinvoke");
let v = llvm::LLVMBuildInvoke(B(cx), Fn, vec::unsafe::to_ptr(Args),
Args.len() as c_uint,
Then, Catch, noname());
@ -172,7 +172,7 @@ fn Unreachable(cx: block) {
if cx.unreachable { return; }
cx.unreachable = true;
if !cx.terminated {
count_insn(cx, ~"unreachable");
count_insn(cx, "unreachable");
llvm::LLVMBuildUnreachable(B(cx));
}
}
@ -184,218 +184,218 @@ fn _Undef(val: ValueRef) -> ValueRef {
/* Arithmetic */
fn Add(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"add");
count_insn(cx, "add");
return llvm::LLVMBuildAdd(B(cx), LHS, RHS, noname());
}
fn NSWAdd(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"nswadd");
count_insn(cx, "nswadd");
return llvm::LLVMBuildNSWAdd(B(cx), LHS, RHS, noname());
}
fn NUWAdd(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"nuwadd");
count_insn(cx, "nuwadd");
return llvm::LLVMBuildNUWAdd(B(cx), LHS, RHS, noname());
}
fn FAdd(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"fadd");
count_insn(cx, "fadd");
return llvm::LLVMBuildFAdd(B(cx), LHS, RHS, noname());
}
fn Sub(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"sub");
count_insn(cx, "sub");
return llvm::LLVMBuildSub(B(cx), LHS, RHS, noname());
}
fn NSWSub(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"nwsub");
count_insn(cx, "nwsub");
return llvm::LLVMBuildNSWSub(B(cx), LHS, RHS, noname());
}
fn NUWSub(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"nuwsub");
count_insn(cx, "nuwsub");
return llvm::LLVMBuildNUWSub(B(cx), LHS, RHS, noname());
}
fn FSub(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"sub");
count_insn(cx, "sub");
return llvm::LLVMBuildFSub(B(cx), LHS, RHS, noname());
}
fn Mul(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"mul");
count_insn(cx, "mul");
return llvm::LLVMBuildMul(B(cx), LHS, RHS, noname());
}
fn NSWMul(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"nswmul");
count_insn(cx, "nswmul");
return llvm::LLVMBuildNSWMul(B(cx), LHS, RHS, noname());
}
fn NUWMul(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"nuwmul");
count_insn(cx, "nuwmul");
return llvm::LLVMBuildNUWMul(B(cx), LHS, RHS, noname());
}
fn FMul(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"fmul");
count_insn(cx, "fmul");
return llvm::LLVMBuildFMul(B(cx), LHS, RHS, noname());
}
fn UDiv(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"udiv");
count_insn(cx, "udiv");
return llvm::LLVMBuildUDiv(B(cx), LHS, RHS, noname());
}
fn SDiv(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"sdiv");
count_insn(cx, "sdiv");
return llvm::LLVMBuildSDiv(B(cx), LHS, RHS, noname());
}
fn ExactSDiv(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"extractsdiv");
count_insn(cx, "extractsdiv");
return llvm::LLVMBuildExactSDiv(B(cx), LHS, RHS, noname());
}
fn FDiv(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"fdiv");
count_insn(cx, "fdiv");
return llvm::LLVMBuildFDiv(B(cx), LHS, RHS, noname());
}
fn URem(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"urem");
count_insn(cx, "urem");
return llvm::LLVMBuildURem(B(cx), LHS, RHS, noname());
}
fn SRem(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"srem");
count_insn(cx, "srem");
return llvm::LLVMBuildSRem(B(cx), LHS, RHS, noname());
}
fn FRem(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"frem");
count_insn(cx, "frem");
return llvm::LLVMBuildFRem(B(cx), LHS, RHS, noname());
}
fn Shl(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"shl");
count_insn(cx, "shl");
return llvm::LLVMBuildShl(B(cx), LHS, RHS, noname());
}
fn LShr(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"lshr");
count_insn(cx, "lshr");
return llvm::LLVMBuildLShr(B(cx), LHS, RHS, noname());
}
fn AShr(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"ashr");
count_insn(cx, "ashr");
return llvm::LLVMBuildAShr(B(cx), LHS, RHS, noname());
}
fn And(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"and");
count_insn(cx, "and");
return llvm::LLVMBuildAnd(B(cx), LHS, RHS, noname());
}
fn Or(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"or");
count_insn(cx, "or");
return llvm::LLVMBuildOr(B(cx), LHS, RHS, noname());
}
fn Xor(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"xor");
count_insn(cx, "xor");
return llvm::LLVMBuildXor(B(cx), LHS, RHS, noname());
}
fn BinOp(cx: block, Op: Opcode, LHS: ValueRef, RHS: ValueRef) ->
ValueRef {
if cx.unreachable { return _Undef(LHS); }
count_insn(cx, ~"binop");
count_insn(cx, "binop");
return llvm::LLVMBuildBinOp(B(cx), Op, LHS, RHS, noname());
}
fn Neg(cx: block, V: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(V); }
count_insn(cx, ~"neg");
count_insn(cx, "neg");
return llvm::LLVMBuildNeg(B(cx), V, noname());
}
fn NSWNeg(cx: block, V: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(V); }
count_insn(cx, ~"nswneg");
count_insn(cx, "nswneg");
return llvm::LLVMBuildNSWNeg(B(cx), V, noname());
}
fn NUWNeg(cx: block, V: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(V); }
count_insn(cx, ~"nuwneg");
count_insn(cx, "nuwneg");
return llvm::LLVMBuildNUWNeg(B(cx), V, noname());
}
fn FNeg(cx: block, V: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(V); }
count_insn(cx, ~"fneg");
count_insn(cx, "fneg");
return llvm::LLVMBuildFNeg(B(cx), V, noname());
}
fn Not(cx: block, V: ValueRef) -> ValueRef {
if cx.unreachable { return _Undef(V); }
count_insn(cx, ~"not");
count_insn(cx, "not");
return llvm::LLVMBuildNot(B(cx), V, noname());
}
/* Memory */
fn Malloc(cx: block, Ty: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_i8())); }
count_insn(cx, ~"malloc");
count_insn(cx, "malloc");
return llvm::LLVMBuildMalloc(B(cx), Ty, noname());
}
fn ArrayMalloc(cx: block, Ty: TypeRef, Val: ValueRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_i8())); }
count_insn(cx, ~"arraymalloc");
count_insn(cx, "arraymalloc");
return llvm::LLVMBuildArrayMalloc(B(cx), Ty, Val, noname());
}
fn Alloca(cx: block, Ty: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(Ty)); }
count_insn(cx, ~"alloca");
count_insn(cx, "alloca");
return llvm::LLVMBuildAlloca(B(cx), Ty, noname());
}
fn ArrayAlloca(cx: block, Ty: TypeRef, Val: ValueRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(Ty)); }
count_insn(cx, ~"arrayalloca");
count_insn(cx, "arrayalloca");
return llvm::LLVMBuildArrayAlloca(B(cx), Ty, Val, noname());
}
fn Free(cx: block, PointerVal: ValueRef) {
if cx.unreachable { return; }
count_insn(cx, ~"free");
count_insn(cx, "free");
llvm::LLVMBuildFree(B(cx), PointerVal);
}
@ -407,7 +407,7 @@ fn Load(cx: block, PointerVal: ValueRef) -> ValueRef {
llvm::LLVMGetElementType(ty) } else { ccx.int_type };
return llvm::LLVMGetUndef(eltty);
}
count_insn(cx, ~"load");
count_insn(cx, "load");
return llvm::LLVMBuildLoad(B(cx), PointerVal, noname());
}
@ -416,14 +416,14 @@ fn Store(cx: block, Val: ValueRef, Ptr: ValueRef) {
debug!{"Store %s -> %s",
val_str(cx.ccx().tn, Val),
val_str(cx.ccx().tn, Ptr)};
count_insn(cx, ~"store");
count_insn(cx, "store");
llvm::LLVMBuildStore(B(cx), Val, Ptr);
}
fn GEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_nil())); }
unsafe {
count_insn(cx, ~"gep");
count_insn(cx, "gep");
return llvm::LLVMBuildGEP(B(cx), Pointer, vec::unsafe::to_ptr(Indices),
Indices.len() as c_uint, noname());
}
@ -434,7 +434,7 @@ fn GEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) -> ValueRef {
fn GEPi(cx: block, base: ValueRef, ixs: ~[uint]) -> ValueRef {
let mut v: ~[ValueRef] = ~[];
for vec::each(ixs) |i| { vec::push(v, C_i32(i as i32)); }
count_insn(cx, ~"gepi");
count_insn(cx, "gepi");
return InBoundsGEP(cx, base, v);
}
@ -442,7 +442,7 @@ fn InBoundsGEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) ->
ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_nil())); }
unsafe {
count_insn(cx, ~"inboundsgep");
count_insn(cx, "inboundsgep");
return llvm::LLVMBuildInBoundsGEP(B(cx), Pointer,
vec::unsafe::to_ptr(Indices),
Indices.len() as c_uint,
@ -452,138 +452,138 @@ fn InBoundsGEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) ->
fn StructGEP(cx: block, Pointer: ValueRef, Idx: uint) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_nil())); }
count_insn(cx, ~"structgep");
count_insn(cx, "structgep");
return llvm::LLVMBuildStructGEP(B(cx), Pointer, Idx as c_uint, noname());
}
fn GlobalString(cx: block, _Str: *libc::c_char) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_i8())); }
count_insn(cx, ~"globalstring");
count_insn(cx, "globalstring");
return llvm::LLVMBuildGlobalString(B(cx), _Str, noname());
}
fn GlobalStringPtr(cx: block, _Str: *libc::c_char) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_i8())); }
count_insn(cx, ~"globalstringptr");
count_insn(cx, "globalstringptr");
return llvm::LLVMBuildGlobalStringPtr(B(cx), _Str, noname());
}
/* Casts */
fn Trunc(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"trunc");
count_insn(cx, "trunc");
return llvm::LLVMBuildTrunc(B(cx), Val, DestTy, noname());
}
fn ZExt(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"zext");
count_insn(cx, "zext");
return llvm::LLVMBuildZExt(B(cx), Val, DestTy, noname());
}
fn SExt(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"sext");
count_insn(cx, "sext");
return llvm::LLVMBuildSExt(B(cx), Val, DestTy, noname());
}
fn FPToUI(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"fptoui");
count_insn(cx, "fptoui");
return llvm::LLVMBuildFPToUI(B(cx), Val, DestTy, noname());
}
fn FPToSI(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"fptosi");
count_insn(cx, "fptosi");
return llvm::LLVMBuildFPToSI(B(cx), Val, DestTy, noname());
}
fn UIToFP(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"uitofp");
count_insn(cx, "uitofp");
return llvm::LLVMBuildUIToFP(B(cx), Val, DestTy, noname());
}
fn SIToFP(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"sitofp");
count_insn(cx, "sitofp");
return llvm::LLVMBuildSIToFP(B(cx), Val, DestTy, noname());
}
fn FPTrunc(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"fptrunc");
count_insn(cx, "fptrunc");
return llvm::LLVMBuildFPTrunc(B(cx), Val, DestTy, noname());
}
fn FPExt(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"fpext");
count_insn(cx, "fpext");
return llvm::LLVMBuildFPExt(B(cx), Val, DestTy, noname());
}
fn PtrToInt(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"ptrtoint");
count_insn(cx, "ptrtoint");
return llvm::LLVMBuildPtrToInt(B(cx), Val, DestTy, noname());
}
fn IntToPtr(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"inttoptr");
count_insn(cx, "inttoptr");
return llvm::LLVMBuildIntToPtr(B(cx), Val, DestTy, noname());
}
fn BitCast(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"bitcast");
count_insn(cx, "bitcast");
return llvm::LLVMBuildBitCast(B(cx), Val, DestTy, noname());
}
fn ZExtOrBitCast(cx: block, Val: ValueRef, DestTy: TypeRef) ->
ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"zextorbitcast");
count_insn(cx, "zextorbitcast");
return llvm::LLVMBuildZExtOrBitCast(B(cx), Val, DestTy, noname());
}
fn SExtOrBitCast(cx: block, Val: ValueRef, DestTy: TypeRef) ->
ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"sextorbitcast");
count_insn(cx, "sextorbitcast");
return llvm::LLVMBuildSExtOrBitCast(B(cx), Val, DestTy, noname());
}
fn TruncOrBitCast(cx: block, Val: ValueRef, DestTy: TypeRef) ->
ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"truncorbitcast");
count_insn(cx, "truncorbitcast");
return llvm::LLVMBuildTruncOrBitCast(B(cx), Val, DestTy, noname());
}
fn Cast(cx: block, Op: Opcode, Val: ValueRef, DestTy: TypeRef,
_Name: *u8) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"cast");
count_insn(cx, "cast");
return llvm::LLVMBuildCast(B(cx), Op, Val, DestTy, noname());
}
fn PointerCast(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"pointercast");
count_insn(cx, "pointercast");
return llvm::LLVMBuildPointerCast(B(cx), Val, DestTy, noname());
}
fn IntCast(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"intcast");
count_insn(cx, "intcast");
return llvm::LLVMBuildIntCast(B(cx), Val, DestTy, noname());
}
fn FPCast(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(DestTy); }
count_insn(cx, ~"fpcast");
count_insn(cx, "fpcast");
return llvm::LLVMBuildFPCast(B(cx), Val, DestTy, noname());
}
@ -592,21 +592,21 @@ fn FPCast(cx: block, Val: ValueRef, DestTy: TypeRef) -> ValueRef {
fn ICmp(cx: block, Op: IntPredicate, LHS: ValueRef, RHS: ValueRef)
-> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_i1()); }
count_insn(cx, ~"icmp");
count_insn(cx, "icmp");
return llvm::LLVMBuildICmp(B(cx), Op as c_uint, LHS, RHS, noname());
}
fn FCmp(cx: block, Op: RealPredicate, LHS: ValueRef, RHS: ValueRef)
-> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_i1()); }
count_insn(cx, ~"fcmp");
count_insn(cx, "fcmp");
return llvm::LLVMBuildFCmp(B(cx), Op as c_uint, LHS, RHS, noname());
}
/* Miscellaneous instructions */
fn EmptyPhi(cx: block, Ty: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(Ty); }
count_insn(cx, ~"emptyphi");
count_insn(cx, "emptyphi");
return llvm::LLVMBuildPhi(B(cx), Ty, noname());
}
@ -616,7 +616,7 @@ fn Phi(cx: block, Ty: TypeRef, vals: ~[ValueRef], bbs: ~[BasicBlockRef])
assert vals.len() == bbs.len();
let phi = EmptyPhi(cx, Ty);
unsafe {
count_insn(cx, ~"addincoming");
count_insn(cx, "addincoming");
llvm::LLVMAddIncoming(phi, vec::unsafe::to_ptr(vals),
vec::unsafe::to_ptr(bbs),
vals.len() as c_uint);
@ -671,7 +671,7 @@ fn add_comment(bcx: block, text: ~str) {
fn Call(cx: block, Fn: ValueRef, Args: ~[ValueRef]) -> ValueRef {
if cx.unreachable { return _UndefReturn(cx, Fn); }
unsafe {
count_insn(cx, ~"call");
count_insn(cx, "call");
debug!{"Call(Fn=%s, Args=%?)",
val_str(cx.ccx().tn, Fn),
@ -685,7 +685,7 @@ fn Call(cx: block, Fn: ValueRef, Args: ~[ValueRef]) -> ValueRef {
fn FastCall(cx: block, Fn: ValueRef, Args: ~[ValueRef]) -> ValueRef {
if cx.unreachable { return _UndefReturn(cx, Fn); }
unsafe {
count_insn(cx, ~"fastcall");
count_insn(cx, "fastcall");
let v = llvm::LLVMBuildCall(B(cx), Fn, vec::unsafe::to_ptr(Args),
Args.len() as c_uint, noname());
lib::llvm::SetInstructionCallConv(v, lib::llvm::FastCallConv);
@ -697,7 +697,7 @@ fn CallWithConv(cx: block, Fn: ValueRef, Args: ~[ValueRef],
Conv: CallConv) -> ValueRef {
if cx.unreachable { return _UndefReturn(cx, Fn); }
unsafe {
count_insn(cx, ~"callwithconv");
count_insn(cx, "callwithconv");
let v = llvm::LLVMBuildCall(B(cx), Fn, vec::unsafe::to_ptr(Args),
Args.len() as c_uint, noname());
lib::llvm::SetInstructionCallConv(v, Conv);
@ -708,40 +708,40 @@ fn CallWithConv(cx: block, Fn: ValueRef, Args: ~[ValueRef],
fn Select(cx: block, If: ValueRef, Then: ValueRef, Else: ValueRef) ->
ValueRef {
if cx.unreachable { return _Undef(Then); }
count_insn(cx, ~"select");
count_insn(cx, "select");
return llvm::LLVMBuildSelect(B(cx), If, Then, Else, noname());
}
fn VAArg(cx: block, list: ValueRef, Ty: TypeRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(Ty); }
count_insn(cx, ~"vaarg");
count_insn(cx, "vaarg");
return llvm::LLVMBuildVAArg(B(cx), list, Ty, noname());
}
fn ExtractElement(cx: block, VecVal: ValueRef, Index: ValueRef) ->
ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_nil()); }
count_insn(cx, ~"extractelement");
count_insn(cx, "extractelement");
return llvm::LLVMBuildExtractElement(B(cx), VecVal, Index, noname());
}
fn InsertElement(cx: block, VecVal: ValueRef, EltVal: ValueRef,
Index: ValueRef) {
if cx.unreachable { return; }
count_insn(cx, ~"insertelement");
count_insn(cx, "insertelement");
llvm::LLVMBuildInsertElement(B(cx), VecVal, EltVal, Index, noname());
}
fn ShuffleVector(cx: block, V1: ValueRef, V2: ValueRef,
Mask: ValueRef) {
if cx.unreachable { return; }
count_insn(cx, ~"shufflevector");
count_insn(cx, "shufflevector");
llvm::LLVMBuildShuffleVector(B(cx), V1, V2, Mask, noname());
}
fn ExtractValue(cx: block, AggVal: ValueRef, Index: uint) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_nil()); }
count_insn(cx, ~"extractvalue");
count_insn(cx, "extractvalue");
return llvm::LLVMBuildExtractValue(
B(cx), AggVal, Index as c_uint, noname());
}
@ -749,27 +749,27 @@ fn ExtractValue(cx: block, AggVal: ValueRef, Index: uint) -> ValueRef {
fn InsertValue(cx: block, AggVal: ValueRef, EltVal: ValueRef,
Index: uint) {
if cx.unreachable { return; }
count_insn(cx, ~"insertvalue");
count_insn(cx, "insertvalue");
llvm::LLVMBuildInsertValue(B(cx), AggVal, EltVal, Index as c_uint,
noname());
}
fn IsNull(cx: block, Val: ValueRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_i1()); }
count_insn(cx, ~"isnull");
count_insn(cx, "isnull");
return llvm::LLVMBuildIsNull(B(cx), Val, noname());
}
fn IsNotNull(cx: block, Val: ValueRef) -> ValueRef {
if cx.unreachable { return llvm::LLVMGetUndef(T_i1()); }
count_insn(cx, ~"isnotnull");
count_insn(cx, "isnotnull");
return llvm::LLVMBuildIsNotNull(B(cx), Val, noname());
}
fn PtrDiff(cx: block, LHS: ValueRef, RHS: ValueRef) -> ValueRef {
let ccx = cx.fcx.ccx;
if cx.unreachable { return llvm::LLVMGetUndef(ccx.int_type); }
count_insn(cx, ~"ptrdiff");
count_insn(cx, "ptrdiff");
return llvm::LLVMBuildPtrDiff(B(cx), LHS, RHS, noname());
}
@ -785,7 +785,7 @@ fn Trap(cx: block) {
assert (T as int != 0);
let Args: ~[ValueRef] = ~[];
unsafe {
count_insn(cx, ~"trap");
count_insn(cx, "trap");
llvm::LLVMBuildCall(b, T, vec::unsafe::to_ptr(Args),
Args.len() as c_uint, noname());
}
@ -794,20 +794,20 @@ fn Trap(cx: block) {
fn LandingPad(cx: block, Ty: TypeRef, PersFn: ValueRef,
NumClauses: uint) -> ValueRef {
assert !cx.terminated && !cx.unreachable;
count_insn(cx, ~"landingpad");
count_insn(cx, "landingpad");
return llvm::LLVMBuildLandingPad(B(cx), Ty, PersFn,
NumClauses as c_uint, noname());
}
fn SetCleanup(cx: block, LandingPad: ValueRef) {
count_insn(cx, ~"setcleanup");
count_insn(cx, "setcleanup");
llvm::LLVMSetCleanup(LandingPad, lib::llvm::True);
}
fn Resume(cx: block, Exn: ValueRef) -> ValueRef {
assert (!cx.terminated);
cx.terminated = true;
count_insn(cx, ~"resume");
count_insn(cx, "resume");
return llvm::LLVMBuildResume(B(cx), Exn);
}

View file

@ -137,11 +137,11 @@ fn allocate_cbox(bcx: block,
ck: ty::closure_kind,
cdata_ty: ty::t)
-> result {
let _icx = bcx.insn_ctxt(~"closure::allocate_cbox");
let _icx = bcx.insn_ctxt("closure::allocate_cbox");
let ccx = bcx.ccx(), tcx = ccx.tcx;
fn nuke_ref_count(bcx: block, llbox: ValueRef) {
let _icx = bcx.insn_ctxt(~"closure::nuke_ref_count");
let _icx = bcx.insn_ctxt("closure::nuke_ref_count");
// Initialize ref count to arbitrary value for debugging:
let ccx = bcx.ccx();
let llbox = PointerCast(bcx, llbox, T_opaque_box_ptr(ccx));
@ -178,7 +178,7 @@ type closure_result = {
fn store_environment(bcx: block,
bound_values: ~[environment_value],
ck: ty::closure_kind) -> closure_result {
let _icx = bcx.insn_ctxt(~"closure::store_environment");
let _icx = bcx.insn_ctxt("closure::store_environment");
let ccx = bcx.ccx(), tcx = ccx.tcx;
// compute the shape of the closure
@ -251,7 +251,7 @@ fn build_closure(bcx0: block,
ck: ty::closure_kind,
id: ast::node_id,
include_ret_handle: option<ValueRef>) -> closure_result {
let _icx = bcx0.insn_ctxt(~"closure::build_closure");
let _icx = bcx0.insn_ctxt("closure::build_closure");
// If we need to, package up the iterator body to call
let mut env_vals = ~[];
let mut bcx = bcx0;
@ -312,7 +312,7 @@ fn load_environment(fcx: fn_ctxt,
cap_vars: ~[capture::capture_var],
load_ret_handle: bool,
ck: ty::closure_kind) {
let _icx = fcx.insn_ctxt(~"closure::load_environment");
let _icx = fcx.insn_ctxt("closure::load_environment");
let bcx = raw_block(fcx, false, fcx.llloadenv);
// Load a pointer to the closure data, skipping over the box header:
@ -354,7 +354,7 @@ fn trans_expr_fn(bcx: block,
cap_clause: ast::capture_clause,
is_loop_body: option<option<ValueRef>>,
dest: dest) -> block {
let _icx = bcx.insn_ctxt(~"closure::trans_expr_fn");
let _icx = bcx.insn_ctxt("closure::trans_expr_fn");
if dest == ignore { return bcx; }
let ccx = bcx.ccx();
let fty = node_id_type(bcx, id);
@ -407,7 +407,7 @@ fn make_fn_glue(
t: ty::t,
glue_fn: fn@(block, v: ValueRef, t: ty::t) -> block)
-> block {
let _icx = cx.insn_ctxt(~"closure::make_fn_glue");
let _icx = cx.insn_ctxt("closure::make_fn_glue");
let bcx = cx;
let tcx = cx.tcx();
@ -439,7 +439,7 @@ fn make_opaque_cbox_take_glue(
cboxptr: ValueRef) // ptr to ptr to the opaque closure
-> block {
// Easy cases:
let _icx = bcx.insn_ctxt(~"closure::make_opaque_cbox_take_glue");
let _icx = bcx.insn_ctxt("closure::make_opaque_cbox_take_glue");
match ck {
ty::ck_block => return bcx,
ty::ck_box => {
@ -491,7 +491,7 @@ fn make_opaque_cbox_drop_glue(
ck: ty::closure_kind,
cboxptr: ValueRef) // ptr to the opaque closure
-> block {
let _icx = bcx.insn_ctxt(~"closure::make_opaque_cbox_drop_glue");
let _icx = bcx.insn_ctxt("closure::make_opaque_cbox_drop_glue");
match ck {
ty::ck_block => bcx,
ty::ck_box => {
@ -510,7 +510,7 @@ fn make_opaque_cbox_free_glue(
ck: ty::closure_kind,
cbox: ValueRef) // ptr to ptr to the opaque closure
-> block {
let _icx = bcx.insn_ctxt(~"closure::make_opaque_cbox_free_glue");
let _icx = bcx.insn_ctxt("closure::make_opaque_cbox_free_glue");
match ck {
ty::ck_block => return bcx,
ty::ck_box | ty::ck_uniq => { /* hard cases: */ }

View file

@ -4,7 +4,7 @@ import base::get_insn_ctxt;
fn const_lit(cx: @crate_ctxt, e: @ast::expr, lit: ast::lit)
-> ValueRef {
let _icx = cx.insn_ctxt(~"trans_lit");
let _icx = cx.insn_ctxt("trans_lit");
match lit.node {
ast::lit_int(i, t) => C_integral(T_int_ty(cx, t), i as u64, True),
ast::lit_uint(u, t) => C_integral(T_uint_ty(cx, t), u, False),
@ -82,7 +82,7 @@ fn const_autoderef(cx: @crate_ctxt, ty: ty::t, v: ValueRef)
fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
let _icx = cx.insn_ctxt(~"const_expr");
let _icx = cx.insn_ctxt("const_expr");
match e.node {
ast::expr_lit(lit) => consts::const_lit(cx, e, *lit),
ast::expr_binary(b, e1, e2) => {
@ -366,7 +366,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
}
fn trans_const(ccx: @crate_ctxt, e: @ast::expr, id: ast::node_id) {
let _icx = ccx.insn_ctxt(~"trans_const");
let _icx = ccx.insn_ctxt("trans_const");
let v = const_expr(ccx, e);
// The scalars come back as 1st class LLVM vals

View file

@ -511,7 +511,7 @@ fn build_wrap_fn_(ccx: @crate_ctxt,
arg_builder: wrap_arg_builder,
ret_builder: wrap_ret_builder) {
let _icx = ccx.insn_ctxt(~"foreign::build_wrap_fn_");
let _icx = ccx.insn_ctxt("foreign::build_wrap_fn_");
let fcx = new_fn_ctxt(ccx, ~[], llwrapfn, none);
let bcx = top_scope_block(fcx, none);
let lltop = bcx.llbb;
@ -571,18 +571,18 @@ fn build_wrap_fn_(ccx: @crate_ctxt,
fn trans_foreign_mod(ccx: @crate_ctxt,
foreign_mod: ast::foreign_mod, abi: ast::foreign_abi) {
let _icx = ccx.insn_ctxt(~"foreign::trans_foreign_mod");
let _icx = ccx.insn_ctxt("foreign::trans_foreign_mod");
fn build_shim_fn(ccx: @crate_ctxt,
foreign_item: @ast::foreign_item,
tys: @c_stack_tys,
cc: lib::llvm::CallConv) -> ValueRef {
let _icx = ccx.insn_ctxt(~"foreign::build_shim_fn");
let _icx = ccx.insn_ctxt("foreign::build_shim_fn");
fn build_args(bcx: block, tys: @c_stack_tys,
llargbundle: ValueRef) -> ~[ValueRef] {
let _icx = bcx.insn_ctxt(~"foreign::shim::build_args");
let _icx = bcx.insn_ctxt("foreign::shim::build_args");
let mut llargvals = ~[];
let mut i = 0u;
let n = vec::len(tys.arg_tys);
@ -628,7 +628,7 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
fn build_ret(bcx: block, tys: @c_stack_tys,
llargbundle: ValueRef, llretval: ValueRef) {
let _icx = bcx.insn_ctxt(~"foreign::shim::build_ret");
let _icx = bcx.insn_ctxt("foreign::shim::build_ret");
match tys.x86_64_tys {
some(x86_64) => {
do vec::iteri(x86_64.attrs) |i, a| {
@ -719,11 +719,11 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
llshimfn: ValueRef,
llwrapfn: ValueRef) {
let _icx = ccx.insn_ctxt(~"foreign::build_wrap_fn");
let _icx = ccx.insn_ctxt("foreign::build_wrap_fn");
fn build_args(bcx: block, tys: @c_stack_tys,
llwrapfn: ValueRef, llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt(~"foreign::wrap::build_args");
let _icx = bcx.insn_ctxt("foreign::wrap::build_args");
let mut i = 0u;
let n = vec::len(tys.arg_tys);
let implicit_args = first_real_arg; // return + env
@ -738,7 +738,7 @@ fn trans_foreign_mod(ccx: @crate_ctxt,
fn build_ret(bcx: block, _tys: @c_stack_tys,
_llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt(~"foreign::wrap::build_ret");
let _icx = bcx.insn_ctxt("foreign::wrap::build_ret");
RetVoid(bcx);
}
@ -987,12 +987,12 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
body: ast::blk, llwrapfn: ValueRef, id: ast::node_id) {
let _icx = ccx.insn_ctxt(~"foreign::build_foreign_fn");
let _icx = ccx.insn_ctxt("foreign::build_foreign_fn");
fn build_rust_fn(ccx: @crate_ctxt, path: ast_map::path,
decl: ast::fn_decl, body: ast::blk,
id: ast::node_id) -> ValueRef {
let _icx = ccx.insn_ctxt(~"foreign::foreign::build_rust_fn");
let _icx = ccx.insn_ctxt("foreign::foreign::build_rust_fn");
let t = ty::node_id_to_type(ccx.tcx, id);
let ps = link::mangle_internal_name_by_path(
ccx, vec::append_one(path, ast_map::path_name(@~"__rust_abi")));
@ -1005,11 +1005,11 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
fn build_shim_fn(ccx: @crate_ctxt, path: ast_map::path,
llrustfn: ValueRef, tys: @c_stack_tys) -> ValueRef {
let _icx = ccx.insn_ctxt(~"foreign::foreign::build_shim_fn");
let _icx = ccx.insn_ctxt("foreign::foreign::build_shim_fn");
fn build_args(bcx: block, tys: @c_stack_tys,
llargbundle: ValueRef) -> ~[ValueRef] {
let _icx = bcx.insn_ctxt(~"foreign::extern::shim::build_args");
let _icx = bcx.insn_ctxt("foreign::extern::shim::build_args");
let mut llargvals = ~[];
let mut i = 0u;
let n = vec::len(tys.arg_tys);
@ -1042,11 +1042,11 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
fn build_wrap_fn(ccx: @crate_ctxt, llshimfn: ValueRef,
llwrapfn: ValueRef, tys: @c_stack_tys) {
let _icx = ccx.insn_ctxt(~"foreign::foreign::build_wrap_fn");
let _icx = ccx.insn_ctxt("foreign::foreign::build_wrap_fn");
fn build_args(bcx: block, tys: @c_stack_tys,
llwrapfn: ValueRef, llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt(~"foreign::foreign::wrap::build_args");
let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_args");
match tys.x86_64_tys {
option::some(x86_64) => {
let mut atys = x86_64.arg_tys;
@ -1100,7 +1100,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
fn build_ret(bcx: block, tys: @c_stack_tys,
llargbundle: ValueRef) {
let _icx = bcx.insn_ctxt(~"foreign::foreign::wrap::build_ret");
let _icx = bcx.insn_ctxt("foreign::foreign::wrap::build_ret");
match tys.x86_64_tys {
option::some(x86_64) => {
if x86_64.sret || !tys.ret_def {
@ -1144,7 +1144,7 @@ fn trans_foreign_fn(ccx: @crate_ctxt, path: ast_map::path, decl: ast::fn_decl,
fn register_foreign_fn(ccx: @crate_ctxt, sp: span,
path: ast_map::path, node_id: ast::node_id)
-> ValueRef {
let _icx = ccx.insn_ctxt(~"foreign::register_foreign_fn");
let _icx = ccx.insn_ctxt("foreign::register_foreign_fn");
let t = ty::node_id_to_type(ccx.tcx, node_id);
let (llargtys, llretty, ret_ty) = c_arg_and_ret_lltys(ccx, node_id);
return if ccx.sess.targ_cfg.arch == arch_x86_64 {

View file

@ -20,7 +20,7 @@ import syntax::print::pprust::expr_to_str;
fn trans_impl(ccx: @crate_ctxt, path: path, name: ast::ident,
methods: ~[@ast::method], tps: ~[ast::ty_param]) {
let _icx = ccx.insn_ctxt(~"impl::trans_impl");
let _icx = ccx.insn_ctxt("impl::trans_impl");
if tps.len() > 0u { return; }
let sub_path = vec::append_one(path, path_name(name));
for vec::each(methods) |m| {
@ -41,7 +41,7 @@ fn trans_impl(ccx: @crate_ctxt, path: path, name: ast::ident,
}
fn trans_self_arg(bcx: block, base: @ast::expr, derefs: uint) -> result {
let _icx = bcx.insn_ctxt(~"impl::trans_self_arg");
let _icx = bcx.insn_ctxt("impl::trans_self_arg");
let basety = expr_ty(bcx, base);
let m_by_ref = ast::expl(ast::by_ref);
let mut temp_cleanups = ~[];
@ -59,7 +59,7 @@ fn trans_self_arg(bcx: block, base: @ast::expr, derefs: uint) -> result {
fn trans_method_callee(bcx: block, callee_id: ast::node_id,
self: @ast::expr, mentry: typeck::method_map_entry)
-> lval_maybe_callee {
let _icx = bcx.insn_ctxt(~"impl::trans_method_callee");
let _icx = bcx.insn_ctxt("impl::trans_method_callee");
match mentry.origin {
typeck::method_static(did) => {
let {bcx, val} = trans_self_arg(bcx, self, mentry.derefs);
@ -89,7 +89,7 @@ fn trans_method_callee(bcx: block, callee_id: ast::node_id,
fn trans_static_method_callee(bcx: block, method_id: ast::def_id,
callee_id: ast::node_id) -> lval_maybe_callee {
let _icx = bcx.insn_ctxt(~"impl::trans_static_method_callee");
let _icx = bcx.insn_ctxt("impl::trans_static_method_callee");
let ccx = bcx.ccx();
let mname = if method_id.crate == ast::local_crate {
@ -175,7 +175,7 @@ fn trans_monomorphized_callee(bcx: block, callee_id: ast::node_id,
trait_id: ast::def_id, n_method: uint,
vtbl: typeck::vtable_origin)
-> lval_maybe_callee {
let _icx = bcx.insn_ctxt(~"impl::trans_monomorphized_callee");
let _icx = bcx.insn_ctxt("impl::trans_monomorphized_callee");
match vtbl {
typeck::vtable_static(impl_did, impl_substs, sub_origins) => {
let ccx = bcx.ccx();
@ -210,7 +210,7 @@ fn trans_monomorphized_callee(bcx: block, callee_id: ast::node_id,
fn trans_trait_callee(bcx: block, val: ValueRef,
callee_ty: ty::t, n_method: uint)
-> lval_maybe_callee {
let _icx = bcx.insn_ctxt(~"impl::trans_trait_callee");
let _icx = bcx.insn_ctxt("impl::trans_trait_callee");
let ccx = bcx.ccx();
let vtable = Load(bcx, PointerCast(bcx, GEPi(bcx, val, ~[0u, 0u]),
T_ptr(T_ptr(T_vtable()))));
@ -299,7 +299,7 @@ fn get_vtable(ccx: @crate_ctxt, origin: typeck::vtable_origin)
}
fn make_vtable(ccx: @crate_ctxt, ptrs: ~[ValueRef]) -> ValueRef {
let _icx = ccx.insn_ctxt(~"impl::make_vtable");
let _icx = ccx.insn_ctxt("impl::make_vtable");
let tbl = C_struct(ptrs);
let vt_gvar = str::as_c_str(ccx.names(~"vtable"), |buf| {
llvm::LLVMAddGlobal(ccx.llmod, val_ty(tbl), buf)
@ -312,7 +312,7 @@ fn make_vtable(ccx: @crate_ctxt, ptrs: ~[ValueRef]) -> ValueRef {
fn make_impl_vtable(ccx: @crate_ctxt, impl_id: ast::def_id, substs: ~[ty::t],
vtables: typeck::vtable_res) -> ValueRef {
let _icx = ccx.insn_ctxt(~"impl::make_impl_vtable");
let _icx = ccx.insn_ctxt("impl::make_impl_vtable");
let tcx = ccx.tcx;
// XXX: This should support multiple traits.
@ -345,7 +345,7 @@ fn make_impl_vtable(ccx: @crate_ctxt, impl_id: ast::def_id, substs: ~[ty::t],
fn trans_cast(bcx: block, val: @ast::expr, id: ast::node_id, dest: dest)
-> block {
let _icx = bcx.insn_ctxt(~"impl::trans_cast");
let _icx = bcx.insn_ctxt("impl::trans_cast");
if dest == ignore { return trans_expr(bcx, val, ignore); }
let ccx = bcx.ccx();
let v_ty = expr_ty(bcx, val);

View file

@ -32,7 +32,7 @@ fn expand_boxed_vec_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
}
fn get_fill(bcx: block, vptr: ValueRef) -> ValueRef {
let _icx = bcx.insn_ctxt(~"tvec::get_fill");
let _icx = bcx.insn_ctxt("tvec::get_fill");
Load(bcx, GEPi(bcx, vptr, ~[0u, abi::vec_elt_fill]))
}
fn set_fill(bcx: block, vptr: ValueRef, fill: ValueRef) {
@ -48,12 +48,12 @@ fn get_bodyptr(bcx: block, vptr: ValueRef) -> ValueRef {
fn get_dataptr(bcx: block, vptr: ValueRef)
-> ValueRef {
let _icx = bcx.insn_ctxt(~"tvec::get_dataptr");
let _icx = bcx.insn_ctxt("tvec::get_dataptr");
GEPi(bcx, vptr, ~[0u, abi::vec_elt_elems, 0u])
}
fn pointer_add(bcx: block, ptr: ValueRef, bytes: ValueRef) -> ValueRef {
let _icx = bcx.insn_ctxt(~"tvec::pointer_add");
let _icx = bcx.insn_ctxt("tvec::pointer_add");
let old_ty = val_ty(ptr);
let bptr = PointerCast(bcx, ptr, T_ptr(T_i8()));
return PointerCast(bcx, InBoundsGEP(bcx, bptr, ~[bytes]), old_ty);
@ -61,7 +61,7 @@ fn pointer_add(bcx: block, ptr: ValueRef, bytes: ValueRef) -> ValueRef {
fn alloc_raw(bcx: block, unit_ty: ty::t,
fill: ValueRef, alloc: ValueRef, heap: heap) -> result {
let _icx = bcx.insn_ctxt(~"tvec::alloc_uniq");
let _icx = bcx.insn_ctxt("tvec::alloc_uniq");
let ccx = bcx.ccx();
let vecbodyty = ty::mk_mut_unboxed_vec(bcx.tcx(), unit_ty);
@ -79,7 +79,7 @@ fn alloc_uniq_raw(bcx: block, unit_ty: ty::t,
}
fn alloc_vec(bcx: block, unit_ty: ty::t, elts: uint, heap: heap) -> result {
let _icx = bcx.insn_ctxt(~"tvec::alloc_uniq");
let _icx = bcx.insn_ctxt("tvec::alloc_uniq");
let ccx = bcx.ccx();
let llunitty = type_of::type_of(ccx, unit_ty);
let unit_sz = llsize_of(ccx, llunitty);
@ -92,7 +92,7 @@ fn alloc_vec(bcx: block, unit_ty: ty::t, elts: uint, heap: heap) -> result {
}
fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> result {
let _icx = bcx.insn_ctxt(~"tvec::duplicate_uniq");
let _icx = bcx.insn_ctxt("tvec::duplicate_uniq");
let fill = get_fill(bcx, get_bodyptr(bcx, vptr));
let unit_ty = ty::sequence_element_type(bcx.tcx(), vec_ty);
@ -110,7 +110,7 @@ fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> result {
fn make_drop_glue_unboxed(bcx: block, vptr: ValueRef, vec_ty: ty::t) ->
block {
let _icx = bcx.insn_ctxt(~"tvec::make_drop_glue_unboxed");
let _icx = bcx.insn_ctxt("tvec::make_drop_glue_unboxed");
let tcx = bcx.tcx(), unit_ty = ty::sequence_element_type(tcx, vec_ty);
if ty::type_needs_drop(tcx, unit_ty) {
iter_vec_unboxed(bcx, vptr, vec_ty, base::drop_ty)
@ -124,7 +124,7 @@ enum evec_elements {
fn trans_evec(bcx: block, elements: evec_elements,
vst: ast::vstore, id: ast::node_id, dest: dest) -> block {
let _icx = bcx.insn_ctxt(~"tvec::trans_evec");
let _icx = bcx.insn_ctxt("tvec::trans_evec");
let ccx = bcx.ccx();
let mut bcx = bcx;
@ -318,7 +318,7 @@ fn get_base_and_len(cx: block, v: ValueRef, e_ty: ty::t)
fn trans_estr(bcx: block, s: @~str, vstore: option<ast::vstore>,
dest: dest) -> block {
let _icx = bcx.insn_ctxt(~"tvec::trans_estr");
let _icx = bcx.insn_ctxt("tvec::trans_estr");
if dest == base::ignore { return bcx; }
let ccx = bcx.ccx();
@ -362,7 +362,7 @@ type iter_vec_block = fn(block, ValueRef, ty::t) -> block;
fn iter_vec_raw(bcx: block, data_ptr: ValueRef, vec_ty: ty::t,
fill: ValueRef, f: iter_vec_block) -> block {
let _icx = bcx.insn_ctxt(~"tvec::iter_vec_raw");
let _icx = bcx.insn_ctxt("tvec::iter_vec_raw");
let unit_ty = ty::sequence_element_type(bcx.tcx(), vec_ty);
@ -393,14 +393,14 @@ fn iter_vec_raw(bcx: block, data_ptr: ValueRef, vec_ty: ty::t,
fn iter_vec_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t,
fill: ValueRef, f: iter_vec_block) -> block {
let _icx = bcx.insn_ctxt(~"tvec::iter_vec_uniq");
let _icx = bcx.insn_ctxt("tvec::iter_vec_uniq");
let data_ptr = get_dataptr(bcx, get_bodyptr(bcx, vptr));
iter_vec_raw(bcx, data_ptr, vec_ty, fill, f)
}
fn iter_vec_unboxed(bcx: block, body_ptr: ValueRef, vec_ty: ty::t,
f: iter_vec_block) -> block {
let _icx = bcx.insn_ctxt(~"tvec::iter_vec_unboxed");
let _icx = bcx.insn_ctxt("tvec::iter_vec_unboxed");
let fill = get_fill(bcx, body_ptr);
let dataptr = get_dataptr(bcx, body_ptr);
return iter_vec_raw(bcx, dataptr, vec_ty, fill, f);

View file

@ -9,7 +9,7 @@ export make_free_glue, autoderef, duplicate;
fn make_free_glue(bcx: block, vptrptr: ValueRef, t: ty::t)
-> block {
let _icx = bcx.insn_ctxt(~"uniq::make_free_glue");
let _icx = bcx.insn_ctxt("uniq::make_free_glue");
let vptr = Load(bcx, vptrptr);
do with_cond(bcx, IsNotNull(bcx, vptr)) |bcx| {
let content_ty = content_ty(t);
@ -33,7 +33,7 @@ fn autoderef(bcx: block, v: ValueRef, t: ty::t) -> {v: ValueRef, t: ty::t} {
}
fn duplicate(bcx: block, v: ValueRef, t: ty::t) -> result {
let _icx = bcx.insn_ctxt(~"uniq::duplicate");
let _icx = bcx.insn_ctxt("uniq::duplicate");
let content_ty = content_ty(t);
let {bcx: bcx, box: dst_box, body: dst_body} =
malloc_unique(bcx, content_ty);