Skip to content

Commit 85aec92

Browse files
authored
Rollup merge of rust-lang#136653 - dpaoliello:cleanllvm1, r=Zalathar
Remove dead code from rustc_codegen_llvm and the LLVM wrapper First step to clean up the LLVM wrapper: remove existing dead code. Split out of rust-lang#135502 r? `@Zalathar`
2 parents 303bc62 + 2a6b274 commit 85aec92

File tree

2 files changed

+0
-60
lines changed

2 files changed

+0
-60
lines changed

Diff for: compiler/rustc_codegen_llvm/src/llvm/ffi.rs

-29
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,6 @@ pub enum LLVMRustResult {
6969
Failure,
7070
}
7171

72-
/// Translation of LLVM's MachineTypes enum, defined in llvm\include\llvm\BinaryFormat\COFF.h.
73-
///
74-
/// We include only architectures supported on Windows.
75-
#[derive(Copy, Clone, PartialEq)]
76-
#[repr(C)]
77-
pub enum LLVMMachineType {
78-
AMD64 = 0x8664,
79-
I386 = 0x14c,
80-
ARM64 = 0xaa64,
81-
ARM64EC = 0xa641,
82-
ARM = 0x01c0,
83-
}
84-
8572
/// Must match the layout of `LLVMRustModuleFlagMergeBehavior`.
8673
///
8774
/// When merging modules (e.g. during LTO), their metadata flags are combined. Conflicts are
@@ -645,16 +632,6 @@ pub enum ThreadLocalMode {
645632
LocalExec,
646633
}
647634

648-
/// LLVMRustTailCallKind
649-
#[derive(Copy, Clone)]
650-
#[repr(C)]
651-
pub enum TailCallKind {
652-
None,
653-
Tail,
654-
MustTail,
655-
NoTail,
656-
}
657-
658635
/// LLVMRustChecksumKind
659636
#[derive(Copy, Clone)]
660637
#[repr(C)]
@@ -773,7 +750,6 @@ pub struct Builder<'a>(InvariantOpaque<'a>);
773750
#[repr(C)]
774751
pub struct PassManager<'a>(InvariantOpaque<'a>);
775752
unsafe extern "C" {
776-
pub type Pass;
777753
pub type TargetMachine;
778754
pub type Archive;
779755
}
@@ -799,7 +775,6 @@ unsafe extern "C" {
799775
}
800776

801777
pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
802-
pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
803778

804779
pub mod debuginfo {
805780
use std::ptr;
@@ -853,7 +828,6 @@ pub mod debuginfo {
853828
pub type DIFile = DIScope;
854829
pub type DILexicalBlock = DIScope;
855830
pub type DISubprogram = DIScope;
856-
pub type DINameSpace = DIScope;
857831
pub type DIType = DIDescriptor;
858832
pub type DIBasicType = DIType;
859833
pub type DIDerivedType = DIType;
@@ -1809,7 +1783,6 @@ unsafe extern "C" {
18091783
Name: *const c_char,
18101784
NameLen: size_t,
18111785
) -> Option<&Value>;
1812-
pub fn LLVMRustSetTailCallKind(CallInst: &Value, TKC: TailCallKind);
18131786

18141787
// Operations on attributes
18151788
pub fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute;
@@ -2586,8 +2559,6 @@ unsafe extern "C" {
25862559

25872560
pub fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;
25882561

2589-
pub fn LLVMRustIsBitcode(ptr: *const u8, len: usize) -> bool;
2590-
25912562
pub fn LLVMRustLLVMHasZlibCompressionForDebugSymbols() -> bool;
25922563

25932564
pub fn LLVMRustLLVMHasZstdCompressionForDebugSymbols() -> bool;

Diff for: compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

-31
Original file line numberDiff line numberDiff line change
@@ -195,33 +195,6 @@ LLVMRustVerifyFunction(LLVMValueRef Fn, LLVMRustVerifierFailureAction Action) {
195195
return LLVMVerifyFunction(Fn, fromRust(Action));
196196
}
197197

198-
enum class LLVMRustTailCallKind {
199-
None,
200-
Tail,
201-
MustTail,
202-
NoTail,
203-
};
204-
205-
static CallInst::TailCallKind fromRust(LLVMRustTailCallKind Kind) {
206-
switch (Kind) {
207-
case LLVMRustTailCallKind::None:
208-
return CallInst::TailCallKind::TCK_None;
209-
case LLVMRustTailCallKind::Tail:
210-
return CallInst::TailCallKind::TCK_Tail;
211-
case LLVMRustTailCallKind::MustTail:
212-
return CallInst::TailCallKind::TCK_MustTail;
213-
case LLVMRustTailCallKind::NoTail:
214-
return CallInst::TailCallKind::TCK_NoTail;
215-
default:
216-
report_fatal_error("bad CallInst::TailCallKind.");
217-
}
218-
}
219-
220-
extern "C" void LLVMRustSetTailCallKind(LLVMValueRef Call,
221-
LLVMRustTailCallKind TCK) {
222-
unwrap<CallInst>(Call)->setTailCallKind(fromRust(TCK));
223-
}
224-
225198
extern "C" LLVMValueRef LLVMRustGetOrInsertFunction(LLVMModuleRef M,
226199
const char *Name,
227200
size_t NameLen,
@@ -1976,10 +1949,6 @@ extern "C" int32_t LLVMRustGetElementTypeArgIndex(LLVMValueRef CallSite) {
19761949
return -1;
19771950
}
19781951

1979-
extern "C" bool LLVMRustIsBitcode(char *ptr, size_t len) {
1980-
return identify_magic(StringRef(ptr, len)) == file_magic::bitcode;
1981-
}
1982-
19831952
extern "C" bool LLVMRustIsNonGVFunctionPointerTy(LLVMValueRef V) {
19841953
if (unwrap<Value>(V)->getType()->isPointerTy()) {
19851954
if (auto *GV = dyn_cast<GlobalValue>(unwrap<Value>(V))) {

0 commit comments

Comments
 (0)