[llvm-commits] CVS: llvm/include/llvm/Instruction.def Intrinsics.h iOther.h
Chris Lattner
lattner at cs.uiuc.edu
Sat Oct 18 00:54:01 PDT 2003
Changes in directory llvm/include/llvm:
Instruction.def updated: 1.8 -> 1.9
Intrinsics.h updated: 1.10 -> 1.11
iOther.h updated: 1.37 -> 1.38
---
Log message:
New revised variable argument handling support
---
Diffs of the changes: (+54 -20)
Index: llvm/include/llvm/Instruction.def
diff -u llvm/include/llvm/Instruction.def:1.8 llvm/include/llvm/Instruction.def:1.9
--- llvm/include/llvm/Instruction.def:1.8 Tue Sep 30 13:37:37 2003
+++ llvm/include/llvm/Instruction.def Sat Oct 18 00:52:51 2003
@@ -120,11 +120,12 @@
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, VANext , VANextInst ) // vanext instruction
+HANDLE_OTHER_INST(32, VAArg , VAArgInst ) // vaarg instruction
-HANDLE_OTHER_INST(32, UserOp1, Instruction) // May be used internally in a pass
-HANDLE_OTHER_INST(33, UserOp2, Instruction)
- LAST_OTHER_INST(33)
+HANDLE_OTHER_INST(33, UserOp1, Instruction) // May be used internally in a pass
+HANDLE_OTHER_INST(34, UserOp2, Instruction)
+ LAST_OTHER_INST(34)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
Index: llvm/include/llvm/Intrinsics.h
diff -u llvm/include/llvm/Intrinsics.h:1.10 llvm/include/llvm/Intrinsics.h:1.11
--- llvm/include/llvm/Intrinsics.h:1.10 Mon Sep 8 14:44:47 2003
+++ llvm/include/llvm/Intrinsics.h Sat Oct 18 00:52:51 2003
@@ -18,9 +18,9 @@
not_intrinsic = 0, // Must be zero
// Varargs handling intrinsics...
- va_start, // Used to represent a va_start call in C
- va_end, // Used to represent a va_end call in C
- va_copy, // Used to represent a va_copy call in C
+ va_start, // Used to implement the va_start macro in C
+ va_end, // Used to implement the va_end macro in C
+ va_copy, // Used to implement the va_copy macro in C
// Setjmp/Longjmp intrinsics...
setjmp, // Used to represent a setjmp call in C
Index: llvm/include/llvm/iOther.h
diff -u llvm/include/llvm/iOther.h:1.37 llvm/include/llvm/iOther.h:1.38
--- llvm/include/llvm/iOther.h:1.37 Tue Sep 30 13:37:37 2003
+++ llvm/include/llvm/iOther.h Sat Oct 18 00:52:51 2003
@@ -123,34 +123,67 @@
//===----------------------------------------------------------------------===//
-// VarArgInst Class
+// VANextInst 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.
+/// VANextInst - This class represents the va_next llvm instruction, which
+/// advances a vararg list passed an argument of the specified type, returning
+/// the resultant list.
///
-class VarArgInst : public Instruction {
- VarArgInst(const VarArgInst &VAI) : Instruction(VAI.getType(), VarArg) {
+class VANextInst : public Instruction {
+ PATypeHolder ArgTy;
+ VANextInst(const VANextInst &VAN)
+ : Instruction(VAN.getType(), VANext), ArgTy(VAN.getArgType()) {
Operands.reserve(1);
- Operands.push_back(Use(VAI.Operands[0], this));
+ Operands.push_back(Use(VAN.Operands[0], this));
}
public:
- VarArgInst(Value *S, const Type *Ty, const std::string &Name = "",
+ VANextInst(Value *List, const Type *Ty, const std::string &Name = "",
Instruction *InsertBefore = 0)
- : Instruction(Ty, VarArg, Name, InsertBefore) {
+ : Instruction(List->getType(), VANext, Name, InsertBefore), ArgTy(Ty) {
Operands.reserve(1);
- Operands.push_back(Use(S, this));
+ Operands.push_back(Use(List, this));
}
- virtual Instruction *clone() const { return new VarArgInst(*this); }
+ const Type *getArgType() const { return ArgTy; }
+
+ virtual Instruction *clone() const { return new VANextInst(*this); }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const VANextInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return I->getOpcode() == VANext;
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
+};
+
+/// VAArgInst - This class represents the va_arg llvm instruction, which returns
+/// an argument of the specified type given a va_list.
+///
+class VAArgInst : public Instruction {
+ VAArgInst(const VAArgInst &VAA)
+ : Instruction(VAA.getType(), VAArg) {
+ Operands.reserve(1);
+ Operands.push_back(Use(VAA.Operands[0], this));
+ }
+public:
+ VAArgInst(Value *List, const Type *Ty, const std::string &Name = "",
+ Instruction *InsertBefore = 0)
+ : Instruction(Ty, VAArg, Name, InsertBefore) {
+ Operands.reserve(1);
+ Operands.push_back(Use(List, this));
+ }
+
+ virtual Instruction *clone() const { return new VAArgInst(*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 VAArgInst *) { return true; }
static inline bool classof(const Instruction *I) {
- return I->getOpcode() == VarArg;
+ return I->getOpcode() == VAArg;
}
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
More information about the llvm-commits
mailing list