summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-09-29 21:57:54 +0000
committerEric Christopher <echristo@gmail.com>2014-09-29 21:57:54 +0000
commit6a0551e43a1878d174c00a9e4d8ab007c4567128 (patch)
tree07f54ee21033af251ef4a9f435c6bfafd89146ad /llvm/lib
parent9b270d4dc9b1c5a668e9013c6dcba48b7e1e4cb0 (diff)
downloadbcm5719-llvm-6a0551e43a1878d174c00a9e4d8ab007c4567128.tar.gz
bcm5719-llvm-6a0551e43a1878d174c00a9e4d8ab007c4567128.zip
Add soft-float to the key for the subtarget lookup in the TargetMachine
map, this makes sure that we can compile the same code for two different ABIs (hard and soft float) in the same module. Update one testcase accordingly (and fix some confusing naming) and add a new testcase as well with the ordering swapped which would highlight the problem. llvm-svn: 218632
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/MipsTargetMachine.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/MipsTargetMachine.cpp b/llvm/lib/Target/Mips/MipsTargetMachine.cpp
index 542f24fe8eb..31c84bf5176 100644
--- a/llvm/lib/Target/Mips/MipsTargetMachine.cpp
+++ b/llvm/lib/Target/Mips/MipsTargetMachine.cpp
@@ -105,12 +105,24 @@ MipsTargetMachine::getSubtargetImpl(const Function &F) const {
!FnAttrs.getAttribute(AttributeSet::FunctionIndex, "nomips16")
.hasAttribute(Attribute::None);
+ // 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 before we can generate a subtarget. We also need to use
+ // it as a key for the subtarget since that can be the only difference
+ // between two functions.
+ Attribute SFAttr =
+ FnAttrs.getAttribute(AttributeSet::FunctionIndex, "use-soft-float");
+ bool softFloat = !SFAttr.hasAttribute(Attribute::None)
+ ? (SFAttr.getValueAsString() == "true" ? true : false)
+ : Options.UseSoftFloat;
+
if (hasMips16Attr)
FS += FS.empty() ? "+mips16" : ",+mips16";
else if (hasNoMips16Attr)
FS += FS.empty() ? "-mips16" : ",-mips16";
- auto &I = SubtargetMap[CPU + FS];
+ auto &I = SubtargetMap[CPU + FS + (softFloat ? "use-soft-float=true"
+ : "use-soft-float=false")];
if (!I) {
// This needs to be done before we create a new subtarget since any
// creation will depend on the TM and the code generation flags on the
OpenPOWER on IntegriCloud