diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-31 17:42:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-31 17:42:42 +0000 |
commit | f26e03bc7e30162197641406e37e662a15d80f7e (patch) | |
tree | 2c109dc8f8764abb040f71fe14215b9116d11922 /include/llvm/Target/TargetLoweringObjectFile.h | |
parent | 5defacc6e605f4651c6300237cef8e9bb2eb6d0e (diff) |
refactor section construction in TLOF to be through an explicit
initialize method, which can be called when an MCContext is available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77687 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetLoweringObjectFile.h')
-rw-r--r-- | include/llvm/Target/TargetLoweringObjectFile.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h index 6b2e91008c..713b545bfd 100644 --- a/include/llvm/Target/TargetLoweringObjectFile.h +++ b/include/llvm/Target/TargetLoweringObjectFile.h @@ -19,6 +19,7 @@ #include "llvm/Target/TargetAsmInfo.h" namespace llvm { + class MCContext; /// SectionKind - This is a simple POD value that classifies the properties of /// a section. A global variable is classified into the deepest possible @@ -256,6 +257,12 @@ public: virtual ~TargetLoweringObjectFile(); + /// Initialize - this method must be called before any actual lowering is + /// done. This specifies the current context for codegen, and gives the + /// lowering implementations a chance to set up their default sections. + virtual void Initialize(MCContext &Ctx, const TargetMachine &TM) {} + + const Section *getTextSection() const { return TextSection; } const Section *getDataSection() const { return DataSection; } @@ -310,12 +317,17 @@ protected: class TargetLoweringObjectFileELF : public TargetLoweringObjectFile { bool AtIsCommentChar; // True if @ is the comment character on this target. + bool HasCrazyBSS; public: /// ELF Constructor - AtIsCommentChar is true if the CommentCharacter from TAI /// is "@". - TargetLoweringObjectFileELF(bool AtIsCommentChar = false, + TargetLoweringObjectFileELF(bool atIsCommentChar = false, // FIXME: REMOVE AFTER UNIQUING IS FIXED. - bool HasCrazyBSS = false); + bool hasCrazyBSS = false) + : AtIsCommentChar(atIsCommentChar), HasCrazyBSS(hasCrazyBSS) {} + + virtual void Initialize(MCContext &Ctx, const TargetMachine &TM); + /// getSectionForMergeableConstant - Given a mergeable constant with the /// specified size and relocation information, return a section that it @@ -342,6 +354,8 @@ protected: const Section *MergeableConst16Section; }; + + class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile { const Section *TextCoalSection; const Section *ConstTextCoalSection; @@ -352,7 +366,9 @@ class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile { const Section *EightByteConstantSection; const Section *SixteenByteConstantSection; public: - TargetLoweringObjectFileMachO(const TargetMachine &TM); + + virtual void Initialize(MCContext &Ctx, const TargetMachine &TM); + virtual const Section * SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang, const TargetMachine &TM) const; @@ -365,7 +381,8 @@ public: class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile { public: - TargetLoweringObjectFileCOFF(); + virtual void Initialize(MCContext &Ctx, const TargetMachine &TM); + virtual void getSectionFlagsAsString(SectionKind Kind, SmallVectorImpl<char> &Str) const; |