34#define DEBUG_TYPE "asm-printer" 
   39    MSP430AsmPrinter(
TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer)
 
   42    StringRef getPassName()
 const override { 
return "MSP430 Assembly Printer"; }
 
   48                      bool PrefixHash = 
true);
 
   75void MSP430AsmPrinter::printOperand(
const MachineInstr *
MI, 
int OpNum,
 
   76                                    raw_ostream &O, 
bool PrefixHash) {
 
   77  const MachineOperand &MO = 
MI->getOperand(OpNum);
 
   98    PrintSymbolOperand(MO, O);
 
  104void MSP430AsmPrinter::printSrcMemOperand(
const MachineInstr *
MI, 
int OpNum,
 
  106  const MachineOperand &
Base = 
MI->getOperand(OpNum);
 
  107  const MachineOperand &Disp = 
MI->getOperand(OpNum+1);
 
  112  if (Disp.
isImm() && 
Base.getReg() == MSP430::SR)
 
  117  if (
Base.getReg() != MSP430::SR && 
Base.getReg() != MSP430::PC) {
 
  126bool MSP430AsmPrinter::PrintAsmOperand(
const MachineInstr *
MI, 
unsigned OpNo,
 
  127                                       const char *ExtraCode, raw_ostream &O) {
 
  129  if (ExtraCode && ExtraCode[0])
 
  136bool MSP430AsmPrinter::PrintAsmMemoryOperand(
const MachineInstr *
MI,
 
  138                                             const char *ExtraCode,
 
  140  if (ExtraCode && ExtraCode[0]) {
 
  143  printSrcMemOperand(
MI, OpNo, O);
 
  148void MSP430AsmPrinter::emitInstruction(
const MachineInstr *
MI) {
 
  149  MSP430_MC::verifyInstructionPredicates(
MI->getOpcode(),
 
  150                                         getSubtargetInfo().getFeatureBits());
 
  152  MSP430MCInstLower MCInstLowering(OutContext, *
this);
 
  155  MCInstLowering.Lower(
MI, TmpInst);
 
  156  EmitToStreamer(*OutStreamer, TmpInst);
 
  159void MSP430AsmPrinter::EmitInterruptVectorSection(MachineFunction &ISR) {
 
  160  MCSection *Cur = OutStreamer->getCurrentSectionOnly();
 
  162  if (
F->getCallingConv() != CallingConv::MSP430_INTR) {
 
  163    report_fatal_error(
"Functions with 'interrupt' attribute must have msp430_intrcc CC");
 
  166  MCSection *
IV = OutStreamer->getContext().getELFSection(
 
  167    "__interrupt_vector_" + IVIdx,
 
  169  OutStreamer->switchSection(
IV);
 
  172  OutStreamer->emitSymbolValue(FunctionSymbol, 
TM.getProgramPointerSize());
 
  173  OutStreamer->switchSection(Cur);
 
  176bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
  179    EmitInterruptVectorSection(MF);
 
  182  SetupMachineFunction(MF);
 
  187char MSP430AsmPrinter::ID = 0;
 
  190                "MSP430 Assembly Printer", 
false, 
false)
 
  194LLVMInitializeMSP430AsmPrinter() {
 
 
#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 bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
 
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
 
static const uint32_t IV[8]
 
This class is intended to be used as a driving class for all asm writers.
 
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.
 
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
 
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
 
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
 
LLVM_ABI void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
 
static const char * getRegisterName(MCRegister Reg)
 
LLVM_ABI 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.
 
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.
 
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 
This is an optimization pass for GlobalISel generic memory operations.
 
Target & getTheMSP430Target()
 
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
 
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...