Skip to content

Commit 97c2316

Browse files
committed
[NFC] Rename functions to match our naming scheme.
In the review of D111085 it was pointed out that these functions don't conform to the naming scheme in use in LLVM. With this commit we should be good for all of FPEnv.h.
1 parent 548b01c commit 97c2316

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

llvm/include/llvm/IR/FPEnv.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ enum ExceptionBehavior : uint8_t {
3939
/// Returns a valid RoundingMode enumerator when given a string
4040
/// that is valid as input in constrained intrinsic rounding mode
4141
/// metadata.
42-
Optional<RoundingMode> StrToRoundingMode(StringRef);
42+
Optional<RoundingMode> convertStrToRoundingMode(StringRef);
4343

4444
/// For any RoundingMode enumerator, returns a string valid as input in
4545
/// constrained intrinsic rounding mode metadata.
46-
Optional<StringRef> RoundingModeToStr(RoundingMode);
46+
Optional<StringRef> convertRoundingModeToStr(RoundingMode);
4747

4848
/// Returns a valid ExceptionBehavior enumerator when given a string
4949
/// valid as input in constrained intrinsic exception behavior metadata.
50-
Optional<fp::ExceptionBehavior> StrToExceptionBehavior(StringRef);
50+
Optional<fp::ExceptionBehavior> convertStrToExceptionBehavior(StringRef);
5151

5252
/// For any ExceptionBehavior enumerator, returns a string valid as
5353
/// input in constrained intrinsic exception behavior metadata.
54-
Optional<StringRef> ExceptionBehaviorToStr(fp::ExceptionBehavior);
54+
Optional<StringRef> convertExceptionBehaviorToStr(fp::ExceptionBehavior);
5555

5656
/// Returns true if the exception handling behavior and rounding mode
5757
/// match what is used in the default floating point environment.

llvm/include/llvm/IR/IRBuilder.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class IRBuilderBase {
316316
/// Set the exception handling to be used with constrained floating point
317317
void setDefaultConstrainedExcept(fp::ExceptionBehavior NewExcept) {
318318
#ifndef NDEBUG
319-
Optional<StringRef> ExceptStr = ExceptionBehaviorToStr(NewExcept);
319+
Optional<StringRef> ExceptStr = convertExceptionBehaviorToStr(NewExcept);
320320
assert(ExceptStr.hasValue() && "Garbage strict exception behavior!");
321321
#endif
322322
DefaultConstrainedExcept = NewExcept;
@@ -325,7 +325,7 @@ class IRBuilderBase {
325325
/// Set the rounding mode handling to be used with constrained floating point
326326
void setDefaultConstrainedRounding(RoundingMode NewRounding) {
327327
#ifndef NDEBUG
328-
Optional<StringRef> RoundingStr = RoundingModeToStr(NewRounding);
328+
Optional<StringRef> RoundingStr = convertRoundingModeToStr(NewRounding);
329329
assert(RoundingStr.hasValue() && "Garbage strict rounding mode!");
330330
#endif
331331
DefaultConstrainedRounding = NewRounding;
@@ -1176,7 +1176,7 @@ class IRBuilderBase {
11761176
if (Rounding.hasValue())
11771177
UseRounding = Rounding.getValue();
11781178

1179-
Optional<StringRef> RoundingStr = RoundingModeToStr(UseRounding);
1179+
Optional<StringRef> RoundingStr = convertRoundingModeToStr(UseRounding);
11801180
assert(RoundingStr.hasValue() && "Garbage strict rounding mode!");
11811181
auto *RoundingMDS = MDString::get(Context, RoundingStr.getValue());
11821182

@@ -1189,7 +1189,7 @@ class IRBuilderBase {
11891189
if (Except.hasValue())
11901190
UseExcept = Except.getValue();
11911191

1192-
Optional<StringRef> ExceptStr = ExceptionBehaviorToStr(UseExcept);
1192+
Optional<StringRef> ExceptStr = convertExceptionBehaviorToStr(UseExcept);
11931193
assert(ExceptStr.hasValue() && "Garbage strict exception behavior!");
11941194
auto *ExceptMDS = MDString::get(Context, ExceptStr.getValue());
11951195

llvm/lib/IR/FPEnv.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace llvm {
1919

20-
Optional<RoundingMode> StrToRoundingMode(StringRef RoundingArg) {
20+
Optional<RoundingMode> convertStrToRoundingMode(StringRef RoundingArg) {
2121
// For dynamic rounding mode, we use round to nearest but we will set the
2222
// 'exact' SDNodeFlag so that the value will not be rounded.
2323
return StringSwitch<Optional<RoundingMode>>(RoundingArg)
@@ -30,7 +30,7 @@ Optional<RoundingMode> StrToRoundingMode(StringRef RoundingArg) {
3030
.Default(None);
3131
}
3232

33-
Optional<StringRef> RoundingModeToStr(RoundingMode UseRounding) {
33+
Optional<StringRef> convertRoundingModeToStr(RoundingMode UseRounding) {
3434
Optional<StringRef> RoundingStr = None;
3535
switch (UseRounding) {
3636
case RoundingMode::Dynamic:
@@ -57,15 +57,17 @@ Optional<StringRef> RoundingModeToStr(RoundingMode UseRounding) {
5757
return RoundingStr;
5858
}
5959

60-
Optional<fp::ExceptionBehavior> StrToExceptionBehavior(StringRef ExceptionArg) {
60+
Optional<fp::ExceptionBehavior>
61+
convertStrToExceptionBehavior(StringRef ExceptionArg) {
6162
return StringSwitch<Optional<fp::ExceptionBehavior>>(ExceptionArg)
6263
.Case("fpexcept.ignore", fp::ebIgnore)
6364
.Case("fpexcept.maytrap", fp::ebMayTrap)
6465
.Case("fpexcept.strict", fp::ebStrict)
6566
.Default(None);
6667
}
6768

68-
Optional<StringRef> ExceptionBehaviorToStr(fp::ExceptionBehavior UseExcept) {
69+
Optional<StringRef>
70+
convertExceptionBehaviorToStr(fp::ExceptionBehavior UseExcept) {
6971
Optional<StringRef> ExceptStr = None;
7072
switch (UseExcept) {
7173
case fp::ebStrict:

llvm/lib/IR/IntrinsicInst.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Optional<RoundingMode> ConstrainedFPIntrinsic::getRoundingMode() const {
195195
MD = MAV->getMetadata();
196196
if (!MD || !isa<MDString>(MD))
197197
return None;
198-
return StrToRoundingMode(cast<MDString>(MD)->getString());
198+
return convertStrToRoundingMode(cast<MDString>(MD)->getString());
199199
}
200200

201201
Optional<fp::ExceptionBehavior>
@@ -207,7 +207,7 @@ ConstrainedFPIntrinsic::getExceptionBehavior() const {
207207
MD = MAV->getMetadata();
208208
if (!MD || !isa<MDString>(MD))
209209
return None;
210-
return StrToExceptionBehavior(cast<MDString>(MD)->getString());
210+
return convertStrToExceptionBehavior(cast<MDString>(MD)->getString());
211211
}
212212

213213
bool ConstrainedFPIntrinsic::isDefaultFPEnvironment() const {

0 commit comments

Comments
 (0)