Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/include/clang/CIR/Dialect/IR/CIRTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class CIR_Type<string name, string typeMnemonic, list<Trait> traits = [],
def CIR_IntType : CIR_Type<"Int", "int", [
DeclareTypeInterfaceMethods<DataLayoutTypeInterface>,
DeclareTypeInterfaceMethods<CIR_SizedTypeInterface>,
DeclareTypeInterfaceMethods<CIR_IntTypeInterface>,
]> {
let summary = "Integer type with arbitrary precision up to a fixed limit";
let description = [{
Expand Down
44 changes: 44 additions & 0 deletions clang/include/clang/CIR/Interfaces/CIRTypeInterfaces.td
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,50 @@

include "mlir/IR/OpBase.td"

def CIR_IntTypeInterface : TypeInterface<"IntTypeInterface"> {
let description = [{
Contains helper functions to query properties about an integer type.
}];

let cppNamespace = "::cir";

let methods = [
InterfaceMethod<[{
Returns true if this is a signed integer type.
}],
/*retTy=*/"bool",
/*methodName=*/"isSigned",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
return $_type.isSigned();
}]
>,
InterfaceMethod<[{
Returns true if this is an unsigned integer type.
}],
/*retTy=*/"bool",
/*methodName=*/"isUnsigned",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
return $_type.isUnsigned();
}]
>,
InterfaceMethod<[{
Returns the bit width of this integer type.
}],
/*retTy=*/"unsigned",
/*methodName=*/"getWidth",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
return $_type.getWidth();
}]
>
];
}

def CIR_FPTypeInterface : TypeInterface<"FPTypeInterface"> {
let description = [{
Contains helper functions to query properties about a floating-point type.
Expand Down
Loading