rustc_codegen_llvm: avoid converting between DILocation and Value.
This commit is contained in:
parent
fa2b381ec8
commit
88d874de63
@ -192,7 +192,8 @@ impl DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> {
|
|||||||
let dbg_loc = self.cx().create_debug_loc(scope, span);
|
let dbg_loc = self.cx().create_debug_loc(scope, span);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMSetCurrentDebugLocation(self.llbuilder, dbg_loc);
|
let dbg_loc_as_llval = llvm::LLVMRustMetadataAsValue(self.cx().llcx, dbg_loc);
|
||||||
|
llvm::LLVMSetCurrentDebugLocation(self.llbuilder, dbg_loc_as_llval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
|
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
|
||||||
|
@ -2,8 +2,8 @@ use super::metadata::{UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER};
|
|||||||
use super::utils::debug_context;
|
use super::utils::debug_context;
|
||||||
|
|
||||||
use crate::common::CodegenCx;
|
use crate::common::CodegenCx;
|
||||||
use crate::llvm::debuginfo::DIScope;
|
use crate::llvm;
|
||||||
use crate::llvm::{self, Value};
|
use crate::llvm::debuginfo::{DILocation, DIScope};
|
||||||
use rustc_codegen_ssa::traits::*;
|
use rustc_codegen_ssa::traits::*;
|
||||||
|
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
@ -45,7 +45,7 @@ impl CodegenCx<'ll, '_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_debug_loc(&self, scope: &'ll DIScope, span: Span) -> &'ll Value {
|
pub fn create_debug_loc(&self, scope: &'ll DIScope, span: Span) -> &'ll DILocation {
|
||||||
let DebugLoc { line, col, .. } = self.lookup_debug_loc(span.lo());
|
let DebugLoc { line, col, .. } = self.lookup_debug_loc(span.lo());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -5,8 +5,9 @@ use rustc_codegen_ssa::coverageinfo::map as coverage_map;
|
|||||||
|
|
||||||
use super::debuginfo::{
|
use super::debuginfo::{
|
||||||
DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
|
DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
|
||||||
DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DINameSpace, DISPFlags, DIScope,
|
DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DILocation, DINameSpace,
|
||||||
DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind,
|
DISPFlags, DIScope, DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable,
|
||||||
|
DebugEmissionKind,
|
||||||
};
|
};
|
||||||
|
|
||||||
use libc::{c_char, c_int, c_uint, size_t};
|
use libc::{c_char, c_int, c_uint, size_t};
|
||||||
@ -794,6 +795,7 @@ pub mod debuginfo {
|
|||||||
pub struct DIBuilder<'a>(InvariantOpaque<'a>);
|
pub struct DIBuilder<'a>(InvariantOpaque<'a>);
|
||||||
|
|
||||||
pub type DIDescriptor = Metadata;
|
pub type DIDescriptor = Metadata;
|
||||||
|
pub type DILocation = Metadata;
|
||||||
pub type DIScope = DIDescriptor;
|
pub type DIScope = DIDescriptor;
|
||||||
pub type DIFile = DIScope;
|
pub type DIFile = DIScope;
|
||||||
pub type DILexicalBlock = DIScope;
|
pub type DILexicalBlock = DIScope;
|
||||||
@ -2005,7 +2007,7 @@ extern "C" {
|
|||||||
VarInfo: &'a DIVariable,
|
VarInfo: &'a DIVariable,
|
||||||
AddrOps: *const i64,
|
AddrOps: *const i64,
|
||||||
AddrOpsCount: c_uint,
|
AddrOpsCount: c_uint,
|
||||||
DL: &'a Value,
|
DL: &'a DILocation,
|
||||||
InsertAtEnd: &'a BasicBlock,
|
InsertAtEnd: &'a BasicBlock,
|
||||||
) -> &'a Value;
|
) -> &'a Value;
|
||||||
|
|
||||||
@ -2093,8 +2095,8 @@ extern "C" {
|
|||||||
Line: c_uint,
|
Line: c_uint,
|
||||||
Column: c_uint,
|
Column: c_uint,
|
||||||
Scope: &'a DIScope,
|
Scope: &'a DIScope,
|
||||||
InlinedAt: Option<&'a Metadata>,
|
InlinedAt: Option<&'a DILocation>,
|
||||||
) -> &'a Value;
|
) -> &'a DILocation;
|
||||||
pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
|
pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
|
||||||
pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
|
pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
|
||||||
|
|
||||||
|
@ -931,12 +931,12 @@ LLVMRustDIBuilderGetOrCreateArray(LLVMRustDIBuilderRef Builder,
|
|||||||
|
|
||||||
extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd(
|
extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd(
|
||||||
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
|
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
|
||||||
int64_t *AddrOps, unsigned AddrOpsCount, LLVMValueRef DL,
|
int64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
|
||||||
LLVMBasicBlockRef InsertAtEnd) {
|
LLVMBasicBlockRef InsertAtEnd) {
|
||||||
return wrap(Builder->insertDeclare(
|
return wrap(Builder->insertDeclare(
|
||||||
unwrap(V), unwrap<DILocalVariable>(VarInfo),
|
unwrap(V), unwrap<DILocalVariable>(VarInfo),
|
||||||
Builder->createExpression(llvm::ArrayRef<int64_t>(AddrOps, AddrOpsCount)),
|
Builder->createExpression(llvm::ArrayRef<int64_t>(AddrOps, AddrOpsCount)),
|
||||||
DebugLoc(cast<MDNode>(unwrap<MetadataAsValue>(DL)->getMetadata())),
|
DebugLoc(cast<MDNode>(DL)),
|
||||||
unwrap(InsertAtEnd)));
|
unwrap(InsertAtEnd)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1003,7 +1003,7 @@ LLVMRustDICompositeTypeReplaceArrays(LLVMRustDIBuilderRef Builder,
|
|||||||
DINodeArray(unwrap<MDTuple>(Params)));
|
DINodeArray(unwrap<MDTuple>(Params)));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" LLVMValueRef
|
extern "C" LLVMMetadataRef
|
||||||
LLVMRustDIBuilderCreateDebugLocation(LLVMContextRef ContextRef, unsigned Line,
|
LLVMRustDIBuilderCreateDebugLocation(LLVMContextRef ContextRef, unsigned Line,
|
||||||
unsigned Column, LLVMMetadataRef Scope,
|
unsigned Column, LLVMMetadataRef Scope,
|
||||||
LLVMMetadataRef InlinedAt) {
|
LLVMMetadataRef InlinedAt) {
|
||||||
@ -1012,7 +1012,7 @@ LLVMRustDIBuilderCreateDebugLocation(LLVMContextRef ContextRef, unsigned Line,
|
|||||||
DebugLoc debug_loc = DebugLoc::get(Line, Column, unwrapDIPtr<MDNode>(Scope),
|
DebugLoc debug_loc = DebugLoc::get(Line, Column, unwrapDIPtr<MDNode>(Scope),
|
||||||
unwrapDIPtr<MDNode>(InlinedAt));
|
unwrapDIPtr<MDNode>(InlinedAt));
|
||||||
|
|
||||||
return wrap(MetadataAsValue::get(Context, debug_loc.getAsMDNode()));
|
return wrap(debug_loc.getAsMDNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() {
|
extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user