Skip to content

Commit 17ac428

Browse files
committed
single commit with new opt2 impl
1 parent 1dc58da commit 17ac428

File tree

3 files changed

+16
-32
lines changed

3 files changed

+16
-32
lines changed

compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
11
#![allow(non_camel_case_types)]
22

33
use libc::{c_char, c_uint, size_t};
4-
use rustc_ast::expand::autodiff_attrs::DiffActivity;
5-
use tracing::trace;
6-
74
use super::ffi::*;
85

96
extern "C" {
107
// Enzyme
118
pub fn LLVMRustAddFncParamAttr<'a>(F: &'a Value, index: c_uint, Attr: &'a Attribute);
12-
139
pub fn LLVMRustAddRetFncAttr(F: &Value, attr: &Attribute);
1410
pub fn LLVMRustHasMetadata(I: &Value, KindID: c_uint) -> bool;
1511
pub fn LLVMRustEraseInstBefore(BB: &BasicBlock, I: &Value);
1612
pub fn LLVMRustGetLastInstruction<'a>(BB: &BasicBlock) -> Option<&'a Value>;
1713
pub fn LLVMRustDIGetInstMetadata(I: &Value) -> &Metadata;
1814
pub fn LLVMRustEraseInstFromParent(V: &Value);
1915
pub fn LLVMRustGetTerminator<'a>(B: &BasicBlock) -> &'a Value;
16+
pub fn LLVMRustAddEnumAttributeAtIndex(
17+
C: &Context,
18+
V: &Value,
19+
index: c_uint,
20+
attr: AttributeKind,
21+
);
22+
pub fn LLVMRustRemoveEnumAttributeAtIndex(V: &Value, index: c_uint, attr: AttributeKind);
23+
pub fn LLVMRustGetEnumAttributeAtIndex(
24+
V: &Value,
25+
index: c_uint,
26+
attr: AttributeKind,
27+
) -> &Attribute;
28+
pub fn LLVMRustAddParamAttr<'a>(Instr: &'a Value, index: c_uint, Attr: &'a Attribute);
29+
30+
2031
pub fn LLVMGetReturnType(T: &Type) -> &Type;
21-
pub fn LLVMRustIsStructType(T: &Type) -> bool;
2232
pub fn LLVMDumpModule(M: &Module);
2333
pub fn LLVMCountStructElementTypes(T: &Type) -> c_uint;
2434
pub fn LLVMVerifyFunction(V: &Value, action: LLVMVerifierFailureAction) -> bool;
@@ -34,7 +44,6 @@ extern "C" {
3444
pub fn LLVMGetFirstFunction(M: &Module) -> Option<&Value>;
3545
pub fn LLVMGetNextFunction(V: &Value) -> Option<&Value>;
3646
pub fn LLVMGetNamedFunction(M: &Module, Name: *const c_char) -> Option<&Value>;
37-
//pub fn LLVMGlobalGetValueType(val: &Value) -> &Type;
3847
pub fn LLVMRustGetFunctionType(fnc: &Value) -> &Type;
3948

4049
pub fn LLVMRemoveStringAttributeAtIndex(F: &Value, Idx: c_uint, K: *const c_char, KLen: c_uint);
@@ -46,20 +55,6 @@ extern "C" {
4655
) -> &Attribute;
4756
pub fn LLVMIsEnumAttribute(A: &Attribute) -> bool;
4857
pub fn LLVMIsStringAttribute(A: &Attribute) -> bool;
49-
pub fn LLVMRustAddEnumAttributeAtIndex(
50-
C: &Context,
51-
V: &Value,
52-
index: c_uint,
53-
attr: AttributeKind,
54-
);
55-
pub fn LLVMRustRemoveEnumAttributeAtIndex(V: &Value, index: c_uint, attr: AttributeKind);
56-
pub fn LLVMRustGetEnumAttributeAtIndex(
57-
V: &Value,
58-
index: c_uint,
59-
attr: AttributeKind,
60-
) -> &Attribute;
61-
62-
pub fn LLVMRustAddParamAttr<'a>(Instr: &'a Value, index: c_uint, Attr: &'a Attribute);
6358

6459
}
6560

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,6 @@ extern "C" void LLVMRustAddFunctionAttributes(LLVMValueRef Fn, unsigned Index,
336336
AddAttributes(F, Index, Attrs, AttrsLen);
337337
}
338338

339-
extern "C" bool LLVMRustIsStructType(LLVMTypeRef Ty) {
340-
return unwrap(Ty)->isStructTy();
341-
}
342-
343339
extern "C" void LLVMRustAddCallSiteAttributes(LLVMValueRef Instr,
344340
unsigned Index,
345341
LLVMAttributeRef *Attrs,
@@ -963,13 +959,6 @@ extern "C" LLVMMetadataRef LLVMRustDIGetInstMetadata(LLVMValueRef x) {
963959
return nullptr;
964960
}
965961

966-
extern "C" void LLVMRustAddParamAttr(LLVMValueRef call, unsigned i,
967-
LLVMAttributeRef RustAttr) {
968-
if (auto *CI = dyn_cast<CallInst>(unwrap<Value>(call))) {
969-
CI->addParamAttr(i, unwrap(RustAttr));
970-
}
971-
}
972-
973962
extern "C" void LLVMRustGlobalAddMetadata(LLVMValueRef Global, unsigned Kind,
974963
LLVMMetadataRef MD) {
975964
unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD));

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub use rustc_session::lint::RegisteredTools;
4848
use rustc_span::hygiene::MacroKind;
4949
use rustc_span::symbol::{Ident, Symbol, kw, sym};
5050
use rustc_span::{ExpnId, ExpnKind, Span};
51-
use rustc_target::abi::{Align, FieldIdx, FieldsShape, Integer, IntegerType, VariantIdx};
51+
use rustc_target::abi::{Align, FieldIdx, Integer, IntegerType, VariantIdx};
5252
pub use rustc_target::abi::{ReprFlags, ReprOptions};
5353
pub use rustc_type_ir::ConstKind::{
5454
Bound as BoundCt, Error as ErrorCt, Expr as ExprCt, Infer as InferCt, Param as ParamCt,

0 commit comments

Comments
 (0)