aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@redhat.com>2021-03-24 16:45:04 -0400
committerserge-sans-paille <sguelton@redhat.com>2021-04-17 08:17:33 +0200
commitd6de1e1a71406c75a4ea4d5a2fe84289f07ea3a1 (patch)
treeabbf039ca49e20d35a9796d4fae72300ac4f5072 /llvm/lib/Target/Sparc/SparcTargetMachine.cpp
parentbbba69425c6131283163af99201577c296aa3877 (diff)
downloadllvm-d6de1e1a71406c75a4ea4d5a2fe84289f07ea3a1.zip
llvm-d6de1e1a71406c75a4ea4d5a2fe84289f07ea3a1.tar.gz
llvm-d6de1e1a71406c75a4ea4d5a2fe84289f07ea3a1.tar.bz2
Normalize interaction with boolean attributes
Such attributes can either be unset, or set to "true" or "false" (as string). throughout the codebase, this led to inelegant checks ranging from if (Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true") to if (Fn->hasAttribute("no-jump-tables") && Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true") Introduce a getValueAsBool that normalize the check, with the following behavior: no attributes or attribute set to "false" => return false attribute set to "true" => return true Differential Revision: https://reviews.llvm.org/D99299
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/Sparc/SparcTargetMachine.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/Target/Sparc/SparcTargetMachine.cpp b/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
index ae5228d..083339b 100644
--- a/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
+++ b/llvm/lib/Target/Sparc/SparcTargetMachine.cpp
@@ -117,9 +117,7 @@ SparcTargetMachine::getSubtargetImpl(const Function &F) const {
// FIXME: This is related to the code below to reset the target options,
// we need to know whether or not the soft float flag is set on the
// function, so we can enable it as a subtarget feature.
- bool softFloat =
- F.hasFnAttribute("use-soft-float") &&
- F.getFnAttribute("use-soft-float").getValueAsString() == "true";
+ bool softFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
if (softFloat)
FS += FS.empty() ? "+soft-float" : ",+soft-float";