From af494c5f13354fe52159cd2d0fc1adc2aba99e26 Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Wed, 26 May 2004 22:07:18 +0000 Subject: [PATCH] Inline trivial constructors. llvm-svn: 13797 --- llvm/include/llvm/iTerminators.h | 36 +++++++++++++++++++++++++------- llvm/lib/VMCore/iBranch.cpp | 22 ------------------- llvm/lib/VMCore/iSwitch.cpp | 11 ---------- 3 files changed, 28 insertions(+), 41 deletions(-) diff --git a/llvm/include/llvm/iTerminators.h b/llvm/include/llvm/iTerminators.h index 78a1b74fd847..7a10467e0623 100644 --- a/llvm/include/llvm/iTerminators.h +++ b/llvm/include/llvm/iTerminators.h @@ -99,12 +99,26 @@ public: // 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, BasicBlock *IfFalse, Value *cond, - Instruction *InsertBefore = 0); - BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd); - BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *cond, - BasicBlock *InsertAtEnd); + BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = 0) + : TerminatorInst(Instruction::Br, InsertBefore) { + init(IfTrue); + } + BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, + Instruction *InsertBefore = 0) + : TerminatorInst(Instruction::Br, InsertBefore) { + init(IfTrue, IfFalse, Cond); + } + + BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Br, InsertAtEnd) { + init(IfTrue); + } + + BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond, + BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Br, InsertAtEnd) { + init(IfTrue, IfFalse, Cond); + } virtual Instruction *clone() const { return new BranchInst(*this); } @@ -168,8 +182,14 @@ class SwitchInst : public TerminatorInst { void init(Value *Value, BasicBlock *Default); public: - SwitchInst(Value *Value, BasicBlock *Default, Instruction *InsertBefore = 0); - SwitchInst(Value *Value, BasicBlock *Default, BasicBlock *InsertAtEnd); + SwitchInst(Value *Value, BasicBlock *Default, Instruction *InsertBefore = 0) + : TerminatorInst(Instruction::Switch, InsertBefore) { + init(Value, Default); + } + SwitchInst(Value *Value, BasicBlock *Default, BasicBlock *InsertAtEnd) + : TerminatorInst(Instruction::Switch, InsertAtEnd) { + init(Value, Default); + } virtual Instruction *clone() const { return new SwitchInst(*this); } diff --git a/llvm/lib/VMCore/iBranch.cpp b/llvm/lib/VMCore/iBranch.cpp index a5ba36fd1773..e0bdcf7d18a0 100644 --- a/llvm/lib/VMCore/iBranch.cpp +++ b/llvm/lib/VMCore/iBranch.cpp @@ -47,28 +47,6 @@ void BranchInst::init(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond) Operands.push_back(Use(Cond, this)); } -BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond, - Instruction *InsertBefore) - : TerminatorInst(Instruction::Br, InsertBefore) { - init(True, False, Cond); -} - -BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond, - BasicBlock *InsertAtEnd) - : TerminatorInst(Instruction::Br, InsertAtEnd) { - init(True, False, Cond); -} - -BranchInst::BranchInst(BasicBlock *True, Instruction *InsertBefore) - : TerminatorInst(Instruction::Br, InsertBefore) { - init(True); -} - -BranchInst::BranchInst(BasicBlock *True, BasicBlock *InsertAtEnd) - : TerminatorInst(Instruction::Br, InsertAtEnd) { - init(True); -} - BranchInst::BranchInst(const BranchInst &BI) : TerminatorInst(Instruction::Br) { Operands.reserve(BI.Operands.size()); Operands.push_back(Use(BI.Operands[0], this)); diff --git a/llvm/lib/VMCore/iSwitch.cpp b/llvm/lib/VMCore/iSwitch.cpp index d4dccde5b58b..b78cfbbdc3d8 100644 --- a/llvm/lib/VMCore/iSwitch.cpp +++ b/llvm/lib/VMCore/iSwitch.cpp @@ -22,17 +22,6 @@ void SwitchInst::init(Value *Value, BasicBlock *Default) Operands.push_back(Use(Default, this)); } -SwitchInst::SwitchInst(Value *V, BasicBlock *D, - Instruction *InsertBefore) - : TerminatorInst(Instruction::Switch, InsertBefore) { - init(V, D); -} - -SwitchInst::SwitchInst(Value *V, BasicBlock *D, BasicBlock *InsertAtEnd) - : TerminatorInst(Instruction::Switch, InsertAtEnd) { - init(V, D); -} - SwitchInst::SwitchInst(const SwitchInst &SI) : TerminatorInst(Instruction::Switch) { Operands.reserve(SI.Operands.size()); -- GitLab