LLVM API Documentation

X86TargetAsmInfo.h

Go to the documentation of this file.
00001 //=====-- X86TargetAsmInfo.h - X86 asm properties -------------*- C++ -*--====//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the declaration of the X86TargetAsmInfo class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef X86TARGETASMINFO_H
00015 #define X86TARGETASMINFO_H
00016 
00017 #include "X86TargetMachine.h"
00018 #include "llvm/Target/TargetAsmInfo.h"
00019 #include "llvm/Target/ELFTargetAsmInfo.h"
00020 #include "llvm/Target/DarwinTargetAsmInfo.h"
00021 #include "llvm/Support/Compiler.h"
00022 
00023 namespace llvm {
00024 
00025   extern const char *const x86_asm_table[];
00026 
00027   template <class BaseTAI>
00028   struct X86TargetAsmInfo : public BaseTAI {
00029     explicit X86TargetAsmInfo(const X86TargetMachine &TM):
00030       BaseTAI(TM) {
00031       const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
00032 
00033       BaseTAI::AsmTransCBE = x86_asm_table;
00034       BaseTAI::AssemblerDialect = Subtarget->getAsmFlavor();
00035     }
00036 
00037     virtual bool ExpandInlineAsm(CallInst *CI) const;
00038 
00039   private:
00040     bool LowerToBSwap(CallInst *CI) const;
00041   };
00042 
00043   typedef X86TargetAsmInfo<TargetAsmInfo> X86GenericTargetAsmInfo;
00044 
00045   EXTERN_TEMPLATE_INSTANTIATION(class X86TargetAsmInfo<TargetAsmInfo>);
00046 
00047   struct X86DarwinTargetAsmInfo : public X86TargetAsmInfo<DarwinTargetAsmInfo> {
00048     explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
00049     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
00050                                            bool Global) const;
00051     virtual const char *getEHGlobalPrefix() const;
00052   };
00053 
00054   struct X86ELFTargetAsmInfo : public X86TargetAsmInfo<ELFTargetAsmInfo> {
00055     explicit X86ELFTargetAsmInfo(const X86TargetMachine &TM);
00056     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
00057                                            bool Global) const;
00058   };
00059 
00060   struct X86COFFTargetAsmInfo : public X86GenericTargetAsmInfo {
00061     explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM);
00062     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
00063                                            bool Global) const;
00064     virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
00065                                                SectionKind::Kind kind) const;
00066     virtual std::string printSectionFlags(unsigned flags) const;
00067   };
00068 
00069   struct X86WinTargetAsmInfo : public X86GenericTargetAsmInfo {
00070     explicit X86WinTargetAsmInfo(const X86TargetMachine &TM);
00071   };
00072 
00073 } // namespace llvm
00074 
00075 #endif