This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add Size Saving for String To Float
AbandonedPublic

Authored by michaelrj on Jul 26 2022, 9:56 AM.

Details

Reviewers
sivachandra
lntue
Summary

String to float uses the Eisel-Lemire algorithm for better performance
in most cases, however this requires a very large table. Some
configurations, such as embedded devices, don't care about speed as much
as code size. This patch adds a flag to disable the Eisel-Lemire
algorithm as well as other code size savings for string to float.

Diff Detail

Event Timeline

michaelrj created this revision.Jul 26 2022, 9:56 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 26 2022, 9:56 AM
michaelrj requested review of this revision.Jul 26 2022, 9:56 AM

The flag name is TBD, I picked LIBC_SIZE because it would be obvious what it was being used for, but it doesn't seem like a good long-term solution.

The flag name is TBD, I picked LIBC_SIZE because it would be obvious what it was being used for, but it doesn't seem like a good long-term solution.

Could I have instead a custom entrypoints.txt file with an adapted symbols list for my embedded target? Then I can mix and match..

In src/stdlib maybe, add a README.md which describes the new knob this patch is adding.

libc/src/__support/str_to_float.h
81

Use a more specific flag name. Also, instead of excluding large blocks of code, move this to a separate header file and conditionally include it.

592–613

Can this block be moved in to a function by itself and invoked conditionally?

libc/test/src/__support/str_to_float_test.cpp
17

Instead of conditional exclusion, move them to a more focused test.