[llvm-commits] [llvm] r80041 - in /llvm/trunk: include/llvm/InstrTypes.h include/llvm/Instructions.h lib/VMCore/Instructions.cpp
Dan Gohman
gohman at apple.com
Tue Aug 25 15:29:09 PDT 2009
Author: djg
Date: Tue Aug 25 17:29:08 2009
New Revision: 80041
URL: http://llvm.org/viewvc/llvm-project?rev=80041&view=rev
Log:
Use covariant return types for Instruction::clone, and eliminate
the forms of ExtractElementInst and InsertElementInst that are
equivalent to clone.
Modified:
llvm/trunk/include/llvm/InstrTypes.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=80041&r1=80040&r2=80041&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Tue Aug 25 17:29:08 2009
@@ -53,7 +53,7 @@
virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0;
public:
- virtual Instruction *clone(LLVMContext &Context) const = 0;
+ virtual TerminatorInst *clone(LLVMContext &Context) const = 0;
/// getNumSuccessors - Return the number of successors that this terminator
/// has.
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=80041&r1=80040&r2=80041&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Aug 25 17:29:08 2009
@@ -78,7 +78,7 @@
unsigned getAlignment() const { return (1u << SubclassData) >> 1; }
void setAlignment(unsigned Align);
- virtual Instruction *clone(LLVMContext &Context) const = 0;
+ virtual AllocationInst *clone(LLVMContext &Context) const = 0;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const AllocationInst *) { return true; }
@@ -1276,10 +1276,6 @@
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr,
BasicBlock *InsertAtEnd);
public:
- static ExtractElementInst *Create(const ExtractElementInst &EE) {
- return Create(EE.getOperand(0), EE.getOperand(1));
- }
-
static ExtractElementInst *Create(Value *Vec, Value *Idx,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
@@ -1330,9 +1326,6 @@
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr, BasicBlock *InsertAtEnd);
public:
- static InsertElementInst *Create(const InsertElementInst &IE) {
- return Create(IE.getOperand(0), IE.getOperand(1), IE.getOperand(2));
- }
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
@@ -2638,7 +2631,7 @@
);
/// @brief Clone an identical TruncInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual TruncInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const TruncInst *) { return true; }
@@ -2674,7 +2667,7 @@
);
/// @brief Clone an identical ZExtInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual ZExtInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ZExtInst *) { return true; }
@@ -2710,7 +2703,7 @@
);
/// @brief Clone an identical SExtInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual SExtInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SExtInst *) { return true; }
@@ -2746,7 +2739,7 @@
);
/// @brief Clone an identical FPTruncInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual FPTruncInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPTruncInst *) { return true; }
@@ -2782,7 +2775,7 @@
);
/// @brief Clone an identical FPExtInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual FPExtInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPExtInst *) { return true; }
@@ -2818,7 +2811,7 @@
);
/// @brief Clone an identical UIToFPInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual UIToFPInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const UIToFPInst *) { return true; }
@@ -2854,7 +2847,7 @@
);
/// @brief Clone an identical SIToFPInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual SIToFPInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SIToFPInst *) { return true; }
@@ -2890,7 +2883,7 @@
);
/// @brief Clone an identical FPToUIInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual FPToUIInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPToUIInst *) { return true; }
@@ -2926,7 +2919,7 @@
);
/// @brief Clone an identical FPToSIInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual FPToSIInst *clone(LLVMContext &Context) const;
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPToSIInst *) { return true; }
@@ -2962,7 +2955,7 @@
);
/// @brief Clone an identical IntToPtrInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual IntToPtrInst *clone(LLVMContext &Context) const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const IntToPtrInst *) { return true; }
@@ -2998,7 +2991,7 @@
);
/// @brief Clone an identical PtrToIntInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual PtrToIntInst *clone(LLVMContext &Context) const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const PtrToIntInst *) { return true; }
@@ -3034,7 +3027,7 @@
);
/// @brief Clone an identical BitCastInst
- virtual CastInst *clone(LLVMContext &Context) const;
+ virtual BitCastInst *clone(LLVMContext &Context) const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BitCastInst *) { return true; }
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=80041&r1=80040&r2=80041&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Aug 25 17:29:08 2009
@@ -2933,73 +2933,73 @@
return New;
}
-CastInst *TruncInst::clone(LLVMContext&) const {
+TruncInst *TruncInst::clone(LLVMContext&) const {
TruncInst *New = new TruncInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *ZExtInst::clone(LLVMContext&) const {
+ZExtInst *ZExtInst::clone(LLVMContext&) const {
ZExtInst *New = new ZExtInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *SExtInst::clone(LLVMContext&) const {
+SExtInst *SExtInst::clone(LLVMContext&) const {
SExtInst *New = new SExtInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *FPTruncInst::clone(LLVMContext&) const {
+FPTruncInst *FPTruncInst::clone(LLVMContext&) const {
FPTruncInst *New = new FPTruncInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *FPExtInst::clone(LLVMContext&) const {
+FPExtInst *FPExtInst::clone(LLVMContext&) const {
FPExtInst *New = new FPExtInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *UIToFPInst::clone(LLVMContext&) const {
+UIToFPInst *UIToFPInst::clone(LLVMContext&) const {
UIToFPInst *New = new UIToFPInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *SIToFPInst::clone(LLVMContext&) const {
+SIToFPInst *SIToFPInst::clone(LLVMContext&) const {
SIToFPInst *New = new SIToFPInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *FPToUIInst::clone(LLVMContext&) const {
+FPToUIInst *FPToUIInst::clone(LLVMContext&) const {
FPToUIInst *New = new FPToUIInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *FPToSIInst::clone(LLVMContext&) const {
+FPToSIInst *FPToSIInst::clone(LLVMContext&) const {
FPToSIInst *New = new FPToSIInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *PtrToIntInst::clone(LLVMContext&) const {
+PtrToIntInst *PtrToIntInst::clone(LLVMContext&) const {
PtrToIntInst *New = new PtrToIntInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *IntToPtrInst::clone(LLVMContext&) const {
+IntToPtrInst *IntToPtrInst::clone(LLVMContext&) const {
IntToPtrInst *New = new IntToPtrInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
}
-CastInst *BitCastInst::clone(LLVMContext&) const {
+BitCastInst *BitCastInst::clone(LLVMContext&) const {
BitCastInst *New = new BitCastInst(getOperand(0), getType());
New->SubclassOptionalData = SubclassOptionalData;
return New;
More information about the llvm-commits
mailing list