Deleted Added
full compact
XCoreInstrInfo.cpp (210299) XCoreInstrInfo.cpp (212904)
1//===- XCoreInstrInfo.cpp - XCore Instruction Information -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 32 unchanged lines hidden (view full) ---

41 : TargetInstrInfoImpl(XCoreInsts, array_lengthof(XCoreInsts)),
42 RI(*this) {
43}
44
45static bool isZeroImm(const MachineOperand &op) {
46 return op.isImm() && op.getImm() == 0;
47}
48
1//===- XCoreInstrInfo.cpp - XCore Instruction Information -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 32 unchanged lines hidden (view full) ---

41 : TargetInstrInfoImpl(XCoreInsts, array_lengthof(XCoreInsts)),
42 RI(*this) {
43}
44
45static bool isZeroImm(const MachineOperand &op) {
46 return op.isImm() && op.getImm() == 0;
47}
48
49/// Return true if the instruction is a register to register move and
50/// leave the source and dest operands in the passed parameters.
51///
52bool XCoreInstrInfo::isMoveInstr(const MachineInstr &MI,
53 unsigned &SrcReg, unsigned &DstReg,
54 unsigned &SrcSR, unsigned &DstSR) const {
55 SrcSR = DstSR = 0; // No sub-registers.
56
57 // We look for 4 kinds of patterns here:
58 // add dst, src, 0
59 // sub dst, src, 0
60 // or dst, src, src
61 // and dst, src, src
62 if ((MI.getOpcode() == XCore::ADD_2rus || MI.getOpcode() == XCore::SUB_2rus)
63 && isZeroImm(MI.getOperand(2))) {
64 DstReg = MI.getOperand(0).getReg();
65 SrcReg = MI.getOperand(1).getReg();
66 return true;
67 } else if ((MI.getOpcode() == XCore::OR_3r || MI.getOpcode() == XCore::AND_3r)
68 && MI.getOperand(1).getReg() == MI.getOperand(2).getReg()) {
69 DstReg = MI.getOperand(0).getReg();
70 SrcReg = MI.getOperand(1).getReg();
71 return true;
72 }
73 return false;
74}
75
76/// isLoadFromStackSlot - If the specified machine instruction is a direct
77/// load from a stack slot, return the virtual or physical register number of
78/// the destination along with the FrameIndex of the loaded stack slot. If
79/// not, return 0. This predicate must return 0 if the instruction has
80/// any side effects other than loading from the stack slot.
81unsigned
82XCoreInstrInfo::isLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) const{
83 int Opcode = MI->getOpcode();

--- 348 unchanged lines hidden (view full) ---

432 MBB.addLiveIn(it->getReg());
433
434 unsigned Reg = it->getReg();
435 const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg);
436 storeRegToStackSlot(MBB, MI, Reg, true,
437 it->getFrameIdx(), RC, &RI);
438 if (emitFrameMoves) {
439 MCSymbol *SaveLabel = MF->getContext().CreateTempSymbol();
49/// isLoadFromStackSlot - If the specified machine instruction is a direct
50/// load from a stack slot, return the virtual or physical register number of
51/// the destination along with the FrameIndex of the loaded stack slot. If
52/// not, return 0. This predicate must return 0 if the instruction has
53/// any side effects other than loading from the stack slot.
54unsigned
55XCoreInstrInfo::isLoadFromStackSlot(const MachineInstr *MI, int &FrameIndex) const{
56 int Opcode = MI->getOpcode();

--- 348 unchanged lines hidden (view full) ---

405 MBB.addLiveIn(it->getReg());
406
407 unsigned Reg = it->getReg();
408 const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg);
409 storeRegToStackSlot(MBB, MI, Reg, true,
410 it->getFrameIdx(), RC, &RI);
411 if (emitFrameMoves) {
412 MCSymbol *SaveLabel = MF->getContext().CreateTempSymbol();
440 BuildMI(MBB, MI, DL, get(XCore::DBG_LABEL)).addSym(SaveLabel);
413 BuildMI(MBB, MI, DL, get(XCore::PROLOG_LABEL)).addSym(SaveLabel);
441 XFI->getSpillLabels().push_back(std::make_pair(SaveLabel, *it));
442 }
443 }
444 return true;
445}
446
447bool XCoreInstrInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
448 MachineBasicBlock::iterator MI,

--- 38 unchanged lines hidden ---
414 XFI->getSpillLabels().push_back(std::make_pair(SaveLabel, *it));
415 }
416 }
417 return true;
418}
419
420bool XCoreInstrInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
421 MachineBasicBlock::iterator MI,

--- 38 unchanged lines hidden ---