Skip to content

Commit cdf3d98

Browse files
committed
remove uncheckedGetInstrincSource, add llvm-c/Core.h
1 parent 24f81e4 commit cdf3d98

File tree

5 files changed

+1
-72
lines changed

5 files changed

+1
-72
lines changed

mlir/include/mlir-c/Target/LLVMIR.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "mlir-c/IR.h"
1818
#include "mlir-c/Support.h"
19+
#include "llvm-c/Core.h"
1920
#include "llvm-c/Support.h"
2021

2122
#ifdef __cplusplus
@@ -74,14 +75,6 @@ mlirTypeToLLVMIRTranslatorDestroy(MlirTypeToLLVMIRTranslator translator);
7475
MLIR_CAPI_EXPORTED LLVMTypeRef mlirTypeToLLVMIRTranslatorTranslateType(
7576
MlirTypeToLLVMIRTranslator translator, MlirType mlirType);
7677

77-
/// Attempts to look up the LLVM intrinsic matching `id` with parameter types
78-
/// `mlirParamTypes`. Note, since no return type is required, no check is
79-
/// performed to verify the found intrinsic.
80-
MLIR_CAPI_EXPORTED LLVMTypeRef
81-
mlirTypeToLLVMIRTranslatorUncheckedGetIntrinsicSignature(
82-
MlirTypeToLLVMIRTranslator translator, unsigned id,
83-
MlirType *mlirParamTypes, unsigned numParams);
84-
8578
#ifdef __cplusplus
8679
}
8780
#endif

mlir/include/mlir/Target/LLVMIR/TypeToLLVM.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ class TypeToLLVMIRTranslator {
5353
/// Translates the given MLIR LLVM dialect type to LLVM IR.
5454
llvm::Type *translateType(Type type);
5555

56-
/// Attempts to look up the LLVM intrinsic matching `id` with parameter types
57-
/// `types`. Note, since no return type is required, no check is performed to
58-
/// verify the found intrinsic.
59-
llvm::FunctionType *
60-
uncheckedGetIntrinsicSignature(unsigned id, llvm::ArrayRef<Type> types);
61-
6256
private:
6357
/// Private implementation.
6458
std::unique_ptr<detail::TypeToLLVMIRTranslatorImpl> impl;

mlir/lib/CAPI/Target/LLVMIR.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include "mlir-c/Target/LLVMIR.h"
1111

12-
#include "llvm/IR/Intrinsics.h"
1312
#include "llvm/IR/LLVMContext.h"
1413
#include "llvm/IR/Module.h"
1514
#include "llvm/IR/Type.h"
@@ -78,15 +77,3 @@ mlirTypeToLLVMIRTranslatorTranslateType(MlirTypeToLLVMIRTranslator translator,
7877
llvm::Type *type = translator_->translateType(unwrap(mlirType));
7978
return llvm::wrap(type);
8079
}
81-
82-
LLVMTypeRef mlirTypeToLLVMIRTranslatorUncheckedGetIntrinsicSignature(
83-
MlirTypeToLLVMIRTranslator translator, unsigned id,
84-
MlirType *mlirParamTypes, unsigned numParams) {
85-
SmallVector<mlir::Type, 4> paramTypes;
86-
for (unsigned i = 0; i < numParams; i++)
87-
paramTypes.emplace_back(unwrap(mlirParamTypes[i]));
88-
LLVM::TypeToLLVMIRTranslator *translator_ = unwrap(translator);
89-
llvm::Type *functionType =
90-
translator_->uncheckedGetIntrinsicSignature(id, paramTypes);
91-
return llvm::wrap(functionType);
92-
}

mlir/lib/Target/LLVMIR/TypeToLLVM.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ class TypeToLLVMIRTranslatorImpl {
8585
return translated;
8686
}
8787

88-
llvm::FunctionType *
89-
uncheckedGetIntrinsicSignature(unsigned id, llvm::ArrayRef<Type> types) {
90-
SmallVector<llvm::Type *, 8> paramTypes;
91-
if (llvm::Intrinsic::isOverloaded(id)) {
92-
translateTypes(types, paramTypes);
93-
}
94-
return llvm::Intrinsic::getType(context, id, paramTypes);
95-
}
96-
9788
private:
9889
/// Translates the given array type.
9990
llvm::Type *translate(LLVM::LLVMArrayType type) {
@@ -203,12 +194,6 @@ llvm::Type *LLVM::TypeToLLVMIRTranslator::translateType(Type type) {
203194
return impl->translateType(type);
204195
}
205196

206-
llvm::FunctionType *
207-
LLVM::TypeToLLVMIRTranslator::uncheckedGetIntrinsicSignature(
208-
unsigned id, llvm::ArrayRef<Type> types) {
209-
return impl->uncheckedGetIntrinsicSignature(id, types);
210-
}
211-
212197
unsigned LLVM::TypeToLLVMIRTranslator::getPreferredAlignment(
213198
Type type, const llvm::DataLayout &layout) {
214199
return layout.getPrefTypeAlign(translateType(type)).value();

mlir/test/CAPI/translation.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -79,36 +79,6 @@ static void testTypeToFromLLVMIRTranslator(MlirContext ctx) {
7979
LLVMDumpType(llvmTy2);
8080
fprintf(stderr, "\n");
8181

82-
// check "not overloaded" path
83-
MlirType i32 = mlirIntegerTypeGet(ctx, 32);
84-
MlirType nonOverloadeTys[] = {i32};
85-
unsigned returnAddressIID = LLVMLookupIntrinsicID("llvm.returnaddress", 18);
86-
LLVMTypeRef returnAddressIntrinsicTy =
87-
mlirTypeToLLVMIRTranslatorUncheckedGetIntrinsicSignature(
88-
toLLVMTranslator, returnAddressIID, nonOverloadeTys, 1);
89-
// CHECK: ptr (i32)
90-
LLVMDumpType(returnAddressIntrinsicTy);
91-
fprintf(stderr, "\n");
92-
93-
// check "overloaded" path
94-
MlirType overloadeTys[] = {i32, i32};
95-
unsigned sMaxIID = LLVMLookupIntrinsicID("llvm.smax", 9);
96-
LLVMTypeRef llvmSMaxIntrinsicTy =
97-
mlirTypeToLLVMIRTranslatorUncheckedGetIntrinsicSignature(
98-
toLLVMTranslator, sMaxIID, overloadeTys, 2);
99-
// CHECK: i32 (i32, i32)
100-
LLVMDumpType(llvmSMaxIntrinsicTy);
101-
fprintf(stderr, "\n");
102-
103-
MlirType mlirSMaxIntrinsicTy = mlirTypeFromLLVMIRTranslatorTranslateType(
104-
fromLLVMTranslator, llvmSMaxIntrinsicTy);
105-
// CHECK: !llvm.func<i32 (i32, i32)>
106-
mlirTypeDump(mlirSMaxIntrinsicTy);
107-
108-
MlirType retType = mlirLLVMFunctionTypeGetReturnType(mlirSMaxIntrinsicTy);
109-
// CHECK: i32
110-
mlirTypeDump(retType);
111-
11282
mlirTypeFromLLVMIRTranslatorDestroy(fromLLVMTranslator);
11383
mlirTypeToLLVMIRTranslatorDestroy(toLLVMTranslator);
11484
LLVMContextDispose(llvmCtx);

0 commit comments

Comments
 (0)