ADT: add <bit> header, implement C++20 bit_cast, use
authorJF Bastien <jfbastien@apple.com>
Fri, 7 Sep 2018 23:08:26 +0000 (23:08 +0000)
committerJF Bastien <jfbastien@apple.com>
Fri, 7 Sep 2018 23:08:26 +0000 (23:08 +0000)
commit28655081a476d8808e9e2c0900d4ca87fb17abe3
tree0d3cc6e818710083eda5cd6472b6a9c7798cd770
parentf803b23879d9e1d9415ec1875713534dcc203df5
ADT: add <bit> header, implement C++20 bit_cast, use

Summary: I saw a few places that were punning through a union of FP and integer, and that made me sad. Luckily, C++20 adds bit_cast for exactly that purpose. Implement our own version in ADT (without constexpr, leaving us a bit sad), and use it in the few places my grep-fu found silly union punning.

Reviewers: javed.absar

Subscribers: dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D51693

llvm-svn: 341728
llvm/include/llvm/ADT/bit.h [new file with mode: 0644]
llvm/lib/Support/APInt.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
llvm/lib/Target/ARM/MCTargetDesc/ARMAddressingModes.h