Skip to content

Commit 1cbbbc0

Browse files
authored
Rollup merge of rust-lang#47233 - dotdash:cleanup_llvm, r=alexcrichton
Remove unused LLVM related code Ticks a few more boxes on rust-lang#46437
2 parents 4a6f440 + 907855f commit 1cbbbc0

File tree

8 files changed

+1
-58
lines changed

8 files changed

+1
-58
lines changed

src/librustc/session/config.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
10841084
"omit landing pads for unwinding"),
10851085
fewer_names: bool = (false, parse_bool, [TRACKED],
10861086
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR)"),
1087-
debug_llvm: bool = (false, parse_bool, [UNTRACKED],
1088-
"enable debug output from LLVM"),
10891087
meta_stats: bool = (false, parse_bool, [UNTRACKED],
10901088
"gather metadata statistics"),
10911089
print_link_args: bool = (false, parse_bool, [UNTRACKED],
@@ -2747,8 +2745,6 @@ mod tests {
27472745
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
27482746
opts.debugging_opts.borrowck_stats = true;
27492747
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
2750-
opts.debugging_opts.debug_llvm = true;
2751-
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
27522748
opts.debugging_opts.meta_stats = true;
27532749
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
27542750
opts.debugging_opts.print_link_args = true;

src/librustc_driver/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ mod rustc_trans {
167167
pub use rustc_trans_utils::trans_crate::TranslatedCrate as CrateTranslation;
168168

169169
pub fn init(_sess: &Session) {}
170-
pub fn enable_llvm_debug() {}
171170
pub fn print_version() {}
172171
pub fn print_passes() {}
173172
pub fn print(_req: PrintRequest, _sess: &Session) {}
@@ -205,10 +204,6 @@ pub fn run_compiler<'a>(args: &[String],
205204

206205
let (sopts, cfg) = config::build_session_options_and_crate_config(&matches);
207206

208-
if sopts.debugging_opts.debug_llvm {
209-
rustc_trans::enable_llvm_debug();
210-
}
211-
212207
let descriptions = diagnostics_registry();
213208

214209
do_or_return!(callbacks.early_callback(&matches,

src/librustc_llvm/ffi.rs

-6
Original file line numberDiff line numberDiff line change
@@ -1315,9 +1315,6 @@ extern "C" {
13151315
ElementCount: c_uint,
13161316
Packed: Bool);
13171317

1318-
/// Enables LLVM debug output.
1319-
pub fn LLVMRustSetDebug(Enabled: c_int);
1320-
13211318
/// Prepares inline assembly.
13221319
pub fn LLVMRustInlineAsm(Ty: TypeRef,
13231320
AsmString: *const c_char,
@@ -1610,7 +1607,6 @@ extern "C" {
16101607
pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
16111608
pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef, AddLifetimes: bool);
16121609
pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef, bc: *const c_char, len: size_t) -> bool;
1613-
pub fn LLVMRustLinkInParsedExternalBitcode(M: ModuleRef, M: ModuleRef) -> bool;
16141610
pub fn LLVMRustRunRestrictionPass(M: ModuleRef, syms: *const *const c_char, len: size_t);
16151611
pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
16161612

@@ -1646,8 +1642,6 @@ extern "C" {
16461642
pub fn LLVMRustWriteDiagnosticInfoToString(DI: DiagnosticInfoRef, s: RustStringRef);
16471643
pub fn LLVMRustGetDiagInfoKind(DI: DiagnosticInfoRef) -> DiagnosticKind;
16481644

1649-
pub fn LLVMRustWriteDebugLocToString(C: ContextRef, DL: DebugLocRef, s: RustStringRef);
1650-
16511645
pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: ContextRef,
16521646
H: InlineAsmDiagHandler,
16531647
CX: *mut c_void);

src/librustc_llvm/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,6 @@ pub unsafe fn twine_to_string(tr: TwineRef) -> String {
296296
build_string(|s| LLVMRustWriteTwineToString(tr, s)).expect("got a non-UTF8 Twine from LLVM")
297297
}
298298

299-
pub unsafe fn debug_loc_to_string(c: ContextRef, tr: DebugLocRef) -> String {
300-
build_string(|s| LLVMRustWriteDebugLocToString(c, tr, s))
301-
.expect("got a non-UTF8 DebugLoc from LLVM")
302-
}
303-
304299
pub fn initialize_available_targets() {
305300
macro_rules! init_target(
306301
($cfg:meta, $($method:ident),*) => { {

src/librustc_trans/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub use base::trans_crate;
6969
use back::bytecode::RLIB_BYTECODE_EXTENSION;
7070

7171
pub use metadata::LlvmMetadataLoader;
72-
pub use llvm_util::{init, target_features, print_version, print_passes, print, enable_llvm_debug};
72+
pub use llvm_util::{init, target_features, print_version, print_passes, print};
7373

7474
use std::any::Any;
7575
use std::path::PathBuf;

src/librustc_trans/llvm_util.rs

-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,3 @@ pub fn print(req: PrintRequest, sess: &Session) {
140140
}
141141
}
142142
}
143-
144-
pub fn enable_llvm_debug() {
145-
unsafe { llvm::LLVMRustSetDebug(1); }
146-
}

src/rustllvm/RustWrapper.cpp

-31
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,6 @@ LLVMRustBuildAtomicFence(LLVMBuilderRef B, LLVMAtomicOrdering Order,
384384
return wrap(unwrap(B)->CreateFence(fromRust(Order), fromRust(Scope)));
385385
}
386386

387-
extern "C" void LLVMRustSetDebug(int Enabled) {
388-
#ifndef NDEBUG
389-
DebugFlag = Enabled;
390-
#endif
391-
}
392-
393387
enum class LLVMRustAsmDialect {
394388
Other,
395389
Att,
@@ -933,23 +927,6 @@ extern "C" bool LLVMRustLinkInExternalBitcode(LLVMModuleRef DstRef, char *BC,
933927
return true;
934928
}
935929

936-
extern "C" bool LLVMRustLinkInParsedExternalBitcode(
937-
LLVMModuleRef DstRef, LLVMModuleRef SrcRef) {
938-
#if LLVM_VERSION_GE(4, 0)
939-
Module *Dst = unwrap(DstRef);
940-
std::unique_ptr<Module> Src(unwrap(SrcRef));
941-
942-
if (Linker::linkModules(*Dst, std::move(Src))) {
943-
LLVMRustSetLastError("failed to link modules");
944-
return false;
945-
}
946-
return true;
947-
#else
948-
LLVMRustSetLastError("can't link parsed modules on this LLVM");
949-
return false;
950-
#endif
951-
}
952-
953930
// Note that the two following functions look quite similar to the
954931
// LLVMGetSectionName function. Sadly, it appears that this function only
955932
// returns a char* pointer, which isn't guaranteed to be null-terminated. The
@@ -981,7 +958,6 @@ extern "C" LLVMTypeRef LLVMRustArrayType(LLVMTypeRef ElementTy,
981958
}
982959

983960
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Twine, LLVMTwineRef)
984-
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DebugLoc, LLVMDebugLocRef)
985961

986962
extern "C" void LLVMRustWriteTwineToString(LLVMTwineRef T, RustStringRef Str) {
987963
RawRustStringOstream OS(Str);
@@ -1130,13 +1106,6 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) {
11301106
report_fatal_error("Unhandled TypeID.");
11311107
}
11321108

1133-
extern "C" void LLVMRustWriteDebugLocToString(LLVMContextRef C,
1134-
LLVMDebugLocRef DL,
1135-
RustStringRef Str) {
1136-
RawRustStringOstream OS(Str);
1137-
unwrap(DL)->print(OS);
1138-
}
1139-
11401109
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(SMDiagnostic, LLVMSMDiagnosticRef)
11411110

11421111
extern "C" void LLVMRustSetInlineAsmDiagnosticHandler(

src/rustllvm/rustllvm.h

-2
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ enum LLVMRustAttribute {
103103

104104
typedef struct OpaqueRustString *RustStringRef;
105105
typedef struct LLVMOpaqueTwine *LLVMTwineRef;
106-
typedef struct LLVMOpaqueDebugLoc *LLVMDebugLocRef;
107106
typedef struct LLVMOpaqueSMDiagnostic *LLVMSMDiagnosticRef;
108-
typedef struct LLVMOpaqueRustJITMemoryManager *LLVMRustJITMemoryManagerRef;
109107

110108
extern "C" void LLVMRustStringWriteImpl(RustStringRef Str, const char *Ptr,
111109
size_t Size);

0 commit comments

Comments
 (0)