提交 eed48f56 编写于 作者: I Irina Popa

rustc_codegen_llvm: use safe references for Metadata and DI*.

上级 6d0d82ce
......@@ -31,7 +31,7 @@
use abi;
use back::link;
use back::write::{self, OngoingCodegen};
use llvm::{ValueRef, Vector, get_param};
use llvm::{TypeKind, ValueRef, get_param};
use llvm;
use metadata;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
......@@ -349,10 +349,10 @@ fn cast_shift_rhs<'ll, F, G>(op: hir::BinOpKind,
if op.is_shift() {
let mut rhs_llty = val_ty(rhs);
let mut lhs_llty = val_ty(lhs);
if rhs_llty.kind() == Vector {
if rhs_llty.kind() == TypeKind::Vector {
rhs_llty = rhs_llty.element_type()
}
if lhs_llty.kind() == Vector {
if lhs_llty.kind() == TypeKind::Vector {
lhs_llty = lhs_llty.element_type()
}
let rhs_sz = rhs_llty.int_width();
......
......@@ -13,10 +13,9 @@
use super::utils::{DIB, span_start};
use llvm;
use llvm::debuginfo::DIScope_opaque;
use llvm::debuginfo::DIScope;
use common::CodegenCx;
use rustc::mir::{Mir, SourceScope};
use std::ptr::NonNull;
use libc::c_uint;
......@@ -28,15 +27,15 @@
use syntax_pos::BytePos;
#[derive(Clone, Copy, Debug)]
pub struct MirDebugScope {
pub scope_metadata: Option<NonNull<DIScope_opaque>>,
pub struct MirDebugScope<'ll> {
pub scope_metadata: Option<&'ll DIScope>,
// Start and end offsets of the file to which this DIScope belongs.
// These are used to quickly determine whether some span refers to the same file.
pub file_start_pos: BytePos,
pub file_end_pos: BytePos,
}
impl MirDebugScope {
impl MirDebugScope<'ll> {
pub fn is_valid(&self) -> bool {
!self.scope_metadata.is_none()
}
......@@ -44,8 +43,8 @@ pub fn is_valid(&self) -> bool {
/// Produce DIScope DIEs for each MIR Scope which has variables defined in it.
/// If debuginfo is disabled, the returned vector is empty.
pub fn create_mir_scopes(cx: &CodegenCx, mir: &Mir, debug_context: &FunctionDebugContext)
-> IndexVec<SourceScope, MirDebugScope> {
pub fn create_mir_scopes(cx: &CodegenCx<'ll, '_>, mir: &Mir, debug_context: &FunctionDebugContext<'ll>)
-> IndexVec<SourceScope, MirDebugScope<'ll>> {
let null_scope = MirDebugScope {
scope_metadata: None,
file_start_pos: BytePos(0),
......@@ -77,12 +76,12 @@ pub fn create_mir_scopes(cx: &CodegenCx, mir: &Mir, debug_context: &FunctionDebu
scopes
}
fn make_mir_scope(cx: &CodegenCx,
fn make_mir_scope(cx: &CodegenCx<'ll, '_>,
mir: &Mir,
has_variables: &BitVector<SourceScope>,
debug_context: &FunctionDebugContextData,
debug_context: &FunctionDebugContextData<'ll>,
scope: SourceScope,
scopes: &mut IndexVec<SourceScope, MirDebugScope>) {
scopes: &mut IndexVec<SourceScope, MirDebugScope<'ll>>) {
if scopes[scope].is_valid() {
return;
}
......@@ -95,7 +94,7 @@ fn make_mir_scope(cx: &CodegenCx,
// The root is the function itself.
let loc = span_start(cx, mir.span);
scopes[scope] = MirDebugScope {
scope_metadata: NonNull::new(debug_context.fn_metadata),
scope_metadata: Some(debug_context.fn_metadata),
file_start_pos: loc.file.start_pos,
file_end_pos: loc.file.end_pos,
};
......@@ -109,7 +108,7 @@ fn make_mir_scope(cx: &CodegenCx,
// However, we don't skip creating a nested scope if
// our parent is the root, because we might want to
// put arguments in the root and not have shadowing.
if parent_scope.scope_metadata.unwrap().as_ptr() != debug_context.fn_metadata {
if parent_scope.scope_metadata.unwrap() != debug_context.fn_metadata {
scopes[scope] = parent_scope;
return;
}
......@@ -121,9 +120,9 @@ fn make_mir_scope(cx: &CodegenCx,
debug_context.defining_crate);
let scope_metadata = unsafe {
NonNull::new(llvm::LLVMRustDIBuilderCreateLexicalBlock(
Some(llvm::LLVMRustDIBuilderCreateLexicalBlock(
DIB(cx),
parent_scope.scope_metadata.unwrap().as_ptr(),
parent_scope.scope_metadata.unwrap(),
file_metadata,
loc.line as c_uint,
loc.col.to_usize() as c_uint))
......
......@@ -39,7 +39,6 @@
use libc::c_uint;
use std::cell::{Cell, RefCell};
use std::ffi::CString;
use std::ptr::NonNull;
use syntax_pos::{self, Span, Pos};
use syntax::ast;
......@@ -71,15 +70,15 @@ pub struct CrateDebugContext<'a, 'tcx> {
llcontext: &'a llvm::Context,
llmod: &'a llvm::Module,
builder: &'a DIBuilder,
created_files: RefCell<FxHashMap<(Symbol, Symbol), DIFile>>,
created_enum_disr_types: RefCell<FxHashMap<(DefId, layout::Primitive), DIType>>,
created_files: RefCell<FxHashMap<(Symbol, Symbol), &'a DIFile>>,
created_enum_disr_types: RefCell<FxHashMap<(DefId, layout::Primitive), &'a DIType>>,
type_map: RefCell<TypeMap<'tcx>>,
namespace_map: RefCell<DefIdMap<DIScope>>,
type_map: RefCell<TypeMap<'a, 'tcx>>,
namespace_map: RefCell<DefIdMap<&'a DIScope>>,
// This collection is used to assert that composite types (structs, enums,
// ...) have their members only set once:
composite_types_completed: RefCell<FxHashSet<DIType>>,
composite_types_completed: RefCell<FxHashSet<&'a DIType>>,
}
impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
......@@ -101,14 +100,14 @@ pub fn new(llmod: &'a llvm::Module) -> Self {
}
}
pub enum FunctionDebugContext {
RegularContext(FunctionDebugContextData),
pub enum FunctionDebugContext<'ll> {
RegularContext(FunctionDebugContextData<'ll>),
DebugInfoDisabled,
FunctionWithoutDebugInfo,
}
impl FunctionDebugContext {
pub fn get_ref<'a>(&'a self, span: Span) -> &'a FunctionDebugContextData {
impl FunctionDebugContext<'ll> {
pub fn get_ref<'a>(&'a self, span: Span) -> &'a FunctionDebugContextData<'ll> {
match *self {
FunctionDebugContext::RegularContext(ref data) => data,
FunctionDebugContext::DebugInfoDisabled => {
......@@ -130,8 +129,8 @@ fn should_be_ignored_message() -> &'static str {
}
}
pub struct FunctionDebugContextData {
fn_metadata: DISubprogram,
pub struct FunctionDebugContextData<'ll> {
fn_metadata: &'ll DISubprogram,
source_locations_enabled: Cell<bool>,
pub defining_crate: CrateNum,
}
......@@ -201,11 +200,13 @@ pub fn finalize(cx: &CodegenCx) {
/// for debug info creation. The function may also return another variant of the
/// FunctionDebugContext enum which indicates why no debuginfo should be created
/// for the function.
pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
instance: Instance<'tcx>,
sig: ty::FnSig<'tcx>,
llfn: ValueRef,
mir: &mir::Mir) -> FunctionDebugContext {
pub fn create_function_debug_context(
cx: &CodegenCx<'ll, 'tcx>,
instance: Instance<'tcx>,
sig: ty::FnSig<'tcx>,
llfn: ValueRef,
mir: &mir::Mir,
) -> FunctionDebugContext<'ll> {
if cx.sess().opts.debuginfo == NoDebugInfo {
return FunctionDebugContext::DebugInfoDisabled;
}
......@@ -302,8 +303,10 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
return FunctionDebugContext::RegularContext(fn_debug_context);
fn get_function_signature<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
sig: ty::FnSig<'tcx>) -> DIArray {
fn get_function_signature(
cx: &CodegenCx<'ll, 'tcx>,
sig: ty::FnSig<'tcx>,
) -> &'ll DIArray {
if cx.sess().opts.debuginfo == LimitedDebugInfo {
return create_DIArray(DIB(cx), &[]);
}
......@@ -313,7 +316,7 @@ fn get_function_signature<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
// Return type -- llvm::DIBuilder wants this at index 0
signature.push(match sig.output().sty {
ty::TyTuple(ref tys) if tys.is_empty() => None,
_ => NonNull::new(type_metadata(cx, sig.output(), syntax_pos::DUMMY_SP))
_ => Some(type_metadata(cx, sig.output(), syntax_pos::DUMMY_SP))
});
let inputs = if sig.abi == Abi::RustCall {
......@@ -342,11 +345,11 @@ fn get_function_signature<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
}
_ => t
};
NonNull::new(type_metadata(cx, t, syntax_pos::DUMMY_SP))
Some(type_metadata(cx, t, syntax_pos::DUMMY_SP))
}));
} else {
signature.extend(inputs.iter().map(|t| {
NonNull::new(type_metadata(cx, t, syntax_pos::DUMMY_SP))
Some(type_metadata(cx, t, syntax_pos::DUMMY_SP))
}));
}
......@@ -354,7 +357,7 @@ fn get_function_signature<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
if let ty::TyTuple(args) = sig.inputs()[sig.inputs().len() - 1].sty {
signature.extend(
args.iter().map(|argument_type| {
NonNull::new(type_metadata(cx, argument_type, syntax_pos::DUMMY_SP))
Some(type_metadata(cx, argument_type, syntax_pos::DUMMY_SP))
})
);
}
......@@ -363,13 +366,13 @@ fn get_function_signature<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
return create_DIArray(DIB(cx), &signature[..]);
}
fn get_template_parameters<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
generics: &ty::Generics,
substs: &Substs<'tcx>,
file_metadata: DIFile,
name_to_append_suffix_to: &mut String)
-> DIArray
{
fn get_template_parameters(
cx: &CodegenCx<'ll, 'tcx>,
generics: &ty::Generics,
substs: &Substs<'tcx>,
file_metadata: &'ll DIFile,
name_to_append_suffix_to: &mut String,
) -> &'ll DIArray {
if substs.types().next().is_none() {
return create_DIArray(DIB(cx), &[]);
}
......@@ -399,14 +402,15 @@ fn get_template_parameters<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
type_metadata(cx, actual_type, syntax_pos::DUMMY_SP);
let name = CString::new(name.as_str().as_bytes()).unwrap();
Some(unsafe {
NonNull::new(llvm::LLVMRustDIBuilderCreateTemplateTypeParameter(
Some(llvm::LLVMRustDIBuilderCreateTemplateTypeParameter(
DIB(cx),
None,
name.as_ptr(),
actual_type_metadata,
file_metadata,
0,
0))
0,
))
})
} else {
None
......@@ -429,9 +433,10 @@ fn get_parameter_names(cx: &CodegenCx,
names
}
fn get_containing_scope<'cx, 'tcx>(cx: &CodegenCx<'cx, 'tcx>,
instance: Instance<'tcx>)
-> DIScope {
fn get_containing_scope(
cx: &CodegenCx<'ll, 'tcx>,
instance: Instance<'tcx>,
) -> &'ll DIScope {
// First, let's see if this is a method within an inherent impl. Because
// if yes, we want to make the result subroutine DIE a child of the
// subroutine's self-type.
......@@ -473,10 +478,10 @@ fn get_containing_scope<'cx, 'tcx>(cx: &CodegenCx<'cx, 'tcx>,
pub fn declare_local(
bx: &Builder<'a, 'll, 'tcx>,
dbg_context: &FunctionDebugContext,
dbg_context: &FunctionDebugContext<'ll>,
variable_name: ast::Name,
variable_type: Ty<'tcx>,
scope_metadata: DIScope,
scope_metadata: &'ll DIScope,
variable_access: VariableAccess,
variable_kind: VariableKind,
span: Span,
......
......@@ -22,7 +22,6 @@
use common::CodegenCx;
use std::ffi::CString;
use std::ptr::NonNull;
pub fn mangled_name_of_instance<'a, 'tcx>(
cx: &CodegenCx<'a, 'tcx>,
......@@ -32,17 +31,17 @@ pub fn mangled_name_of_instance<'a, 'tcx>(
tcx.symbol_name(instance)
}
pub fn item_namespace(cx: &CodegenCx, def_id: DefId) -> DIScope {
pub fn item_namespace(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope {
if let Some(&scope) = debug_context(cx).namespace_map.borrow().get(&def_id) {
return scope;
}
let def_key = cx.tcx.def_key(def_id);
let parent_scope = def_key.parent.and_then(|parent| {
NonNull::new(item_namespace(cx, DefId {
let parent_scope = def_key.parent.map(|parent| {
item_namespace(cx, DefId {
krate: def_id.krate,
index: parent
}))
})
});
let namespace_name = match def_key.disambiguated_data.data {
......
......@@ -15,7 +15,7 @@
use super::FunctionDebugContext;
use llvm;
use llvm::debuginfo::{DIScope_opaque, DIScope};
use llvm::debuginfo::DIScope;
use builder::Builder;
use libc::c_uint;
......@@ -26,7 +26,10 @@
///
/// Maps to a call to llvm::LLVMSetCurrentDebugLocation(...).
pub fn set_source_location(
debug_context: &FunctionDebugContext, bx: &Builder, scope: Option<NonNull<DIScope_opaque>>, span: Span
debug_context: &FunctionDebugContext<'ll>,
bx: &Builder<'_, 'll, '_>,
scope: Option<&'ll DIScope>,
span: Span,
) {
let function_debug_context = match *debug_context {
FunctionDebugContext::DebugInfoDisabled => return,
......@@ -40,7 +43,7 @@ pub fn set_source_location(
let dbg_loc = if function_debug_context.source_locations_enabled.get() {
debug!("set_source_location: {}", bx.sess().codemap().span_to_string(span));
let loc = span_start(bx.cx, span);
InternalDebugLocation::new(scope.unwrap().as_ptr(), loc.line, loc.col.to_usize())
InternalDebugLocation::new(scope.unwrap(), loc.line, loc.col.to_usize())
} else {
UnknownLocation
};
......@@ -53,7 +56,7 @@ pub fn set_source_location(
/// they are disabled when beginning to codegen a new function. This functions
/// switches source location emitting on and must therefore be called before the
/// first real statement/expression of the function is codegened.
pub fn start_emitting_source_locations(dbg_context: &FunctionDebugContext) {
pub fn start_emitting_source_locations(dbg_context: &FunctionDebugContext<'ll>) {
match *dbg_context {
FunctionDebugContext::RegularContext(ref data) => {
data.source_locations_enabled.set(true)
......@@ -64,13 +67,13 @@ pub fn start_emitting_source_locations(dbg_context: &FunctionDebugContext) {
#[derive(Copy, Clone, PartialEq)]
pub enum InternalDebugLocation {
KnownLocation { scope: DIScope, line: usize, col: usize },
pub enum InternalDebugLocation<'ll> {
KnownLocation { scope: &'ll DIScope, line: usize, col: usize },
UnknownLocation
}
impl InternalDebugLocation {
pub fn new(scope: DIScope, line: usize, col: usize) -> InternalDebugLocation {
impl InternalDebugLocation<'ll> {
pub fn new(scope: &'ll DIScope, line: usize, col: usize) -> Self {
KnownLocation {
scope,
line,
......@@ -79,7 +82,7 @@ pub fn new(scope: DIScope, line: usize, col: usize) -> InternalDebugLocation {
}
}
pub fn set_debug_location(bx: &Builder, debug_location: InternalDebugLocation) {
pub fn set_debug_location(bx: &Builder<'_, 'll, '_>, debug_location: InternalDebugLocation<'ll>) {
let metadata_node = match debug_location {
KnownLocation { scope, line, col } => {
// For MSVC, set the column number to zero.
......
......@@ -17,10 +17,9 @@
use rustc::ty::DefIdTree;
use llvm;
use llvm::debuginfo::{DIScope, DIBuilder, DIDescriptor_opaque, DIArray};
use llvm::debuginfo::{DIScope, DIBuilder, DIDescriptor, DIArray};
use common::{CodegenCx};
use std::ptr::NonNull;
use syntax_pos::{self, Span};
pub fn is_node_local_to_unit(cx: &CodegenCx, def_id: DefId) -> bool
......@@ -37,7 +36,7 @@ pub fn is_node_local_to_unit(cx: &CodegenCx, def_id: DefId) -> bool
}
#[allow(non_snake_case)]
pub fn create_DIArray(builder: &DIBuilder, arr: &[Option<NonNull<DIDescriptor_opaque>>]) -> DIArray {
pub fn create_DIArray(builder: &'ll DIBuilder, arr: &[Option<&'ll DIDescriptor>]) -> &'ll DIArray {
return unsafe {
llvm::LLVMRustDIBuilderGetOrCreateArray(builder, arr.as_ptr(), arr.len() as u32)
};
......@@ -49,7 +48,7 @@ pub fn span_start(cx: &CodegenCx, span: Span) -> syntax_pos::Loc {
}
#[inline]
pub fn debug_context(cx: &'a CodegenCx<'ll, 'tcx>) -> &'a CrateDebugContext<'a, 'tcx> {
pub fn debug_context(cx: &'a CodegenCx<'ll, 'tcx>) -> &'a CrateDebugContext<'ll, 'tcx> {
cx.dbg_cx.as_ref().unwrap()
}
......@@ -59,7 +58,7 @@ pub fn DIB(cx: &CodegenCx<'ll, '_>) -> &'ll DIBuilder {
cx.dbg_cx.as_ref().unwrap().builder
}
pub fn get_namespace_for_item(cx: &CodegenCx, def_id: DefId) -> DIScope {
pub fn get_namespace_for_item(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope {
item_namespace(cx, cx.tcx.parent(def_id)
.expect("get_namespace_for_item: missing parent?"))
}
......@@ -12,7 +12,7 @@
use intrinsics::{self, Intrinsic};
use llvm;
use llvm::{ValueRef};
use llvm::{TypeKind, ValueRef};
use abi::{Abi, FnType, LlvmType, PassMode};
use mir::place::PlaceRef;
use mir::operand::{OperandRef, OperandValue};
......@@ -1060,7 +1060,7 @@ fn generic_simd_intrinsic(
found `{}` with length {}",
in_len, in_ty,
ret_ty, out_len);
require!(llret_ty.element_type().kind() == llvm::Integer,
require!(llret_ty.element_type().kind() == TypeKind::Integer,
"expected return type with integer elements, found `{}` with non-integer `{}`",
ret_ty,
ret_ty.simd_type(tcx));
......
......@@ -16,7 +16,6 @@
pub use self::IntPredicate::*;
pub use self::RealPredicate::*;
pub use self::TypeKind::*;
pub use self::AtomicRmwBinOp::*;
pub use self::MetadataType::*;
pub use self::CodeGenOptSize::*;
......
......@@ -11,7 +11,7 @@
use common::{C_i32, C_null};
use libc::c_uint;
use llvm::{self, ValueRef, BasicBlockRef};
use llvm::debuginfo::DIScope_opaque;
use llvm::debuginfo::DIScope;
use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts};
use rustc::ty::layout::{LayoutOf, TyLayout};
use rustc::mir::{self, Mir};
......@@ -29,7 +29,6 @@
use syntax::symbol::keywords;
use std::iter;
use std::ptr::NonNull;
use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
......@@ -48,7 +47,7 @@ pub struct FunctionCx<'a, 'll: 'a, 'tcx: 'll> {
mir: &'a mir::Mir<'tcx>,
debug_context: debuginfo::FunctionDebugContext,
debug_context: FunctionDebugContext<'ll>,
llfn: ValueRef,
......@@ -100,7 +99,7 @@ pub struct FunctionCx<'a, 'll: 'a, 'tcx: 'll> {
locals: IndexVec<mir::Local, LocalRef<'tcx>>,
/// Debug information for MIR scopes.
scopes: IndexVec<mir::SourceScope, debuginfo::MirDebugScope>,
scopes: IndexVec<mir::SourceScope, debuginfo::MirDebugScope<'ll>>,
/// If this function is being monomorphized, this contains the type substitutions used.
param_substs: &'tcx Substs<'tcx>,
......@@ -117,12 +116,12 @@ pub fn monomorphize<T>(&self, value: &T) -> T
)
}
pub fn set_debug_loc(&mut self, bx: &Builder, source_info: mir::SourceInfo) {
pub fn set_debug_loc(&mut self, bx: &Builder<'_, 'll, '_>, source_info: mir::SourceInfo) {
let (scope, span) = self.debug_loc(source_info);
debuginfo::set_source_location(&self.debug_context, bx, scope, span);
}
pub fn debug_loc(&mut self, source_info: mir::SourceInfo) -> (Option<NonNull<DIScope_opaque>>, Span) {
pub fn debug_loc(&mut self, source_info: mir::SourceInfo) -> (Option<&'ll DIScope>, Span) {
// Bail out if debug info emission is not enabled.
match self.debug_context {
FunctionDebugContext::DebugInfoDisabled |
......@@ -162,14 +161,14 @@ pub fn debug_loc(&mut self, source_info: mir::SourceInfo) -> (Option<NonNull<DIS
// corresponding to span's containing source scope. If so, we need to create a DIScope
// "extension" into that file.
fn scope_metadata_for_loc(&self, scope_id: mir::SourceScope, pos: BytePos)
-> Option<NonNull<DIScope_opaque>> {
-> Option<&'ll DIScope> {
let scope_metadata = self.scopes[scope_id].scope_metadata;
if pos < self.scopes[scope_id].file_start_pos ||
pos >= self.scopes[scope_id].file_end_pos {
let cm = self.cx.sess().codemap();
let defining_crate = self.debug_context.get_ref(DUMMY_SP).defining_crate;
NonNull::new(debuginfo::extend_scope_to_file(self.cx,
scope_metadata.unwrap().as_ptr(),
Some(debuginfo::extend_scope_to_file(self.cx,
scope_metadata.unwrap(),
&cm.lookup_char_pos(pos).file,
defining_crate))
} else {
......@@ -281,7 +280,7 @@ pub fn codegen_mir(
span: decl.source_info.span,
scope: decl.visibility_scope,
});
declare_local(&bx, &fx.debug_context, name, layout.ty, scope.unwrap().as_ptr(),
declare_local(&bx, &fx.debug_context, name, layout.ty, scope.unwrap(),
VariableAccess::DirectVariable { alloca: place.llval },
VariableKind::LocalVariable, span);
}
......@@ -416,7 +415,7 @@ fn create_funclets(
fn arg_local_refs(
bx: &Builder<'a, 'll, 'tcx>,
fx: &FunctionCx<'a, 'll, 'tcx>,
scopes: &IndexVec<mir::SourceScope, debuginfo::MirDebugScope>,
scopes: &IndexVec<mir::SourceScope, debuginfo::MirDebugScope<'ll>>,
memory_locals: &BitVector<mir::Local>,
) -> Vec<LocalRef<'tcx>> {
let mir = fx.mir;
......@@ -473,7 +472,7 @@ fn arg_local_refs(
bx,
&fx.debug_context,
arg_decl.name.unwrap_or(keywords::Invalid.name()),
arg_ty, scope.as_ptr(),
arg_ty, scope,
variable_access,
VariableKind::ArgumentVariable(arg_index + 1),
DUMMY_SP
......@@ -552,7 +551,7 @@ fn arg_local_refs(
&fx.debug_context,
arg_decl.name.unwrap_or(keywords::Invalid.name()),
arg.layout.ty,
scope.as_ptr(),
scope,
variable_access,
VariableKind::ArgumentVariable(arg_index + 1),
DUMMY_SP
......@@ -603,7 +602,7 @@ fn arg_local_refs(
&fx.debug_context,
decl.debug_name,
ty,
scope.as_ptr(),
scope,
variable_access,
VariableKind::LocalVariable,
DUMMY_SP
......
......@@ -14,7 +14,6 @@
use llvm;
use llvm::{Bool, False, True, TypeKind};
use llvm::{Float, Double, X86_FP80, PPC_FP128, FP128};
use context::CodegenCx;
......@@ -265,10 +264,10 @@ pub fn func_params(&self) -> Vec<&Type> {
pub fn float_width(&self) -> usize {
match self.kind() {
Float => 32,
Double => 64,
X86_FP80 => 80,
FP128 | PPC_FP128 => 128,
TypeKind::Float => 32,
TypeKind::Double => 64,
TypeKind::X86_FP80 => 80,
TypeKind::FP128 | TypeKind::PPC_FP128 => 128,
_ => bug!("llvm_float_width called on a non-float type")
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册