mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-30 17:33:24 +00:00
fed90b6d09
a new ilist_node class, and remove them. Unlike alist_node, ilist_node doesn't attempt to manage storage itself, so it avoids the associated problems, including being opaque in gdb. Adjust the Recycler class so that it doesn't depend on alist_node. Also, change it to use explicit Size and Align parameters, allowing it to work when the largest-sized node doesn't have the greatest alignment requirement. Change MachineInstr's MachineMemOperand list from a pool-backed alist to a std::list for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54146 91177308-0d34-0410-b5e6-96231b3b80d8
71 lines
2.6 KiB
C++
71 lines
2.6 KiB
C++
//===-- llvm/SymbolTableListTraits.h - Traits for iplist --------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines a generic class that is used to implement the automatic
|
|
// symbol table manipulation that occurs when you put (for example) a named
|
|
// instruction into a basic block.
|
|
//
|
|
// The way that this is implemented is by using a special traits class with the
|
|
// intrusive list that makes up the list of instructions in a basic block. When
|
|
// a new element is added to the list of instructions, the traits class is
|
|
// notified, allowing the symbol table to be updated.
|
|
//
|
|
// This generic class implements the traits class. It must be generic so that
|
|
// it can work for all uses it, which include lists of instructions, basic
|
|
// blocks, arguments, functions, global variables, etc...
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_SYMBOLTABLELISTTRAITS_H
|
|
#define LLVM_SYMBOLTABLELISTTRAITS_H
|
|
|
|
#include "llvm/ADT/ilist.h"
|
|
|
|
namespace llvm {
|
|
|
|
template<typename NodeTy> class ilist_iterator;
|
|
template<typename NodeTy, typename Traits> class iplist;
|
|
template<typename Ty> struct ilist_traits;
|
|
|
|
// ValueSubClass - The type of objects that I hold, e.g. Instruction.
|
|
// ItemParentType - The type of object that owns the list, e.g. BasicBlock.
|
|
// TraitBaseClass - The class this trait should inherit from, it should
|
|
// inherit from ilist_traits<ValueSubClass>
|
|
//
|
|
template<typename ValueSubClass, typename ItemParentClass>
|
|
class SymbolTableListTraits : public ilist_default_traits<ValueSubClass> {
|
|
typedef ilist_traits<ValueSubClass> TraitsClass;
|
|
public:
|
|
SymbolTableListTraits() {}
|
|
|
|
/// getListOwner - Return the object that owns this list. If this is a list
|
|
/// of instructions, it returns the BasicBlock that owns them.
|
|
ItemParentClass *getListOwner() {
|
|
return reinterpret_cast<ItemParentClass*>(reinterpret_cast<char*>(this)-
|
|
TraitsClass::getListOffset());
|
|
}
|
|
|
|
void deleteNode(ValueSubClass *V) {
|
|
delete V;
|
|
}
|
|
|
|
void addNodeToList(ValueSubClass *V);
|
|
void removeNodeFromList(ValueSubClass *V);
|
|
void transferNodesFromList(ilist_traits<ValueSubClass> &L2,
|
|
ilist_iterator<ValueSubClass> first,
|
|
ilist_iterator<ValueSubClass> last);
|
|
//private:
|
|
template<typename TPtr>
|
|
void setSymTabObject(TPtr *, TPtr);
|
|
};
|
|
|
|
} // End llvm namespace
|
|
|
|
#endif
|