LLVM: lib/Target/Xtensa/XtensaAsmPrinter.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
32
33using namespace llvm;
34
37 switch (Modifier) {
42 }
44}
45
47 unsigned Opc = MI->getOpcode();
48
49 switch (Opc) {
50 case Xtensa::BR_JT:
53 MCInstBuilder(Xtensa::JX).addReg(MI->getOperand(0).getReg()));
54 return;
55 default:
59 return;
60 }
61}
62
68
76 MCSym = MBB->getSymbol();
80 } else {
81 assert(XtensaCPV->isExtSymbol() && "unrecognized constant pool value");
84 const char *SymName = XtensaSym->getSymbol();
85
88 MCSym = OutContext.getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
89 SymName);
90 } else {
91 MCSym = OutContext.getOrCreateSymbol(SymName);
92 }
93 }
94
96 auto *TS =
99
101 std::string SymName(MCSym->getName());
103 SymName += Modifier;
104 MCSym = OutContext.getOrCreateSymbol(SymName);
105 }
106
108 TS->emitLiteral(LblSym, Expr, false);
109}
110
118 } else {
120 auto *TS =
124
128 CFP->getValueAPF().bitcastToAPInt().getSExtValue(), OutContext);
133 } else {
135 }
136
137 TS->emitLiteral(LblSym, Value, false);
138 }
139}
140
141
142
143
144
148 const std::vector &CP = MCP->getConstants();
149 if (CP.empty())
150 return;
151
153
154 auto *TS =
157 TS->startLiteralSection(CS);
158
159 int CPIdx = 0;
162 }
163
165}
166
170
176 break;
177 }
178 default:
180 }
181}
182
185
186 if (!ExtraCode || !ExtraCode[0]) {
188 return false;
189 }
190
191
193}
194
196 unsigned OpNo,
197 const char *ExtraCode,
199 if (ExtraCode && ExtraCode[0])
200 return true;
201
202 assert(OpNo + 1 < MI->getNumOperands() && "Insufficient operands");
203
206
208 "Unexpected base pointer for inline asm memory operand.");
209 assert(Offset.isImm() && "Unexpected offset for inline asm memory operand.");
210
212 OS << ", ";
213 OS << Offset.getImm();
214
215 return false;
216}
217
223
227
231 unsigned Offset) const {
233 switch (MOTy) {
237 break;
240 break;
244 break;
248 break;
251 break;
255 break;
256 default:
258 }
259
262
264
268 }
269
271}
272
274 unsigned Offset) const {
276
277 switch (MOTy) {
279
281 break;
286 break;
294 default:
296 }
297
299}
300
302 MCInst &OutMI) const {
304
305 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
308
311 }
312}
313
315
317 "Xtensa Assembly Printer", false, false)
318
321}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static uint8_t getModifierSpecifier(ARMCP::ARMCPModifier Modifier)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_EXTERNAL_VISIBILITY
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static Xtensa::Specifier getModifierSpecifier(XtensaCP::XtensaCPModifier Modifier)
Definition XtensaAsmPrinter.cpp:36
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
MCSymbol * getSymbol(const GlobalValue *GV) const
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
TargetMachine & TM
Target machine description.
virtual MCSymbol * GetCPISymbol(unsigned CPID) const
Return the symbol for the specified constant pool entry.
MachineFunction * MF
The current machine function.
virtual const MCExpr * lowerConstant(const Constant *CV, const Constant *BaseCV=nullptr, uint64_t Offset=0)
Lower the specified LLVM Constant to an MCExpr.
MCSymbol * GetJTISymbol(unsigned JTID, bool isLinkerPrivate=false) const
Return the symbol for the specified jump table entry.
MCContext & OutContext
This is the context for the output file that we are streaming.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
const DataLayout & getDataLayout() const
Return information about data layout.
MCSymbol * GetExternalSymbolSymbol(const Twine &Sym) const
Return the MCSymbol for the specified ExternalSymbol.
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant.
The address of a basic block.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Base class for the full range of assembler expressions which are needed for parsing.
Instances of this class represent a single low-level machine instruction.
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
Instances of this class represent operands of the MCInst class.
static MCOperand createExpr(const MCExpr *Val)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
Instances of this class represent a uniqued identifier for a section in the current translation unit.
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 ...
StringRef getName() const
getName - Get the symbol name.
LLVM_ABI MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
This class is a data container for one entry in a MachineConstantPool.
union llvm::MachineConstantPoolEntry::@004270020304201266316354007027341142157160323045 Val
The constant itself.
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
MachineConstantPoolValue * MachineCPVal
const Constant * ConstVal
Abstract base class for all machine specific constantpool value subclasses.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
const std::vector< MachineConstantPoolEntry > & getConstants() const
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
const GlobalValue * getGlobal() const
MachineBasicBlock * getMBB() const
const BlockAddress * getBlockAddress() const
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
const char * getSymbolName() const
Register getReg() const
getReg - Returns the register number.
@ MO_Immediate
Immediate operand.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
@ MO_GlobalAddress
Address of a global value.
@ MO_RegisterMask
Mask of preserved registers.
@ MO_BlockAddress
Address of a basic block.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_Register
Register operand.
@ MO_ExternalSymbol
Name of external global symbol.
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
int64_t getOffset() const
Return the offset from the symbol in this operand.
StringRef - Represent a constant reference to a string, i.e.
MCSection * SectionForGlobal(const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const
This method computes the appropriate section to emit the specified global variable or function defini...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &O) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant.
Definition XtensaAsmPrinter.cpp:183
MCOperand LowerSymbolOperand(const MachineOperand &MO, MachineOperand::MachineOperandType MOTy, unsigned Offset) const
Definition XtensaAsmPrinter.cpp:229
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
Definition XtensaAsmPrinter.cpp:195
void emitMachineConstantPoolEntry(const MachineConstantPoolEntry &CPE, int i)
Definition XtensaAsmPrinter.cpp:111
void emitConstantPool() override
Print to the current output stream assembly representations of the constants in the constant pool MCP...
Definition XtensaAsmPrinter.cpp:145
void lowerToMCInst(const MachineInstr *MI, MCInst &OutMI) const
Definition XtensaAsmPrinter.cpp:301
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O)
Definition XtensaAsmPrinter.cpp:167
MCSymbol * GetConstantPoolIndexSymbol(const MachineOperand &MO) const
Definition XtensaAsmPrinter.cpp:219
void emitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
Definition XtensaAsmPrinter.cpp:46
MCSymbol * GetJumpTableSymbol(const MachineOperand &MO) const
Definition XtensaAsmPrinter.cpp:224
void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override
Definition XtensaAsmPrinter.cpp:63
MCOperand lowerOperand(const MachineOperand &MO, unsigned Offset=0) const
Definition XtensaAsmPrinter.cpp:273
XtensaConstantPoolSymbol - Xtensa-specific constantpool values for external symbols.
const char * getSymbol() const
XtensaConstantPoolValue - Xtensa specific constantpool value.
unsigned getLabelId() const
StringRef getModifierText() const
bool isMachineBasicBlock() const
bool isBlockAddress() const
void setLabelId(unsigned ID)
XtensaCP::XtensaCPModifier getModifier() const
static const char * getRegisterName(MCRegister Reg)
static void printOperand(const MCOperand &MO, raw_ostream &O)
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ 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.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Target & getTheXtensaTarget()
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...