[llvm-commits] CVS: llvm/include/llvm/Instruction.def iOther.h
Chris Lattner
lattner at cs.uiuc.edu
Wed May 7 21:44:02 PDT 2003
Changes in directory llvm/include/llvm:
Instruction.def updated: 1.5 -> 1.6
iOther.h updated: 1.32 -> 1.33
---
Log message:
Add new VarArgInst class for the va_arg instruction
---
Diffs of the changes:
Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.5 llvm/include/llvm/Instruction.def:1.6
--- llvm/include/llvm/Instruction.def:1.5 Tue Sep 10 10:27:31 2002
+++ llvm/include/llvm/Instruction.def Wed May 7 21:42:50 2003
@@ -119,10 +119,11 @@
HANDLE_OTHER_INST(29, Shl , ShiftInst ) // Shift operations
HANDLE_OTHER_INST(30, Shr , ShiftInst )
+HANDLE_OTHER_INST(31, VarArg , VarArgInst ) // va_arg instruction
-HANDLE_OTHER_INST(31, UserOp1, Instruction) // May be used internally in a pass
-HANDLE_OTHER_INST(32, UserOp2, Instruction)
- LAST_OTHER_INST(32)
+HANDLE_OTHER_INST(32, UserOp1, Instruction) // May be used internally in a pass
+HANDLE_OTHER_INST(33, UserOp2, Instruction)
+ LAST_OTHER_INST(33)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
Index: llvm/include/llvm/iOther.h
diff -u llvm/include/llvm/iOther.h:1.32 llvm/include/llvm/iOther.h:1.33
--- llvm/include/llvm/iOther.h:1.32 Mon Feb 24 14:48:28 2003
+++ llvm/include/llvm/iOther.h Wed May 7 21:42:50 2003
@@ -121,4 +121,40 @@
}
};
+
+//===----------------------------------------------------------------------===//
+// VarArgInst Class
+//===----------------------------------------------------------------------===//
+
+/// VarArgInst - This class represents the va_arg llvm instruction, which reads
+/// an argument of the destination type from the va_list operand pointed to by
+/// the only operand.
+///
+class VarArgInst : public Instruction {
+ VarArgInst(const VarArgInst &VAI) : Instruction(VAI.getType(), VarArg) {
+ Operands.reserve(1);
+ Operands.push_back(Use(VAI.Operands[0], this));
+ }
+public:
+ VarArgInst(Value *S, const Type *Ty, const std::string &Name = "",
+ Instruction *InsertBefore = 0)
+ : Instruction(Ty, VarArg, Name, InsertBefore) {
+ Operands.reserve(1);
+ Operands.push_back(Use(S, this));
+ }
+
+ virtual Instruction *clone() const { return new VarArgInst(*this); }
+
+ bool mayWriteToMemory() const { return true; }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const VarArgInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return I->getOpcode() == VarArg;
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
+};
+
#endif
More information about the llvm-commits
mailing list