-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR][Transforms][TargetLowering][NFC] Add SPIR-V skeleton (#737)
This NFC PR adds the SPIR-V `TargetLoweringInfo` with ABI stuff unimplemented. It's useful for other target-specific information to land first.
- Loading branch information
1 parent
57a6d37
commit dcb6ec2
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
clang/lib/CIR/Dialect/Transforms/TargetLowering/Targets/SPIR.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//===- SPIR.cpp - TargetInfo for SPIR and SPIR-V --------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "ABIInfoImpl.h" | ||
#include "LowerFunctionInfo.h" | ||
#include "LowerTypes.h" | ||
#include "TargetInfo.h" | ||
#include "TargetLoweringInfo.h" | ||
#include "clang/CIR/ABIArgInfo.h" | ||
#include "clang/CIR/MissingFeatures.h" | ||
#include "llvm/Support/ErrorHandling.h" | ||
|
||
using ABIArgInfo = ::cir::ABIArgInfo; | ||
using MissingFeature = ::cir::MissingFeatures; | ||
|
||
namespace mlir { | ||
namespace cir { | ||
|
||
//===----------------------------------------------------------------------===// | ||
// SPIR-V ABI Implementation | ||
//===----------------------------------------------------------------------===// | ||
|
||
namespace { | ||
|
||
class SPIRVABIInfo : public ABIInfo { | ||
public: | ||
SPIRVABIInfo(LowerTypes <) : ABIInfo(LT) {} | ||
|
||
private: | ||
void computeInfo(LowerFunctionInfo &FI) const override { | ||
llvm_unreachable("ABI NYI"); | ||
} | ||
}; | ||
|
||
class SPIRVTargetLoweringInfo : public TargetLoweringInfo { | ||
public: | ||
SPIRVTargetLoweringInfo(LowerTypes <) | ||
: TargetLoweringInfo(std::make_unique<SPIRVABIInfo>(LT)) {} | ||
}; | ||
|
||
} // namespace | ||
|
||
std::unique_ptr<TargetLoweringInfo> | ||
createSPIRVTargetLoweringInfo(LowerModule &lowerModule) { | ||
return std::make_unique<SPIRVTargetLoweringInfo>(lowerModule.getTypes()); | ||
} | ||
|
||
} // namespace cir | ||
} // namespace mlir |