mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
Note: This change ended up being slightly more controversial than expected. Chandler has tentatively okayed this for the moment, but I may be revisiting this in the near future after we settle some high level questions. Rather than have the GCStrategy object owned by the GCModuleInfo - which is an immutable analysis pass used mainly by gc.root - have it be owned by the LLVMContext. This simplifies the ownership logic (i.e. can you have two instances of the same strategy at once?), but more importantly, allows us to access the GCStrategy in the middle end optimizer. To this end, I add an accessor through Function which becomes the canonical way to get at a GCStrategy instance. In the near future, this will allows me to move some of the checks from http://reviews.llvm.org/D6808 into the Verifier itself, and to introduce optimization legality predicates for some of the recent additions to InstCombine. (These will follow as separate changes.) Differential Revision: http://reviews.llvm.org/D6811 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226311 91177308-0d34-0410-b5e6-96231b3b80d8
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
//===-- ErlangGC.cpp - Erlang/OTP GC strategy -------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements the Erlang/OTP runtime-compatible garbage collector
|
|
// (e.g. defines safe points, root initialization etc.)
|
|
//
|
|
// The frametable emitter is in ErlangGCPrinter.cpp.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/CodeGen/GCs.h"
|
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
|
#include "llvm/IR/GCStrategy.h"
|
|
#include "llvm/MC/MCContext.h"
|
|
#include "llvm/MC/MCSymbol.h"
|
|
#include "llvm/Target/TargetInstrInfo.h"
|
|
#include "llvm/Target/TargetMachine.h"
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
|
|
|
using namespace llvm;
|
|
|
|
namespace {
|
|
|
|
class ErlangGC : public GCStrategy {
|
|
public:
|
|
ErlangGC();
|
|
};
|
|
|
|
}
|
|
|
|
static GCRegistry::Add<ErlangGC>
|
|
X("erlang", "erlang-compatible garbage collector");
|
|
|
|
void llvm::linkErlangGC() { }
|
|
|
|
ErlangGC::ErlangGC() {
|
|
InitRoots = false;
|
|
NeededSafePoints = 1 << GC::PostCall;
|
|
UsesMetadata = true;
|
|
CustomRoots = false;
|
|
}
|