comparison lib/Target/AVR/AVRFrameLowering.cpp @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
comparison
equal deleted inserted replaced
146:3fc4d5c3e21e 148:63bd29f05246
1 //===-- AVRFrameLowering.cpp - AVR Frame Information ----------------------===// 1 //===-- AVRFrameLowering.cpp - AVR Frame Information ----------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 // 8 //
10 // This file contains the AVR implementation of TargetFrameLowering class. 9 // This file contains the AVR implementation of TargetFrameLowering class.
11 // 10 //
360 359
361 MachineBasicBlock::iterator AVRFrameLowering::eliminateCallFramePseudoInstr( 360 MachineBasicBlock::iterator AVRFrameLowering::eliminateCallFramePseudoInstr(
362 MachineFunction &MF, MachineBasicBlock &MBB, 361 MachineFunction &MF, MachineBasicBlock &MBB,
363 MachineBasicBlock::iterator MI) const { 362 MachineBasicBlock::iterator MI) const {
364 const AVRSubtarget &STI = MF.getSubtarget<AVRSubtarget>(); 363 const AVRSubtarget &STI = MF.getSubtarget<AVRSubtarget>();
365 const TargetFrameLowering &TFI = *STI.getFrameLowering();
366 const AVRInstrInfo &TII = *STI.getInstrInfo(); 364 const AVRInstrInfo &TII = *STI.getInstrInfo();
367 365
368 // There is nothing to insert when the call frame memory is allocated during 366 // There is nothing to insert when the call frame memory is allocated during
369 // function entry. Delete the call frame pseudo and replace all pseudo stores 367 // function entry. Delete the call frame pseudo and replace all pseudo stores
370 // with real store instructions. 368 // with real store instructions.
371 if (TFI.hasReservedCallFrame(MF)) { 369 if (hasReservedCallFrame(MF)) {
372 fixStackStores(MBB, MI, TII, false); 370 fixStackStores(MBB, MI, TII, false);
373 return MBB.erase(MI); 371 return MBB.erase(MI);
374 } 372 }
375 373
376 DebugLoc DL = MI->getDebugLoc(); 374 DebugLoc DL = MI->getDebugLoc();
380 // Adjcallstackup does not need to allocate stack space for the call, instead 378 // Adjcallstackup does not need to allocate stack space for the call, instead
381 // we insert push instructions that will allocate the necessary stack. 379 // we insert push instructions that will allocate the necessary stack.
382 // For adjcallstackdown we convert it into an 'adiw reg, <amt>' handling 380 // For adjcallstackdown we convert it into an 'adiw reg, <amt>' handling
383 // the read and write of SP in I/O space. 381 // the read and write of SP in I/O space.
384 if (Amount != 0) { 382 if (Amount != 0) {
385 assert(TFI.getStackAlignment() == 1 && "Unsupported stack alignment"); 383 assert(getStackAlignment() == 1 && "Unsupported stack alignment");
386 384
387 if (Opcode == TII.getCallFrameSetupOpcode()) { 385 if (Opcode == TII.getCallFrameSetupOpcode()) {
388 fixStackStores(MBB, MI, TII, true); 386 fixStackStores(MBB, MI, TII, true);
389 } else { 387 } else {
390 assert(Opcode == TII.getCallFrameDestroyOpcode()); 388 assert(Opcode == TII.getCallFrameDestroyOpcode());