//! Code that is useful in various trans modules.
use driver::session::Session;
-use lib::llvm::{ValueRef, BasicBlockRef, BuilderRef};
-use lib::llvm::{True, False, Bool};
-use lib::llvm::llvm;
-use lib;
+use llvm;
+use llvm::{ValueRef, BasicBlockRef, BuilderRef};
+use llvm::{True, False, Bool};
use middle::def;
use middle::lang_items::LangItem;
use middle::subst;
}
match ty::get(ty).sty {
ty::ty_bot => true,
- ty::ty_struct(..) | ty::ty_enum(..) | ty::ty_tup(..) => {
+ ty::ty_struct(..) | ty::ty_enum(..) | ty::ty_tup(..) |
+ ty::ty_unboxed_closure(..) => {
let llty = sizing_type_of(ccx, ty);
llsize_of_alloc(ccx, llty) <= llsize_of_alloc(ccx, ccx.int_type)
}
pub type RvalueDatum = datum::Datum<datum::Rvalue>;
pub type LvalueDatum = datum::Datum<datum::Lvalue>;
+#[deriving(Clone, Eq, PartialEq)]
+pub enum HandleItemsFlag {
+ IgnoreItems,
+ TranslateItems,
+}
+
// Function context. Every LLVM function we create will have one of
// these.
pub struct FunctionContext<'a> {
// Cleanup scopes.
pub scopes: RefCell<Vec<cleanup::CleanupScope<'a>> >,
+
+ // How to handle items encountered during translation of this function.
+ pub handle_items: HandleItemsFlag,
}
impl<'a> FunctionContext<'a> {
});
llvm::LLVMSetInitializer(g, sc);
llvm::LLVMSetGlobalConstant(g, True);
- lib::llvm::SetLinkage(g, lib::llvm::InternalLinkage);
+ llvm::SetLinkage(g, llvm::InternalLinkage);
cx.const_cstr_cache.borrow_mut().insert(s, g);
g
});
llvm::LLVMSetInitializer(g, lldata);
llvm::LLVMSetGlobalConstant(g, True);
- lib::llvm::SetLinkage(g, lib::llvm::InternalLinkage);
+ llvm::SetLinkage(g, llvm::InternalLinkage);
let cs = llvm::LLVMConstPointerCast(g, Type::i8p(cx).to_ref());
C_struct(cx, [cs, C_uint(cx, len)], false)
}
}
-pub fn get_param(fndecl: ValueRef, param: uint) -> ValueRef {
- unsafe {
- llvm::LLVMGetParam(fndecl, param as c_uint)
- }
-}
-
pub fn const_get_elt(cx: &CrateContext, v: ValueRef, us: &[c_uint])
-> ValueRef {
unsafe {
typeck::vtable_param(n_param, n_bound) => {
find_vtable(tcx, param_substs, n_param, n_bound)
}
+ typeck::vtable_unboxed_closure(def_id) => {
+ typeck::vtable_unboxed_closure(def_id)
+ }
typeck::vtable_error => typeck::vtable_error
}
}