diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-04 18:34:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-04 18:34:07 +0000 |
commit | 736e31d0cfd8a28c31741f39be606a11e7fc0036 (patch) | |
tree | 8c48fb48bc3910a38252c4d54d26cd35b788a5be /include/llvm/CodeGen/AsmPrinter.h | |
parent | 285199502b08d7d2ac5f37ce5f94cb5e68cec197 (diff) | |
download | llvm-736e31d0cfd8a28c31741f39be606a11e7fc0036.tar.gz llvm-736e31d0cfd8a28c31741f39be606a11e7fc0036.tar.bz2 llvm-736e31d0cfd8a28c31741f39be606a11e7fc0036.tar.xz |
split inline asm support out to its own .cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/AsmPrinter.h')
-rw-r--r-- | include/llvm/CodeGen/AsmPrinter.h | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 3ac229fe38..64df7b1e4f 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -103,9 +103,6 @@ namespace llvm { /// MCSymbol *CurrentFnSym; - /// getCurrentSection() - Return the current section we are emitting to. - const MCSection *getCurrentSection() const; - /// VerboseAsm - Emit comments in assembly output if this is true. /// bool VerboseAsm; @@ -113,17 +110,13 @@ namespace llvm { /// getObjFileLowering - Return information about object file lowering. TargetLoweringObjectFile &getObjFileLowering() const; + /// getCurrentSection() - Return the current section we are emitting to. + const MCSection *getCurrentSection() const; + private: // GCMetadataPrinters - The garbage collection metadata printer table. void *GCMetadataPrinters; // Really a DenseMap. - /// Private state for PrintSpecial() - // Assign a unique ID to this machine instruction. - mutable const MachineInstr *LastMI; - mutable const Function *LastFn; - mutable unsigned Counter; - mutable unsigned SetCounter; - protected: explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer); @@ -159,32 +152,6 @@ namespace llvm { /// pass, you must make sure to call it explicitly. bool doFinalization(Module &M); - /// PrintSpecial - Print information related to the specified machine instr - /// that is independent of the operand, and may be independent of the instr - /// itself. This can be useful for portably encoding the comment character - /// or other bits of target-specific knowledge into the asmstrings. The - /// syntax used is ${:comment}. Targets can override this to add support - /// for their own strange codes. - virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS, - const char *Code) const; - - /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM - /// instruction, using the specified assembler variant. Targets should - /// override this to format as appropriate. This method can return true if - /// the operand is erroneous. - virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, const char *ExtraCode, - raw_ostream &OS); - - /// PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM - /// instruction, using the specified assembler variant as an address. - /// Targets should override this to format as appropriate. This method can - /// return true if the operand is erroneous. - virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, - unsigned AsmVariant, - const char *ExtraCode, - raw_ostream &OS); - /// runOnMachineFunction - Emit the specified function out to the /// OutStreamer. virtual bool runOnMachineFunction(MachineFunction &MF) { @@ -336,13 +303,6 @@ namespace llvm { isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const; private: - /// EmitInlineAsm - Emit a blob of inline asm to the output streamer. - void EmitInlineAsm(StringRef Str) const; - - /// EmitInlineAsm - This method formats and emits the specified machine - /// instruction that is an inline asm. - void EmitInlineAsm(const MachineInstr *MI) const; - /// EmitImplicitDef - This method emits the specified machine instruction /// that is an implicit def. void EmitImplicitDef(const MachineInstr *MI) const; @@ -362,6 +322,54 @@ namespace llvm { void EmitLLVMUsedList(Constant *List); void EmitXXStructorList(Constant *List); GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C); + + //===------------------------------------------------------------------===// + // Inline Asm Support + //===------------------------------------------------------------------===// + public: + // These are hooks that targets can override to implement inline asm + // support. These should probably be moved out of AsmPrinter someday. + + /// PrintSpecial - Print information related to the specified machine instr + /// that is independent of the operand, and may be independent of the instr + /// itself. This can be useful for portably encoding the comment character + /// or other bits of target-specific knowledge into the asmstrings. The + /// syntax used is ${:comment}. Targets can override this to add support + /// for their own strange codes. + virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS, + const char *Code) const; + + /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM + /// instruction, using the specified assembler variant. Targets should + /// override this to format as appropriate. This method can return true if + /// the operand is erroneous. + virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, + unsigned AsmVariant, const char *ExtraCode, + raw_ostream &OS); + + /// PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM + /// instruction, using the specified assembler variant as an address. + /// Targets should override this to format as appropriate. This method can + /// return true if the operand is erroneous. + virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, + unsigned AsmVariant, + const char *ExtraCode, + raw_ostream &OS); + + private: + /// Private state for PrintSpecial() + // Assign a unique ID to this machine instruction. + mutable const MachineInstr *LastMI; + mutable unsigned LastFn; + mutable unsigned Counter; + mutable unsigned SetCounter; + + /// EmitInlineAsm - Emit a blob of inline asm to the output streamer. + void EmitInlineAsm(StringRef Str) const; + + /// EmitInlineAsm - This method formats and emits the specified machine + /// instruction that is an inline asm. + void EmitInlineAsm(const MachineInstr *MI) const; }; } |