matthias-springer wrote:

There are various places in `APFloat.h` and `APFloat.cpp` that contain 
switch-case / if-check sequences for checking the type of semantics. I'm trying 
to reduce these. What I had in mind:

* Removing `APFloatBase::IEEEhalf()`, `APFloatBase::BFloat()`, ..., and use a 
single `APFloatBase::getSemantics` instead. (But there are a lot of places that 
call `IEEEHalf` etc.)
* Add function pointers `APInt (*convertToAPInt)(const APFloat &)` and `APFloat 
(*initFromAPInt)(const APInt &)` to `fltSemantics`. Each semantics can specify 
how to convert between APFloat and APInt. No more switch case statements in 
`IEEEFloat::bitcastToAPInt()` etc.
* Longer term: Turn `fltSemantics` into a public class that can be used to 
define custom floating-point types in downstream projects (without having to 
modify LLVM).

Any thoughts?

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

Reply via email to