Handle ELF mergeable sections
[oota-llvm.git] / lib / Target / X86 / X86TargetAsmInfo.h
1 //=====-- X86TargetAsmInfo.h - X86 asm properties -------------*- C++ -*--====//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declaration of the X86TargetAsmInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef X86TARGETASMINFO_H
15 #define X86TARGETASMINFO_H
16
17 #include "llvm/Target/TargetAsmInfo.h"
18
19 namespace llvm {
20
21   // Forward declaration.
22   class X86TargetMachine;
23   class GlobalVariable;
24
25   struct X86TargetAsmInfo : public TargetAsmInfo {
26     explicit X86TargetAsmInfo(const X86TargetMachine &TM);
27
28     virtual bool ExpandInlineAsm(CallInst *CI) const;
29     virtual std::string SectionForGlobal(const GlobalValue *GV) const;
30
31   private:
32     bool LowerToBSwap(CallInst *CI) const;
33   protected:
34     const X86TargetMachine* X86TM;
35   };
36
37   struct X86DarwinTargetAsmInfo : public X86TargetAsmInfo {
38     explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
39     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
40                                            bool Global) const;
41     virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
42                                                SectionKind::Kind kind) const;
43   };
44
45   struct X86ELFTargetAsmInfo : public X86TargetAsmInfo {
46     explicit X86ELFTargetAsmInfo(const X86TargetMachine &TM);
47     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
48                                            bool Global) const;
49
50     virtual std::string SelectSectionForGlobal(const GlobalValue *GV) const;
51     virtual unsigned SectionFlagsForGlobal(const GlobalValue *GV,
52                                            const char* name) const;
53     virtual std::string PrintSectionFlags(unsigned flags) const;
54     std::string MergeableConstSection(const GlobalVariable *GV) const;
55     std::string MergeableStringSection(const GlobalVariable *GV) const;
56   };
57
58   struct X86COFFTargetAsmInfo : public X86TargetAsmInfo {
59     explicit X86COFFTargetAsmInfo(const X86TargetMachine &TM);
60     virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
61                                            bool Global) const;
62     virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
63                                                SectionKind::Kind kind) const;
64     virtual std::string PrintSectionFlags(unsigned flags) const;
65   };
66
67   struct X86WinTargetAsmInfo : public X86TargetAsmInfo {
68     explicit X86WinTargetAsmInfo(const X86TargetMachine &TM);
69   };
70 } // namespace llvm
71
72 #endif