@@ -29,7 +29,7 @@ use back::link::{mangle_exported_name};
2929use back:: { link, abi, upcall} ;
3030use driver:: session;
3131use driver:: session:: Session ;
32- use lib:: llvm:: { ContextRef , ModuleRef , ValueRef , TypeRef , BasicBlockRef } ;
32+ use lib:: llvm:: { ModuleRef , ValueRef , TypeRef , BasicBlockRef } ;
3333use lib:: llvm:: { True , False } ;
3434use lib:: llvm:: { llvm, mk_target_data, mk_type_names} ;
3535use lib;
@@ -73,7 +73,6 @@ use core::libc::c_uint;
7373use core:: str;
7474use core:: uint;
7575use core:: vec;
76- use core:: local_data;
7776use extra:: time;
7877use syntax:: ast:: ident;
7978use syntax:: ast_map:: { path, path_elt_to_str, path_name} ;
@@ -1188,7 +1187,7 @@ pub fn new_block(cx: fn_ctxt, parent: Option<block>, kind: block_kind,
11881187 } ;
11891188 unsafe {
11901189 let llbb = str:: as_c_str ( cx. ccx . sess . str_of ( s) , |buf| {
1191- llvm:: LLVMAppendBasicBlockInContext ( cx . ccx . llcx , cx. llfn , buf)
1190+ llvm:: LLVMAppendBasicBlock ( cx. llfn , buf)
11921191 } ) ;
11931192 let bcx = mk_block ( llbb,
11941193 parent,
@@ -1555,12 +1554,11 @@ pub struct BasicBlocks {
15551554// Creates the standard set of basic blocks for a function
15561555pub fn mk_standard_basic_blocks( llfn: ValueRef ) -> BasicBlocks {
15571556 unsafe {
1558- let cx = task_llcx( ) ;
15591557 BasicBlocks {
15601558 sa : str:: as_c_str( "static_allocas" ,
1561- |buf| llvm:: LLVMAppendBasicBlockInContext ( cx , llfn, buf) ) ,
1559+ |buf| llvm:: LLVMAppendBasicBlock ( llfn, buf) ) ,
15621560 rt : str:: as_c_str( "return" ,
1563- |buf| llvm:: LLVMAppendBasicBlockInContext ( cx , llfn, buf) )
1561+ |buf| llvm:: LLVMAppendBasicBlock ( llfn, buf) )
15641562 }
15651563 }
15661564}
@@ -2343,7 +2341,7 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
23432341 };
23442342 let llbb = str::as_c_str(" top", |buf| {
23452343 unsafe {
2346- llvm::LLVMAppendBasicBlockInContext(ccx.llcx, llfn, buf)
2344+ llvm::LLVMAppendBasicBlock( llfn, buf)
23472345 }
23482346 });
23492347 let bld = ccx.builder.B;
@@ -2661,10 +2659,10 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> {
26612659 T_void()));
26622660 let memcpy32 =
26632661 decl_cdecl_fn(llmod, " llvm. memcpy. p0i8. p0i8. i32 ",
2664- T_fn(T_memcpy32_args, T_void()));
2662+ T_fn(copy T_memcpy32_args, T_void()));
26652663 let memcpy64 =
26662664 decl_cdecl_fn(llmod, " llvm. memcpy. p0i8. p0i8. i64 ",
2667- T_fn(T_memcpy64_args, T_void()));
2665+ T_fn(copy T_memcpy64_args, T_void()));
26682666 let memmove32 =
26692667 decl_cdecl_fn(llmod, " llvm. memmove. p0i8. p0i8. i32 ",
26702668 T_fn(T_memcpy32_args, T_void()));
@@ -3040,13 +3038,9 @@ pub fn trans_crate(sess: session::Session,
30403038 let llmod_id = link_meta.name.to_owned() + " . rc";
30413039
30423040 unsafe {
3043- if !llvm::LLVMRustStartMultithreading() {
3044- sess.bug(" couldn' t enable multi-threaded LLVM ");
3045- }
3046- let llcx = llvm::LLVMContextCreate();
3047- set_task_llcx(llcx);
30483041 let llmod = str::as_c_str(llmod_id, |buf| {
3049- llvm::LLVMModuleCreateWithNameInContext(buf, llcx)
3042+ llvm::LLVMModuleCreateWithNameInContext
3043+ (buf, llvm::LLVMGetGlobalContext())
30503044 });
30513045 let data_layout: &str = sess.targ_cfg.target_strs.data_layout;
30523046 let targ_triple: &str = sess.targ_cfg.target_strs.target_triple;
@@ -3077,7 +3071,6 @@ pub fn trans_crate(sess: session::Session,
30773071 let ccx = @CrateContext {
30783072 sess: sess,
30793073 llmod: llmod,
3080- llcx: llcx,
30813074 td: td,
30823075 tn: tn,
30833076 externs: @mut HashMap::new(),
@@ -3131,9 +3124,7 @@ pub fn trans_crate(sess: session::Session,
31313124 int_type: int_type,
31323125 float_type: float_type,
31333126 opaque_vec_type: T_opaque_vec(targ_cfg),
3134- builder: BuilderRef_res(unsafe {
3135- llvm::LLVMCreateBuilderInContext(llcx)
3136- }),
3127+ builder: BuilderRef_res(unsafe { llvm::LLVMCreateBuilder() }),
31373128 shape_cx: mk_ctxt(llmod),
31383129 crate_map: crate_map,
31393130 uses_gc: @mut false,
@@ -3181,16 +3172,3 @@ pub fn trans_crate(sess: session::Session,
31813172 return ( llmod, link_meta) ;
31823173 }
31833174}
3184-
3185- fn task_local_llcx_key(_v: @ContextRef) {}
3186-
3187- pub fn task_llcx() -> ContextRef {
3188- let opt = unsafe { local_data::local_data_get(task_local_llcx_key) };
3189- *opt.expect(" task-local LLVMContextRef wasn' t ever set!" )
3190- }
3191-
3192- fn set_task_llcx ( c : ContextRef ) {
3193- unsafe {
3194- local_data:: local_data_set ( task_local_llcx_key, @c) ;
3195- }
3196- }
0 commit comments