Anton Vayvod
2006-Aug-16 14:14 UTC
[LLVMdev] allocation_order_begin takes non-const reference for MachineFunction
Hi! Could someone tell me the reason why allocation_order_begin method of TargetRegisterClass class takes a non-const reference to MachineFunction? I can't imagine why this method will change function and didn't find any override within llvm source which uses non-const methods of the MF parameter. Just run into compiler error because I passed a const reference to the method. Best regards, Tony. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060816/34ce8094/attachment.html>
Reid Spencer
2006-Aug-16 15:37 UTC
[LLVMdev] allocation_order_begin takes non-const reference for MachineFunction
Hi Tony, It doesn't look right to me either. The "begin" and "end" methods which allocation_order_begin should return a const_iterator instead of an iterator. Those methods are "const". And, yes, the MachineFunction reference isn't even used so at the very least it could be const (if not removed). However, I'm not an expert in this area of the code. Chris or someone else will have to look at this and provide a determination. Reid. On Wed, 2006-08-16 at 18:14 +0400, Anton Vayvod wrote:> Hi! > > Could someone tell me the reason why allocation_order_begin method of > TargetRegisterClass class takes a non-const reference to > MachineFunction? I can't imagine why this method will change function > and didn't find any override within llvm source which uses non-const > methods of the MF parameter. > > Just run into compiler error because I passed a const reference to the > method. > > Best regards, > > Tony. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Anton Vayvod
2006-Aug-16 16:01 UTC
[LLVMdev] allocation_order_begin takes non-const reference for MachineFunction
Thanks, Reid. I've found that some overrides of allocation_order_begin() calls MachineFunction getInfo method. this method is not const. However, I think there could be default const implementation (const_cast of non-const method) and then allocation_order_begin() could be const. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060816/4109a977/attachment.html>
Possibly Parallel Threads
- [LLVMdev] allocation_order_begin takes non-const reference for MachineFunction
- [LLVMdev] allocation_order_begin takes non-const reference for MachineFunction
- [LLVMdev] allocation_order_begin takes non-const reference for MachineFunction
- [LLVMdev] allocation_order_begin takes non-const reference for MachineFunction
- [LLVMdev] allocation_order_begin takes non-const reference for MachineFunction