summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/CodeGen/GCMetadata.h9
-rw-r--r--llvm/include/llvm/CodeGen/GCStrategy.h25
-rw-r--r--llvm/lib/CodeGen/BuiltinGCs.cpp8
-rw-r--r--llvm/lib/CodeGen/GCMetadata.cpp10
-rw-r--r--llvm/lib/CodeGen/GCRootLowering.cpp6
5 files changed, 14 insertions, 44 deletions
diff --git a/llvm/include/llvm/CodeGen/GCMetadata.h b/llvm/include/llvm/CodeGen/GCMetadata.h
index ad2599fc120..7fb27202c12 100644
--- a/llvm/include/llvm/CodeGen/GCMetadata.h
+++ b/llvm/include/llvm/CodeGen/GCMetadata.h
@@ -55,12 +55,11 @@ class MCSymbol;
/// GCPoint - Metadata for a collector-safe point in machine code.
///
struct GCPoint {
- GC::PointKind Kind; ///< The kind of the safe point.
MCSymbol *Label; ///< A label.
DebugLoc Loc;
- GCPoint(GC::PointKind K, MCSymbol *L, DebugLoc DL)
- : Kind(K), Label(L), Loc(std::move(DL)) {}
+ GCPoint(MCSymbol *L, DebugLoc DL)
+ : Label(L), Loc(std::move(DL)) {}
};
/// GCRoot - Metadata for a pointer to an object managed by the garbage
@@ -124,8 +123,8 @@ public:
/// addSafePoint - Notes the existence of a safe point. Num is the ID of the
/// label just prior to the safe point (if the code generator is using
/// MachineModuleInfo).
- void addSafePoint(GC::PointKind Kind, MCSymbol *Label, const DebugLoc &DL) {
- SafePoints.emplace_back(Kind, Label, DL);
+ void addSafePoint(MCSymbol *Label, const DebugLoc &DL) {
+ SafePoints.emplace_back(Label, DL);
}
/// getFrameSize/setFrameSize - Records the function's frame size.
diff --git a/llvm/include/llvm/CodeGen/GCStrategy.h b/llvm/include/llvm/CodeGen/GCStrategy.h
index ab0366bebbc..5a60cd7cb82 100644
--- a/llvm/include/llvm/CodeGen/GCStrategy.h
+++ b/llvm/include/llvm/CodeGen/GCStrategy.h
@@ -59,18 +59,6 @@ namespace llvm {
class Type;
-namespace GC {
-
-/// PointKind - Used to indicate whether the address of the call instruction
-/// or the address after the call instruction is listed in the stackmap. For
-/// most runtimes, PostCall safepoints are appropriate.
-///
-enum PointKind {
- PostCall ///< Instr is the return address of a call.
-};
-
-} // end namespace GC
-
/// GCStrategy describes a garbage collector algorithm's code generation
/// requirements, and provides overridable hooks for those needs which cannot
/// be abstractly described. GCStrategy objects must be looked up through
@@ -87,7 +75,7 @@ protected:
/// if set, none of the other options can be
/// anything but their default values.
- unsigned NeededSafePoints = 0; ///< Bitmask of required safe points.
+ bool NeededSafePoints = false; ///< if set, calls are inferred to be safepoints
bool UsesMetadata = false; ///< If set, backend must emit metadata tables.
public:
@@ -120,15 +108,8 @@ public:
*/
///@{
- /// True if safe points of any kind are required. By default, none are
- /// recorded.
- bool needsSafePoints() const { return NeededSafePoints != 0; }
-
- /// True if the given kind of safe point is required. By default, none are
- /// recorded.
- bool needsSafePoint(GC::PointKind Kind) const {
- return (NeededSafePoints & 1 << Kind) != 0;
- }
+ /// True if safe points need to be inferred on call sites
+ bool needsSafePoints() const { return NeededSafePoints; }
/// If set, appropriate metadata tables must be emitted by the back-end
/// (assembler, JIT, or otherwise). For statepoint, this method is
diff --git a/llvm/lib/CodeGen/BuiltinGCs.cpp b/llvm/lib/CodeGen/BuiltinGCs.cpp
index 5ee2055cff9..93939e573b7 100644
--- a/llvm/lib/CodeGen/BuiltinGCs.cpp
+++ b/llvm/lib/CodeGen/BuiltinGCs.cpp
@@ -28,7 +28,7 @@ namespace {
class ErlangGC : public GCStrategy {
public:
ErlangGC() {
- NeededSafePoints = 1 << GC::PostCall;
+ NeededSafePoints = true;
UsesMetadata = true;
}
};
@@ -39,7 +39,7 @@ public:
class OcamlGC : public GCStrategy {
public:
OcamlGC() {
- NeededSafePoints = 1 << GC::PostCall;
+ NeededSafePoints = true;
UsesMetadata = true;
}
};
@@ -69,7 +69,7 @@ public:
UseStatepoints = true;
// These options are all gc.root specific, we specify them so that the
// gc.root lowering code doesn't run.
- NeededSafePoints = 0;
+ NeededSafePoints = false;
UsesMetadata = false;
}
@@ -101,7 +101,7 @@ public:
UseStatepoints = true;
// These options are all gc.root specific, we specify them so that the
// gc.root lowering code doesn't run.
- NeededSafePoints = 0;
+ NeededSafePoints = false;
UsesMetadata = false;
}
diff --git a/llvm/lib/CodeGen/GCMetadata.cpp b/llvm/lib/CodeGen/GCMetadata.cpp
index 4bf5335f9d7..1c80556dfef 100644
--- a/llvm/lib/CodeGen/GCMetadata.cpp
+++ b/llvm/lib/CodeGen/GCMetadata.cpp
@@ -103,14 +103,6 @@ void Printer::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<GCModuleInfo>();
}
-static const char *DescKind(GC::PointKind Kind) {
- switch (Kind) {
- case GC::PostCall:
- return "post-call";
- }
- llvm_unreachable("Invalid point kind");
-}
-
bool Printer::runOnFunction(Function &F) {
if (F.hasGC())
return false;
@@ -127,7 +119,7 @@ bool Printer::runOnFunction(Function &F) {
for (GCFunctionInfo::iterator PI = FD->begin(), PE = FD->end(); PI != PE;
++PI) {
- OS << "\t" << PI->Label->getName() << ": " << DescKind(PI->Kind)
+ OS << "\t" << PI->Label->getName() << ": " << "post-call"
<< ", live = {";
for (GCFunctionInfo::live_iterator RI = FD->live_begin(PI),
diff --git a/llvm/lib/CodeGen/GCRootLowering.cpp b/llvm/lib/CodeGen/GCRootLowering.cpp
index fff76f540f5..e8ccd84b0b9 100644
--- a/llvm/lib/CodeGen/GCRootLowering.cpp
+++ b/llvm/lib/CodeGen/GCRootLowering.cpp
@@ -268,10 +268,8 @@ void GCMachineCodeAnalysis::VisitCallPoint(MachineBasicBlock::iterator CI) {
MachineBasicBlock::iterator RAI = CI;
++RAI;
- if (FI->getStrategy().needsSafePoint(GC::PostCall)) {
- MCSymbol *Label = InsertLabel(*CI->getParent(), RAI, CI->getDebugLoc());
- FI->addSafePoint(GC::PostCall, Label, CI->getDebugLoc());
- }
+ MCSymbol *Label = InsertLabel(*CI->getParent(), RAI, CI->getDebugLoc());
+ FI->addSafePoint(Label, CI->getDebugLoc());
}
void GCMachineCodeAnalysis::FindSafePoints(MachineFunction &MF) {
OpenPOWER on IntegriCloud