Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mk/rustllvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ LLVM_EXTRA_INCDIRS_$(1)= $$(call CFG_CC_INCLUDE_$(1),$(S)src/llvm/include) \
endif

RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, \
ExecutionEngineWrapper.cpp RustWrapper.cpp PassWrapper.cpp \
RustWrapper.cpp PassWrapper.cpp \
ArchiveWrapper.cpp)

RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub fn run_compiler_with_file_loader<'a, L>(args: &[String],
let sopts = config::build_session_options(&matches);

if sopts.debugging_opts.debug_llvm {
unsafe { llvm::LLVMSetDebug(1); }
unsafe { llvm::LLVMRustSetDebug(1); }
}

let descriptions = diagnostics_registry();
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ fn main() {
cfg.flag(&flag);
}

cfg.file("../rustllvm/ExecutionEngineWrapper.cpp")
.file("../rustllvm/PassWrapper.cpp")
cfg.file("../rustllvm/PassWrapper.cpp")
.file("../rustllvm/RustWrapper.cpp")
.file("../rustllvm/ArchiveWrapper.cpp")
.cpp(true)
Expand Down
58 changes: 40 additions & 18 deletions src/librustc_llvm/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,29 @@ pub use self::Diagnostic::*;
use libc::{c_char, c_uint};
use std::ptr;

use {DebugLocRef, DiagnosticInfoRef, TwineRef, ValueRef};
use {DiagnosticInfoRef, TwineRef, ValueRef};
use ffi::DebugLocRef;

#[derive(Copy, Clone)]
pub enum OptimizationDiagnosticKind {
OptimizationRemark,
OptimizationMissed,
OptimizationAnalysis,
OptimizationAnalysisFPCommute,
OptimizationAnalysisAliasing,
OptimizationFailure,
OptimizationRemarkOther,
}

impl OptimizationDiagnosticKind {
pub fn describe(self) -> &'static str {
match self {
OptimizationRemark => "remark",
OptimizationRemark |
OptimizationRemarkOther => "remark",
OptimizationMissed => "missed",
OptimizationAnalysis => "analysis",
OptimizationAnalysisFPCommute => "floating-point",
OptimizationAnalysisAliasing => "aliasing",
OptimizationFailure => "failure",
}
}
Expand All @@ -58,11 +65,11 @@ impl OptimizationDiagnostic {
message: ptr::null_mut(),
};

super::LLVMUnpackOptimizationDiagnostic(di,
&mut opt.pass_name,
&mut opt.function,
&mut opt.debug_loc,
&mut opt.message);
super::LLVMRustUnpackOptimizationDiagnostic(di,
&mut opt.pass_name,
&mut opt.function,
&mut opt.debug_loc,
&mut opt.message);

opt
}
Expand All @@ -84,10 +91,10 @@ impl InlineAsmDiagnostic {
instruction: ptr::null_mut(),
};

super::LLVMUnpackInlineAsmDiagnostic(di,
&mut opt.cookie,
&mut opt.message,
&mut opt.instruction);
super::LLVMRustUnpackInlineAsmDiagnostic(di,
&mut opt.cookie,
&mut opt.message,
&mut opt.instruction);

opt
}
Expand All @@ -103,24 +110,39 @@ pub enum Diagnostic {

impl Diagnostic {
pub unsafe fn unpack(di: DiagnosticInfoRef) -> Diagnostic {
let kind = super::LLVMGetDiagInfoKind(di);
use super::DiagnosticKind as Dk;
let kind = super::LLVMRustGetDiagInfoKind(di);

match kind {
super::DK_InlineAsm => InlineAsm(InlineAsmDiagnostic::unpack(di)),
Dk::InlineAsm => InlineAsm(InlineAsmDiagnostic::unpack(di)),

super::DK_OptimizationRemark => {
Dk::OptimizationRemark => {
Optimization(OptimizationDiagnostic::unpack(OptimizationRemark, di))
}

super::DK_OptimizationRemarkMissed => {
Dk::OptimizationRemarkOther => {
Optimization(OptimizationDiagnostic::unpack(OptimizationRemarkOther, di))
}
Dk::OptimizationRemarkMissed => {
Optimization(OptimizationDiagnostic::unpack(OptimizationMissed, di))
}

super::DK_OptimizationRemarkAnalysis => {
Dk::OptimizationRemarkAnalysis => {
Optimization(OptimizationDiagnostic::unpack(OptimizationAnalysis, di))
}

super::DK_OptimizationFailure => {

Dk::OptimizationRemarkAnalysisFPCommute => {
Optimization(OptimizationDiagnostic::unpack(
OptimizationAnalysisFPCommute, di))
}

Dk::OptimizationRemarkAnalysisAliasing => {
Optimization(OptimizationDiagnostic::unpack(
OptimizationAnalysisAliasing, di))
}


Dk::OptimizationFailure => {
Optimization(OptimizationDiagnostic::unpack(OptimizationFailure, di))
}

Expand Down
Loading