mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
All targets are now allowed to have their own MachineFunctionInfo objects,
also, make getInfo do some checking and cast to the appropriate concrete type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15903 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -23,6 +23,12 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
|
class Function;
|
||||||
|
class TargetMachine;
|
||||||
|
class SSARegMap;
|
||||||
|
class MachineFrameInfo;
|
||||||
|
class MachineConstantPool;
|
||||||
|
|
||||||
// ilist_traits
|
// ilist_traits
|
||||||
template <>
|
template <>
|
||||||
class ilist_traits<MachineBasicBlock> {
|
class ilist_traits<MachineBasicBlock> {
|
||||||
@@ -58,15 +64,13 @@ public:
|
|||||||
ilist_iterator<MachineBasicBlock> last);
|
ilist_iterator<MachineBasicBlock> last);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// MachineFunctionInfo - This class can be derived from and used by targets to
|
||||||
class Function;
|
/// hold private target-specific information for each MachineFunction. Objects
|
||||||
class TargetMachine;
|
/// of type are accessed/created with MF::getInfo and destroyed when the
|
||||||
class SSARegMap;
|
/// MachineFunction is destroyed.
|
||||||
class MachineFrameInfo;
|
struct MachineFunctionInfo {
|
||||||
class MachineConstantPool;
|
virtual ~MachineFunctionInfo() {};
|
||||||
// MachineFunctionInfoBase - This is a gross SparcV9 hack
|
};
|
||||||
struct MachineFunctionInfoBase { virtual ~MachineFunctionInfoBase() {}; };
|
|
||||||
class MachineFunctionInfo;
|
|
||||||
|
|
||||||
class MachineFunction : private Annotation {
|
class MachineFunction : private Annotation {
|
||||||
const Function *Fn;
|
const Function *Fn;
|
||||||
@@ -78,8 +82,9 @@ class MachineFunction : private Annotation {
|
|||||||
// Keeping track of mapping from SSA values to registers
|
// Keeping track of mapping from SSA values to registers
|
||||||
SSARegMap *SSARegMapping;
|
SSARegMap *SSARegMapping;
|
||||||
|
|
||||||
// Used to keep track of frame and constant area information for SparcV9 BE.
|
// Used to keep track of target-specific per-machine function information for
|
||||||
mutable MachineFunctionInfoBase *MFInfo;
|
// the target implementation.
|
||||||
|
MachineFunctionInfo *MFInfo;
|
||||||
|
|
||||||
// Keep track of objects allocated on the stack.
|
// Keep track of objects allocated on the stack.
|
||||||
MachineFrameInfo *FrameInfo;
|
MachineFrameInfo *FrameInfo;
|
||||||
@@ -124,7 +129,14 @@ public:
|
|||||||
/// MachineFunctionInfo - Keep track of various per-function pieces of
|
/// MachineFunctionInfo - Keep track of various per-function pieces of
|
||||||
/// information for the sparc backend.
|
/// information for the sparc backend.
|
||||||
///
|
///
|
||||||
MachineFunctionInfo *getInfo() const;
|
template<typename Ty>
|
||||||
|
Ty *getInfo() {
|
||||||
|
if (!MFInfo) MFInfo = new Ty(*this);
|
||||||
|
|
||||||
|
assert((void*)dynamic_cast<Ty*>(MFInfo) == (void*)MFInfo &&
|
||||||
|
"Invalid concrete type or multiple inheritence for getInfo");
|
||||||
|
return static_cast<Ty*>(MFInfo);
|
||||||
|
}
|
||||||
|
|
||||||
/// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
|
/// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
|
||||||
/// are inserted into the machine function. The block number for a machine
|
/// are inserted into the machine function. The block number for a machine
|
||||||
|
Reference in New Issue
Block a user