LLVM: lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
27
28using namespace llvm;
29
30namespace {
31
33public:
34 void finishAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) override;
35};
36
37}
38
39static GCMetadataPrinterRegistry::Add
40 X("erlang", "erlang-compatible garbage collector");
41
45 unsigned IntPtrSize = M.getDataLayout().getPointerSize();
46
47
50
51
52 for (GCModuleInfo::FuncInfoVec::iterator FI = Info.funcinfo_begin(),
53 IE = Info.funcinfo_end();
54 FI != IE; ++FI) {
57
58 continue;
59
60
61
62
63
64
65
66
67
68
69
70
71
73
74
77
78
80
84 }
85
86
87
89
90
91 OS.AddComment("stack frame size (in words)");
92 AP.emitInt16(MD.getFrameSize() / IntPtrSize);
93
94
95 unsigned RegisteredArgs = IntPtrSize == 4 ? 5 : 6;
96 unsigned StackArity = MD.getFunction().arg_size() > RegisteredArgs
97 ? MD.getFunction().arg_size() - RegisteredArgs
98 : 0;
101
102
105
106
108 LE = MD.live_end(PI);
109 LI != LE; ++LI) {
110
111 OS.AddComment("stack index (offset / wordsize)");
112 AP.emitInt16(LI->StackOffset / IntPtrSize);
113 }
114 }
115}
116
Analysis containing CSE Info
Module.h This file contains the declarations for the Module class.
Machine Check Debug Module
static StringRef getName(Value *V)
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
This class is intended to be used as a driving class for all asm writers.
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
void emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset, unsigned Size, bool IsSectionRelative=false) const
Emit something like ".long Label+Offset" where the size in bytes of the directive is specified by Siz...
void emitAlignment(Align Alignment, const GlobalObject *GV=nullptr, unsigned MaxBytesToEmit=0) const
Emit an alignment directive to the specified power of two boundary.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
void emitInt16(int Value) const
Emit a short directive and value.
Garbage collection metadata for a single function.
GCStrategy & getStrategy()
getStrategy - Return the GC strategy for the function.
std::vector< GCRoot >::const_iterator live_iterator
std::vector< GCPoint >::iterator iterator
An analysis pass which caches information about the entire Module.
const std::string & getName() const
Return the name of the GC strategy.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
MCContext & getContext() const
Streaming machine code generation interface.
virtual void AddComment(const Twine &T, bool EOL=true)
Add a textual comment.
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void linkErlangGCPrinter()
Creates an erlang-compatible metadata printer.
Definition ErlangGCPrinter.cpp:117
This struct is a compact representation of a valid (non-zero power of two) alignment.
GCPoint - Metadata for a collector-safe point in machine code.