@@ -29,7 +29,7 @@ use back::link::{mangle_exported_name};
29
29
use back:: { link, abi, upcall} ;
30
30
use driver:: session;
31
31
use driver:: session:: Session ;
32
- use lib:: llvm:: { ContextRef , ModuleRef , ValueRef , TypeRef , BasicBlockRef } ;
32
+ use lib:: llvm:: { ModuleRef , ValueRef , TypeRef , BasicBlockRef } ;
33
33
use lib:: llvm:: { True , False } ;
34
34
use lib:: llvm:: { llvm, mk_target_data, mk_type_names} ;
35
35
use lib;
@@ -73,7 +73,6 @@ use core::libc::c_uint;
73
73
use core:: str;
74
74
use core:: uint;
75
75
use core:: vec;
76
- use core:: local_data;
77
76
use extra:: time;
78
77
use syntax:: ast:: ident;
79
78
use 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,
1188
1187
} ;
1189
1188
unsafe {
1190
1189
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)
1192
1191
} ) ;
1193
1192
let bcx = mk_block ( llbb,
1194
1193
parent,
@@ -1555,12 +1554,11 @@ pub struct BasicBlocks {
1555
1554
// Creates the standard set of basic blocks for a function
1556
1555
pub fn mk_standard_basic_blocks( llfn: ValueRef ) -> BasicBlocks {
1557
1556
unsafe {
1558
- let cx = task_llcx( ) ;
1559
1557
BasicBlocks {
1560
1558
sa : str:: as_c_str( "static_allocas" ,
1561
- |buf| llvm:: LLVMAppendBasicBlockInContext ( cx , llfn, buf) ) ,
1559
+ |buf| llvm:: LLVMAppendBasicBlock ( llfn, buf) ) ,
1562
1560
rt : str:: as_c_str( "return" ,
1563
- |buf| llvm:: LLVMAppendBasicBlockInContext ( cx , llfn, buf) )
1561
+ |buf| llvm:: LLVMAppendBasicBlock ( llfn, buf) )
1564
1562
}
1565
1563
}
1566
1564
}
@@ -2343,7 +2341,7 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
2343
2341
};
2344
2342
let llbb = str::as_c_str(" top", |buf| {
2345
2343
unsafe {
2346
- llvm::LLVMAppendBasicBlockInContext(ccx.llcx, llfn, buf)
2344
+ llvm::LLVMAppendBasicBlock( llfn, buf)
2347
2345
}
2348
2346
});
2349
2347
let bld = ccx.builder.B;
@@ -2661,10 +2659,10 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> {
2661
2659
T_void()));
2662
2660
let memcpy32 =
2663
2661
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()));
2665
2663
let memcpy64 =
2666
2664
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()));
2668
2666
let memmove32 =
2669
2667
decl_cdecl_fn(llmod, " llvm. memmove. p0i8. p0i8. i32 ",
2670
2668
T_fn(T_memcpy32_args, T_void()));
@@ -3040,13 +3038,9 @@ pub fn trans_crate(sess: session::Session,
3040
3038
let llmod_id = link_meta.name.to_owned() + " . rc";
3041
3039
3042
3040
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);
3048
3041
let llmod = str::as_c_str(llmod_id, |buf| {
3049
- llvm::LLVMModuleCreateWithNameInContext(buf, llcx)
3042
+ llvm::LLVMModuleCreateWithNameInContext
3043
+ (buf, llvm::LLVMGetGlobalContext())
3050
3044
});
3051
3045
let data_layout: &str = sess.targ_cfg.target_strs.data_layout;
3052
3046
let targ_triple: &str = sess.targ_cfg.target_strs.target_triple;
@@ -3077,7 +3071,6 @@ pub fn trans_crate(sess: session::Session,
3077
3071
let ccx = @CrateContext {
3078
3072
sess: sess,
3079
3073
llmod: llmod,
3080
- llcx: llcx,
3081
3074
td: td,
3082
3075
tn: tn,
3083
3076
externs: @mut HashMap::new(),
@@ -3131,9 +3124,7 @@ pub fn trans_crate(sess: session::Session,
3131
3124
int_type: int_type,
3132
3125
float_type: float_type,
3133
3126
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() }),
3137
3128
shape_cx: mk_ctxt(llmod),
3138
3129
crate_map: crate_map,
3139
3130
uses_gc: @mut false,
@@ -3181,16 +3172,3 @@ pub fn trans_crate(sess: session::Session,
3181
3172
return ( llmod, link_meta) ;
3182
3173
}
3183
3174
}
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