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_MC_DESC
21 #define GET_REGINFO_TARGET_DESC
22 #include "PTXGenRegisterInfo.inc"
26 PTXRegisterInfo::PTXRegisterInfo(PTXTargetMachine
&TM
,
27 const TargetInstrInfo
&TII
)
28 : PTXGenRegisterInfo() {
31 void PTXRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II
,
33 RegScavenger
*RS
) const {
35 MachineInstr
& MI
= *II
;
38 while (!MI
.getOperand(Index
).isFI()) {
40 assert(Index
< MI
.getNumOperands() &&
41 "Instr does not have a FrameIndex operand!");
44 int FrameIndex
= MI
.getOperand(Index
).getIndex();
46 DEBUG(dbgs() << "eliminateFrameIndex: " << MI
);
47 DEBUG(dbgs() << "- SPAdj: " << SPAdj
<< "\n");
48 DEBUG(dbgs() << "- FrameIndex: " << FrameIndex
<< "\n");
50 // This frame index is post stack slot re-use assignments
51 MI
.getOperand(Index
).ChangeToImmediate(FrameIndex
);