summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMFrameLowering.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-05-01 04:19:59 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-05-01 04:19:59 +0000
commita1a235f869cd1c7d2716ab20242f06589775442e (patch)
treed9ac45dab90b2f1f5d9e2747c1da0c93c3542ad2 /lib/Target/ARM/ARMFrameLowering.cpp
parentfd2fb489242bd1df75d3aa33e2ca38c6c62152d9 (diff)
downloadllvm-a1a235f869cd1c7d2716ab20242f06589775442e.tar.gz
llvm-a1a235f869cd1c7d2716ab20242f06589775442e.tar.bz2
llvm-a1a235f869cd1c7d2716ab20242f06589775442e.tar.xz
ARM: fix memory leak, simplify WoA stack probing
This fixes the memory leak introduced with the initial addition of support for WoA stack probing. Now that the pseudo-instruction expansion can handle an external symbol, use that to generate the load which simplifies the logic as well as avoids the memory leak. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMFrameLowering.cpp')
-rw-r--r--lib/Target/ARM/ARMFrameLowering.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/Target/ARM/ARMFrameLowering.cpp b/lib/Target/ARM/ARMFrameLowering.cpp
index af4c97db68..c900015696 100644
--- a/lib/Target/ARM/ARMFrameLowering.cpp
+++ b/lib/Target/ARM/ARMFrameLowering.cpp
@@ -25,7 +25,6 @@
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Function.h"
-#include "llvm/IR/Module.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetOptions.h"
@@ -316,20 +315,15 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF) const {
.addReg(ARM::R4, RegState::Implicit);
break;
case CodeModel::Large:
- case CodeModel::JITDefault: {
- LLVMContext &Ctx = MF.getMMI().getModule()->getContext();
- const GlobalValue *F =
- Function::Create(FunctionType::get(Type::getVoidTy(Ctx), false),
- GlobalValue::AvailableExternallyLinkage, "__chkstk");
-
+ case CodeModel::JITDefault:
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2MOVi32imm), ARM::R12)
- .addGlobalAddress(F);
+ .addExternalSymbol("__chkstk");
+
BuildMI(MBB, MBBI, dl, TII.get(ARM::BLX))
.addReg(ARM::R12, RegState::Kill)
.addReg(ARM::R4, RegState::Implicit);
break;
}
- }
AddDefaultCC(AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::t2SUBrr),
ARM::SP)