diff options
Diffstat (limited to 'include/llvm/MC')
-rw-r--r-- | include/llvm/MC/MCAssembler.h | 4 | ||||
-rw-r--r-- | include/llvm/MC/MCContext.h | 22 | ||||
-rw-r--r-- | include/llvm/MC/MCDirectives.h | 3 | ||||
-rw-r--r-- | include/llvm/MC/MCObjectStreamer.h | 56 | ||||
-rw-r--r-- | include/llvm/MC/MCObjectWriter.h | 2 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/AsmLexer.h | 6 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/AsmParser.h | 42 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCAsmLexer.h | 7 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCAsmParser.h | 32 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCAsmParserExtension.h | 66 | ||||
-rw-r--r-- | include/llvm/MC/MCSection.h | 6 | ||||
-rw-r--r-- | include/llvm/MC/MCSectionCOFF.h | 52 | ||||
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 10 | ||||
-rw-r--r-- | include/llvm/MC/SectionKind.h | 64 |
14 files changed, 243 insertions, 129 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index d9963ec..07ca070 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -354,7 +354,7 @@ public: typedef FragmentListType::reverse_iterator reverse_iterator; private: - iplist<MCFragment> Fragments; + FragmentListType Fragments; const MCSection *Section; /// Ordinal - The section index in the assemblers section list. @@ -641,7 +641,7 @@ public: /// in the symbol table, or whether it can be discarded by the assembler. This /// also effects whether the assembler treats the label as potentially /// defining a separate atom. - bool isSymbolLinkerVisible(const MCSymbolData *SD) const; + bool isSymbolLinkerVisible(const MCSymbol &SD) const; /// Emit the section contents using the given object writer. // diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index 03b5fb0..a57b5bf 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -14,6 +14,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/Allocator.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { class MCAsmInfo; @@ -54,6 +55,17 @@ namespace llvm { /// for the LocalLabelVal and adds it to the map if needed. unsigned GetInstance(int64_t LocalLabelVal); + /// The file name of the log file from the enviromment variable + /// AS_SECURE_LOG_FILE. Which must be set before the .secure_log_unique + /// directive is used or it is an error. + char *SecureLogFile; + /// The stream that gets written to for the .secure_log_unique directive. + raw_ostream *SecureLog; + /// Boolean toggled when .secure_log_unique / .secure_log_reset is seen to + /// catch errors if .secure_log_unique appears twice without + /// .secure_log_reset appearing between them. + bool SecureLogUsed; + /// Allocator - Allocator object used for creating machine code objects. /// /// We use a bump pointer allocator to avoid the need to track all allocated @@ -127,6 +139,16 @@ namespace llvm { /// @} + char *getSecureLogFile() { return SecureLogFile; } + raw_ostream *getSecureLog() { return SecureLog; } + bool getSecureLogUsed() { return SecureLogUsed; } + void setSecureLog(raw_ostream *Value) { + SecureLog = Value; + } + void setSecureLogUsed(bool Value) { + SecureLogUsed = Value; + } + void *Allocate(unsigned Size, unsigned Align = 8) { return Allocator.Allocate(Size, Align); } diff --git a/include/llvm/MC/MCDirectives.h b/include/llvm/MC/MCDirectives.h index 1f7364d..223b09e 100644 --- a/include/llvm/MC/MCDirectives.h +++ b/include/llvm/MC/MCDirectives.h @@ -38,7 +38,8 @@ enum MCSymbolAttr { MCSA_Reference, ///< .reference (MachO) MCSA_Weak, ///< .weak MCSA_WeakDefinition, ///< .weak_definition (MachO) - MCSA_WeakReference ///< .weak_reference (MachO) + MCSA_WeakReference, ///< .weak_reference (MachO) + MCSA_WeakDefAutoPrivate ///< .weak_def_can_be_hidden (MachO) }; enum MCAssemblerFlag { diff --git a/include/llvm/MC/MCObjectStreamer.h b/include/llvm/MC/MCObjectStreamer.h new file mode 100644 index 0000000..7b9ff00 --- /dev/null +++ b/include/llvm/MC/MCObjectStreamer.h @@ -0,0 +1,56 @@ +//===- MCObjectStreamer.h - MCStreamer Object File Interface ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_MC_MCOBJECTSTREAMER_H +#define LLVM_MC_MCOBJECTSTREAMER_H + +#include "llvm/MC/MCStreamer.h" + +namespace llvm { +class MCAssembler; +class MCCodeEmitter; +class MCSectionData; +class TargetAsmBackend; +class raw_ostream; + +/// \brief Streaming object file generation interface. +/// +/// This class provides an implementation of the MCStreamer interface which is +/// suitable for use with the assembler backend. Specific object file formats +/// are expected to subclass this interface to implement directives specific +/// to that file format or custom semantics expected by the object writer +/// implementation. +class MCObjectStreamer : public MCStreamer { + MCAssembler *Assembler; + MCSectionData *CurSectionData; + +protected: + MCObjectStreamer(MCContext &Context, TargetAsmBackend &TAB, + raw_ostream &_OS, MCCodeEmitter *_Emitter); + ~MCObjectStreamer(); + + MCSectionData *getCurrentSectionData() const { + return CurSectionData; + } + +public: + MCAssembler &getAssembler() { return *Assembler; } + + /// @name MCStreamer Interface + /// @{ + + virtual void SwitchSection(const MCSection *Section); + virtual void Finish(); + + /// @} +}; + +} // end namespace llvm + +#endif diff --git a/include/llvm/MC/MCObjectWriter.h b/include/llvm/MC/MCObjectWriter.h index e900584..22eea7e 100644 --- a/include/llvm/MC/MCObjectWriter.h +++ b/include/llvm/MC/MCObjectWriter.h @@ -162,6 +162,8 @@ public: /// @} }; +MCObjectWriter *createWinCOFFObjectWriter(raw_ostream &OS); + } // End llvm namespace #endif diff --git a/include/llvm/MC/MCParser/AsmLexer.h b/include/llvm/MC/MCParser/AsmLexer.h index cf6eefb..2187889 100644 --- a/include/llvm/MC/MCParser/AsmLexer.h +++ b/include/llvm/MC/MCParser/AsmLexer.h @@ -33,8 +33,6 @@ class AsmLexer : public MCAsmLexer { const char *CurPtr; const MemoryBuffer *CurBuf; - const char *TokStart; - void operator=(const AsmLexer&); // DO NOT IMPLEMENT AsmLexer(const AsmLexer&); // DO NOT IMPLEMENT @@ -48,9 +46,7 @@ public: void setBuffer(const MemoryBuffer *buf, const char *ptr = NULL); - SMLoc getLoc() const; - - StringRef LexUntilEndOfStatement(); + virtual StringRef LexUntilEndOfStatement(); bool isAtStartOfComment(char Char); diff --git a/include/llvm/MC/MCParser/AsmParser.h b/include/llvm/MC/MCParser/AsmParser.h index e929fd1..82b120b 100644 --- a/include/llvm/MC/MCParser/AsmParser.h +++ b/include/llvm/MC/MCParser/AsmParser.h @@ -26,6 +26,7 @@ namespace llvm { class AsmCond; class AsmToken; +class MCAsmParserExtension; class MCContext; class MCExpr; class MCInst; @@ -36,11 +37,15 @@ class TargetAsmParser; class Twine; class AsmParser : public MCAsmParser { + AsmParser(const AsmParser &); // DO NOT IMPLEMENT + void operator=(const AsmParser &); // DO NOT IMPLEMENT private: AsmLexer Lexer; MCContext &Ctx; MCStreamer &Out; SourceMgr &SrcMgr; + MCAsmParserExtension *GenericParser; + MCAsmParserExtension *PlatformParser; TargetAsmParser *TargetParser; /// This is the current buffer index we're lexing from as managed by the @@ -54,26 +59,28 @@ private: /// invoked after the directive identifier is read and is responsible for /// parsing and validating the rest of the directive. The handler is passed /// in the directive name and the location of the directive keyword. - StringMap<bool(AsmParser::*)(StringRef, SMLoc)> DirectiveMap; + StringMap<std::pair<MCAsmParserExtension*, DirectiveHandler> > DirectiveMap; public: - AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out, + AsmParser(const Target &T, SourceMgr &SM, MCContext &Ctx, MCStreamer &Out, const MCAsmInfo &MAI); ~AsmParser(); bool Run(bool NoInitialTextSection, bool NoFinalize = false); - - void AddDirectiveHandler(StringRef Directive, - bool (AsmParser::*Handler)(StringRef, SMLoc)) { - DirectiveMap[Directive] = Handler; + void AddDirectiveHandler(MCAsmParserExtension *Object, + StringRef Directive, + DirectiveHandler Handler) { + DirectiveMap[Directive] = std::make_pair(Object, Handler); } + public: TargetAsmParser &getTargetParser() const { return *TargetParser; } - void setTargetParser(TargetAsmParser &P) { TargetParser = &P; } + void setTargetParser(TargetAsmParser &P); /// @name MCAsmParser Interface /// { + virtual SourceMgr &getSourceManager() { return SrcMgr; } virtual MCAsmLexer &getLexer() { return Lexer; } virtual MCContext &getContext() { return Ctx; } virtual MCStreamer &getStreamer() { return Out; } @@ -91,12 +98,8 @@ public: /// } private: - MCSymbol *CreateSymbol(StringRef Name); - bool ParseStatement(); - bool TokError(const char *Msg); - void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const; /// EnterIncludeFile - Enter the specified file. This returns true on failure. @@ -115,10 +118,6 @@ private: bool ParseIdentifier(StringRef &Res); // Directive Parsing. - bool ParseDirectiveDarwinSection(); // Darwin specific ".section". - bool ParseDirectiveSectionSwitch(const char *Segment, const char *Section, - unsigned TAA = 0, unsigned ImplicitAlign = 0, - unsigned StubSize = 0); bool ParseDirectiveAscii(bool ZeroTerminated); // ".ascii", ".asciiz" bool ParseDirectiveValue(unsigned Size); // ".byte", ".long", ... bool ParseDirectiveFill(); // ".fill" @@ -132,17 +131,8 @@ private: /// accepts a single symbol (which should be a label or an external). bool ParseDirectiveSymbolAttribute(MCSymbolAttr Attr); bool ParseDirectiveELFType(); // ELF specific ".type" - bool ParseDirectiveDarwinSymbolDesc(); // Darwin specific ".desc" - bool ParseDirectiveDarwinLsym(); // Darwin specific ".lsym" bool ParseDirectiveComm(bool IsLocal); // ".comm" and ".lcomm" - bool ParseDirectiveDarwinZerofill(); // Darwin specific ".zerofill" - bool ParseDirectiveDarwinTBSS(); // Darwin specific ".tbss" - - // Darwin specific ".subsections_via_symbols" - bool ParseDirectiveDarwinSubsectionsViaSymbols(); - // Darwin specific .dump and .load - bool ParseDirectiveDarwinDumpOrLoad(SMLoc IDLoc, bool IsDump); bool ParseDirectiveAbort(); // ".abort" bool ParseDirectiveInclude(); // ".include" @@ -152,10 +142,6 @@ private: bool ParseDirectiveElse(SMLoc DirectiveLoc); // ".else" bool ParseDirectiveEndIf(SMLoc DirectiveLoc); // .endif - bool ParseDirectiveFile(StringRef, SMLoc DirectiveLoc); // ".file" - bool ParseDirectiveLine(StringRef, SMLoc DirectiveLoc); // ".line" - bool ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc); // ".loc" - /// ParseEscapedString - Parse the current token as a string which may include /// escaped characters and return the string contents. bool ParseEscapedString(std::string &Data); diff --git a/include/llvm/MC/MCParser/MCAsmLexer.h b/include/llvm/MC/MCParser/MCAsmLexer.h index bd1496f..d690e81 100644 --- a/include/llvm/MC/MCParser/MCAsmLexer.h +++ b/include/llvm/MC/MCParser/MCAsmLexer.h @@ -121,6 +121,8 @@ class MCAsmLexer { MCAsmLexer(const MCAsmLexer &); // DO NOT IMPLEMENT void operator=(const MCAsmLexer &); // DO NOT IMPLEMENT protected: // Can only create subclasses. + const char *TokStart; + MCAsmLexer(); virtual AsmToken LexToken() = 0; @@ -141,6 +143,11 @@ public: return CurTok = LexToken(); } + virtual StringRef LexUntilEndOfStatement() = 0; + + /// getLoc - Get the current source location. + SMLoc getLoc() const; + /// getTok - Get the current (last) lexed token. const AsmToken &getTok() { return CurTok; diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index 7f7f1b6..d0ccd0f 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -15,35 +15,48 @@ namespace llvm { class AsmToken; class MCAsmLexer; +class MCAsmParserExtension; class MCContext; class MCExpr; class MCStreamer; class SMLoc; +class SourceMgr; +class StringRef; class Twine; /// MCAsmParser - Generic assembler parser interface, for use by target specific /// assembly parsers. class MCAsmParser { +public: + typedef bool (MCAsmParserExtension::*DirectiveHandler)(StringRef, SMLoc); + +private: MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT void operator=(const MCAsmParser &); // DO NOT IMPLEMENT protected: // Can only create subclasses. MCAsmParser(); - + public: virtual ~MCAsmParser(); + virtual void AddDirectiveHandler(MCAsmParserExtension *Object, + StringRef Directive, + DirectiveHandler Handler) = 0; + + virtual SourceMgr &getSourceManager() = 0; + virtual MCAsmLexer &getLexer() = 0; virtual MCContext &getContext() = 0; - /// getSteamer - Return the output streamer for the assembler. + /// getStreamer - Return the output streamer for the assembler. virtual MCStreamer &getStreamer() = 0; /// Warning - Emit a warning at the location \arg L, with the message \arg /// Msg. virtual void Warning(SMLoc L, const Twine &Msg) = 0; - /// Warning - Emit an error at the location \arg L, with the message \arg + /// Error - Emit an error at the location \arg L, with the message \arg /// Msg. /// /// \return The return value is always true, as an idiomatic convenience to @@ -53,10 +66,17 @@ public: /// Lex - Get the next AsmToken in the stream, possibly handling file /// inclusion first. virtual const AsmToken &Lex() = 0; - + /// getTok - Get the current AsmToken from the stream. const AsmToken &getTok(); - + + /// \brief Report an error at the current lexer location. + bool TokError(const char *Msg); + + /// ParseIdentifier - Parse an identifier or string (as a quoted identifier) + /// and set \arg Res to the identifier contents. + virtual bool ParseIdentifier(StringRef &Res) = 0; + /// ParseExpression - Parse an arbitrary expression. /// /// @param Res - The value of the expression. The result is undefined @@ -64,7 +84,7 @@ public: /// @result - False on success. virtual bool ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0; bool ParseExpression(const MCExpr *&Res); - + /// ParseParenExpression - Parse an arbitrary expression, assuming that an /// initial '(' has already been consumed. /// diff --git a/include/llvm/MC/MCParser/MCAsmParserExtension.h b/include/llvm/MC/MCParser/MCAsmParserExtension.h new file mode 100644 index 0000000..ad9ccf7 --- /dev/null +++ b/include/llvm/MC/MCParser/MCAsmParserExtension.h @@ -0,0 +1,66 @@ +//===-- llvm/MC/MCAsmParserExtension.h - Asm Parser Hooks -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_MC_MCASMPARSEREXTENSION_H +#define LLVM_MC_MCASMPARSEREXTENSION_H + +#include "llvm/MC/MCParser/MCAsmParser.h" +#include "llvm/Support/SMLoc.h" + +namespace llvm { + +/// \brief Generic interface for extending the MCAsmParser, +/// which is implemented by target and object file assembly parser +/// implementations. +class MCAsmParserExtension { + MCAsmParserExtension(const MCAsmParserExtension &); // DO NOT IMPLEMENT + void operator=(const MCAsmParserExtension &); // DO NOT IMPLEMENT + + MCAsmParser *Parser; + +protected: + MCAsmParserExtension(); + +public: + virtual ~MCAsmParserExtension(); + + /// \brief Initialize the extension for parsing using the given \arg + /// Parser. The extension should use the AsmParser interfaces to register its + /// parsing routines. + virtual void Initialize(MCAsmParser &Parser); + + /// @name MCAsmParser Proxy Interfaces + /// @{ + + MCContext &getContext() { return getParser().getContext(); } + MCAsmLexer &getLexer() { return getParser().getLexer(); } + MCAsmParser &getParser() { return *Parser; } + SourceMgr &getSourceManager() { return getParser().getSourceManager(); } + MCStreamer &getStreamer() { return getParser().getStreamer(); } + void Warning(SMLoc L, const Twine &Msg) { + return getParser().Warning(L, Msg); + } + bool Error(SMLoc L, const Twine &Msg) { + return getParser().Error(L, Msg); + } + + const AsmToken &Lex() { return getParser().Lex(); } + + const AsmToken &getTok() { return getParser().getTok(); } + + bool TokError(const char *Msg) { + return getParser().TokError(Msg); + } + + /// @} +}; + +} // End llvm namespace + +#endif diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index 808767c..5c99735 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -23,7 +23,7 @@ namespace llvm { class MCContext; class MCAsmInfo; class raw_ostream; - + /// MCSection - Instances of this class represent a uniqued identifier for a /// section in the current translation unit. The MCContext class uniques and /// creates these. @@ -49,7 +49,7 @@ namespace llvm { SectionKind getKind() const { return Kind; } SectionVariant getVariant() const { return Variant; } - + virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS) const = 0; @@ -63,7 +63,7 @@ namespace llvm { static bool classof(const MCSection *) { return true; } }; - + } // end namespace llvm #endif diff --git a/include/llvm/MC/MCSectionCOFF.h b/include/llvm/MC/MCSectionCOFF.h index 938a388..f828e10 100644 --- a/include/llvm/MC/MCSectionCOFF.h +++ b/include/llvm/MC/MCSectionCOFF.h @@ -16,6 +16,8 @@ #include "llvm/MC/MCSection.h" +#include "llvm/Support/COFF.h" + namespace llvm { /// MCSectionCOFF - This represents a section on Windows @@ -47,56 +49,6 @@ namespace llvm { /// should be printed before the section name bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const; - //FIXME: all COFF enumerations/flags should be standardized into one place... - // Target/X86COFF.h doesn't seem right as COFF can be used for other targets, - // MC/WinCOFF.h maybe right as it isn't target or entity specific, and it is - // pretty low on the dependancy graph (is there any need to support non - // windows COFF?) - // here is good for section stuff, but others should go elsewhere - - /// Valid section flags. - enum { - IMAGE_SCN_TYPE_NO_PAD = 0x00000008, - IMAGE_SCN_CNT_CODE = 0x00000020, - IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040, - IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080, - IMAGE_SCN_LNK_OTHER = 0x00000100, - IMAGE_SCN_LNK_INFO = 0x00000200, - IMAGE_SCN_LNK_REMOVE = 0x00000800, - IMAGE_SCN_LNK_COMDAT = 0x00001000, - IMAGE_SCN_MEM_FARDATA = 0x00008000, - IMAGE_SCN_MEM_PURGEABLE = 0x00020000, - IMAGE_SCN_MEM_16BIT = 0x00020000, - IMAGE_SCN_MEM_LOCKED = 0x00040000, - IMAGE_SCN_MEM_PRELOAD = 0x00080000, - /* these are handled elsewhere - IMAGE_SCN_ALIGN_1BYTES = 0x00100000, - IMAGE_SCN_ALIGN_2BYTES = 0x00200000, - IMAGE_SCN_ALIGN_4BYTES = 0x00300000, - IMAGE_SCN_ALIGN_8BYTES = 0x00400000, - IMAGE_SCN_ALIGN_16BYTES = 0x00500000, - IMAGE_SCN_ALIGN_32BYTES = 0x00600000, - IMAGE_SCN_ALIGN_64BYTES = 0x00700000, - */ - IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000, - IMAGE_SCN_MEM_DISCARDABLE = 0x02000000, - IMAGE_SCN_MEM_NOT_CACHED = 0x04000000, - IMAGE_SCN_MEM_NOT_PAGED = 0x08000000, - IMAGE_SCN_MEM_SHARED = 0x10000000, - IMAGE_SCN_MEM_EXECUTE = 0x20000000, - IMAGE_SCN_MEM_READ = 0x40000000, - IMAGE_SCN_MEM_WRITE = 0x80000000 - }; - - enum { - IMAGE_COMDAT_SELECT_NODUPLICATES = 1, - IMAGE_COMDAT_SELECT_ANY, - IMAGE_COMDAT_SELECT_SAME_SIZE, - IMAGE_COMDAT_SELECT_EXACT_MATCH, - IMAGE_COMDAT_SELECT_ASSOCIATIVE, - IMAGE_COMDAT_SELECT_LARGEST - }; - StringRef getSectionName() const { return SectionName; } unsigned getCharacteristics() const { return Characteristics; } int getSelection () const { return Selection; } diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index 0783159..aca7dd3 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -314,7 +314,7 @@ namespace llvm { virtual void EmitRawText(StringRef String); void EmitRawText(const Twine &String); - /// Finish - Finish emission of machine code and flush any output. + /// Finish - Finish emission of machine code. virtual void Finish() = 0; }; @@ -341,12 +341,18 @@ namespace llvm { MCCodeEmitter *CE = 0, bool ShowInst = false); - /// createMachOStreamer - Create a machine code streamer which will generative + /// createMachOStreamer - Create a machine code streamer which will generate /// Mach-O format object files. MCStreamer *createMachOStreamer(MCContext &Ctx, TargetAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll = false); + /// createWinCOFFStreamer - Create a machine code streamer which will + /// generate Microsoft COFF format object files. + MCStreamer *createWinCOFFStreamer(MCContext &Ctx, + TargetAsmBackend &TAB, + MCCodeEmitter &CE, raw_ostream &OS); + /// createLoggingStreamer - Create a machine code streamer which just logs the /// API calls and then dispatches to another streamer. /// diff --git a/include/llvm/MC/SectionKind.h b/include/llvm/MC/SectionKind.h index c9557f2..85a91c6 100644 --- a/include/llvm/MC/SectionKind.h +++ b/include/llvm/MC/SectionKind.h @@ -29,10 +29,10 @@ class SectionKind { enum Kind { /// Metadata - Debug info sections or other metadata. Metadata, - + /// Text - Text section, used for functions and other executable code. Text, - + /// ReadOnly - Data that is never written to at program runtime by the /// program or the dynamic linker. Things in the top-level readonly /// SectionKind are not mergeable. @@ -45,7 +45,7 @@ class SectionKind { /// Mergeable1ByteCString - 1 byte mergable, null terminated, string. Mergeable1ByteCString, - + /// Mergeable2ByteCString - 2 byte mergable, null terminated, string. Mergeable2ByteCString, @@ -56,11 +56,11 @@ class SectionKind { /// constants together. For example, this can be used to unique /// constant pool entries etc. MergeableConst, - + /// MergeableConst4 - This is a section used by 4-byte constants, /// for example, floats. MergeableConst4, - + /// MergeableConst8 - This is a section used by 8-byte constants, /// for example, doubles. MergeableConst8, @@ -68,33 +68,33 @@ class SectionKind { /// MergeableConst16 - This is a section used by 16-byte constants, /// for example, vectors. MergeableConst16, - + /// Writeable - This is the base of all segments that need to be written /// to during program runtime. - + /// ThreadLocal - This is the base of all TLS segments. All TLS /// objects must be writeable, otherwise there is no reason for them to /// be thread local! - + /// ThreadBSS - Zero-initialized TLS data objects. ThreadBSS, - + /// ThreadData - Initialized TLS data objects. ThreadData, - + /// GlobalWriteableData - Writeable data that is global (not thread /// local). - + /// BSS - Zero initialized writeable data. BSS, - + /// BSSLocal - This is BSS (zero initialized and writable) data /// which has local linkage. BSSLocal, - + /// BSSExtern - This is BSS data with normal external linkage. BSSExtern, - + /// Common - Data with common linkage. These represent tentative /// definitions, which always have a zero initializer and are never /// marked 'constant'. @@ -123,20 +123,20 @@ class SectionKind { /// mark the pages these globals end up on as read-only after it is /// done with its relocation phase. ReadOnlyWithRel, - + /// ReadOnlyWithRelLocal - This is data that is readonly by the /// program, but must be writeable so that the dynamic linker /// can perform relocations in it. This is used when we know /// that all the relocations are to globals in this final /// linked image. ReadOnlyWithRelLocal - + } K : 8; public: - + bool isMetadata() const { return K == Metadata; } bool isText() const { return K == Text; } - + bool isReadOnly() const { return K == ReadOnly || isMergeableCString() || isMergeableConst(); @@ -149,7 +149,7 @@ public: bool isMergeable1ByteCString() const { return K == Mergeable1ByteCString; } bool isMergeable2ByteCString() const { return K == Mergeable2ByteCString; } bool isMergeable4ByteCString() const { return K == Mergeable4ByteCString; } - + bool isMergeableConst() const { return K == MergeableConst || K == MergeableConst4 || K == MergeableConst8 || K == MergeableConst16; @@ -157,38 +157,38 @@ public: bool isMergeableConst4() const { return K == MergeableConst4; } bool isMergeableConst8() const { return K == MergeableConst8; } bool isMergeableConst16() const { return K == MergeableConst16; } - + bool isWriteable() const { return isThreadLocal() || isGlobalWriteableData(); } - + bool isThreadLocal() const { return K == ThreadData || K == ThreadBSS; } - - bool isThreadBSS() const { return K == ThreadBSS; } - bool isThreadData() const { return K == ThreadData; } + + bool isThreadBSS() const { return K == ThreadBSS; } + bool isThreadData() const { return K == ThreadData; } bool isGlobalWriteableData() const { return isBSS() || isCommon() || isDataRel() || isReadOnlyWithRel(); } - + bool isBSS() const { return K == BSS || K == BSSLocal || K == BSSExtern; } bool isBSSLocal() const { return K == BSSLocal; } bool isBSSExtern() const { return K == BSSExtern; } - + bool isCommon() const { return K == Common; } - + bool isDataRel() const { return K == DataRel || K == DataRelLocal || K == DataNoRel; } - + bool isDataRelLocal() const { return K == DataRelLocal || K == DataNoRel; } bool isDataNoRel() const { return K == DataNoRel; } - + bool isReadOnlyWithRel() const { return K == ReadOnlyWithRel || K == ReadOnlyWithRelLocal; } @@ -196,14 +196,14 @@ public: bool isReadOnlyWithRelLocal() const { return K == ReadOnlyWithRelLocal; } -private: +private: static SectionKind get(Kind K) { SectionKind Res; Res.K = K; return Res; } public: - + static SectionKind getMetadata() { return get(Metadata); } static SectionKind getText() { return get(Text); } static SectionKind getReadOnly() { return get(ReadOnly); } @@ -234,7 +234,7 @@ public: return get(ReadOnlyWithRelLocal); } }; - + } // end namespace llvm #endif |