[Statepoint] Clean up Statepoint.h: clang-format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjoy Das 2015-05-06 02:36:28 +00:00
parent 1df2d64d55
commit b9a2e8271f

View File

@ -52,7 +52,7 @@ class StatepointBase {
void *operator new(size_t, unsigned) = delete; void *operator new(size_t, unsigned) = delete;
void *operator new(size_t s) = delete; void *operator new(size_t s) = delete;
protected: protected:
explicit StatepointBase(InstructionTy *I) : StatepointCS(I) { explicit StatepointBase(InstructionTy *I) : StatepointCS(I) {
assert(isStatepoint(I)); assert(isStatepoint(I));
} }
@ -60,13 +60,11 @@ class StatepointBase {
assert(isStatepoint(CS)); assert(isStatepoint(CS));
} }
public: public:
typedef typename CallSiteTy::arg_iterator arg_iterator; typedef typename CallSiteTy::arg_iterator arg_iterator;
/// Return the underlying CallSite. /// Return the underlying CallSite.
CallSiteTy getCallSite() { CallSiteTy getCallSite() { return StatepointCS; }
return StatepointCS;
}
/// Return the value actually being called or invoked. /// Return the value actually being called or invoked.
ValueTy *getActualCallee() { return StatepointCS.getArgument(0); } ValueTy *getActualCallee() { return StatepointCS.getArgument(0); }
@ -110,9 +108,7 @@ class StatepointBase {
return iterator_range<arg_iterator>(call_args_begin(), call_args_end()); return iterator_range<arg_iterator>(call_args_begin(), call_args_end());
} }
typename CallSiteTy::arg_iterator vm_state_begin() { typename CallSiteTy::arg_iterator vm_state_begin() { return call_args_end(); }
return call_args_end();
}
typename CallSiteTy::arg_iterator vm_state_end() { typename CallSiteTy::arg_iterator vm_state_end() {
int Offset = 3 + getNumCallArgs() + 1 + getNumTotalVMSArgs(); int Offset = 3 + getNumCallArgs() + 1 + getNumTotalVMSArgs();
assert(Offset <= (int)StatepointCS.arg_size()); assert(Offset <= (int)StatepointCS.arg_size());
@ -130,9 +126,7 @@ class StatepointBase {
return vm_state_begin() + 6; return vm_state_begin() + 6;
} }
typename CallSiteTy::arg_iterator gc_args_begin() { typename CallSiteTy::arg_iterator gc_args_begin() { return vm_state_end(); }
return vm_state_end();
}
typename CallSiteTy::arg_iterator gc_args_end() { typename CallSiteTy::arg_iterator gc_args_end() {
return StatepointCS.arg_end(); return StatepointCS.arg_end();
} }
@ -170,8 +164,7 @@ class StatepointBase {
/// A specialization of it's base class for read only access /// A specialization of it's base class for read only access
/// to a gc.statepoint. /// to a gc.statepoint.
class ImmutableStatepoint class ImmutableStatepoint
: public StatepointBase<const Instruction, const Value, : public StatepointBase<const Instruction, const Value, ImmutableCallSite> {
ImmutableCallSite> {
typedef StatepointBase<const Instruction, const Value, ImmutableCallSite> typedef StatepointBase<const Instruction, const Value, ImmutableCallSite>
Base; Base;
@ -196,30 +189,23 @@ public:
class GCRelocateOperands { class GCRelocateOperands {
ImmutableCallSite RelocateCS; ImmutableCallSite RelocateCS;
public: public:
GCRelocateOperands(const User* U) : RelocateCS(U) { GCRelocateOperands(const User *U) : RelocateCS(U) { assert(isGCRelocate(U)); }
assert(isGCRelocate(U));
}
GCRelocateOperands(const Instruction *inst) : RelocateCS(inst) { GCRelocateOperands(const Instruction *inst) : RelocateCS(inst) {
assert(isGCRelocate(inst)); assert(isGCRelocate(inst));
} }
GCRelocateOperands(CallSite CS) : RelocateCS(CS) { GCRelocateOperands(CallSite CS) : RelocateCS(CS) { assert(isGCRelocate(CS)); }
assert(isGCRelocate(CS));
}
/// Return true if this relocate is tied to the invoke statepoint. /// Return true if this relocate is tied to the invoke statepoint.
/// This includes relocates which are on the unwinding path. /// This includes relocates which are on the unwinding path.
bool isTiedToInvoke() const { bool isTiedToInvoke() const {
const Value *Token = RelocateCS.getArgument(0); const Value *Token = RelocateCS.getArgument(0);
return isa<ExtractValueInst>(Token) || return isa<ExtractValueInst>(Token) || isa<InvokeInst>(Token);
isa<InvokeInst>(Token);
} }
/// Get enclosed relocate intrinsic /// Get enclosed relocate intrinsic
ImmutableCallSite getUnderlyingCallSite() { ImmutableCallSite getUnderlyingCallSite() { return RelocateCS; }
return RelocateCS;
}
/// The statepoint with which this gc.relocate is associated. /// The statepoint with which this gc.relocate is associated.
const Instruction *getStatepoint() { const Instruction *getStatepoint() {
@ -269,8 +255,8 @@ class GCRelocateOperands {
template <typename InstructionTy, typename ValueTy, typename CallSiteTy> template <typename InstructionTy, typename ValueTy, typename CallSiteTy>
std::vector<GCRelocateOperands> std::vector<GCRelocateOperands>
StatepointBase<InstructionTy, ValueTy, CallSiteTy>:: StatepointBase<InstructionTy, ValueTy, CallSiteTy>::getRelocates(
getRelocates(ImmutableStatepoint &IS) { ImmutableStatepoint &IS) {
std::vector<GCRelocateOperands> Result; std::vector<GCRelocateOperands> Result;
@ -288,7 +274,7 @@ std::vector<GCRelocateOperands>
// We need to scan thorough exceptional relocations if it is invoke statepoint // We need to scan thorough exceptional relocations if it is invoke statepoint
LandingPadInst *LandingPad = LandingPadInst *LandingPad =
cast<InvokeInst>(StatepointCS.getInstruction())->getLandingPadInst(); cast<InvokeInst>(StatepointCS.getInstruction())->getLandingPadInst();
// Search for extract value from landingpad instruction to which // Search for extract value from landingpad instruction to which
// gc relocates will be attached // gc relocates will be attached
@ -303,7 +289,6 @@ std::vector<GCRelocateOperands>
} }
return Result; return Result;
} }
} }
#endif #endif