[RFC] Move fixed-point classes from Clang to LLVM and add a FixedPointBuilder


To facilitate the implementation of Embedded-C’s support for fixed-point numbers, classes were added to Clang to handle the representation of fixed-point type semantics and operations. These classes are FixedPointSemantics and APFixedPoint, mirroring fltSemantics and APFloat in LLVM. They were added to Clang and not LLVM as the fixed-point types they represent primarily exist as concepts on the C level rather than in IR. The possibility to move them to LLVM in the future was left open, should the need arise.

Following discussions in https://reviews.llvm.org/D82663, we’ve determined that it would be beneficial to add a canonical LLVM IR interface for constructing fixed-point operations. In order to describe the semantics of these operations, it’s necessary to describe the semantics of the conceptual fixed-point types that they operate on. For this reason, I would like to suggest moving the FixedPointSemantics and APFixedPoint classes into ADT/Support. Both classes are completely Clang-agnostic, so the move is simply a matter of moving the file+unittests in question, and remapping include paths and namespaces to the new location.

Most of the testing done on APFixedPoint has been done through C code rather than via unit tests. It may be that more tests need to be added on the LLVM side, unless it’s acceptable that the Clang usage tests the class sufficiently.

A patch for moving the fixed-point classes can be found here: https://reviews.llvm.org/D85312

Following the move, a new FixedPointBuilder would be added to llvm/IR. The public interface would work similarly to MatrixBuilder.

A patch for adding FixedPointBuilder can be found here: https://reviews.llvm.org/D85314