[llvm-commits] [llvm] r49579 - in /llvm/branches/ggreif/use-diet: include/llvm/Instructions.h lib/VMCore/Instructions.cpp
Gabor Greif
ggreif at gmail.com
Sat Apr 12 00:44:20 PDT 2008
Author: ggreif
Date: Sat Apr 12 02:44:20 2008
New Revision: 49579
URL: http://llvm.org/viewvc/llvm-project?rev=49579&view=rev
Log:
convert BranchInst
Modified:
llvm/branches/ggreif/use-diet/include/llvm/Instructions.h
llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp
Modified: llvm/branches/ggreif/use-diet/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Instructions.h?rev=49579&r1=49578&r2=49579&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Instructions.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Instructions.h Sat Apr 12 02:44:20 2008
@@ -451,27 +451,11 @@
InputIterator IdxEnd,
unsigned Values,
const std::string &Name,
- Instruction *InsertBefore);/*
- : Instruction(PointerType::get(
- checkType(getIndexedType(Ptr->getType(),
- IdxBegin, IdxEnd, true)),
- cast<PointerType>(Ptr->getType())->getAddressSpace()),
- GetElementPtr, 0, Values, InsertBefore) {
- init(Ptr, IdxBegin, IdxEnd, Name,
- typename std::iterator_traits<InputIterator>::iterator_category());
- }*/
+ Instruction *InsertBefore);
template<typename InputIterator>
inline GetElementPtrInst(Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd,
unsigned Values,
- const std::string &Name, BasicBlock *InsertAtEnd);/*
- : Instruction(PointerType::get(
- checkType(getIndexedType(Ptr->getType(),
- IdxBegin, IdxEnd, true)),
- cast<PointerType>(Ptr->getType())->getAddressSpace()),
- GetElementPtr, 0, Values, InsertAtEnd) {
- init(Ptr, IdxBegin, IdxEnd, Name,
- typename std::iterator_traits<InputIterator>::iterator_category());
- }*/
+ const std::string &Name, BasicBlock *InsertAtEnd);
/// Constructors - These two constructors are convenience methods because one
/// and two index getelementptr instructions are so common.
@@ -1714,14 +1698,15 @@
}
/// Transparently provide more efficient getOperand methods.
- Value *getOperand(unsigned i) const {
+ DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
+ /* Value *getOperand(unsigned i) const {
assert(i < getNumOperands() && "getOperand() out of range!");
return OperandList[i];
}
void setOperand(unsigned i, Value *Val) {
assert(i < getNumOperands() && "setOperand() out of range!");
OperandList[i] = Val;
- }
+ }*/
virtual BranchInst *clone() const;
@@ -1776,6 +1761,12 @@
virtual void setSuccessorV(unsigned idx, BasicBlock *B);
};
+template <>
+struct OperandTraits<BranchInst> : VariadicOperandTraits<1> {
+};
+
+DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BranchInst, Value)
+
//===----------------------------------------------------------------------===//
// SwitchInst Class
//===----------------------------------------------------------------------===//
Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp?rev=49579&r1=49578&r2=49579&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/Instructions.cpp Sat Apr 12 02:44:20 2008
@@ -618,13 +618,17 @@
}
BranchInst::BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore)
- : TerminatorInst(Type::VoidTy, Instruction::Br, /*Ops*/NULL, 1, InsertBefore) {
+ : TerminatorInst(Type::VoidTy, Instruction::Br,
+ OperandTraits<BranchInst>::op_end(this) - 1,
+ 1, InsertBefore) {
assert(IfTrue != 0 && "Branch destination may not be null!");
Op<0>().init(reinterpret_cast<Value*>(IfTrue), this);
}
BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
Instruction *InsertBefore)
-: TerminatorInst(Type::VoidTy, Instruction::Br, /*Ops*/NULL, 3, InsertBefore) {
+ : TerminatorInst(Type::VoidTy, Instruction::Br,
+ OperandTraits<BranchInst>::op_end(this) - 3,
+ 3, InsertBefore) {
Op<0>().init(reinterpret_cast<Value*>(IfTrue), this);
Op<1>().init(reinterpret_cast<Value*>(IfFalse), this);
Op<2>().init(Cond, this);
@@ -634,14 +638,18 @@
}
BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd)
- : TerminatorInst(Type::VoidTy, Instruction::Br, /*Ops*/NULL, 1, InsertAtEnd) {
+ : TerminatorInst(Type::VoidTy, Instruction::Br,
+ OperandTraits<BranchInst>::op_end(this) - 1,
+ 1, InsertAtEnd) {
assert(IfTrue != 0 && "Branch destination may not be null!");
Op<0>().init(reinterpret_cast<Value*>(IfTrue), this);
}
BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
BasicBlock *InsertAtEnd)
- : TerminatorInst(Type::VoidTy, Instruction::Br, /*Ops*/NULL, 3, InsertAtEnd) {
+ : TerminatorInst(Type::VoidTy, Instruction::Br,
+ OperandTraits<BranchInst>::op_end(this) - 3,
+ 3, InsertAtEnd) {
Op<0>().init(reinterpret_cast<Value*>(IfTrue), this);
Op<1>().init(reinterpret_cast<Value*>(IfFalse), this);
Op<2>().init(Cond, this);
More information about the llvm-commits
mailing list