diff options
Diffstat (limited to 'include/llvm/MC')
-rw-r--r-- | include/llvm/MC/MCAsmInfo.h | 12 | ||||
-rw-r--r-- | include/llvm/MC/MCAssembler.h | 12 | ||||
-rw-r--r-- | include/llvm/MC/MCELFObjectWriter.h | 9 | ||||
-rw-r--r-- | include/llvm/MC/MCELFStreamer.h | 3 | ||||
-rw-r--r-- | include/llvm/MC/MCExpr.h | 4 | ||||
-rw-r--r-- | include/llvm/MC/MCInst.h | 2 | ||||
-rw-r--r-- | include/llvm/MC/MCObjectFileInfo.h | 11 | ||||
-rw-r--r-- | include/llvm/MC/MCObjectStreamer.h | 10 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCAsmParser.h | 36 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCParsedAsmOperand.h | 11 | ||||
-rw-r--r-- | include/llvm/MC/MCSection.h | 4 | ||||
-rw-r--r-- | include/llvm/MC/MCSectionCOFF.h | 3 | ||||
-rw-r--r-- | include/llvm/MC/MCSectionELF.h | 3 | ||||
-rw-r--r-- | include/llvm/MC/MCSectionMachO.h | 3 | ||||
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 48 | ||||
-rw-r--r-- | include/llvm/MC/MCTargetAsmParser.h | 14 | ||||
-rw-r--r-- | include/llvm/MC/MCWinCOFFObjectWriter.h | 6 | ||||
-rw-r--r-- | include/llvm/MC/MachineLocation.h | 7 | ||||
-rw-r--r-- | include/llvm/MC/SubtargetFeature.h | 4 |
19 files changed, 143 insertions, 59 deletions
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h index 28256b3..d020de3 100644 --- a/include/llvm/MC/MCAsmInfo.h +++ b/include/llvm/MC/MCAsmInfo.h @@ -217,6 +217,8 @@ namespace llvm { /// convention. bool HasMicrosoftFastStdCallMangling; // Defaults to false. + bool NeedsDwarfSectionOffsetDirective; + //===--- Alignment Information ----------------------------------------===// /// AlignDirective - The directive used to emit round up to an alignment @@ -320,9 +322,6 @@ namespace llvm { /// encode inline subroutine information. bool DwarfUsesInlineInfoSection; // Defaults to false. - /// DwarfSectionOffsetDirective - Special section offset directive. - const char* DwarfSectionOffsetDirective; // Defaults to NULL - /// DwarfUsesRelocationsAcrossSections - True if Dwarf2 output generally /// uses relocations for references to other .debug_* sections. bool DwarfUsesRelocationsAcrossSections; @@ -412,6 +411,10 @@ namespace llvm { return HasMicrosoftFastStdCallMangling; } + bool needsDwarfSectionOffsetDirective() const { + return NeedsDwarfSectionOffsetDirective; + } + // Accessors. // bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; } @@ -557,9 +560,6 @@ namespace llvm { bool doesDwarfUseInlineInfoSection() const { return DwarfUsesInlineInfoSection; } - const char *getDwarfSectionOffsetDirective() const { - return DwarfSectionOffsetDirective; - } bool doesDwarfUseRelocationsAcrossSections() const { return DwarfUsesRelocationsAcrossSections; } diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index 43fbdc9..38a70f0 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -451,7 +451,7 @@ class MCLEBFragment : public MCFragment { SmallString<8> Contents; public: - MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSectionData *SD) + MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSectionData *SD = 0) : MCFragment(FT_LEB, SD), Value(&Value_), IsSigned(IsSigned_) { Contents.push_back(0); } @@ -487,7 +487,7 @@ class MCDwarfLineAddrFragment : public MCFragment { public: MCDwarfLineAddrFragment(int64_t _LineDelta, const MCExpr &_AddrDelta, - MCSectionData *SD) + MCSectionData *SD = 0) : MCFragment(FT_Dwarf, SD), LineDelta(_LineDelta), AddrDelta(&_AddrDelta) { Contents.push_back(0); } @@ -518,7 +518,7 @@ class MCDwarfCallFrameFragment : public MCFragment { SmallString<8> Contents; public: - MCDwarfCallFrameFragment(const MCExpr &_AddrDelta, MCSectionData *SD) + MCDwarfCallFrameFragment(const MCExpr &_AddrDelta, MCSectionData *SD = 0) : MCFragment(FT_DwarfFrame, SD), AddrDelta(&_AddrDelta) { Contents.push_back(0); } @@ -590,6 +590,10 @@ private: /// it. unsigned HasInstructions : 1; + /// Mapping from subsection number to insertion point for subsection numbers + /// below that number. + SmallVector<std::pair<unsigned, MCFragment *>, 1> SubsectionFragmentMap; + /// @} public: @@ -633,6 +637,8 @@ public: bool empty() const { return Fragments.empty(); } + iterator getSubsectionInsertionPoint(unsigned Subsection); + bool isBundleLocked() const { return BundleLockState != NotBundleLocked; } diff --git a/include/llvm/MC/MCELFObjectWriter.h b/include/llvm/MC/MCELFObjectWriter.h index a59776d..65dd1e8 100644 --- a/include/llvm/MC/MCELFObjectWriter.h +++ b/include/llvm/MC/MCELFObjectWriter.h @@ -45,7 +45,14 @@ struct ELFRelocationEntry { // Support lexicographic sorting. bool operator<(const ELFRelocationEntry &RE) const { - return RE.r_offset < r_offset; + if (RE.r_offset != r_offset) + return RE.r_offset < r_offset; + if (Type != RE.Type) + return Type < RE.Type; + if (Index != RE.Index) + return Index < RE.Index; + llvm_unreachable("ELFRelocs might be unstable!"); + return 0; } }; diff --git a/include/llvm/MC/MCELFStreamer.h b/include/llvm/MC/MCELFStreamer.h index 6fb2d22..55c05b0 100644 --- a/include/llvm/MC/MCELFStreamer.h +++ b/include/llvm/MC/MCELFStreamer.h @@ -50,7 +50,8 @@ public: virtual void InitSections(); virtual void InitToTextSection(); - virtual void ChangeSection(const MCSection *Section); + virtual void ChangeSection(const MCSection *Section, + const MCExpr *Subsection); virtual void EmitLabel(MCSymbol *Symbol); virtual void EmitDebugLabel(MCSymbol *Symbol); virtual void EmitAssemblerFlag(MCAssemblerFlag Flag); diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h index b5bfed1..a2c5bd3 100644 --- a/include/llvm/MC/MCExpr.h +++ b/include/llvm/MC/MCExpr.h @@ -216,7 +216,9 @@ public: VK_Mips_GOT_HI16, VK_Mips_GOT_LO16, VK_Mips_CALL_HI16, - VK_Mips_CALL_LO16 + VK_Mips_CALL_LO16, + + VK_COFF_IMGREL32 // symbol@imgrel (image-relative) }; private: diff --git a/include/llvm/MC/MCInst.h b/include/llvm/MC/MCInst.h index e91c6a2..4766815 100644 --- a/include/llvm/MC/MCInst.h +++ b/include/llvm/MC/MCInst.h @@ -171,7 +171,7 @@ public: void clear() { Operands.clear(); } size_t size() { return Operands.size(); } - typedef SmallVector<MCOperand, 8>::iterator iterator; + typedef SmallVectorImpl<MCOperand>::iterator iterator; iterator begin() { return Operands.begin(); } iterator end() { return Operands.end(); } iterator insert(iterator I, const MCOperand &Op) { diff --git a/include/llvm/MC/MCObjectFileInfo.h b/include/llvm/MC/MCObjectFileInfo.h index c8d7484..a5853b6 100644 --- a/include/llvm/MC/MCObjectFileInfo.h +++ b/include/llvm/MC/MCObjectFileInfo.h @@ -46,10 +46,15 @@ protected: unsigned FDEEncoding; unsigned FDECFIEncoding; unsigned TTypeEncoding; - // Section flags for eh_frame + + /// Section flags for eh_frame unsigned EHSectionType; unsigned EHSectionFlags; + /// CompactUnwindDwarfEHFrameOnly - Compact unwind encoding indicating that we + /// should emit only an EH frame. + unsigned CompactUnwindDwarfEHFrameOnly; + /// TextSection - Section directive for standard text. /// const MCSection *TextSection; @@ -201,6 +206,10 @@ public: } unsigned getTTypeEncoding() const { return TTypeEncoding; } + unsigned getCompactUnwindDwarfEHFrameOnly() const { + return CompactUnwindDwarfEHFrameOnly; + } + const MCSection *getTextSection() const { return TextSection; } const MCSection *getDataSection() const { return DataSection; } const MCSection *getBSSSection() const { return BSSSection; } diff --git a/include/llvm/MC/MCObjectStreamer.h b/include/llvm/MC/MCObjectStreamer.h index f06c49f..22a2839 100644 --- a/include/llvm/MC/MCObjectStreamer.h +++ b/include/llvm/MC/MCObjectStreamer.h @@ -10,6 +10,7 @@ #ifndef LLVM_MC_MCOBJECTSTREAMER_H #define LLVM_MC_MCOBJECTSTREAMER_H +#include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCStreamer.h" namespace llvm { @@ -32,6 +33,7 @@ class raw_ostream; class MCObjectStreamer : public MCStreamer { MCAssembler *Assembler; MCSectionData *CurSectionData; + MCSectionData::iterator CurInsertionPoint; virtual void EmitInstToData(const MCInst &Inst) = 0; virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame); @@ -56,6 +58,11 @@ protected: MCFragment *getCurrentFragment() const; + void insert(MCFragment *F) const { + CurSectionData->getFragmentList().insert(CurInsertionPoint, F); + F->setParent(CurSectionData); + } + /// Get a data fragment to write into, creating a new one if the current /// fragment is not a data fragment. MCDataFragment *getOrCreateDataFragment() const; @@ -76,7 +83,8 @@ public: virtual void EmitULEB128Value(const MCExpr *Value); virtual void EmitSLEB128Value(const MCExpr *Value); virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol); - virtual void ChangeSection(const MCSection *Section); + virtual void ChangeSection(const MCSection *Section, + const MCExpr *Subsection); virtual void EmitInstruction(const MCInst &Inst); /// \brief Emit an instruction to a special fragment, because this instruction diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index d7e3902..dcc9886 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -33,15 +33,31 @@ class Twine; /// MCAsmParserSemaCallback - Generic Sema callback for assembly parser. class MCAsmParserSemaCallback { public: + typedef struct { + void *OpDecl; + bool IsVarDecl; + unsigned Length, Size, Type; + + void clear() { + OpDecl = 0; + IsVarDecl = false; + Length = 1; + Size = 0; + Type = 0; + } + } InlineAsmIdentifierInfo; + virtual ~MCAsmParserSemaCallback(); - virtual void *LookupInlineAsmIdentifier(StringRef Name, void *Loc, - unsigned &Length, unsigned &Size, - unsigned &Type, bool &IsVarDecl) = 0; + virtual void *LookupInlineAsmIdentifier(StringRef &LineBuf, + InlineAsmIdentifierInfo &Info, + bool IsUnevaluatedContext) = 0; virtual bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset) = 0; }; +typedef MCAsmParserSemaCallback::InlineAsmIdentifierInfo + InlineAsmIdentifierInfo; /// MCAsmParser - Generic assembler parser interface, for use by target specific /// assembly parsers. @@ -106,14 +122,14 @@ public: /// /// \return The return value is true, if warnings are fatal. virtual bool Warning(SMLoc L, const Twine &Msg, - ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()) = 0; + ArrayRef<SMRange> Ranges = None) = 0; /// Error - Emit an error at the location \p L, with the message \p Msg. /// /// \return The return value is always true, as an idiomatic convenience to /// clients. virtual bool Error(SMLoc L, const Twine &Msg, - ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()) = 0; + ArrayRef<SMRange> Ranges = None) = 0; /// Lex - Get the next AsmToken in the stream, possibly handling file /// inclusion first. @@ -123,8 +139,7 @@ public: const AsmToken &getTok(); /// \brief Report an error at the current lexer location. - bool TokError(const Twine &Msg, - ArrayRef<SMRange> Ranges = ArrayRef<SMRange>()); + bool TokError(const Twine &Msg, ArrayRef<SMRange> Ranges = None); /// parseIdentifier - Parse an identifier or string (as a quoted identifier) /// and set \p Res to the identifier contents. @@ -151,6 +166,13 @@ public: virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0; bool parseExpression(const MCExpr *&Res); + /// parsePrimaryExpr - Parse a primary expression. + /// + /// @param Res - The value of the expression. The result is undefined + /// on error. + /// @result - False on success. + virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) = 0; + /// parseParenExpression - Parse an arbitrary expression, assuming that an /// initial '(' has already been consumed. /// diff --git a/include/llvm/MC/MCParser/MCParsedAsmOperand.h b/include/llvm/MC/MCParser/MCParsedAsmOperand.h index 4650bf2..818fbbd 100644 --- a/include/llvm/MC/MCParser/MCParsedAsmOperand.h +++ b/include/llvm/MC/MCParser/MCParsedAsmOperand.h @@ -37,15 +37,8 @@ public: void setMCOperandNum (unsigned OpNum) { MCOperandNum = OpNum; } unsigned getMCOperandNum() { return MCOperandNum; } - unsigned getNameLen() { - assert (getStartLoc().isValid() && "Invalid StartLoc!"); - assert (getEndLoc().isValid() && "Invalid EndLoc!"); - return getEndLoc().getPointer() - getStartLoc().getPointer(); - } - - StringRef getName() { - return StringRef(getStartLoc().getPointer(), getNameLen()); - } + virtual StringRef getSymName() { return StringRef(); } + virtual void *getOpDecl() { return 0; } /// isToken - Is this a token operand? virtual bool isToken() const = 0; diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index e575424..de2678a 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -20,6 +20,7 @@ namespace llvm { class MCAsmInfo; + class MCExpr; class raw_ostream; /// MCSection - Instances of this class represent a uniqued identifier for a @@ -48,7 +49,8 @@ namespace llvm { SectionVariant getVariant() const { return Variant; } virtual void PrintSwitchToSection(const MCAsmInfo &MAI, - raw_ostream &OS) const = 0; + raw_ostream &OS, + const MCExpr *Subsection) const = 0; // Convenience routines to get label names for the beginning/end of a // section. diff --git a/include/llvm/MC/MCSectionCOFF.h b/include/llvm/MC/MCSectionCOFF.h index 07c4714..50e33a5 100644 --- a/include/llvm/MC/MCSectionCOFF.h +++ b/include/llvm/MC/MCSectionCOFF.h @@ -60,7 +60,8 @@ namespace llvm { int getSelection () const { return Selection; } virtual void PrintSwitchToSection(const MCAsmInfo &MAI, - raw_ostream &OS) const; + raw_ostream &OS, + const MCExpr *Subsection) const; virtual bool UseCodeAlign() const; virtual bool isVirtualSection() const; diff --git a/include/llvm/MC/MCSectionELF.h b/include/llvm/MC/MCSectionELF.h index 4b8b849..5979915 100644 --- a/include/llvm/MC/MCSectionELF.h +++ b/include/llvm/MC/MCSectionELF.h @@ -70,7 +70,8 @@ public: const MCSymbol *getGroup() const { return Group; } void PrintSwitchToSection(const MCAsmInfo &MAI, - raw_ostream &OS) const; + raw_ostream &OS, + const MCExpr *Subsection) const; virtual bool UseCodeAlign() const; virtual bool isVirtualSection() const; diff --git a/include/llvm/MC/MCSectionMachO.h b/include/llvm/MC/MCSectionMachO.h index 898f571..b68bd85 100644 --- a/include/llvm/MC/MCSectionMachO.h +++ b/include/llvm/MC/MCSectionMachO.h @@ -175,7 +175,8 @@ public: unsigned &StubSize); // Out. virtual void PrintSwitchToSection(const MCAsmInfo &MAI, - raw_ostream &OS) const; + raw_ostream &OS, + const MCExpr *Subsection) const; virtual bool UseCodeAlign() const; virtual bool isVirtualSection() const; diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index a069a2b..2cab481 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -37,6 +37,8 @@ namespace llvm { class raw_ostream; class formatted_raw_ostream; + typedef std::pair<const MCSection *, const MCExpr *> MCSectionSubPair; + /// MCStreamer - Streaming machine code generation interface. This interface /// is intended to provide a programatic interface that is very similar to the /// level that an assembler .s file provides. It has callbacks to emit bytes, @@ -86,8 +88,7 @@ namespace llvm { /// SectionStack - This is stack of current and previous section /// values saved by PushSection. - SmallVector<std::pair<const MCSection *, - const MCSection *>, 4> SectionStack; + SmallVector<std::pair<MCSectionSubPair, MCSectionSubPair>, 4> SectionStack; bool AutoInitSections; @@ -174,25 +175,25 @@ namespace llvm { /// getCurrentSection - Return the current section that the streamer is /// emitting code to. - const MCSection *getCurrentSection() const { + MCSectionSubPair getCurrentSection() const { if (!SectionStack.empty()) return SectionStack.back().first; - return NULL; + return MCSectionSubPair(); } /// getPreviousSection - Return the previous section that the streamer is /// emitting code to. - const MCSection *getPreviousSection() const { + MCSectionSubPair getPreviousSection() const { if (!SectionStack.empty()) return SectionStack.back().second; - return NULL; + return MCSectionSubPair(); } /// ChangeSection - Update streamer for a new active section. /// /// This is called by PopSection and SwitchSection, if the current /// section changes. - virtual void ChangeSection(const MCSection *) = 0; + virtual void ChangeSection(const MCSection *, const MCExpr *) = 0; /// pushSection - Save the current and previous section on the /// section stack. @@ -208,11 +209,19 @@ namespace llvm { bool PopSection() { if (SectionStack.size() <= 1) return false; - const MCSection *oldSection = SectionStack.pop_back_val().first; - const MCSection *curSection = SectionStack.back().first; + MCSectionSubPair oldSection = SectionStack.pop_back_val().first; + MCSectionSubPair curSection = SectionStack.back().first; if (oldSection != curSection) - ChangeSection(curSection); + ChangeSection(curSection.first, curSection.second); + return true; + } + + bool SubSection(const MCExpr *Subsection) { + if (SectionStack.empty()) + return false; + + SwitchSection(SectionStack.back().first.first, Subsection); return true; } @@ -220,25 +229,26 @@ namespace llvm { /// @p Section. This is required to update CurSection. /// /// This corresponds to assembler directives like .section, .text, etc. - void SwitchSection(const MCSection *Section) { + void SwitchSection(const MCSection *Section, const MCExpr *Subsection = 0) { assert(Section && "Cannot switch to a null section!"); - const MCSection *curSection = SectionStack.back().first; + MCSectionSubPair curSection = SectionStack.back().first; SectionStack.back().second = curSection; - if (Section != curSection) { - SectionStack.back().first = Section; - ChangeSection(Section); + if (MCSectionSubPair(Section, Subsection) != curSection) { + SectionStack.back().first = MCSectionSubPair(Section, Subsection); + ChangeSection(Section, Subsection); } } /// SwitchSectionNoChange - Set the current section where code is being /// emitted to @p Section. This is required to update CurSection. This /// version does not call ChangeSection. - void SwitchSectionNoChange(const MCSection *Section) { + void SwitchSectionNoChange(const MCSection *Section, + const MCExpr *Subsection = 0) { assert(Section && "Cannot switch to a null section!"); - const MCSection *curSection = SectionStack.back().first; + MCSectionSubPair curSection = SectionStack.back().first; SectionStack.back().second = curSection; - if (Section != curSection) - SectionStack.back().first = Section; + if (MCSectionSubPair(Section, Subsection) != curSection) + SectionStack.back().first = MCSectionSubPair(Section, Subsection); } /// Initialize the streamer. diff --git a/include/llvm/MC/MCTargetAsmParser.h b/include/llvm/MC/MCTargetAsmParser.h index 4c5b176..6e878df 100644 --- a/include/llvm/MC/MCTargetAsmParser.h +++ b/include/llvm/MC/MCTargetAsmParser.h @@ -22,6 +22,7 @@ class MCInst; template <typename T> class SmallVectorImpl; enum AsmRewriteKind { + AOK_Delete = 0, // Rewrite should be ignored. AOK_Align, // Rewrite align as .align. AOK_DotOperator, // Rewrite a dot operator expression as an immediate. // E.g., [eax].foo.bar -> [eax].8 @@ -34,6 +35,19 @@ enum AsmRewriteKind { AOK_Skip // Skip emission (e.g., offset/type operators). }; +const char AsmRewritePrecedence [] = { + 0, // AOK_Delete + 1, // AOK_Align + 1, // AOK_DotOperator + 1, // AOK_Emit + 3, // AOK_Imm + 3, // AOK_ImmPrefix + 2, // AOK_Input + 2, // AOK_Output + 4, // AOK_SizeDirective + 1 // AOK_Skip +}; + struct AsmRewrite { AsmRewriteKind Kind; SMLoc Loc; diff --git a/include/llvm/MC/MCWinCOFFObjectWriter.h b/include/llvm/MC/MCWinCOFFObjectWriter.h index 11df574..f13e7d5 100644 --- a/include/llvm/MC/MCWinCOFFObjectWriter.h +++ b/include/llvm/MC/MCWinCOFFObjectWriter.h @@ -11,7 +11,9 @@ #define LLVM_MC_MCWINCOFFOBJECTWRITER_H namespace llvm { + class MCFixup; class MCObjectWriter; + class MCValue; class raw_ostream; class MCWinCOFFObjectTargetWriter { @@ -24,7 +26,9 @@ namespace llvm { virtual ~MCWinCOFFObjectTargetWriter() {} unsigned getMachine() const { return Machine; } - virtual unsigned getRelocType(unsigned FixupKind) const = 0; + virtual unsigned getRelocType(const MCValue &Target, + const MCFixup &Fixup, + bool IsCrossSection) const = 0; }; /// \brief Construct a new Win COFF writer instance. diff --git a/include/llvm/MC/MachineLocation.h b/include/llvm/MC/MachineLocation.h index 5caad33..83c8b72 100644 --- a/include/llvm/MC/MachineLocation.h +++ b/include/llvm/MC/MachineLocation.h @@ -9,7 +9,7 @@ // The MachineLocation class is used to represent a simple location in a machine // frame. Locations will be one of two forms; a register or an address formed // from a base address plus an offset. Register indirection can be specified by -// using an offset of zero. +// explicitly passing an offset to the constructor. // // The MachineMove class is used to represent abstract move operations in the // prolog/epilog of a compiled function. A collection of these objects can be @@ -37,8 +37,10 @@ public: }; MachineLocation() : IsRegister(false), Register(0), Offset(0) {} + /// Create a direct register location. explicit MachineLocation(unsigned R) : IsRegister(true), Register(R), Offset(0) {} + /// Create a register-indirect location with an offset. MachineLocation(unsigned R, int O) : IsRegister(false), Register(R), Offset(O) {} @@ -48,17 +50,20 @@ public: } // Accessors + bool isIndirect() const { return !IsRegister; } bool isReg() const { return IsRegister; } unsigned getReg() const { return Register; } int getOffset() const { return Offset; } void setIsRegister(bool Is) { IsRegister = Is; } void setRegister(unsigned R) { Register = R; } void setOffset(int O) { Offset = O; } + /// Make this location a direct register location. void set(unsigned R) { IsRegister = true; Register = R; Offset = 0; } + /// Make this location a register-indirect+offset location. void set(unsigned R, int O) { IsRegister = false; Register = R; diff --git a/include/llvm/MC/SubtargetFeature.h b/include/llvm/MC/SubtargetFeature.h index 37ae03b..8862c8b 100644 --- a/include/llvm/MC/SubtargetFeature.h +++ b/include/llvm/MC/SubtargetFeature.h @@ -62,10 +62,8 @@ struct SubtargetInfoKV { /// /// SubtargetFeatures - Manages the enabling and disabling of subtarget /// specific features. Features are encoded as a string of the form -/// "cpu,+attr1,+attr2,-attr3,...,+attrN" +/// "+attr1,+attr2,-attr3,...,+attrN" /// A comma separates each feature from the next (all lowercase.) -/// The first feature is always the CPU subtype (eg. pentiumm). If the CPU -/// value is "generic" then the CPU subtype should be generic for the target. /// Each of the remaining features is prefixed with + or - indicating whether /// that feature should be enabled or disabled contrary to the cpu /// specification. |