summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2019-11-18 10:45:23 -0800
committerEric Christopher <echristo@gmail.com>2019-11-18 10:46:48 -0800
commit30e7ee3c4bac4a12ea584a879aa320bd4e035cc2 (patch)
tree3c93193eeac41921667a7e2e05fd207cf19670dd /llvm/lib/IR
parenta77b66a05625ea4271c2d76f65428cce02e4699e (diff)
downloadbcm5719-llvm-30e7ee3c4bac4a12ea584a879aa320bd4e035cc2.tar.gz
bcm5719-llvm-30e7ee3c4bac4a12ea584a879aa320bd4e035cc2.zip
Temporarily Revert "Add support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior="
and a follow-up NFC rearrangement as it's causing a crash on valid. Testcase is on the original review thread. This reverts commits af57dbf12e54f3a8ff48534bf1078f4de104c1cd and e6584b2b7b2de06f1e59aac41971760cac1e1b79
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/CMakeLists.txt1
-rw-r--r--llvm/lib/IR/FPEnv.cpp78
-rw-r--r--llvm/lib/IR/IntrinsicInst.cpp67
3 files changed, 65 insertions, 81 deletions
diff --git a/llvm/lib/IR/CMakeLists.txt b/llvm/lib/IR/CMakeLists.txt
index f53d536ca8e..a9012637277 100644
--- a/llvm/lib/IR/CMakeLists.txt
+++ b/llvm/lib/IR/CMakeLists.txt
@@ -22,7 +22,6 @@ add_llvm_library(LLVMCore
DiagnosticInfo.cpp
DiagnosticPrinter.cpp
Dominators.cpp
- FPEnv.cpp
Function.cpp
GVMaterializer.cpp
Globals.cpp
diff --git a/llvm/lib/IR/FPEnv.cpp b/llvm/lib/IR/FPEnv.cpp
deleted file mode 100644
index 00885265823..00000000000
--- a/llvm/lib/IR/FPEnv.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-//===-- FPEnv.cpp ---- FP Environment -------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-/// @file
-/// This file contains the implementations of entities that describe floating
-/// point environment.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ADT/StringSwitch.h"
-#include "llvm/IR/FPEnv.h"
-
-namespace llvm {
-
-Optional<fp::RoundingMode> StrToRoundingMode(StringRef RoundingArg) {
- // For dynamic rounding mode, we use round to nearest but we will set the
- // 'exact' SDNodeFlag so that the value will not be rounded.
- return StringSwitch<Optional<fp::RoundingMode>>(RoundingArg)
- .Case("round.dynamic", fp::rmDynamic)
- .Case("round.tonearest", fp::rmToNearest)
- .Case("round.downward", fp::rmDownward)
- .Case("round.upward", fp::rmUpward)
- .Case("round.towardzero", fp::rmTowardZero)
- .Default(None);
-}
-
-Optional<StringRef> RoundingModeToStr(fp::RoundingMode UseRounding) {
- Optional<StringRef> RoundingStr = None;
- switch (UseRounding) {
- case fp::rmDynamic:
- RoundingStr = "round.dynamic";
- break;
- case fp::rmToNearest:
- RoundingStr = "round.tonearest";
- break;
- case fp::rmDownward:
- RoundingStr = "round.downward";
- break;
- case fp::rmUpward:
- RoundingStr = "round.upward";
- break;
- case fp::rmTowardZero:
- RoundingStr = "round.towardzero";
- break;
- }
- return RoundingStr;
-}
-
-Optional<fp::ExceptionBehavior> StrToExceptionBehavior(StringRef ExceptionArg) {
- return StringSwitch<Optional<fp::ExceptionBehavior>>(ExceptionArg)
- .Case("fpexcept.ignore", fp::ebIgnore)
- .Case("fpexcept.maytrap", fp::ebMayTrap)
- .Case("fpexcept.strict", fp::ebStrict)
- .Default(None);
-}
-
-Optional<StringRef> ExceptionBehaviorToStr(fp::ExceptionBehavior UseExcept) {
- Optional<StringRef> ExceptStr = None;
- switch (UseExcept) {
- case fp::ebStrict:
- ExceptStr = "fpexcept.strict";
- break;
- case fp::ebIgnore:
- ExceptStr = "fpexcept.ignore";
- break;
- case fp::ebMayTrap:
- ExceptStr = "fpexcept.maytrap";
- break;
- }
- return ExceptStr;
-}
-
-} \ No newline at end of file
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 8b80d294a25..26ed46a9cd9 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -102,7 +102,8 @@ Value *InstrProfIncrementInst::getStep() const {
return ConstantInt::get(Type::getInt64Ty(Context), 1);
}
-Optional<fp::RoundingMode> ConstrainedFPIntrinsic::getRoundingMode() const {
+Optional<ConstrainedFPIntrinsic::RoundingMode>
+ConstrainedFPIntrinsic::getRoundingMode() const {
unsigned NumOperands = getNumArgOperands();
Metadata *MD =
cast<MetadataAsValue>(getArgOperand(NumOperands - 2))->getMetadata();
@@ -111,7 +112,43 @@ Optional<fp::RoundingMode> ConstrainedFPIntrinsic::getRoundingMode() const {
return StrToRoundingMode(cast<MDString>(MD)->getString());
}
-Optional<fp::ExceptionBehavior>
+Optional<ConstrainedFPIntrinsic::RoundingMode>
+ConstrainedFPIntrinsic::StrToRoundingMode(StringRef RoundingArg) {
+ // For dynamic rounding mode, we use round to nearest but we will set the
+ // 'exact' SDNodeFlag so that the value will not be rounded.
+ return StringSwitch<Optional<RoundingMode>>(RoundingArg)
+ .Case("round.dynamic", rmDynamic)
+ .Case("round.tonearest", rmToNearest)
+ .Case("round.downward", rmDownward)
+ .Case("round.upward", rmUpward)
+ .Case("round.towardzero", rmTowardZero)
+ .Default(None);
+}
+
+Optional<StringRef>
+ConstrainedFPIntrinsic::RoundingModeToStr(RoundingMode UseRounding) {
+ Optional<StringRef> RoundingStr = None;
+ switch (UseRounding) {
+ case ConstrainedFPIntrinsic::rmDynamic:
+ RoundingStr = "round.dynamic";
+ break;
+ case ConstrainedFPIntrinsic::rmToNearest:
+ RoundingStr = "round.tonearest";
+ break;
+ case ConstrainedFPIntrinsic::rmDownward:
+ RoundingStr = "round.downward";
+ break;
+ case ConstrainedFPIntrinsic::rmUpward:
+ RoundingStr = "round.upward";
+ break;
+ case ConstrainedFPIntrinsic::rmTowardZero:
+ RoundingStr = "round.towardzero";
+ break;
+ }
+ return RoundingStr;
+}
+
+Optional<ConstrainedFPIntrinsic::ExceptionBehavior>
ConstrainedFPIntrinsic::getExceptionBehavior() const {
unsigned NumOperands = getNumArgOperands();
Metadata *MD =
@@ -121,6 +158,32 @@ ConstrainedFPIntrinsic::getExceptionBehavior() const {
return StrToExceptionBehavior(cast<MDString>(MD)->getString());
}
+Optional<ConstrainedFPIntrinsic::ExceptionBehavior>
+ConstrainedFPIntrinsic::StrToExceptionBehavior(StringRef ExceptionArg) {
+ return StringSwitch<Optional<ExceptionBehavior>>(ExceptionArg)
+ .Case("fpexcept.ignore", ebIgnore)
+ .Case("fpexcept.maytrap", ebMayTrap)
+ .Case("fpexcept.strict", ebStrict)
+ .Default(None);
+}
+
+Optional<StringRef>
+ConstrainedFPIntrinsic::ExceptionBehaviorToStr(ExceptionBehavior UseExcept) {
+ Optional<StringRef> ExceptStr = None;
+ switch (UseExcept) {
+ case ConstrainedFPIntrinsic::ebStrict:
+ ExceptStr = "fpexcept.strict";
+ break;
+ case ConstrainedFPIntrinsic::ebIgnore:
+ ExceptStr = "fpexcept.ignore";
+ break;
+ case ConstrainedFPIntrinsic::ebMayTrap:
+ ExceptStr = "fpexcept.maytrap";
+ break;
+ }
+ return ExceptStr;
+}
+
bool ConstrainedFPIntrinsic::isUnaryOp() const {
switch (getIntrinsicID()) {
default:
OpenPOWER on IntegriCloud