https://github.com/Lancern closed
https://github.com/llvm/llvm-project/pull/139748
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Lancern updated
https://github.com/llvm/llvm-project/pull/139748
>From 71009b450a333d4537d9a84176707656c5bdcea1 Mon Sep 17 00:00:00 2001
From: Sirui Mu
Date: Thu, 15 May 2025 23:01:18 +0800
Subject: [PATCH] [CIR] Add support for indirect calls
---
.../CIR/Dialect/Builder/CI
https://github.com/bcardosolopes approved this pull request.
LGTM (pending error propagation)
https://github.com/llvm/llvm-project/pull/139748
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter
&converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir
https://github.com/andykaylor approved this pull request.
I think this looks good once the error handling on the type conversion is fixed.
https://github.com/llvm/llvm-project/pull/139748
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter
&converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter
&converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir
https://github.com/Lancern edited
https://github.com/llvm/llvm-project/pull/139748
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Lancern edited
https://github.com/llvm/llvm-project/pull/139748
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Lancern edited
https://github.com/llvm/llvm-project/pull/139748
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -937,8 +937,28 @@ CIRGenCallee CIRGenFunction::emitCallee(const clang::Expr
*e) {
return emitDirectCallee(cgm, funcDecl);
}
- cgm.errorNYI(e->getSourceRange(), "Unsupported callee kind");
- return {};
+ assert(!cir::MissingFeatures::opCallPseudoDtor());
@@ -539,15 +573,16 @@ mlir::ParseResult cir::CallOp::parse(mlir::OpAsmParser
&parser,
}
void cir::CallOp::print(mlir::OpAsmPrinter &p) {
- printCallCommon(*this, getCalleeAttr(), p);
+ mlir::Value indirectCallee = isIndirect() ? getIndirectCall() : nullptr;
+ printCallComm
@@ -464,15 +464,35 @@ OpFoldResult cir::CastOp::fold(FoldAdaptor adaptor) {
// CallOp
//===--===//
+mlir::OperandRange cir::CallOp::getArgOperands() {
+ if (isIndirect())
+return getArgs().drop_front(1);
@@ -1861,13 +1867,23 @@ def CallOp : CIR_CallOpBase<"call",
[NoRegionArguments]> {
let arguments = commonArgs;
let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee,
- "mlir::Type":$resType,
- "mlir::V
@@ -1861,13 +1867,23 @@ def CallOp : CIR_CallOpBase<"call",
[NoRegionArguments]> {
let arguments = commonArgs;
let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee,
- "mlir::Type":$resType,
- "mlir::V
https://github.com/Lancern updated
https://github.com/llvm/llvm-project/pull/139748
>From 614849751f24c47c6da53ebc1fb296b806223557 Mon Sep 17 00:00:00 2001
From: Sirui Mu
Date: Thu, 15 May 2025 23:01:18 +0800
Subject: [PATCH] [CIR] Add support for indirect calls
---
.../CIR/Dialect/Builder/CI
https://github.com/Lancern updated
https://github.com/llvm/llvm-project/pull/139748
>From eb08d386728d1d9876f68dc40b4042bace9e5d5c Mon Sep 17 00:00:00 2001
From: Sirui Mu
Date: Thu, 15 May 2025 23:01:18 +0800
Subject: [PATCH] [CIR] Add support for indirect calls
---
.../CIR/Dialect/Builder/CI
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter
&converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir
@@ -937,8 +937,28 @@ CIRGenCallee CIRGenFunction::emitCallee(const clang::Expr
*e) {
return emitDirectCallee(cgm, funcDecl);
}
- cgm.errorNYI(e->getSourceRange(), "Unsupported callee kind");
- return {};
+ assert(!cir::MissingFeatures::opCallPseudoDtor());
@@ -1861,13 +1867,23 @@ def CallOp : CIR_CallOpBase<"call",
[NoRegionArguments]> {
let arguments = commonArgs;
let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee,
- "mlir::Type":$resType,
- "mlir::V
@@ -1861,13 +1867,23 @@ def CallOp : CIR_CallOpBase<"call",
[NoRegionArguments]> {
let arguments = commonArgs;
let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee,
- "mlir::Type":$resType,
- "mlir::V
@@ -185,12 +193,26 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo
&funcInfo,
assert(!cir::MissingFeatures::invokeOp());
- auto directFuncOp = dyn_cast(calleePtr);
- assert(!cir::MissingFeatures::opCallIndirect());
+ cir::FuncType indirectFuncTy;
+ mlir::Va
@@ -464,15 +464,35 @@ OpFoldResult cir::CastOp::fold(FoldAdaptor adaptor) {
// CallOp
//===--===//
+mlir::OperandRange cir::CallOp::getArgOperands() {
+ if (isIndirect())
+return getArgs().drop_front(1);
@@ -1826,6 +1821,9 @@ class CIR_CallOpBase
extra_traits = []>
::mlir::Attribute removeArgAttrsAttr() { return {}; }
::mlir::Attribute removeResAttrsAttr() { return {}; }
+bool isIndirect() { return !getCallee(); }
+mlir::Value getIndirectCall();
+
void se
@@ -1839,16 +1837,24 @@ class CIR_CallOpBase
extra_traits = []>
// the upstreaming process moves on. The verifiers is also missing for now,
// will add in the future.
- dag commonArgs = (ins FlatSymbolRefAttr:$callee,
-Variadic:$args);
+ dag comm
@@ -1861,13 +1867,23 @@ def CallOp : CIR_CallOpBase<"call",
[NoRegionArguments]> {
let arguments = commonArgs;
let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee,
- "mlir::Type":$resType,
- "mlir::V
@@ -1861,13 +1867,23 @@ def CallOp : CIR_CallOpBase<"call",
[NoRegionArguments]> {
let arguments = commonArgs;
let builders = [OpBuilder<(ins "mlir::SymbolRefAttr":$callee,
- "mlir::Type":$resType,
- "mlir::V
@@ -539,15 +573,16 @@ mlir::ParseResult cir::CallOp::parse(mlir::OpAsmParser
&parser,
}
void cir::CallOp::print(mlir::OpAsmPrinter &p) {
- printCallCommon(*this, getCalleeAttr(), p);
+ mlir::Value indirectCallee = isIndirect() ? getIndirectCall() : nullptr;
+ printCallComm
@@ -185,12 +193,26 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo
&funcInfo,
assert(!cir::MissingFeatures::invokeOp());
- auto directFuncOp = dyn_cast(calleePtr);
- assert(!cir::MissingFeatures::opCallIndirect());
+ cir::FuncType indirectFuncTy;
+ mlir::Va
https://github.com/Lancern updated
https://github.com/llvm/llvm-project/pull/139748
>From 8c6a8c37037634ea48eb94e022cd76c0cececb84 Mon Sep 17 00:00:00 2001
From: Sirui Mu
Date: Thu, 15 May 2025 23:01:18 +0800
Subject: [PATCH] [CIR] Add support for indirect calls
---
.../CIR/Dialect/Builder/CI
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter
&converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir
@@ -1837,16 +1835,24 @@ class CIR_CallOpBase
extra_traits = []>
// the upstreaming process moves on. The verifiers is also missing for now,
// will add in the future.
- dag commonArgs = (ins FlatSymbolRefAttr:$callee,
-Variadic:$args);
+ dag comm
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter
&converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir
https://github.com/Lancern updated
https://github.com/llvm/llvm-project/pull/139748
Rate limit ยท GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,sans-s
https://github.com/bcardosolopes edited
https://github.com/llvm/llvm-project/pull/139748
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1837,16 +1835,24 @@ class CIR_CallOpBase
extra_traits = []>
// the upstreaming process moves on. The verifiers is also missing for now,
// will add in the future.
- dag commonArgs = (ins FlatSymbolRefAttr:$callee,
-Variadic:$args);
+ dag comm
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter
&converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter
&converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir
https://github.com/bcardosolopes commented:
Mostly good, some nits!
https://github.com/llvm/llvm-project/pull/139748
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Sirui Mu (Lancern)
Changes
This PR adds support for indirect calls to the `cir.call` operation.
---
Patch is 21.03 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/139748.diff
12 Files Affected
https://github.com/Lancern created
https://github.com/llvm/llvm-project/pull/139748
This PR adds support for indirect calls to the `cir.call` operation.
>From 786327894695a73ec80ec256892ca51e68fa5389 Mon Sep 17 00:00:00 2001
From: Sirui Mu
Date: Tue, 13 May 2025 23:02:08 +0800
Subject: [PATCH]
41 matches
Mail list logo