mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-27 15:57:13 +00:00
* Add new constructors to allow insertion of terminator instructions at the
end of basic blocks. * Document some confusing constructor combinations * Move a ReturnInst method out-of-line, so that the vtable and type info don't need to be emitted to every translation unit that uses the class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10106 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
438e364692
commit
dd56927846
@ -34,6 +34,7 @@ protected:
|
|||||||
const std::string &Name = "", Instruction *InsertBefore = 0)
|
const std::string &Name = "", Instruction *InsertBefore = 0)
|
||||||
: Instruction(Ty, iType, Name, InsertBefore) {
|
: Instruction(Ty, iType, Name, InsertBefore) {
|
||||||
}
|
}
|
||||||
|
TerminatorInst(Instruction::TermOps iType, BasicBlock *InsertAtEnd);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Terminators must implement the methods required by Instruction...
|
/// Terminators must implement the methods required by Instruction...
|
||||||
|
@ -33,6 +33,13 @@ class ReturnInst : public TerminatorInst {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
// ReturnInst constructors:
|
||||||
|
// ReturnInst() - 'ret void' instruction
|
||||||
|
// ReturnInst(Value* X) - 'ret X' instruction
|
||||||
|
// ReturnInst( null, Inst *) - 'ret void' instruction, insert before I
|
||||||
|
// ReturnInst(Value* X, Inst *I) - 'ret X' instruction, insert before I
|
||||||
|
// ReturnInst( null, BB *B) - 'ret void' instruction, insert @ end of BB
|
||||||
|
// ReturnInst(Value* X, BB *B) - 'ret X' instruction, insert @ end of BB
|
||||||
ReturnInst(Value *RetVal = 0, Instruction *InsertBefore = 0)
|
ReturnInst(Value *RetVal = 0, Instruction *InsertBefore = 0)
|
||||||
: TerminatorInst(Instruction::Ret, InsertBefore) {
|
: TerminatorInst(Instruction::Ret, InsertBefore) {
|
||||||
if (RetVal) {
|
if (RetVal) {
|
||||||
@ -40,6 +47,13 @@ public:
|
|||||||
Operands.push_back(Use(RetVal, this));
|
Operands.push_back(Use(RetVal, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ReturnInst(Value *RetVal, BasicBlock *InsertAtEnd)
|
||||||
|
: TerminatorInst(Instruction::Ret, InsertAtEnd) {
|
||||||
|
if (RetVal) {
|
||||||
|
Operands.reserve(1);
|
||||||
|
Operands.push_back(Use(RetVal, this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual Instruction *clone() const { return new ReturnInst(*this); }
|
virtual Instruction *clone() const { return new ReturnInst(*this); }
|
||||||
|
|
||||||
@ -55,9 +69,7 @@ public:
|
|||||||
abort();
|
abort();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
|
virtual void setSuccessor(unsigned idx, BasicBlock *NewSucc);
|
||||||
assert(0 && "ReturnInst has no successors!");
|
|
||||||
}
|
|
||||||
virtual unsigned getNumSuccessors() const { return 0; }
|
virtual unsigned getNumSuccessors() const { return 0; }
|
||||||
|
|
||||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||||
@ -76,10 +88,19 @@ public:
|
|||||||
class BranchInst : public TerminatorInst {
|
class BranchInst : public TerminatorInst {
|
||||||
BranchInst(const BranchInst &BI);
|
BranchInst(const BranchInst &BI);
|
||||||
public:
|
public:
|
||||||
// If cond = null, then is an unconditional br...
|
// BranchInst constructors (where {B, T, F} are blocks, and C is a condition):
|
||||||
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *cond = 0,
|
// BranchInst(BB *B) - 'br B'
|
||||||
Instruction *InsertBefore = 0);
|
// BranchInst(BB* T, BB *F, Value *C) - 'br C, T, F'
|
||||||
|
// BranchInst(BB* B, Inst *I) - 'br B' insert before I
|
||||||
|
// BranchInst(BB* T, BB *F, Value *C, Inst *I) - 'br C, T, F', insert before I
|
||||||
|
// BranchInst(BB* B, BB *I) - 'br B' insert at end
|
||||||
|
// BranchInst(BB* T, BB *F, Value *C, BB *I) - 'br C, T, F', insert at end
|
||||||
BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = 0);
|
BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = 0);
|
||||||
|
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *cond,
|
||||||
|
Instruction *InsertBefore = 0);
|
||||||
|
BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd);
|
||||||
|
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *cond,
|
||||||
|
BasicBlock *InsertAtEnd);
|
||||||
|
|
||||||
virtual Instruction *clone() const { return new BranchInst(*this); }
|
virtual Instruction *clone() const { return new BranchInst(*this); }
|
||||||
|
|
||||||
@ -142,6 +163,7 @@ class SwitchInst : public TerminatorInst {
|
|||||||
SwitchInst(const SwitchInst &RI);
|
SwitchInst(const SwitchInst &RI);
|
||||||
public:
|
public:
|
||||||
SwitchInst(Value *Value, BasicBlock *Default, Instruction *InsertBefore = 0);
|
SwitchInst(Value *Value, BasicBlock *Default, Instruction *InsertBefore = 0);
|
||||||
|
SwitchInst(Value *Value, BasicBlock *Default, BasicBlock *InsertAtEnd);
|
||||||
|
|
||||||
virtual Instruction *clone() const { return new SwitchInst(*this); }
|
virtual Instruction *clone() const { return new SwitchInst(*this); }
|
||||||
|
|
||||||
@ -212,6 +234,9 @@ public:
|
|||||||
InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
const std::vector<Value*> &Params, const std::string &Name = "",
|
const std::vector<Value*> &Params, const std::string &Name = "",
|
||||||
Instruction *InsertBefore = 0);
|
Instruction *InsertBefore = 0);
|
||||||
|
InvokeInst(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
|
const std::vector<Value*> &Params, const std::string &Name,
|
||||||
|
BasicBlock *InsertAtEnd);
|
||||||
|
|
||||||
virtual Instruction *clone() const { return new InvokeInst(*this); }
|
virtual Instruction *clone() const { return new InvokeInst(*this); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user