[llvm-commits] [dragonegg] r135265 - in /dragonegg/trunk/src: Convert.cpp Debug.cpp x86/Target.cpp

Jay Foad jay.foad at gmail.com
Fri Jul 15 01:37:35 PDT 2011


Author: foad
Date: Fri Jul 15 03:37:34 2011
New Revision: 135265

URL: http://llvm.org/viewvc/llvm-project?rev=135265&view=rev
Log:
Convert CallInst and InvokeInst APIs to use ArrayRef.

Modified:
    dragonegg/trunk/src/Convert.cpp
    dragonegg/trunk/src/Debug.cpp
    dragonegg/trunk/src/x86/Target.cpp

Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=135265&r1=135264&r2=135265&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Fri Jul 15 03:37:34 2011
@@ -426,7 +426,7 @@
         const Type *ArgTypes[3] = {SBP, SBP, IntPtr };
         Builder.CreateCall(Intrinsic::getDeclaration(TheModule, 
                                                      Intrinsic::memcpy,
-                                                     ArgTypes, 3), Ops, Ops+5);
+                                                     ArgTypes, 3), Ops);
 
         AI->setName(NameStack.back());
       }
@@ -1671,7 +1671,7 @@
   const Type *ArgTypes[3] = { SBP, SBP, IntPtr };
 
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memcpy,
-                                               ArgTypes, 3), Ops, Ops+5);
+                                               ArgTypes, 3), Ops);
   return Ops[0];
 }
 
@@ -1689,7 +1689,7 @@
   const Type *ArgTypes[3] = { SBP, SBP, IntPtr };
 
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memmove,
-                                               ArgTypes, 3), Ops, Ops+5);
+                                               ArgTypes, 3), Ops);
   return Ops[0];
 }
 
@@ -1707,7 +1707,7 @@
   const Type *ArgTypes[2] = { SBP, IntPtr };
 
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::memset,
-                                               ArgTypes, 2), Ops, Ops+5);
+                                               ArgTypes, 2), Ops);
   return Ops[0];
 }
 
@@ -1730,7 +1730,7 @@
     ConstantPointerNull::get(Ty)
   };
 
-  Builder.CreateCall(gcrootFun, Ops, Ops+2);
+  Builder.CreateCall(gcrootFun, Ops);
 }
 
 // Emits annotate intrinsic if the decl has the annotate attribute set.
@@ -1778,7 +1778,7 @@
         lineNo
       };
 
-      Builder.CreateCall(annotateFun, Ops, Ops+4);
+      Builder.CreateCall(annotateFun, Ops);
     }
 
     // Get next annotate attribute.
@@ -2157,8 +2157,7 @@
     }
 
     // Emit the selector call.
-    Value *Filter = Builder.CreateCall(SlctrIntr, Args.begin(), Args.end(),
-                                       "filter");
+    Value *Filter = Builder.CreateCall(SlctrIntr, Args, "filter");
 
     // Store it if made use of elsewhere.
     if (RegionNo < ExceptionFilters.size() && ExceptionFilters[RegionNo])
@@ -2230,7 +2229,7 @@
       // One more than the filter length.
       Args[2] = Builder.getInt32(1);
       // Create the selector call.
-      Builder.CreateCall(SlctrIntr, Args, Args + 3, "filter");
+      Builder.CreateCall(SlctrIntr, Args, "filter");
 
       if (LandingPad != FailureBlock) {
         // Make sure all invokes unwind to the new landing pad.
@@ -2946,13 +2945,12 @@
 
   Value *Call;
   if (!LandingPad) {
-    Call = Builder.CreateCall(Callee, CallOperands.begin(), CallOperands.end());
+    Call = Builder.CreateCall(Callee, CallOperands);
     cast<CallInst>(Call)->setCallingConv(CallingConvention);
     cast<CallInst>(Call)->setAttributes(PAL);
   } else {
     BasicBlock *NextBlock = BasicBlock::Create(Context);
-    Call = Builder.CreateInvoke(Callee, NextBlock, LandingPad,
-                                CallOperands.begin(), CallOperands.end());
+    Call = Builder.CreateInvoke(Callee, NextBlock, LandingPad, CallOperands);
     cast<InvokeInst>(Call)->setCallingConv(CallingConvention);
     cast<InvokeInst>(Call)->setAttributes(PAL);
 
@@ -3126,7 +3124,7 @@
     F->setCallingConv(CC);
 
   // Finally, call the function.
-  CallInst *CI = Builder.CreateCall(Func, Args.begin(), Args.end());
+  CallInst *CI = Builder.CreateCall(Func, Args);
   CI->setCallingConv(CC);
   return CI;
 }
@@ -3714,7 +3712,7 @@
 
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                Intrinsic::memory_barrier),
-                     C, C + 5);
+                     C);
 }
 
 Value *
@@ -3743,7 +3741,7 @@
   Value *Result =
     Builder.CreateCall(Intrinsic::getDeclaration(TheModule,  id,
                                                  Ty, 2),
-    C, C + 2);
+                       C);
 
   // The gcc builtins are also full memory barriers.
   // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
