diff options
author | Diana Picus <diana.picus@linaro.org> | 2017-07-05 12:57:24 +0000 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2017-07-05 12:57:24 +0000 |
commit | fc1675eb16785cebe4286af15d7853ec09854e0b (patch) | |
tree | 92f3f70d84c7e59b6e805a1ed3d991f9a64611ca /llvm/lib/Target/ARM/ARMLegalizerInfo.cpp | |
parent | 6d14fdf62da34df9e65669a00745d597cfb882df (diff) | |
download | bcm5719-llvm-fc1675eb16785cebe4286af15d7853ec09854e0b.tar.gz bcm5719-llvm-fc1675eb16785cebe4286af15d7853ec09854e0b.zip |
[GlobalISel] Refactor Legalizer helpers for libcalls
We used to have a helper that replaced an instruction with a libcall.
That turns out to be too aggressive, since sometimes we need to replace
the instruction with at least two libcalls. Therefore, change our
existing helper to only create the libcall and leave the instruction
removal as a separate step. Also rename the helper accordingly.
llvm-svn: 307149
Diffstat (limited to 'llvm/lib/Target/ARM/ARMLegalizerInfo.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMLegalizerInfo.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp index 10fdb286376..af6505c9862 100644 --- a/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp +++ b/llvm/lib/Target/ARM/ARMLegalizerInfo.cpp @@ -119,6 +119,8 @@ bool ARMLegalizerInfo::legalizeCustom(MachineInstr &MI, MachineIRBuilder &MIRBuilder) const { using namespace TargetOpcode; + MIRBuilder.setInstr(MI); + switch (MI.getOpcode()) { default: return false; @@ -140,9 +142,9 @@ bool ARMLegalizerInfo::legalizeCustom(MachineInstr &MI, auto RetVal = MRI.createGenericVirtualRegister( getLLTForType(*RetTy, MIRBuilder.getMF().getDataLayout())); - auto Status = replaceWithLibcall(MI, MIRBuilder, Libcall, {RetVal, RetTy}, - {{MI.getOperand(1).getReg(), ArgTy}, - {MI.getOperand(2).getReg(), ArgTy}}); + auto Status = createLibcall(MIRBuilder, Libcall, {RetVal, RetTy}, + {{MI.getOperand(1).getReg(), ArgTy}, + {MI.getOperand(2).getReg(), ArgTy}}); if (Status != LegalizerHelper::Legalized) return false; @@ -153,7 +155,10 @@ bool ARMLegalizerInfo::legalizeCustom(MachineInstr &MI, {MRI.createGenericVirtualRegister(LLT::scalar(32)), OriginalResult}, RetVal); - return LegalizerHelper::Legalized; + break; } } + + MI.eraseFromParent(); + return true; } |