hanickadot wrote:

> Is there some explanation of the set of builtins you chose somewhere? How is 
> "masking" a pointer different from the existing 
> __builtin_align_down/__builtin_align_up?

Intention is to allow to use any bits in pointer for tagging and give freedom. 
To do so. I'm not proposing these now for LLVM, this is just prototype, so I 
can get some review of library design, but also I wanted to give here version 
which somehow works, but it doesn't need to be perfect.

> I'm pretty sure your implementation of comparison operators doesn't actually 
> work correctly; what happens if you compare a tagged pointer to a struct to 
> pointer to a member of the struct?

(If we are talking libcxx). 
Not sure what you mean. They should have incompatible types for comparison and 
it won't match the operator.  If they are of compatible types this tagged_ptr 
is doing untagging first with function `.pointer()` so you should get original 
untagged pointer.  If you try to tag pointer in a way which would make original 
value irrecoverable you are breaking semantic requirement inside constructor of 
tagged_ptr.



In ExprConstant.cpp the comparison of tags is happening at the end of comparing 
pointers, where they were compared based on offsets (calculated out of LValue's 
path) so they should be same, but they can differ in tag.


https://github.com/llvm/llvm-project/pull/111861
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to