-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[CIR] floating-point, pointer, and function types #120484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b76111a
[CIR] floating-point, pointer, and function types
dkolsen-pgi 512b4b5
[CIR] Follow-up to floating-point upstream change
dkolsen-pgi 666cda9
[CIR] Improve a couple assert messages
dkolsen-pgi f9b242d
[CIR] Merge change to CIRGenTypes::isFuncParamTypeConvertible
dkolsen-pgi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
//===---------------------------------------------------------------------===// | ||
// | ||
// 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 LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_H | ||
#define LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_H | ||
|
||
#include "mlir/IR/Types.h" | ||
#include "llvm/ADT/APFloat.h" | ||
|
||
/// Include the tablegen'd interface declarations. | ||
#include "clang/CIR/Interfaces/CIRFPTypeInterface.h.inc" | ||
|
||
#endif // LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_H |
This file contains hidden or 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 @@ | ||
//===- CIRFPTypeInterface.td - CIR FP Interface Definitions -----*- C++ -*-===// | ||
bcardosolopes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// | ||
// 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 LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_TD | ||
#define LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_TD | ||
|
||
include "mlir/IR/OpBase.td" | ||
|
||
def CIRFPTypeInterface : TypeInterface<"CIRFPTypeInterface"> { | ||
let description = [{ | ||
Contains helper functions to query properties about a floating-point type. | ||
}]; | ||
let cppNamespace = "::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 // LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_TD |
This file contains hidden or 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,14 @@ | ||
# This replicates part of the add_mlir_interface cmake function from MLIR that | ||
# cannot be used here. This happens because it expects to be run inside MLIR | ||
# directory which is not the case for CIR (and also FIR, both have similar | ||
# workarounds). | ||
|
||
function(add_clang_mlir_type_interface interface) | ||
set(LLVM_TARGET_DEFINITIONS ${interface}.td) | ||
mlir_tablegen(${interface}.h.inc -gen-type-interface-decls) | ||
mlir_tablegen(${interface}.cpp.inc -gen-type-interface-defs) | ||
add_public_tablegen_target(MLIR${interface}IncGen) | ||
add_dependencies(mlir-generic-headers MLIR${interface}IncGen) | ||
endfunction() | ||
|
||
add_clang_mlir_type_interface(CIRFPTypeInterface) |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.