Auto merge of #56198 - bjorn3:cg_ssa_refactor, r=eddyb

Refactor rustc_codegen_ssa

cc #56108 (not all things are done yet)

This removes an unsafe method from cg_ssa.

r? @eddyb
cc @sunfishcode
This commit is contained in:
bors 2018-12-02 18:02:20 +00:00
commit 21f2684950
38 changed files with 537 additions and 526 deletions

View file

@ -24,11 +24,11 @@ use syntax::attr;
/// Inserts a side-effect free instruction sequence that makes sure that the
/// .debug_gdb_scripts global is referenced, so it isn't removed by the linker.
pub fn insert_reference_to_gdb_debug_scripts_section_global(bx: &mut Builder) {
if needs_gdb_debug_scripts_section(bx.cx()) {
let gdb_debug_scripts_section = get_or_insert_gdb_debug_scripts_section_global(bx.cx());
if needs_gdb_debug_scripts_section(bx) {
let gdb_debug_scripts_section = get_or_insert_gdb_debug_scripts_section_global(bx);
// Load just the first byte as that's all that's necessary to force
// LLVM to keep around the reference to the global.
let indices = [bx.cx().const_i32(0), bx.cx().const_i32(0)];
let indices = [bx.const_i32(0), bx.const_i32(0)];
let element = bx.inbounds_gep(gdb_debug_scripts_section, &indices);
let volative_load_instruction = bx.volatile_load(element);
unsafe {

View file

@ -41,7 +41,7 @@ pub fn set_source_location<D>(
};
let dbg_loc = if function_debug_context.source_locations_enabled.get() {
debug!("set_source_location: {}", bx.cx().sess().source_map().span_to_string(span));
debug!("set_source_location: {}", bx.sess().source_map().span_to_string(span));
let loc = span_start(bx.cx(), span);
InternalDebugLocation::new(scope.unwrap(), loc.line, loc.col.to_usize())
} else {
@ -76,7 +76,7 @@ pub fn set_debug_location(
// For MSVC, set the column number to zero.
// Otherwise, emit it. This mimics clang behaviour.
// See discussion in https://github.com/rust-lang/rust/issues/42921
let col_used = if bx.cx().sess().target.target.options.is_like_msvc {
let col_used = if bx.sess().target.target.options.is_like_msvc {
UNKNOWN_COLUMN_NUMBER
} else {
col as c_uint