Differential D77339 Diff 254654 mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp
Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp
//===- DecorateSPIRVCompositeTypeLayoutPass.cpp - Decorate composite type -===// | //===- DecorateSPIRVCompositeTypeLayoutPass.cpp - Decorate composite type -===// | ||||
Lint: Lint: clang-format-diff not found in user's PATH; not linting file. | |||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
static void populateSPIRVLayoutInfoPatterns(OwningRewritePatternList &patterns, | static void populateSPIRVLayoutInfoPatterns(OwningRewritePatternList &patterns, | ||||
MLIRContext *ctx) { | MLIRContext *ctx) { | ||||
patterns.insert<SPIRVGlobalVariableOpLayoutInfoDecoration, | patterns.insert<SPIRVGlobalVariableOpLayoutInfoDecoration, | ||||
SPIRVAddressOfOpLayoutInfoDecoration>(ctx); | SPIRVAddressOfOpLayoutInfoDecoration>(ctx); | ||||
} | } | ||||
namespace { | namespace { | ||||
class DecorateSPIRVCompositeTypeLayoutPass | class DecorateSPIRVCompositeTypeLayoutPass | ||||
: public ModulePass<DecorateSPIRVCompositeTypeLayoutPass> { | : public OperationPass<DecorateSPIRVCompositeTypeLayoutPass, ModuleOp> { | ||||
private: | private: | ||||
void runOnModule() override; | void runOnOperation() override; | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
void DecorateSPIRVCompositeTypeLayoutPass::runOnModule() { | void DecorateSPIRVCompositeTypeLayoutPass::runOnOperation() { | ||||
auto module = getModule(); | auto module = getOperation(); | ||||
OwningRewritePatternList patterns; | OwningRewritePatternList patterns; | ||||
populateSPIRVLayoutInfoPatterns(patterns, module.getContext()); | populateSPIRVLayoutInfoPatterns(patterns, module.getContext()); | ||||
ConversionTarget target(*(module.getContext())); | ConversionTarget target(*(module.getContext())); | ||||
target.addLegalDialect<spirv::SPIRVDialect>(); | target.addLegalDialect<spirv::SPIRVDialect>(); | ||||
target.addLegalOp<FuncOp>(); | target.addLegalOp<FuncOp>(); | ||||
target.addDynamicallyLegalOp<spirv::GlobalVariableOp>( | target.addDynamicallyLegalOp<spirv::GlobalVariableOp>( | ||||
[](spirv::GlobalVariableOp op) { | [](spirv::GlobalVariableOp op) { | ||||
return VulkanLayoutUtils::isLegalType(op.type()); | return VulkanLayoutUtils::isLegalType(op.type()); | ||||
Show All 21 Lines |
clang-format-diff not found in user's PATH; not linting file.