From b5500b9ca0102f1ccaf32f0e77e96d0739aded9b Mon Sep 17 00:00:00 2001 From: pascal Date: Sat, 3 Sep 2016 22:46:54 +0000 Subject: Use the space freed up by sparc and zaurus to import LLVM. ok hackroom@ --- gnu/llvm/lib/CodeGen/StatepointExampleGC.cpp | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 gnu/llvm/lib/CodeGen/StatepointExampleGC.cpp (limited to 'gnu/llvm/lib/CodeGen/StatepointExampleGC.cpp') diff --git a/gnu/llvm/lib/CodeGen/StatepointExampleGC.cpp b/gnu/llvm/lib/CodeGen/StatepointExampleGC.cpp new file mode 100644 index 00000000000..3f60e18fafa --- /dev/null +++ b/gnu/llvm/lib/CodeGen/StatepointExampleGC.cpp @@ -0,0 +1,55 @@ +//===-- StatepointDefaultGC.cpp - The default statepoint GC strategy ------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains a GCStrategy which serves as an example for the usage +// of a statepoint based lowering strategy. This GCStrategy is intended to +// suitable as a default implementation usable with any collector which can +// consume the standard stackmap format generated by statepoints, uses the +// default addrespace to distinguish between gc managed and non-gc managed +// pointers, and has reasonable relocation semantics. +// +//===----------------------------------------------------------------------===// + +#include "llvm/CodeGen/GCStrategy.h" +#include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/Value.h" + +using namespace llvm; + +namespace { +class StatepointGC : public GCStrategy { +public: + StatepointGC() { + UseStatepoints = true; + // These options are all gc.root specific, we specify them so that the + // gc.root lowering code doesn't run. + InitRoots = false; + NeededSafePoints = 0; + UsesMetadata = false; + CustomRoots = false; + } + Optional isGCManagedPointer(const Type *Ty) const override { + // Method is only valid on pointer typed values. + const PointerType *PT = cast(Ty); + // For the sake of this example GC, we arbitrarily pick addrspace(1) as our + // GC managed heap. We know that a pointer into this heap needs to be + // updated and that no other pointer does. Note that addrspace(1) is used + // only as an example, it has no special meaning, and is not reserved for + // GC usage. + return (1 == PT->getAddressSpace()); + } +}; +} + +static GCRegistry::Add X("statepoint-example", + "an example strategy for statepoint"); + +namespace llvm { +void linkStatepointExampleGC() {} +} -- cgit v1.2.3-59-g8ed1b