-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove mlir::cir::FloatType and replace it with an interface
- Loading branch information
Showing
16 changed files
with
158 additions
and
112 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===- FPTypeInterface.h - Interface for CIR FP types ----------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===---------------------------------------------------------------------===// | ||
// | ||
// Defines the interface to generically handle CIR floating-point types. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CLANG_INTERFACES_CIR_FPTYPEINTERFACE_H | ||
#define CLANG_INTERFACES_CIR_FPTYPEINTERFACE_H | ||
|
||
#include "mlir/IR/Types.h" | ||
#include "llvm/ADT/APFloat.h" | ||
|
||
/// Include the tablegen'd interface declarations. | ||
#include "clang/CIR/Interfaces/FPTypeInterface.h.inc" | ||
|
||
#endif // CLANG_INTERFACES_CIR_FPTYPEINTERFACE_H |
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,52 @@ | ||
//===- FPTypeInterface.td - CIR FP Interface Definitions --------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MLIR_CIR_INTERFACES_FP_TYPE_INTERFACE | ||
#define MLIR_CIR_INTERFACES_FP_TYPE_INTERFACE | ||
|
||
include "mlir/IR/OpBase.td" | ||
|
||
def FPTypeInterface : TypeInterface<"FPTypeInterface"> { | ||
let description = [{ | ||
Contains helper functions to query properties about a floating-point type. | ||
}]; | ||
let cppNamespace = "::mlir::cir"; | ||
|
||
let methods = [ | ||
InterfaceMethod<[{ | ||
Returns the bit width of this floating-point type. | ||
}], | ||
/*retTy=*/"unsigned", | ||
/*methodName=*/"getWidth", | ||
/*args=*/(ins), | ||
/*methodBody=*/"", | ||
/*defaultImplementation=*/[{ | ||
return llvm::APFloat::semanticsSizeInBits($_type.getFloatSemantics()); | ||
}] | ||
>, | ||
InterfaceMethod<[{ | ||
Return the mantissa width. | ||
}], | ||
/*retTy=*/"unsigned", | ||
/*methodName=*/"getFPMantissaWidth", | ||
/*args=*/(ins), | ||
/*methodBody=*/"", | ||
/*defaultImplementation=*/[{ | ||
return llvm::APFloat::semanticsPrecision($_type.getFloatSemantics()); | ||
}] | ||
>, | ||
InterfaceMethod<[{ | ||
Return the float semantics of this floating-point type. | ||
}], | ||
/*retTy=*/"const llvm::fltSemantics &", | ||
/*methodName=*/"getFloatSemantics" | ||
>, | ||
]; | ||
} | ||
|
||
#endif // MLIR_CIR_INTERFACES_FP_TYPE_INTERFACE |
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
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
Oops, something went wrong.