LLVM: lib/Target/CSKY/MCTargetDesc/CSKYTargetStreamer.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
16
17using namespace llvm;
18
19
20
21
22
24 if (Entries.empty())
25 return;
26
27 if (CurrentSection != nullptr)
29
33 Align(Entry.Size),
36 Streamer.emitValue(Entry.Value, Entry.Size, Entry.Loc);
37 }
39 Entries.clear();
40}
41
45 if (CurrentSection == nullptr)
47
48 auto &Context = Streamer.getContext();
49
51
52
53 auto Itr = C ? CachedEntries.find(C->getValue()) : CachedEntries.end();
54 if (Itr != CachedEntries.end())
55 return Itr->second;
56
57 MCSymbol *CPEntryLabel = Context.createTempSymbol();
59
60 if (AdjustExpr) {
62
66 }
67
69
70 if (C)
71 CachedEntries[C->getValue()] = SymRef;
72 return SymRef;
73}
74
76
78 CurrentSection = nullptr;
79 CachedEntries.clear();
80}
81
84
87 const MCExpr *AdjustExpr) {
90
91 const MCExpr *OrigExpr = Expr;
92
94 Expr = CE->getSubExpr();
95 ELFRefKind = CE->getSpecifier();
96 }
97
99 const MCSymbol *Sym = &SymExpr->getSymbol();
100
102
106 }
108 }
109
111}
112
117
118
126
128
133
134void CSKYTargetAsmStreamer::emitAttribute(unsigned Attribute, unsigned Value) {
135 OS << "\t.csky_attribute\t" << Attribute << ", " << Twine(Value) << "\n";
136}
137
138void CSKYTargetAsmStreamer::emitTextAttribute(unsigned Attribute,
140 OS << "\t.csky_attribute\t" << Attribute << ", \"" << String << "\"\n";
141}
142
Functions, function parameters, and return types can have attributes to indicate how they should be t...
void clearCache()
Definition CSKYTargetStreamer.cpp:77
void emitAll(MCStreamer &Streamer)
Definition CSKYTargetStreamer.cpp:23
bool empty()
Definition CSKYTargetStreamer.cpp:75
const MCExpr * addEntry(MCStreamer &Streamer, const MCExpr *Value, unsigned Size, SMLoc Loc, const MCExpr *AdjustExpr)
Definition CSKYTargetStreamer.cpp:42
virtual void emitTextAttribute(unsigned Attribute, StringRef String)
Definition CSKYTargetStreamer.cpp:130
virtual void emitTargetAttributes(const MCSubtargetInfo &STI)
Definition CSKYTargetStreamer.cpp:127
DenseMap< SymbolIndex, const MCExpr * > ConstantMap
void finish() override
Definition CSKYTargetStreamer.cpp:119
const MCExpr * addConstantPoolEntry(const MCExpr *, SMLoc Loc, const MCExpr *AdjustExpr=nullptr)
Add a new entry to the constant pool for the current section and return an MCExpr that can be used to...
Definition CSKYTargetStreamer.cpp:86
std::unique_ptr< CSKYConstantPool > ConstantPool
void emitCurrentConstantPool()
Definition CSKYTargetStreamer.cpp:113
virtual void finishAttributeSection()
Definition CSKYTargetStreamer.cpp:132
CSKYTargetStreamer(MCStreamer &S)
Definition CSKYTargetStreamer.cpp:82
virtual void emitAttribute(unsigned Attribute, unsigned Value)
Definition CSKYTargetStreamer.cpp:129
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
const MCSubtargetInfo * getSubtargetInfo() const
Base class for the full range of assembler expressions which are needed for parsing.
static const MCSpecifierExpr * create(const MCExpr *Expr, Spec S, MCContext &Ctx, SMLoc Loc=SMLoc())
Streaming machine code generation interface.
MCContext & getContext() const
void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
virtual void emitCodeAlignment(Align Alignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit=0)
Emit nops until the byte alignment ByteAlignment is reached.
virtual void emitDataRegion(MCDataRegionType Kind)
Note in the output the specified region Kind.
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
MCSection * getCurrentSectionOnly() const
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MCStreamer & getStreamer()
MCTargetStreamer(MCStreamer &S)
Represents a location in source code.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
@ MCDR_DataRegionEnd
.end_data_region
@ MCDR_DataRegion
.data_region
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
This struct is a compact representation of a valid (non-zero power of two) alignment.