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
[CIR][CIRGen] Support for signed #cir.ptr #598
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for improving this. Only necessary change is to change ConstPtrAttr
definition: the value
to be a mlir::IntegerAttr
instead and build that attribute in terms of i64
. This way we don't have to worry specifying what the contract using int64_t
should be.
The constant initialization isn't related to the pointee. We should be able to write #cir.ptr<-1 : i64> : !cir.ptr<whatever>
Thanks! I updated this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the comments. One more nit and we should be good
let description = [{ | ||
A pointer attribute is a literal attribute that represents an integral | ||
value of a pointer type. | ||
}]; | ||
let builders = [ | ||
AttrBuilderWithInferredContext<(ins "Type":$type, "uint64_t":$value), [{ | ||
return $_get(type.getContext(), type.cast<mlir::cir::PointerType>(), value); | ||
AttrBuilderWithInferredContext<(ins "Type":$type, "int64_t":$value), [{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we remove this functionality, better if we force whomever is creating the attribute to pass in the mlir::IntegerType
, assumptions might lead to subtle mistakes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Will merge on the code formatting gets fixed. |
thanks! Fixed |
The constant initialization isn't related to the pointee. We should be able to write #cir.ptr<-1 : i64> : !cir.ptr