2012-02-18 20:03:15 +08:00
|
|
|
//===-- XCoreMachineFuctionInfo.h - XCore machine function info -*- C++ -*-===//
|
2008-11-07 18:59:00 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares XCore-specific per-machine-function information.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_XCORE_XCOREMACHINEFUNCTIONINFO_H
|
2008-11-07 18:59:00 +08:00
|
|
|
|
|
|
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
2012-12-04 15:12:27 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2008-11-07 18:59:00 +08:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
// Forward declarations
|
|
|
|
class Function;
|
|
|
|
|
|
|
|
/// XCoreFunctionInfo - This class is derived from MachineFunction private
|
|
|
|
/// XCore target-specific information for each MachineFunction.
|
|
|
|
class XCoreFunctionInfo : public MachineFunctionInfo {
|
2011-12-20 10:50:00 +08:00
|
|
|
virtual void anchor();
|
2014-01-06 22:20:41 +08:00
|
|
|
bool LRSpillSlotSet;
|
2008-11-07 18:59:00 +08:00
|
|
|
int LRSpillSlot;
|
2014-01-06 22:20:41 +08:00
|
|
|
bool FPSpillSlotSet;
|
2008-11-07 18:59:00 +08:00
|
|
|
int FPSpillSlot;
|
2014-02-18 19:21:48 +08:00
|
|
|
bool EHSpillSlotSet;
|
|
|
|
int EHSpillSlot[2];
|
2014-02-28 01:47:54 +08:00
|
|
|
unsigned ReturnStackOffset;
|
|
|
|
bool ReturnStackOffsetSet;
|
2008-11-07 18:59:00 +08:00
|
|
|
int VarArgsFrameIndex;
|
2013-12-02 19:05:28 +08:00
|
|
|
mutable int CachedEStackSize;
|
2014-03-07 14:08:31 +08:00
|
|
|
std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>>
|
|
|
|
SpillLabels;
|
2008-11-07 18:59:00 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
XCoreFunctionInfo() :
|
2014-01-06 22:20:41 +08:00
|
|
|
LRSpillSlotSet(false),
|
|
|
|
FPSpillSlotSet(false),
|
2014-02-18 19:21:48 +08:00
|
|
|
EHSpillSlotSet(false),
|
2014-02-28 01:47:54 +08:00
|
|
|
ReturnStackOffsetSet(false),
|
2013-12-02 19:05:28 +08:00
|
|
|
VarArgsFrameIndex(0),
|
|
|
|
CachedEStackSize(-1) {}
|
2008-11-07 18:59:00 +08:00
|
|
|
|
2009-06-06 07:05:51 +08:00
|
|
|
explicit XCoreFunctionInfo(MachineFunction &MF) :
|
2014-01-06 22:20:41 +08:00
|
|
|
LRSpillSlotSet(false),
|
|
|
|
FPSpillSlotSet(false),
|
2014-02-18 19:21:48 +08:00
|
|
|
EHSpillSlotSet(false),
|
2014-02-28 01:47:54 +08:00
|
|
|
ReturnStackOffsetSet(false),
|
2013-12-02 19:05:28 +08:00
|
|
|
VarArgsFrameIndex(0),
|
|
|
|
CachedEStackSize(-1) {}
|
2008-11-07 18:59:00 +08:00
|
|
|
|
|
|
|
~XCoreFunctionInfo() {}
|
|
|
|
|
|
|
|
void setVarArgsFrameIndex(int off) { VarArgsFrameIndex = off; }
|
|
|
|
int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
|
2014-01-06 22:20:41 +08:00
|
|
|
|
|
|
|
int createLRSpillSlot(MachineFunction &MF);
|
|
|
|
bool hasLRSpillSlot() { return LRSpillSlotSet; }
|
|
|
|
int getLRSpillSlot() const {
|
2014-02-18 19:21:48 +08:00
|
|
|
assert(LRSpillSlotSet && "LR Spill slot not set");
|
2014-01-06 22:20:41 +08:00
|
|
|
return LRSpillSlot;
|
|
|
|
}
|
|
|
|
|
|
|
|
int createFPSpillSlot(MachineFunction &MF);
|
|
|
|
bool hasFPSpillSlot() { return FPSpillSlotSet; }
|
|
|
|
int getFPSpillSlot() const {
|
2014-02-18 19:21:48 +08:00
|
|
|
assert(FPSpillSlotSet && "FP Spill slot not set");
|
2014-01-06 22:20:41 +08:00
|
|
|
return FPSpillSlot;
|
|
|
|
}
|
|
|
|
|
2014-02-18 19:21:48 +08:00
|
|
|
const int* createEHSpillSlot(MachineFunction &MF);
|
|
|
|
bool hasEHSpillSlot() { return EHSpillSlotSet; }
|
|
|
|
const int* getEHSpillSlot() const {
|
|
|
|
assert(EHSpillSlotSet && "EH Spill slot not set");
|
|
|
|
return EHSpillSlot;
|
|
|
|
}
|
|
|
|
|
2014-02-28 01:47:54 +08:00
|
|
|
void setReturnStackOffset(unsigned value) {
|
|
|
|
assert(!ReturnStackOffsetSet && "Return stack offset set twice");
|
|
|
|
ReturnStackOffset = value;
|
|
|
|
ReturnStackOffsetSet = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned getReturnStackOffset() const {
|
|
|
|
assert(ReturnStackOffsetSet && "Return stack offset not set");
|
|
|
|
return ReturnStackOffset;
|
|
|
|
}
|
|
|
|
|
2013-12-02 19:05:28 +08:00
|
|
|
bool isLargeFrame(const MachineFunction &MF) const;
|
|
|
|
|
2014-03-07 14:08:31 +08:00
|
|
|
std::vector<std::pair<MachineBasicBlock::iterator, CalleeSavedInfo>> &
|
|
|
|
getSpillLabels() {
|
2008-11-07 18:59:00 +08:00
|
|
|
return SpillLabels;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // End llvm namespace
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#endif
|