This is an archive of the discontinued LLVM Phabricator instance.

[APInt] Add a public typedef for the internal type of APInt use it instead of integerPart. Make APINT_BITS_PER_WORD and APINT_WORD_SIZE public.
ClosedPublic

Authored by craig.topper on Mar 30 2017, 9:39 PM.

Details

Summary

This patch is one step to attempt to unify the main APInt interface and the tc functions used by APFloat.

This patch adds a WordType to APInt and uses that in all the tc functions. I've added temporary typedefs to APFloat to alias it to integerPart to keep the patch size down. I'll work on removing that in a future patch.

In future patches I hope to reuse the tc functions to implement some of the main APInt functionality.

I may remove APINT_ from BITS_PER_WORD and WORD_SIZE constants so that we don't have the repetitive APInt::APINT_ externally.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Mar 30 2017, 9:39 PM
hans edited edge metadata.Mar 31 2017, 1:51 AM

Seems reasonable to me, but Tim is more familiar with APFloat, so it would be good if he could take a look.

include/llvm/ADT/APInt.h
75 ↗(On Diff #93584)

ultra nit: finish comment with a period (also below).

lib/Support/APInt.cpp
739 ↗(On Diff #93584)

should this be WordType?

timshen edited edge metadata.Mar 31 2017, 2:03 AM

LGTM for APFloat part.

RKSimon added inline comments.Mar 31 2017, 7:42 AM
lib/Support/APFloat.cpp
41 ↗(On Diff #93584)

If these are temporary, add a TODO?

craig.topper added inline comments.Mar 31 2017, 8:53 AM
lib/Support/APInt.cpp
739 ↗(On Diff #93584)

In the long term, yes. I chose uint64_t to be consistent with the rest of the APInt interface methods in the short term. In this patch I just wanted to use WordType in the tc static functions.

Address review comments

craig.topper marked 2 inline comments as done.Mar 31 2017, 9:23 AM
RKSimon accepted this revision.Apr 2 2017, 11:15 AM

LGTM

This revision is now accepted and ready to land.Apr 2 2017, 11:15 AM
This revision was automatically updated to reflect the committed changes.