33#define DEBUG_TYPE "asm-printer"
38 MSP430AsmPrinter(
TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
72void MSP430AsmPrinter::printOperand(
const MachineInstr *
MI,
int OpNum,
81 if (!Modifier || strcmp(Modifier,
"nohash"))
93 if (!Modifier || strcmp(Modifier,
"nohash"))
95 PrintSymbolOperand(MO, O);
101void MSP430AsmPrinter::printSrcMemOperand(
const MachineInstr *
MI,
int OpNum,
109 if (Disp.
isImm() &&
Base.getReg() == MSP430::SR)
114 if (
Base.getReg() != MSP430::SR &&
Base.getReg() != MSP430::PC) {
123bool MSP430AsmPrinter::PrintAsmOperand(
const MachineInstr *
MI,
unsigned OpNo,
126 if (ExtraCode && ExtraCode[0])
133bool MSP430AsmPrinter::PrintAsmMemoryOperand(
const MachineInstr *
MI,
135 const char *ExtraCode,
137 if (ExtraCode && ExtraCode[0]) {
140 printSrcMemOperand(
MI, OpNo, O);
146 MSP430_MC::verifyInstructionPredicates(
MI->getOpcode(),
147 getSubtargetInfo().getFeatureBits());
152 MCInstLowering.Lower(
MI, TmpInst);
153 EmitToStreamer(*OutStreamer, TmpInst);
156void MSP430AsmPrinter::EmitInterruptVectorSection(
MachineFunction &ISR) {
157 MCSection *Cur = OutStreamer->getCurrentSectionOnly();
160 report_fatal_error(
"Functions with 'interrupt' attribute must have msp430_intrcc CC");
162 StringRef IVIdx =
F->getFnAttribute(
"interrupt").getValueAsString();
163 MCSection *
IV = OutStreamer->getContext().getELFSection(
164 "__interrupt_vector_" + IVIdx,
166 OutStreamer->switchSection(
IV);
169 OutStreamer->emitSymbolValue(FunctionSymbol,
TM.getProgramPointerSize());
170 OutStreamer->switchSection(Cur);
176 EmitInterruptVectorSection(MF);
179 SetupMachineFunction(MF);
#define LLVM_EXTERNAL_VISIBILITY
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeMSP430AsmPrinter()
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
static const uint32_t IV[8]
This class is intended to be used as a driving class for all asm writers.
virtual void emitInstruction(const MachineInstr *)
Targets should implement this to emit instructions.
virtual void PrintSymbolOperand(const MachineOperand &MO, raw_ostream &OS)
Print the MachineOperand as a symbol.
bool runOnMachineFunction(MachineFunction &MF) override
Emit the specified function out to the OutStreamer.
virtual bool PrintAsmMemoryOperand(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 as...
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.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Instances of this class represent a single low-level machine instruction.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
static const char * getRegisterName(MCRegister Reg)
MSP430MCInstLower - This class is used to lower an MachineInstr into an MCInst.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
const GlobalValue * getGlobal() const
MachineBasicBlock * getMBB() const
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
Register getReg() const
getReg - Returns the register number.
@ MO_Immediate
Immediate operand.
@ MO_GlobalAddress
Address of a global value.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_Register
Register operand.
int64_t getOffset() const
Return the offset from the symbol in this operand.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
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.
@ MSP430_INTR
Used for MSP430 interrupt routines.
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheMSP430Target()
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...