@@ -3789,7 +3787,7 @@
   Value *Result =
     Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                  Intrinsic::atomic_cmp_swap,
-                                                 Ty, 2), Ops, Ops + 3);
+                                                 Ty, 2), Ops);
 
   // The gcc builtins are also full memory barriers.
   // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
@@ -3953,7 +3951,7 @@
                                                           Intrinsic::objectsize,
                                                           &Ty,
                                                           1),
-                                Args, Args + 2);
+                                Args);
     return true;
   }
   // Unary bit counting intrinsics.
@@ -4191,7 +4189,7 @@
 
     Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                  Intrinsic::memory_barrier),
-                       C, C + 5);
+                       C);
     return true;
   }
 #if defined(TARGET_ALPHA) || defined(TARGET_386) || defined(TARGET_POWERPC) \
@@ -4352,7 +4350,7 @@
       Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                    Intrinsic::atomic_load_add,
                                                    Ty, 2),
-                         C, C + 2);
+                         C);
 
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
@@ -4400,7 +4398,7 @@
       Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                    Intrinsic::atomic_load_sub,
                                                    Ty, 2),
-                         C, C + 2);
+                         C);
 
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
@@ -4448,7 +4446,7 @@
       Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                    Intrinsic::atomic_load_or,
                                                    Ty, 2),
-                         C, C + 2);
+                         C);
 
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
@@ -4496,7 +4494,7 @@
       Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                    Intrinsic::atomic_load_and,
                                                    Ty, 2),
-                         C, C + 2);
+                         C);
 
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
@@ -4544,7 +4542,7 @@
       Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                    Intrinsic::atomic_load_xor,
                                                    Ty, 2),
-                         C, C + 2);
+                         C);
 
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
@@ -4592,7 +4590,7 @@
       Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                    Intrinsic::atomic_load_nand,
                                                    Ty, 2),
-                         C, C + 2);
+                         C);
 
     // The gcc builtins are also full memory barriers.
     // FIXME: __sync_lock_test_and_set and __sync_lock_release require less.
@@ -4724,7 +4722,7 @@
   Args.push_back(Pow);
   return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                       Intrinsic::powi, &Ty, 1),
-                            Args.begin(), Args.end());
+                            Args);
 }
 
 Value *TreeToLLVM::EmitBuiltinPOW(gimple stmt) {
@@ -4740,7 +4738,7 @@
   Args.push_back(Pow);
   return Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
                                                       Intrinsic::pow, &Ty, 1),
-                            Args.begin(), Args.end());
+                            Args);
 }
 
 Value *TreeToLLVM::EmitBuiltinLCEIL(gimple stmt) {
@@ -5276,7 +5274,7 @@
   Handler = Builder.CreateBitCast(Handler, Type::getInt8PtrTy(Context));
 
   Value *Args[2] = { Offset, Handler };
-  Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Args, Args + 2);
+  Builder.CreateCall(Intrinsic::getDeclaration(TheModule, IID), Args);
   Builder.CreateUnreachable();
   BeginBlock(BasicBlock::Create(Context));
 
@@ -5441,7 +5439,7 @@
   Args.push_back(Builder.CreateBitCast(Arg2, VPTy));
 
   Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::vacopy),
-                     Args.begin(), Args.end());
+                     Args);
   return true;
 }
 
@@ -5502,7 +5500,7 @@
 
   Function *Intr = Intrinsic::getDeclaration(TheModule,
                                              Intrinsic::init_trampoline);
-  Value *Adjusted = Builder.CreateCall(Intr, Ops, Ops + 3, "adjusted");
+  Value *Adjusted = Builder.CreateCall(Intr, Ops, "adjusted");
 
   // Store the llvm.init.trampoline result to the GCC trampoline storage.
   assert(TD.getPointerSize() <= TRAMPOLINE_SIZE &&
@@ -5520,7 +5518,7 @@
   Intr = Intrinsic::getDeclaration(TheModule, Intrinsic::invariant_start);
   Ops[0] = Builder.getInt64(TRAMPOLINE_SIZE);
   Ops[1] = Builder.CreateBitCast(Tramp, VPTy);
-  Builder.CreateCall(Intr, Ops, Ops + 2);
+  Builder.CreateCall(Intr, ArrayRef<Value *>(Ops, 2));
 
   return true;
 }
@@ -5598,7 +5596,7 @@
       };
 
       const Type* FieldPtrType = FieldPtr->getType();
-      FieldPtr = Builder.CreateCall(Fn, Ops, Ops+4);
+      FieldPtr = Builder.CreateCall(Fn, Ops);
       FieldPtr = Builder.CreateBitCast(FieldPtr, FieldPtrType);
     }
 
@@ -7970,7 +7968,7 @@
 
   std::string NewAsmStr = ConvertInlineAsmStr(stmt, NumOutputs+NumInputs);
   Value *Asm = InlineAsm::get(FTy, NewAsmStr, ConstraintStr, HasSideEffects);
