#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
#define LLVM_CODEGEN_MACHINEFUNCTION_H
-#include "llvm/ADT/alist.h"
+#include "llvm/ADT/ilist.h"
+#include "llvm/CodeGen/DebugLoc.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/Support/Annotation.h"
#include "llvm/Support/Allocator.h"
namespace llvm {
class Function;
-class TargetMachine;
class MachineRegisterInfo;
class MachineFrameInfo;
class MachineConstantPool;
class MachineJumpTableInfo;
+class TargetMachine;
template <>
-class alist_traits<MachineBasicBlock, MachineBasicBlock> {
- typedef alist_iterator<MachineBasicBlock> iterator;
+struct ilist_traits<MachineBasicBlock>
+ : public ilist_default_traits<MachineBasicBlock> {
+ mutable MachineBasicBlock Sentinel;
public:
+ MachineBasicBlock *createSentinel() const { return &Sentinel; }
+ void destroySentinel(MachineBasicBlock *) const {}
+
void addNodeToList(MachineBasicBlock* MBB);
void removeNodeFromList(MachineBasicBlock* MBB);
- void transferNodesFromList(alist_traits<MachineBasicBlock> &,
- iterator,
- iterator) {}
void deleteNode(MachineBasicBlock *MBB);
+private:
+ void createNode(const MachineBasicBlock &);
};
/// MachineFunctionInfo - This class can be derived from and used by targets to
// Allocation management for basic blocks in function.
Recycler<MachineBasicBlock> BasicBlockRecycler;
- // Allocation management for memoperands in function.
- Recycler<MachineMemOperand> MemOperandRecycler;
-
// List of machine basic blocks in function
- typedef alist<MachineBasicBlock> BasicBlockListType;
+ typedef ilist<MachineBasicBlock> BasicBlockListType;
BasicBlockListType BasicBlocks;
+ // Tracks debug locations.
+ DebugLocTracker DebugLocInfo;
+
public:
MachineFunction(const Function *Fn, const TargetMachine &TM);
~MachineFunction();
///
void DeleteMachineBasicBlock(MachineBasicBlock *MBB);
- /// CreateMachineMemOperand - Allocate a new MachineMemOperand. Use this
- /// instead of `new MachineMemOperand'.
- ///
- MachineMemOperand *CreateMachineMemOperand(const MachineMemOperand &MMO);
+ //===--------------------------------------------------------------------===//
+ // Debug location.
+ //
- /// DeleteMachineMemOperand - Delete the given MachineMemOperand.
- ///
- void DeleteMachineMemOperand(MachineMemOperand *MMO);
+ /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
+ /// source file, line, and column. If none currently exists, create add a new
+ /// new DebugLocTuple and insert it into the DebugIdMap.
+ unsigned getOrCreateDebugLocID(unsigned Src, unsigned Line, unsigned Col);
};
//===--------------------------------------------------------------------===//