Insert a sanity check on the combining of x86 truncing-store nodes. This comes to...
[oota-llvm.git] / lib / Target / PTX / PTXRegisterInfo.cpp
1 //===- PTXRegisterInfo.cpp - PTX Register Information ---------------------===//
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 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the PTX implementation of the TargetRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "PTX.h"
15 #include "PTXRegisterInfo.h"
16 #include "llvm/CodeGen/MachineFunction.h"
17 #include "llvm/Support/Debug.h"
18 #include "llvm/Support/raw_ostream.h"
19
20 #define GET_REGINFO_TARGET_DESC
21 #include "PTXGenRegisterInfo.inc"
22
23 using namespace llvm;
24
25 PTXRegisterInfo::PTXRegisterInfo(PTXTargetMachine &TM,
26                                  const TargetInstrInfo &TII)
27   // PTX does not have a return address register.
28   : PTXGenRegisterInfo(0) {
29 }
30
31 void PTXRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
32                                           int SPAdj,
33                                           RegScavenger *RS) const {
34   unsigned Index;
35   MachineInstr& MI = *II;
36
37   Index = 0;
38   while (!MI.getOperand(Index).isFI()) {
39     ++Index;
40     assert(Index < MI.getNumOperands() &&
41            "Instr does not have a FrameIndex operand!");
42   }
43
44   int FrameIndex = MI.getOperand(Index).getIndex();
45
46   DEBUG(dbgs() << "eliminateFrameIndex: " << MI);
47   DEBUG(dbgs() << "- SPAdj: " << SPAdj << "\n");
48   DEBUG(dbgs() << "- FrameIndex: " << FrameIndex << "\n");
49
50   // This frame index is post stack slot re-use assignments
51   MI.getOperand(Index).ChangeToImmediate(FrameIndex);
52 }