44 bool doFinalization(
Module &M)
override;
50 "Create Garbage Collector Module Metadata",
false,
false)
55 : F(F), S(S), FrameSize(~0LL) {}
72 if (I != FInfoMap.
end())
76 Functions.push_back(llvm::make_unique<GCFunctionInfo>(F, *S));
85 GCStrategyList.clear();
97 return "Print Garbage Collector Information";
116 OS <<
"\t" << RI->Num <<
"\t" << RI->StackOffset <<
"[sp]\n";
122 OS <<
"\t" << PI->Label->getName() <<
": " <<
"post-call" 128 OS <<
" " << RI->Num;
140 bool Printer::doFinalization(
Module &M) {
141 GCModuleInfo *GMI = getAnalysisIfAvailable<GCModuleInfo>();
142 assert(GMI &&
"Printer didn't require GCModuleInfo?!");
149 auto NMI = GCStrategyMap.find(Name);
150 if (NMI != GCStrategyMap.end())
151 return NMI->getValue();
154 if (Name == Entry.getName()) {
155 std::unique_ptr<GCStrategy> S = Entry.instantiate();
157 GCStrategyMap[
Name] = S.get();
158 GCStrategyList.push_back(std::move(S));
159 return GCStrategyList.back().get();
168 const std::string
error = (
"unsupported GC: " +
Name).str() +
169 " (did you remember to link and initialize the CodeGen library?)";
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
static iterator_range< iterator > entries()
print alias Alias Set Printer
AnalysisUsage & addRequired()
amdgpu Simplify well known AMD library false Value Value const Twine & Name
GCFunctionInfo & getFunctionInfo(const Function &F)
get - Look up function metadata.
An analysis pass which caches information about the entire Module.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
const std::string & getGC() const
FunctionPass * createGCInfoPrinter(raw_ostream &OS)
Creates a pass to print GC metadata.
iterator find(const_arg_type_t< KeyT > Val)
static bool runOnFunction(Function &F, bool PostInlining)
roots_iterator roots_end()
const Function & getFunction() const
getFunction - Return the function to which this metadata applies.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
roots_iterator roots_begin()
roots_begin/roots_end - Iterators for all roots in the function.
std::vector< GCRoot >::iterator roots_iterator
ImmutablePass class - This class is used to provide information that does not need to be run...
live_iterator live_begin(const iterator &p)
live_begin/live_end - Iterators for live roots at a given safe point.
GCStrategy * getGCStrategy(const StringRef Name)
Lookup the GCStrategy object associated with the given gc name.
void setPreservesAll()
Set by analyses that do not transform their input at all.
iterator begin()
begin/end - Iterators for safe points.
std::vector< GCPoint >::iterator iterator
GCStrategy describes a garbage collector algorithm's code generation requirements, and provides overridable hooks for those needs which cannot be abstractly described.
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
void clear()
clear - Resets the pass.
StringRef getName() const
Return a constant reference to the value's name.
void initializeGCModuleInfoPass(PassRegistry &)
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
std::vector< GCRoot >::const_iterator live_iterator
StringRef - Represent a constant reference to a string, i.e.
live_iterator live_end(const iterator &p)
Garbage collection metadata for a single function.