aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Instructions.h
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-02-19 22:15:16 +0000
committerDevang Patel <dpatel@apple.com>2008-02-19 22:15:16 +0000
commit40a04216daaaee119665e023019c005306ec48ac (patch)
tree3b180bf2e6550fdd00ee45fefe851cdc488e4242 /include/llvm/Instructions.h
parent222ebf70b7577be05c3555de0fdd16f1577a0832 (diff)
downloadexternal_llvm-40a04216daaaee119665e023019c005306ec48ac.zip
external_llvm-40a04216daaaee119665e023019c005306ec48ac.tar.gz
external_llvm-40a04216daaaee119665e023019c005306ec48ac.tar.bz2
Add GetResultInst. First step for multiple return value support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47348 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instructions.h')
-rw-r--r--include/llvm/Instructions.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 2de8c57..54b67ff 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -2340,6 +2340,56 @@ public:
}
};
+//===----------------------------------------------------------------------===//
+// GetResultInst Class
+//===----------------------------------------------------------------------===//
+
+/// GetResultInst - This instruction extracts individual result value from
+/// aggregate value, where aggregate value is returned by CallInst.
+///
+class GetResultInst : public Instruction {
+ Use Ops[2];
+ GetResultInst(const GetResultInst &GRI) :
+ Instruction(GRI.getType(), Instruction::GetResult, Ops, 2) {
+ Ops[0].init(GRI.Ops[0], this);
+ Ops[1].init(GRI.Ops[1], this);
+ }
+
+public:
+ explicit GetResultInst(Value *Aggr, Value *Index,
+ const std::string &Name = "",
+ Instruction *InsertBefore = 0);
+
+ /// isValidOperands - Return true if an getresult instruction can be
+ /// formed with the specified operands.
+ static bool isValidOperands(const Value *Aggr, const Value *Idx);
+
+ virtual GetResultInst *clone() const;
+
+ // getType - Get aggregate value element type
+ inline const Type *getType() const {
+ return Ops[0]->getType();
+ }
+
+ Value *getAggregateValue() {
+ return getOperand(0);
+ }
+ const Value *geIndex() {
+ return getOperand(1);
+ }
+
+ unsigned getNumOperands() const { return 2; }
+
+ // Methods for support type inquiry through isa, cast, and dyn_cast:
+ static inline bool classof(const GetResultInst *) { return true; }
+ static inline bool classof(const Instruction *I) {
+ return (I->getOpcode() == Instruction::GetResult);
+ }
+ static inline bool classof(const Value *V) {
+ return isa<Instruction>(V) && classof(cast<Instruction>(V));
+ }
+};
+
} // End llvm namespace
#endif