-  CallInst *CV = Builder.CreateCall(Asm, CallOps.begin(), CallOps.end(),
+  CallInst *CV = Builder.CreateCall(Asm, CallOps,
                                     CallResultTypes.empty() ? "" : "asmtmp");
   CV->setDoesNotThrow();
 

Modified: dragonegg/trunk/src/Debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Debug.cpp?rev=135265&r1=135264&r2=135265&view=diff
==============================================================================
--- dragonegg/trunk/src/Debug.cpp (original)
+++ dragonegg/trunk/src/Debug.cpp Fri Jul 15 03:37:34 2011
@@ -1747,7 +1747,7 @@
 
   Value *Args[] = { MDNode::get(Storage->getContext(), Storage), 
                     D };
-  return CallInst::Create(DeclareFn, Args, Args+2, "", InsertBefore);
+  return CallInst::Create(DeclareFn, Args, "", InsertBefore);
 }
 
 /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
@@ -1764,9 +1764,9 @@
   // If this block already has a terminator then insert this intrinsic
   // before the terminator.
   if (TerminatorInst *T = InsertAtEnd->getTerminator())
-    return CallInst::Create(DeclareFn, Args, Args+2, "", T);
+    return CallInst::Create(DeclareFn, Args, "", T);
   else
-    return CallInst::Create(DeclareFn, Args, Args+2, "", InsertAtEnd);}
+    return CallInst::Create(DeclareFn, Args, "", InsertAtEnd);}
 
 /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
 Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, uint64_t Offset,
@@ -1780,7 +1780,7 @@
   Value *Args[] = { MDNode::get(V->getContext(), V),
                     ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
                     D };
-  return CallInst::Create(ValueFn, Args, Args+3, "", InsertBefore);
+  return CallInst::Create(ValueFn, Args, "", InsertBefore);
 }
 
 /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
@@ -1795,7 +1795,7 @@
   Value *Args[] = { MDNode::get(V->getContext(), V),
                     ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
                     D };
-  return CallInst::Create(ValueFn, Args, Args+3, "", InsertAtEnd);
+  return CallInst::Create(ValueFn, Args, "", InsertAtEnd);
 }
 
 // RecordType - Record DIType in a module such that it is not lost even if

Modified: dragonegg/trunk/src/x86/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/Target.cpp?rev=135265&r1=135264&r2=135265&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Fri Jul 15 03:37:34 2011
@@ -570,7 +570,7 @@
     Value *Arg1 = Ops[1];
     if (flip) std::swap(Arg0, Arg1);
     Value *CallOps[3] = { Arg0, Arg1, Pred };
-    Result = Builder.CreateCall(cmpps, CallOps, CallOps+3);
+    Result = Builder.CreateCall(cmpps, CallOps);
     Result = Builder.CreateBitCast(Result, ResultType);
     return true;
   }
@@ -587,7 +587,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_cmp_ss);
     Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode);
     Value *CallOps[3] = { Ops[0], Ops[1], Pred };
-    Result = Builder.CreateCall(cmpss, CallOps, CallOps+3);
+    Result = Builder.CreateCall(cmpss, CallOps);
     Result = Builder.CreateBitCast(Result, ResultType);
     return true;
   }
@@ -612,7 +612,7 @@
     if (flip) std::swap(Arg0, Arg1);
 
     Value *CallOps[3] = { Arg0, Arg1, Pred };
-    Result = Builder.CreateCall(cmppd, CallOps, CallOps+3);
+    Result = Builder.CreateCall(cmppd, CallOps);
     Result = Builder.CreateBitCast(Result, ResultType);
     return true;
   }
@@ -629,7 +629,7 @@
       Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse2_cmp_sd);
     Value *Pred = ConstantInt::get(Type::getInt8Ty(Context), PredCode);
     Value *CallOps[3] = { Ops[0], Ops[1], Pred };
-    Result = Builder.CreateCall(cmpsd, CallOps, CallOps+3);
+    Result = Builder.CreateCall(cmpsd, CallOps);
     Result = Builder.CreateBitCast(Result, ResultType);
     return true;
   }
@@ -690,7 +690,8 @@
         // create i32 constant
         Function *F = Intrinsic::getDeclaration(TheModule,
                                                 Intrinsic::x86_mmx_psrl_q);
-        Result = Builder.CreateCall(F, &Ops[0], &Ops[0] + 2, "palignr");
+        Result = Builder.CreateCall(F, ArrayRef<Value *>(&Ops[0], 2),
+                                    "palignr");
         return true;
       }
 
@@ -742,7 +743,8 @@
         // create i32 constant
         Function *F = Intrinsic::getDeclaration(TheModule,
                                                 Intrinsic::x86_sse2_psrl_dq);
-        Result = Builder.CreateCall(F, &Ops[0], &Ops[0] + 2, "palignr");
+        Result = Builder.CreateCall(F, ArrayRef<Value *>(&Ops[0], 2),
+                                    "palignr");
         return true;
       }
 





More information about the llvm-commits mailing list