Index: llvm/trunk/include/llvm/IR/Statepoint.h =================================================================== --- llvm/trunk/include/llvm/IR/Statepoint.h +++ llvm/trunk/include/llvm/IR/Statepoint.h @@ -101,13 +101,13 @@ } /// Return the ID associated with this statepoint. - uint64_t getID() { + uint64_t getID() const { const Value *IDVal = getCallSite().getArgument(IDPos); return cast(IDVal)->getZExtValue(); } /// Return the number of patchable bytes associated with this statepoint. - uint32_t getNumPatchBytes() { + uint32_t getNumPatchBytes() const { const Value *NumPatchBytesVal = getCallSite().getArgument(NumPatchBytesPos); uint64_t NumPatchBytes = cast(NumPatchBytesVal)->getZExtValue(); @@ -116,91 +116,93 @@ } /// Return the value actually being called or invoked. - ValueTy *getActualCallee() { + ValueTy *getActualCallee() const { return getCallSite().getArgument(ActualCalleePos); } /// Return the type of the value returned by the call underlying the /// statepoint. - Type *getActualReturnType() { + Type *getActualReturnType() const { auto *FTy = cast( cast(getActualCallee()->getType())->getElementType()); return FTy->getReturnType(); } /// Number of arguments to be passed to the actual callee. - int getNumCallArgs() { + int getNumCallArgs() const { const Value *NumCallArgsVal = getCallSite().getArgument(NumCallArgsPos); return cast(NumCallArgsVal)->getZExtValue(); } - typename CallSiteTy::arg_iterator call_args_begin() { + typename CallSiteTy::arg_iterator call_args_begin() const { assert(CallArgsBeginPos <= (int)getCallSite().arg_size()); return getCallSite().arg_begin() + CallArgsBeginPos; } - typename CallSiteTy::arg_iterator call_args_end() { + typename CallSiteTy::arg_iterator call_args_end() const { auto I = call_args_begin() + getNumCallArgs(); assert((getCallSite().arg_end() - I) >= 0); return I; } /// range adapter for call arguments - iterator_range call_args() { + iterator_range call_args() const { return iterator_range(call_args_begin(), call_args_end()); } /// Number of GC transition args. - int getNumTotalGCTransitionArgs() { + int getNumTotalGCTransitionArgs() const { const Value *NumGCTransitionArgs = *call_args_end(); return cast(NumGCTransitionArgs)->getZExtValue(); } - typename CallSiteTy::arg_iterator gc_transition_args_begin() { + typename CallSiteTy::arg_iterator gc_transition_args_begin() const { auto I = call_args_end() + 1; assert((getCallSite().arg_end() - I) >= 0); return I; } - typename CallSiteTy::arg_iterator gc_transition_args_end() { + typename CallSiteTy::arg_iterator gc_transition_args_end() const { auto I = gc_transition_args_begin() + getNumTotalGCTransitionArgs(); assert((getCallSite().arg_end() - I) >= 0); return I; } /// range adapter for GC transition arguments - iterator_range gc_transition_args() { + iterator_range gc_transition_args() const { return iterator_range(gc_transition_args_begin(), gc_transition_args_end()); } /// Number of additional arguments excluding those intended /// for garbage collection. - int getNumTotalVMSArgs() { + int getNumTotalVMSArgs() const { const Value *NumVMSArgs = *gc_transition_args_end(); return cast(NumVMSArgs)->getZExtValue(); } - typename CallSiteTy::arg_iterator vm_state_begin() { + typename CallSiteTy::arg_iterator vm_state_begin() const { auto I = gc_transition_args_end() + 1; assert((getCallSite().arg_end() - I) >= 0); return I; } - typename CallSiteTy::arg_iterator vm_state_end() { + typename CallSiteTy::arg_iterator vm_state_end() const { auto I = vm_state_begin() + getNumTotalVMSArgs(); assert((getCallSite().arg_end() - I) >= 0); return I; } /// range adapter for vm state arguments - iterator_range vm_state_args() { + iterator_range vm_state_args() const { return iterator_range(vm_state_begin(), vm_state_end()); } - typename CallSiteTy::arg_iterator gc_args_begin() { return vm_state_end(); } - typename CallSiteTy::arg_iterator gc_args_end() { + typename CallSiteTy::arg_iterator gc_args_begin() const { + return vm_state_end(); + } + typename CallSiteTy::arg_iterator gc_args_end() const { return getCallSite().arg_end(); } /// range adapter for gc arguments - iterator_range gc_args() { + iterator_range gc_args() const { return iterator_range(gc_args_begin(), gc_args_end()); } @@ -208,12 +210,12 @@ /// May contain several relocations for the same base/derived pair. /// For example this could happen due to relocations on unwinding /// path of invoke. - std::vector getRelocates(); + std::vector getRelocates() const; /// Get the experimental_gc_result call tied to this statepoint. Can be /// nullptr if there isn't a gc_result tied to this statepoint. Guaranteed to /// be a CallInst if non-null. - InstructionTy *getGCResult() { + InstructionTy *getGCResult() const { for (auto *U : getCallSite().getInstruction()->users()) if (isGCResult(U)) return cast(U); @@ -336,7 +338,7 @@ template std::vector -StatepointBase::getRelocates() { +StatepointBase::getRelocates() const { std::vector Result;