Go to the documentation of this file.
39 #define DEBUG_TYPE "asm-printer"
44 MSP430AsmPrinter(
TargetMachine &
TM, std::unique_ptr<MCStreamer> Streamer)
66 void MSP430AsmPrinter::PrintSymbolOperand(
const MachineOperand &MO,
87 if (!Modifier || strcmp(Modifier,
"nohash"))
99 if (!Modifier || strcmp(Modifier,
"nohash"))
101 PrintSymbolOperand(MO,
O);
107 void MSP430AsmPrinter::printSrcMemOperand(
const MachineInstr *
MI,
int OpNum,
115 if (Disp.
isImm() &&
Base.getReg() == MSP430::SR)
120 if (
Base.getReg() != MSP430::SR &&
Base.getReg() != MSP430::PC) {
129 bool MSP430AsmPrinter::PrintAsmOperand(
const MachineInstr *
MI,
unsigned OpNo,
132 if (ExtraCode && ExtraCode[0])
139 bool MSP430AsmPrinter::PrintAsmMemoryOperand(
const MachineInstr *
MI,
141 const char *ExtraCode,
143 if (ExtraCode && ExtraCode[0]) {
146 printSrcMemOperand(
MI, OpNo,
O);
155 MCInstLowering.Lower(
MI, TmpInst);
156 EmitToStreamer(*OutStreamer, TmpInst);
159 void MSP430AsmPrinter::EmitInterruptVectorSection(
MachineFunction &ISR) {
160 MCSection *Cur = OutStreamer->getCurrentSectionOnly();
163 report_fatal_error(
"Functions with 'interrupt' attribute must have msp430_intrcc CC");
165 StringRef IVIdx =
F->getFnAttribute(
"interrupt").getValueAsString();
166 MCSection *
IV = OutStreamer->getContext().getELFSection(
167 "__interrupt_vector_" + IVIdx,
169 OutStreamer->switchSection(
IV);
172 OutStreamer->emitSymbolValue(FunctionSymbol,
TM.getProgramPointerSize());
173 OutStreamer->switchSection(Cur);
179 EmitInterruptVectorSection(MF);
182 SetupMachineFunction(MF);
MSP430MCInstLower - This class is used to lower an MachineInstr into an MCInst.
@ MO_Immediate
Immediate operand.
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
const GlobalValue * getGlobal() const
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
Instances of this class represent a single low-level machine instruction.
int64_t getOffset() const
Return the offset from the symbol in this operand.
@ MO_Register
Register operand.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
@ MO_GlobalAddress
Address of a global value.
MachineOperand class - Representation of each machine instruction operand.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class implements an extremely fast bulk output stream that can only output to a stream.
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430AsmPrinter()
Representation of each machine instruction.
#define LLVM_EXTERNAL_VISIBILITY
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
Primary interface to the complete machine description for the target machine.
Register getReg() const
getReg - Returns the register number.
MachineBasicBlock * getMBB() const
StringRef - Represent a constant reference to a string, i.e.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
static const char * getRegisterName(unsigned RegNo)
Function & getFunction()
Return the LLVM function that this machine code represents.
Target & getTheMSP430Target()
This class is intended to be used as a driving class for all asm writers.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
@ MSP430_INTR
MSP430_INTR - Calling convention used for MSP430 interrupt routines.
static const uint32_t IV[8]
const char LLVMTargetMachineRef TM
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...
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.