aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2020-09-17 17:50:42 -0400
committerMatt Arsenault <Matthew.Arsenault@amd.com>2020-09-18 09:55:47 -0400
commit751a6c5760b8de591cf241effbdad1b1cae67814 (patch)
treecafb70d01ad906c5796b33ce642519eebbd41826 /llvm/lib/IR/Function.cpp
parent05c02eda4552076dc08ce34866b3d8ee33bbf842 (diff)
downloadllvm-751a6c5760b8de591cf241effbdad1b1cae67814.zip
llvm-751a6c5760b8de591cf241effbdad1b1cae67814.tar.gz
llvm-751a6c5760b8de591cf241effbdad1b1cae67814.tar.bz2
IR: Move denormal mode parsing from MachineFunction to Function
This was just inspecting the IR to begin with, and is useful to check in some places in the IR.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index d03ffbb..ec1000c 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -570,6 +570,21 @@ void Function::addDereferenceableOrNullParamAttr(unsigned ArgNo,
setAttributes(PAL);
}
+DenormalMode Function::getDenormalMode(const fltSemantics &FPType) const {
+ if (&FPType == &APFloat::IEEEsingle()) {
+ Attribute Attr = getFnAttribute("denormal-fp-math-f32");
+ StringRef Val = Attr.getValueAsString();
+ if (!Val.empty())
+ return parseDenormalFPAttribute(Val);
+
+ // If the f32 variant of the attribute isn't specified, try to use the
+ // generic one.
+ }
+
+ Attribute Attr = getFnAttribute("denormal-fp-math");
+ return parseDenormalFPAttribute(Attr.getValueAsString());
+}
+
const std::string &Function::getGC() const {
assert(hasGC() && "Function has no collector");
return getContext().getGC(*this);