aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp4
-rw-r--r--lib/VMCore/Instructions.cpp24
-rw-r--r--lib/VMCore/Verifier.cpp6
3 files changed, 34 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 7b01d63903..1ee93d7bba 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -608,6 +608,10 @@ public:
void visitMemIntrinsic(CallInst &I, unsigned Op);
+ void visitGetResult(GetResultInst &I) {
+ // FIXME
+ }
+
void visitUserOp1(Instruction &I) {
assert(0 && "UserOp1 should not exist at instruction selection time!");
abort();
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 863f011cd0..959ac9b617 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -2698,6 +2698,29 @@ void SwitchInst::setSuccessorV(unsigned idx, BasicBlock *B) {
setSuccessor(idx, B);
}
+//===----------------------------------------------------------------------===//
+// GetResultInst Implementation
+//===----------------------------------------------------------------------===//
+
+GetResultInst::GetResultInst(Value *Aggr, Value *Index,
+ const std::string &Name,
+ Instruction *InsertBef)
+ : Instruction(Aggr->getType(),
+ GetResult, Ops, 2, InsertBef) {
+ assert(isValidOperands(Aggr, Index) && "Invalid GetResultInst operands!");
+ Ops[0].init(Aggr, this);
+ Ops[1].init(Index, this);
+ setName(Name);
+}
+
+bool GetResultInst::isValidOperands(const Value *Aggr, const Value *Index) {
+ if (!Aggr || !Index)
+ return false;
+ if (!isa<StructType>(Aggr->getType()) || Index->getType() != Type::Int32Ty)
+ return false;
+ return true;
+}
+
// Define these methods here so vtables don't get emitted into every translation
// unit that uses these classes.
@@ -2754,3 +2777,4 @@ SwitchInst *SwitchInst::clone() const { return new SwitchInst(*this); }
InvokeInst *InvokeInst::clone() const { return new InvokeInst(*this); }
UnwindInst *UnwindInst::clone() const { return new UnwindInst(); }
UnreachableInst *UnreachableInst::clone() const { return new UnreachableInst();}
+GetResultInst *GetResultInst::clone() const { return new GetResultInst(*this); }
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 98f421e95e..a96f39c2c2 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -257,6 +257,7 @@ namespace { // Anonymous namespace for class
void visitUserOp2(Instruction &I) { visitUserOp1(I); }
void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI);
void visitAllocationInst(AllocationInst &AI);
+ void visitGetResultInst(GetResultInst &GRI);
void VerifyCallSite(CallSite CS);
void VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F,
@@ -1037,6 +1038,11 @@ void Verifier::visitAllocationInst(AllocationInst &AI) {
visitInstruction(AI);
}
+void Verifier::visitGetResultInst(GetResultInst &GRI) {
+ // FIXME : Check operands.
+ visitInstruction(GRI);
+}
+
/// verifyInstruction - Verify that an instruction is well formed.
///