mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Add some out-of-line virtual dtors so that the class has a "home", preventing
vtables for (e.g.) Instruction from being emitted into every .o file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28898 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -37,7 +37,8 @@ protected:
|
|||||||
StatisticBase(const char *name, const char *desc) : Name(name), Desc(desc) {
|
StatisticBase(const char *name, const char *desc) : Name(name), Desc(desc) {
|
||||||
++NumStats; // Keep track of how many stats are created...
|
++NumStats; // Keep track of how many stats are created...
|
||||||
}
|
}
|
||||||
virtual ~StatisticBase() {}
|
// Out of line virtual dtor, to give the vtable etc a home.
|
||||||
|
virtual ~StatisticBase();
|
||||||
|
|
||||||
// destroy - Called by subclass dtor so that we can still invoke virtual
|
// destroy - Called by subclass dtor so that we can still invoke virtual
|
||||||
// functions on the subclass.
|
// functions on the subclass.
|
||||||
|
@ -43,6 +43,9 @@ protected:
|
|||||||
const std::string &Name, BasicBlock *InsertAtEnd)
|
const std::string &Name, BasicBlock *InsertAtEnd)
|
||||||
: Instruction(Ty, iType, Ops, NumOps, Name, InsertAtEnd) {}
|
: Instruction(Ty, iType, Ops, NumOps, Name, InsertAtEnd) {}
|
||||||
|
|
||||||
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
|
~TerminatorInst();
|
||||||
|
|
||||||
/// Virtual methods - Terminators should overload these and provide inline
|
/// Virtual methods - Terminators should overload these and provide inline
|
||||||
/// overrides of non-V methods.
|
/// overrides of non-V methods.
|
||||||
virtual BasicBlock *getSuccessorV(unsigned idx) const = 0;
|
virtual BasicBlock *getSuccessorV(unsigned idx) const = 0;
|
||||||
@ -96,6 +99,8 @@ protected:
|
|||||||
: Instruction(Ty, iType, &Op, 1, Name, IAE), Op(V, this) {
|
: Instruction(Ty, iType, &Op, 1, Name, IAE), Op(V, this) {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
|
~UnaryInstruction();
|
||||||
|
|
||||||
// Transparently provide more efficient getOperand methods.
|
// Transparently provide more efficient getOperand methods.
|
||||||
Value *getOperand(unsigned i) const {
|
Value *getOperand(unsigned i) const {
|
||||||
|
@ -52,11 +52,9 @@ protected:
|
|||||||
Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
|
Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
|
||||||
const std::string &Name, BasicBlock *InsertAtEnd);
|
const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
public:
|
public:
|
||||||
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
~Instruction() {
|
~Instruction();
|
||||||
assert(Parent == 0 && "Instruction still linked in the program!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// mayWriteToMemory - Return true if this instruction may modify memory.
|
/// mayWriteToMemory - Return true if this instruction may modify memory.
|
||||||
///
|
///
|
||||||
virtual bool mayWriteToMemory() const { return false; }
|
virtual bool mayWriteToMemory() const { return false; }
|
||||||
|
@ -40,9 +40,10 @@ protected:
|
|||||||
const std::string &Name = "", Instruction *InsertBefore = 0);
|
const std::string &Name = "", Instruction *InsertBefore = 0);
|
||||||
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
|
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
|
||||||
const std::string &Name, BasicBlock *InsertAtEnd);
|
const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
|
virtual ~AllocationInst();
|
||||||
|
|
||||||
/// isArrayAllocation - Return true if there is an allocation size parameter
|
/// isArrayAllocation - Return true if there is an allocation size parameter
|
||||||
/// to the allocation instruction that is not 1.
|
/// to the allocation instruction that is not 1.
|
||||||
///
|
///
|
||||||
|
@ -61,6 +61,10 @@ struct StatRecord {
|
|||||||
|
|
||||||
static std::vector<StatRecord> *AccumStats = 0;
|
static std::vector<StatRecord> *AccumStats = 0;
|
||||||
|
|
||||||
|
// Out of line virtual dtor, to give the vtable etc a home.
|
||||||
|
StatisticBase::~StatisticBase() {
|
||||||
|
}
|
||||||
|
|
||||||
// Print information when destroyed, iff command line option is specified
|
// Print information when destroyed, iff command line option is specified
|
||||||
void StatisticBase::destroy() const {
|
void StatisticBase::destroy() const {
|
||||||
if (Enabled && hasSomeData()) {
|
if (Enabled && hasSomeData()) {
|
||||||
|
@ -43,6 +43,12 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
|
|||||||
InsertAtEnd->getInstList().push_back(this);
|
InsertAtEnd->getInstList().push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
|
Instruction::~Instruction() {
|
||||||
|
assert(Parent == 0 && "Instruction still linked in the program!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Instruction::setOpcode(unsigned opc) {
|
void Instruction::setOpcode(unsigned opc) {
|
||||||
setValueType(Value::InstructionVal + opc);
|
setValueType(Value::InstructionVal + opc);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ void CallSite::setCallingConv(unsigned CC) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// TerminatorInst Class
|
// TerminatorInst Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -48,6 +50,13 @@ TerminatorInst::TerminatorInst(Instruction::TermOps iType,
|
|||||||
: Instruction(Type::VoidTy, iType, Ops, NumOps, "", IAE) {
|
: Instruction(Type::VoidTy, iType, Ops, NumOps, "", IAE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
|
TerminatorInst::~TerminatorInst() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
|
UnaryInstruction::~UnaryInstruction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -532,6 +541,10 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
|||||||
assert(Ty != Type::VoidTy && "Cannot allocate void!");
|
assert(Ty != Type::VoidTy && "Cannot allocate void!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
|
AllocationInst::~AllocationInst() {
|
||||||
|
}
|
||||||
|
|
||||||
bool AllocationInst::isArrayAllocation() const {
|
bool AllocationInst::isArrayAllocation() const {
|
||||||
if (ConstantUInt *CUI = dyn_cast<ConstantUInt>(getOperand(0)))
|
if (ConstantUInt *CUI = dyn_cast<ConstantUInt>(getOperand(0)))
|
||||||
return CUI->getValue() != 1;
|
return CUI->getValue() != 1;
|
||||||
|
Reference in New Issue
Block a user