diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2017-12-11 18:57:54 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2017-12-11 18:57:54 +0000 |
commit | a8ab1b75cb0d84ea61642d7b7c0139e6e367c28e (patch) | |
tree | e5c4b89bd21c115664b1be7bb84fa2ea11f8b3bd /llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp | |
parent | e83876e31d9da26c9e0c11cf7463e4a645e96bc4 (diff) | |
download | bcm5719-llvm-a8ab1b75cb0d84ea61642d7b7c0139e6e367c28e.tar.gz bcm5719-llvm-a8ab1b75cb0d84ea61642d7b7c0139e6e367c28e.zip |
[Hexagon] Add support for Hexagon V65
llvm-svn: 320404
Diffstat (limited to 'llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp index a6a950ea045..3d8d561e31c 100644 --- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp @@ -336,6 +336,8 @@ static bool needsStackFrame(const MachineBasicBlock &MBB, const BitVector &CSR, /// in the block. static bool hasTailCall(const MachineBasicBlock &MBB) { MachineBasicBlock::const_iterator I = MBB.getLastNonDebugInstr(); + if (I == MBB.end()) + return false; unsigned RetOpc = I->getOpcode(); return RetOpc == Hexagon::PS_tailcall_i || RetOpc == Hexagon::PS_tailcall_r; } @@ -636,7 +638,9 @@ void HexagonFrameLowering::insertEpilogueInBlock(MachineBasicBlock &MBB) const { // Handle EH_RETURN. if (RetOpc == Hexagon::EH_RETURN_JMPR) { - BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::L2_deallocframe)); + BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::L2_deallocframe)) + .addDef(Hexagon::D15) + .addReg(Hexagon::R30); BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::A2_add), SP) .addReg(SP) .addReg(Hexagon::R28); @@ -682,11 +686,15 @@ void HexagonFrameLowering::insertEpilogueInBlock(MachineBasicBlock &MBB) const { // otherwise just add deallocframe. The function could be returning via a // tail call. if (RetOpc != Hexagon::PS_jmpret || DisableDeallocRet) { - BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::L2_deallocframe)); + BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::L2_deallocframe)) + .addDef(Hexagon::D15) + .addReg(Hexagon::R30); return; } unsigned NewOpc = Hexagon::L4_return; - MachineInstr *NewI = BuildMI(MBB, RetI, dl, HII.get(NewOpc)); + MachineInstr *NewI = BuildMI(MBB, RetI, dl, HII.get(NewOpc)) + .addDef(Hexagon::D15) + .addReg(Hexagon::R30); // Transfer the function live-out registers. NewI->copyImplicitOps(MF, *RetI); MBB.erase(RetI); @@ -709,10 +717,13 @@ void HexagonFrameLowering::insertAllocframe(MachineBasicBlock &MBB, MachineMemOperand::MOStore, 4, 4); DebugLoc dl = MBB.findDebugLoc(InsertPt); + unsigned SP = HRI.getStackRegister(); if (NumBytes >= ALLOCFRAME_MAX) { // Emit allocframe(#0). BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::S2_allocframe)) + .addDef(SP) + .addReg(SP) .addImm(0) .addMemOperand(MMO); @@ -723,6 +734,8 @@ void HexagonFrameLowering::insertAllocframe(MachineBasicBlock &MBB, .addImm(-int(NumBytes)); } else { BuildMI(MBB, InsertPt, dl, HII.get(Hexagon::S2_allocframe)) + .addDef(SP) + .addReg(SP) .addImm(NumBytes) .addMemOperand(MMO); } |