llvm.org GIT mirror llvm / 30f8091
Use covariant return types for Instruction::clone, and eliminate the forms of ExtractElementInst and InsertElementInst that are equivalent to clone. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80041 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 11 years ago
3 changed file(s) with 26 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
5252 virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0;
5353 public:
5454
55 virtual Instruction *clone(LLVMContext &Context) const = 0;
55 virtual TerminatorInst *clone(LLVMContext &Context) const = 0;
5656
5757 /// getNumSuccessors - Return the number of successors that this terminator
5858 /// has.
7777 unsigned getAlignment() const { return (1u << SubclassData) >> 1; }
7878 void setAlignment(unsigned Align);
7979
80 virtual Instruction *clone(LLVMContext &Context) const = 0;
80 virtual AllocationInst *clone(LLVMContext &Context) const = 0;
8181
8282 // Methods for support type inquiry through isa, cast, and dyn_cast:
8383 static inline bool classof(const AllocationInst *) { return true; }
12751275 ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr,
12761276 BasicBlock *InsertAtEnd);
12771277 public:
1278 static ExtractElementInst *Create(const ExtractElementInst &EE) {
1279 return Create(EE.getOperand(0), EE.getOperand(1));
1280 }
1281
12821278 static ExtractElementInst *Create(Value *Vec, Value *Idx,
12831279 const Twine &NameStr = "",
12841280 Instruction *InsertBefore = 0) {
13291325 InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
13301326 const Twine &NameStr, BasicBlock *InsertAtEnd);
13311327 public:
1332 static InsertElementInst *Create(const InsertElementInst &IE) {
1333 return Create(IE.getOperand(0), IE.getOperand(1), IE.getOperand(2));
1334 }
13351328 static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
13361329 const Twine &NameStr = "",
13371330 Instruction *InsertBefore = 0) {
26372630 );
26382631
26392632 /// @brief Clone an identical TruncInst
2640 virtual CastInst *clone(LLVMContext &Context) const;
2633 virtual TruncInst *clone(LLVMContext &Context) const;
26412634
26422635 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
26432636 static inline bool classof(const TruncInst *) { return true; }
26732666 );
26742667
26752668 /// @brief Clone an identical ZExtInst
2676 virtual CastInst *clone(LLVMContext &Context) const;
2669 virtual ZExtInst *clone(LLVMContext &Context) const;
26772670
26782671 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
26792672 static inline bool classof(const ZExtInst *) { return true; }
27092702 );
27102703
27112704 /// @brief Clone an identical SExtInst
2712 virtual CastInst *clone(LLVMContext &Context) const;
2705 virtual SExtInst *clone(LLVMContext &Context) const;
27132706
27142707 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
27152708 static inline bool classof(const SExtInst *) { return true; }
27452738 );
27462739
27472740 /// @brief Clone an identical FPTruncInst
2748 virtual CastInst *clone(LLVMContext &Context) const;
2741 virtual FPTruncInst *clone(LLVMContext &Context) const;
27492742
27502743 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
27512744 static inline bool classof(const FPTruncInst *) { return true; }
27812774 );
27822775
27832776 /// @brief Clone an identical FPExtInst
2784 virtual CastInst *clone(LLVMContext &Context) const;
2777 virtual FPExtInst *clone(LLVMContext &Context) const;
27852778
27862779 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
27872780 static inline bool classof(const FPExtInst *) { return true; }
28172810 );
28182811
28192812 /// @brief Clone an identical UIToFPInst
2820 virtual CastInst *clone(LLVMContext &Context) const;
2813 virtual UIToFPInst *clone(LLVMContext &Context) const;
28212814
28222815 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
28232816 static inline bool classof(const UIToFPInst *) { return true; }
28532846 );
28542847
28552848 /// @brief Clone an identical SIToFPInst
2856 virtual CastInst *clone(LLVMContext &Context) const;
2849 virtual SIToFPInst *clone(LLVMContext &Context) const;
28572850
28582851 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
28592852 static inline bool classof(const SIToFPInst *) { return true; }
28892882 );
28902883
28912884 /// @brief Clone an identical FPToUIInst
2892 virtual CastInst *clone(LLVMContext &Context) const;
2885 virtual FPToUIInst *clone(LLVMContext &Context) const;
28932886
28942887 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
28952888 static inline bool classof(const FPToUIInst *) { return true; }
29252918 );
29262919
29272920 /// @brief Clone an identical FPToSIInst
2928 virtual CastInst *clone(LLVMContext &Context) const;
2921 virtual FPToSIInst *clone(LLVMContext &Context) const;
29292922
29302923 /// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
29312924 static inline bool classof(const FPToSIInst *) { return true; }
29612954 );
29622955
29632956 /// @brief Clone an identical IntToPtrInst
2964 virtual CastInst *clone(LLVMContext &Context) const;
2957 virtual IntToPtrInst *clone(LLVMContext &Context) const;
29652958
29662959 // Methods for support type inquiry through isa, cast, and dyn_cast:
29672960 static inline bool classof(const IntToPtrInst *) { return true; }
29972990 );
29982991
29992992 /// @brief Clone an identical PtrToIntInst
3000 virtual CastInst *clone(LLVMContext &Context) const;
2993 virtual PtrToIntInst *clone(LLVMContext &Context) const;
30012994
30022995 // Methods for support type inquiry through isa, cast, and dyn_cast:
30032996 static inline bool classof(const PtrToIntInst *) { return true; }
30333026 );
30343027
30353028 /// @brief Clone an identical BitCastInst
3036 virtual CastInst *clone(LLVMContext &Context) const;
3029 virtual BitCastInst *clone(LLVMContext &Context) const;
30373030
30383031 // Methods for support type inquiry through isa, cast, and dyn_cast:
30393032 static inline bool classof(const BitCastInst *) { return true; }
29322932 return New;
29332933 }
29342934
2935 CastInst *TruncInst::clone(LLVMContext&) const {
2935 TruncInst *TruncInst::clone(LLVMContext&) const {
29362936 TruncInst *New = new TruncInst(getOperand(0), getType());
29372937 New->SubclassOptionalData = SubclassOptionalData;
29382938 return New;
29392939 }
29402940
2941 CastInst *ZExtInst::clone(LLVMContext&) const {
2941 ZExtInst *ZExtInst::clone(LLVMContext&) const {
29422942 ZExtInst *New = new ZExtInst(getOperand(0), getType());
29432943 New->SubclassOptionalData = SubclassOptionalData;
29442944 return New;
29452945 }
29462946
2947 CastInst *SExtInst::clone(LLVMContext&) const {
2947 SExtInst *SExtInst::clone(LLVMContext&) const {
29482948 SExtInst *New = new SExtInst(getOperand(0), getType());
29492949 New->SubclassOptionalData = SubclassOptionalData;
29502950 return New;
29512951 }
29522952
2953 CastInst *FPTruncInst::clone(LLVMContext&) const {
2953 FPTruncInst *FPTruncInst::clone(LLVMContext&) const {
29542954 FPTruncInst *New = new FPTruncInst(getOperand(0), getType());
29552955 New->SubclassOptionalData = SubclassOptionalData;
29562956 return New;
29572957 }
29582958
2959 CastInst *FPExtInst::clone(LLVMContext&) const {
2959 FPExtInst *FPExtInst::clone(LLVMContext&) const {
29602960 FPExtInst *New = new FPExtInst(getOperand(0), getType());
29612961 New->SubclassOptionalData = SubclassOptionalData;
29622962 return New;
29632963 }
29642964
2965 CastInst *UIToFPInst::clone(LLVMContext&) const {
2965 UIToFPInst *UIToFPInst::clone(LLVMContext&) const {
29662966 UIToFPInst *New = new UIToFPInst(getOperand(0), getType());
29672967 New->SubclassOptionalData = SubclassOptionalData;
29682968 return New;
29692969 }
29702970
2971 CastInst *SIToFPInst::clone(LLVMContext&) const {
2971 SIToFPInst *SIToFPInst::clone(LLVMContext&) const {
29722972 SIToFPInst *New = new SIToFPInst(getOperand(0), getType());
29732973 New->SubclassOptionalData = SubclassOptionalData;
29742974 return New;
29752975 }
29762976
2977 CastInst *FPToUIInst::clone(LLVMContext&) const {
2977 FPToUIInst *FPToUIInst::clone(LLVMContext&) const {
29782978 FPToUIInst *New = new FPToUIInst(getOperand(0), getType());
29792979 New->SubclassOptionalData = SubclassOptionalData;
29802980 return New;
29812981 }
29822982
2983 CastInst *FPToSIInst::clone(LLVMContext&) const {
2983 FPToSIInst *FPToSIInst::clone(LLVMContext&) const {
29842984 FPToSIInst *New = new FPToSIInst(getOperand(0), getType());
29852985 New->SubclassOptionalData = SubclassOptionalData;
29862986 return New;
29872987 }
29882988
2989 CastInst *PtrToIntInst::clone(LLVMContext&) const {
2989 PtrToIntInst *PtrToIntInst::clone(LLVMContext&) const {
29902990 PtrToIntInst *New = new PtrToIntInst(getOperand(0), getType());
29912991 New->SubclassOptionalData = SubclassOptionalData;
29922992 return New;
29932993 }
29942994
2995 CastInst *IntToPtrInst::clone(LLVMContext&) const {
2995 IntToPtrInst *IntToPtrInst::clone(LLVMContext&) const {
29962996 IntToPtrInst *New = new IntToPtrInst(getOperand(0), getType());
29972997 New->SubclassOptionalData = SubclassOptionalData;
29982998 return New;
29992999 }
30003000
3001 CastInst *BitCastInst::clone(LLVMContext&) const {
3001 BitCastInst *BitCastInst::clone(LLVMContext&) const {
30023002 BitCastInst *New = new BitCastInst(getOperand(0), getType());
30033003 New->SubclassOptionalData = SubclassOptionalData;
30043004 return New;