summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-14 15:38:12 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-14 15:38:12 +0000
commit8f66a3afe01ce6e3494374dce43d5b0a7e90bbab (patch)
treee6d1d7f285939e0e6c609097b64247d1f9171c80 /llvm
parent576114e676d3670b070691f94531619415ebc4a8 (diff)
downloadbcm5719-llvm-8f66a3afe01ce6e3494374dce43d5b0a7e90bbab.tar.gz
bcm5719-llvm-8f66a3afe01ce6e3494374dce43d5b0a7e90bbab.zip
x86: getCalleeSavedRegs() would crash on 0 (so don't default to it)
The current logic assumes that MF is not 0. Assert that it isn't, and remove the default of 0 from the header. llvm-svn: 203934
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/X86/X86RegisterInfo.cpp1
-rw-r--r--llvm/lib/Target/X86/X86RegisterInfo.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp
index 43057c0fdf6..ccbe579a468 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -237,6 +237,7 @@ X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
bool HasAVX = TM.getSubtarget<X86Subtarget>().hasAVX();
bool HasAVX512 = TM.getSubtarget<X86Subtarget>().hasAVX512();
+ assert(MF && "MachineFunction required");
switch (MF->getFunction()->getCallingConv()) {
case CallingConv::GHC:
case CallingConv::HiPE:
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.h b/llvm/lib/Target/X86/X86RegisterInfo.h
index 3ee328f2e59..447ff953da8 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.h
+++ b/llvm/lib/Target/X86/X86RegisterInfo.h
@@ -101,7 +101,7 @@ public:
/// getCalleeSavedRegs - Return a null-terminated list of all of the
/// callee-save registers on this target.
const uint16_t *
- getCalleeSavedRegs(const MachineFunction* MF = 0) const override;
+ getCalleeSavedRegs(const MachineFunction* MF) const override;
const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
const uint32_t *getNoPreservedMask() const;
OpenPOWER on IntegriCloud