diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-01-26 18:50:13 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-02-03 12:14:21 +0200 |
| commit | 0b633c82f094d52a642b53cae64614ff097eebd8 (patch) | |
| tree | 98eaaa31ac62a13a75c2be318e585a5d14736de5 /src/librustc_codegen_ssa | |
| parent | 0d34a8772251b3f9d4dd05c81d9531d455a14fc2 (diff) | |
| download | rust-0b633c82f094d52a642b53cae64614ff097eebd8.tar.gz rust-0b633c82f094d52a642b53cae64614ff097eebd8.zip | |
rustc_codegen_ssa: split declare_local into create_dbg_var and dbg_var_addr.
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/debuginfo.rs | 8 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/backend.rs | 3 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/builder.rs | 2 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/debuginfo.rs | 22 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/mod.rs | 1 |
5 files changed, 26 insertions, 10 deletions
diff --git a/src/librustc_codegen_ssa/mir/debuginfo.rs b/src/librustc_codegen_ssa/mir/debuginfo.rs index e0aec5d6dd5..1ee5fdba2a2 100644 --- a/src/librustc_codegen_ssa/mir/debuginfo.rs +++ b/src/librustc_codegen_ssa/mir/debuginfo.rs @@ -226,15 +226,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let (scope, span) = self.debug_loc(var.source_info); if let Some(scope) = scope { - bx.declare_local( + let dbg_var = + bx.create_dbg_var(debug_context, var.name, layout.ty, scope, kind, span); + bx.dbg_var_addr( debug_context, - var.name, - layout.ty, + dbg_var, scope, base.llval, direct_offset, &indirect_offsets, - kind, span, ); } diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index bc3a75250bf..7b22961cd46 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -21,7 +21,10 @@ pub trait BackendTypes { type Type: CodegenObject; type Funclet; + // FIXME(eddyb) find a common convention for all of the debuginfo-related + // names (choose between `Dbg`, `Debug`, `DebugInfo`, `DI` etc.). type DIScope: Copy; + type DIVariable: Copy; } pub trait Backend<'tcx>: diff --git a/src/librustc_codegen_ssa/traits/builder.rs b/src/librustc_codegen_ssa/traits/builder.rs index 6f331e14a0d..b3c830eef86 100644 --- a/src/librustc_codegen_ssa/traits/builder.rs +++ b/src/librustc_codegen_ssa/traits/builder.rs @@ -28,7 +28,7 @@ pub enum OverflowOp { pub trait BuilderMethods<'a, 'tcx>: HasCodegen<'tcx> - + DebugInfoBuilderMethods<'tcx> + + DebugInfoBuilderMethods + ArgAbiMethods<'tcx> + AbiBuilderMethods<'tcx> + IntrinsicCallMethods<'tcx> diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index d2784f5b860..22a4e96b9e4 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -30,20 +30,32 @@ pub trait DebugInfoMethods<'tcx>: BackendTypes { defining_crate: CrateNum, ) -> Self::DIScope; fn debuginfo_finalize(&self); -} -pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes { - fn declare_local( - &mut self, + // FIXME(eddyb) find a common convention for all of the debuginfo-related + // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.). + fn create_dbg_var( + &self, dbg_context: &FunctionDebugContext<Self::DIScope>, variable_name: Name, variable_type: Ty<'tcx>, scope_metadata: Self::DIScope, + variable_kind: VariableKind, + span: Span, + ) -> Self::DIVariable; +} + +pub trait DebugInfoBuilderMethods: BackendTypes { + // FIXME(eddyb) find a common convention for all of the debuginfo-related + // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.). + fn dbg_var_addr( + &mut self, + dbg_context: &FunctionDebugContext<Self::DIScope>, + dbg_var: Self::DIVariable, + scope_metadata: Self::DIScope, variable_alloca: Self::Value, direct_offset: Size, // NB: each offset implies a deref (i.e. they're steps in a pointer chain). indirect_offsets: &[Size], - variable_kind: VariableKind, span: Span, ); fn set_source_location( diff --git a/src/librustc_codegen_ssa/traits/mod.rs b/src/librustc_codegen_ssa/traits/mod.rs index fff1b35507c..b8afadaadef 100644 --- a/src/librustc_codegen_ssa/traits/mod.rs +++ b/src/librustc_codegen_ssa/traits/mod.rs @@ -93,5 +93,6 @@ pub trait HasCodegen<'tcx>: Type = Self::Type, Funclet = Self::Funclet, DIScope = Self::DIScope, + DIVariable = Self::DIVariable, >; } |
