1 //===- PTXRegisterInfo.cpp - PTX Register Information ---------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the PTX implementation of the TargetRegisterInfo class.
12 //===----------------------------------------------------------------------===//
15 #include "PTXRegisterInfo.h"
16 #include "llvm/CodeGen/MachineFunction.h"
17 #include "llvm/Support/Debug.h"
18 #include "llvm/Support/raw_ostream.h"
20 #define GET_REGINFO_TARGET_DESC
21 #include "PTXGenRegisterInfo.inc"
25 PTXRegisterInfo::PTXRegisterInfo(PTXTargetMachine &TM,
26 const TargetInstrInfo &TII)
27 : PTXGenRegisterInfo() {
30 void PTXRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
32 RegScavenger *RS) const {
34 MachineInstr& MI = *II;
37 while (!MI.getOperand(Index).isFI()) {
39 assert(Index < MI.getNumOperands() &&
40 "Instr does not have a FrameIndex operand!");
43 int FrameIndex = MI.getOperand(Index).getIndex();
45 DEBUG(dbgs() << "eliminateFrameIndex: " << MI);
46 DEBUG(dbgs() << "- SPAdj: " << SPAdj << "\n");
47 DEBUG(dbgs() << "- FrameIndex: " << FrameIndex << "\n");
49 // This frame index is post stack slot re-use assignments
50 MI.getOperand(Index).ChangeToImmediate(FrameIndex);