llvm.org GIT mirror llvm / f1d78e8
Add support to locate local variables in frames (early version.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26994 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Laskey 13 years ago
13 changed file(s) with 91 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2525 class Type;
2626 class MachineFunction;
2727 class MachineInstr;
28 class MachineLocation;
2829 class TargetRegisterClass;
2930
3031 /// TargetRegisterDesc - This record contains all of the information known about
340341 virtual void emitPrologue(MachineFunction &MF) const = 0;
341342 virtual void emitEpilogue(MachineFunction &MF,
342343 MachineBasicBlock &MBB) const = 0;
344
345 /// getLocation - This method should return the actual location of a frame
346 /// variable given the frame index.
347 virtual void getLocation(MachineFunction &MF, unsigned Index,
348 MachineLocation &ML) const = 0;
343349 };
344350
345351 // This is useful when building DenseMaps keyed on virtual registers
2020 #include "llvm/CodeGen/MachineInstrBuilder.h"
2121 #include "llvm/CodeGen/MachineFunction.h"
2222 #include "llvm/CodeGen/MachineFrameInfo.h"
23 #include "llvm/CodeGen/MachineLocation.h"
2324 #include "llvm/Target/TargetFrameInfo.h"
2425 #include "llvm/Target/TargetMachine.h"
2526 #include "llvm/Target/TargetOptions.h"
352353 }
353354 }
354355
356 void AlphaRegisterInfo::getLocation(MachineFunction &MF, unsigned Index,
357 MachineLocation &ML) const {
358 assert(0 && "Needs to be defined for target");
359 MachineFrameInfo *MFI = MF.getFrameInfo();
360 bool FP = hasFP(MF);
361
362 // FIXME - Needs to handle register variables.
363 // FIXME - Faking that llvm number is same as gcc numbering.
364 ML.set((FP ? Alpha::R15 : Alpha::R30) - Alpha::R0,
365 MFI->getObjectOffset(Index) + MFI->getStackSize());
366 }
367
355368 #include "AlphaGenRegisterInfo.inc"
356369
357370 std::string AlphaRegisterInfo::getPrettyName(unsigned reg)
5252 void emitPrologue(MachineFunction &MF) const;
5353 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
5454
55 void getLocation(MachineFunction &MF, unsigned Index, MachineLocation &ML) const;
56
57
5558 static std::string getPrettyName(unsigned reg);
5659 };
5760
2121 #include "llvm/CodeGen/MachineInstrBuilder.h"
2222 #include "llvm/CodeGen/MachineFunction.h"
2323 #include "llvm/CodeGen/MachineFrameInfo.h"
24 #include "llvm/CodeGen/MachineLocation.h"
2425 #include "llvm/Target/TargetFrameInfo.h"
2526 #include "llvm/Target/TargetMachine.h"
2627 #include "llvm/Target/TargetOptions.h"
327328
328329 }
329330
331 void IA64RegisterInfo::getLocation(MachineFunction &MF, unsigned Index,
332 MachineLocation &ML) const {
333 assert(0 && "Needs to be defined for target");
334 MachineFrameInfo *MFI = MF.getFrameInfo();
335 bool FP = hasFP(MF);
336
337 // FIXME - Needs to handle register variables.
338 // FIXME - Faking that llvm number is same as gcc numbering.
339 ML.set((FP ? IA64::r5 : IA64::r12) - IA64::r0,
340 MFI->getObjectOffset(Index) + MFI->getStackSize());
341 }
342
343
330344 #include "IA64GenRegisterInfo.inc"
331345
4747
4848 void emitPrologue(MachineFunction &MF) const;
4949 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
50
51 void getLocation(MachineFunction &MF, unsigned Index, MachineLocation &ML) const;
5052 };
5153
5254 } // End llvm namespace
2020 #include "llvm/CodeGen/MachineInstrBuilder.h"
2121 #include "llvm/CodeGen/MachineFunction.h"
2222 #include "llvm/CodeGen/MachineFrameInfo.h"
23 #include "llvm/CodeGen/MachineLocation.h"
2324 #include "llvm/Target/TargetFrameInfo.h"
2425 #include "llvm/Target/TargetMachine.h"
2526 #include "llvm/Target/TargetOptions.h"
445446 }
446447 }
447448
449 void PPCRegisterInfo::getLocation(MachineFunction &MF, unsigned Index,
450 MachineLocation &ML) const {
451 MachineFrameInfo *MFI = MF.getFrameInfo();
452 bool FP = hasFP(MF);
453
454 // FIXME - Needs to handle register variables.
455 // FIXME - Faking that llvm number is same as gcc numbering.
456 ML.set((FP ? PPC::R31 : PPC::R1) - PPC::R0,
457 MFI->getObjectOffset(Index) + MFI->getStackSize());
458 }
459
448460 #include "PPCGenRegisterInfo.inc"
449461
5454
5555 void emitPrologue(MachineFunction &MF) const;
5656 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
57
58 void getLocation(MachineFunction &MF, unsigned Index,
59 MachineLocation &ML) const;
5760 };
5861
5962 } // end namespace llvm
1616 #include "llvm/CodeGen/MachineInstrBuilder.h"
1717 #include "llvm/CodeGen/MachineFunction.h"
1818 #include "llvm/CodeGen/MachineFrameInfo.h"
19 #include "llvm/CodeGen/MachineLocation.h"
1920 #include "llvm/Type.h"
2021 #include "llvm/ADT/STLExtras.h"
2122 #include
198199 BuildMI(MBB, MBBI, SP::RESTORErr, 2, SP::G0).addReg(SP::G0).addReg(SP::G0);
199200 }
200201
202 void SparcRegisterInfo::getLocation(MachineFunction &MF, unsigned Index,
203 MachineLocation &ML) const {
204 assert(0 && "Needs to be defined for target");
205 MachineFrameInfo *MFI = MF.getFrameInfo();
206
207 // FIXME - Needs to handle register variables.
208 // FIXME - Faking that llvm number is same as gcc numbering.
209 ML.set(SP::G1 - SP::G0,
210 MFI->getObjectOffset(Index) + MFI->getStackSize());
211 }
212
201213 #include "SparcGenRegisterInfo.inc"
202214
5555
5656 void emitPrologue(MachineFunction &MF) const;
5757 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
58
59 void getLocation(MachineFunction &MF, unsigned Index,
60 MachineLocation &ML) const;
5861 };
5962
6063 } // end namespace llvm
315315 MachineBasicBlock &MBB) const {
316316 abort ();
317317 }
318
319
320 void SparcV9RegisterInfo::getLocation(MachineFunction &MF, unsigned Index,
321 MachineLocation &ML) const {
322 abort ();
323 }
4343 void eliminateFrameIndex (MachineBasicBlock::iterator MI) const;
4444 void emitPrologue (MachineFunction &MF) const;
4545 void emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const;
46 void getLocation(MachineFunction &MF, unsigned Index,
47 MachineLocation &ML) const;
4648 };
4749
4850 } // End llvm namespace
2020 #include "llvm/CodeGen/MachineInstrBuilder.h"
2121 #include "llvm/CodeGen/MachineFunction.h"
2222 #include "llvm/CodeGen/MachineFrameInfo.h"
23 #include "llvm/CodeGen/MachineLocation.h"
2324 #include "llvm/Target/TargetFrameInfo.h"
2425 #include "llvm/Target/TargetMachine.h"
2526 #include "llvm/Target/TargetOptions.h"
684685 }
685686 }
686687
688 void X86RegisterInfo::getLocation(MachineFunction &MF, unsigned Index,
689 MachineLocation &ML) const {
690 MachineFrameInfo *MFI = MF.getFrameInfo();
691 bool FP = hasFP(MF);
692
693 // FIXME - Needs to handle register variables.
694 // FIXME - Hardcoding gcc numbering.
695 ML.set(FP ? 6 : 7,
696 MFI->getObjectOffset(Index) + MFI->getStackSize());
697 }
698
687699 #include "X86GenRegisterInfo.inc"
688700
6161
6262 void emitPrologue(MachineFunction &MF) const;
6363 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
64
65 void getLocation(MachineFunction &MF, unsigned Index,
66 MachineLocation &ML) const;
6467 };
6568
6669 } // End llvm namespace