diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-08-07 23:01:33 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-08-07 23:01:33 +0000 | 
| commit | ee8648bdac07986a0f1ec897b02ec82a2f144d46 (patch) | |
| tree | 52d1861acda1205241ee35a94aa63129c604d469 /include/llvm/MC | |
| parent | 1a82d4c088707c791c792f6822f611b47a12bdfe (diff) | |
Diffstat (limited to 'include/llvm/MC')
| -rw-r--r-- | include/llvm/MC/MCContext.h | 2 | ||||
| -rw-r--r-- | include/llvm/MC/MCDwarf.h | 27 | ||||
| -rw-r--r-- | include/llvm/MC/MCInstrDesc.h | 5 | ||||
| -rw-r--r-- | include/llvm/MC/MCSchedule.h | 22 | ||||
| -rw-r--r-- | include/llvm/MC/MCSubtargetInfo.h | 43 | ||||
| -rw-r--r-- | include/llvm/MC/MCSymbol.h | 4 | ||||
| -rw-r--r-- | include/llvm/MC/MCSymbolMachO.h | 2 | ||||
| -rw-r--r-- | include/llvm/MC/MCTargetOptions.h | 2 | 
8 files changed, 54 insertions, 53 deletions
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index 52017fda189b..41169e9a12a0 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -273,7 +273,7 @@ namespace llvm {      /// Gets a symbol that will be defined to the final stack offset of a local      /// variable after codegen.      /// -    /// \param Idx - The index of a local variable passed to @llvm.frameescape. +    /// \param Idx - The index of a local variable passed to @llvm.localescape.      MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx);      MCSymbol *getOrCreateParentFrameOffsetSymbol(StringRef FuncName); diff --git a/include/llvm/MC/MCDwarf.h b/include/llvm/MC/MCDwarf.h index c7bed8eccda9..1e72dfee4ad1 100644 --- a/include/llvm/MC/MCDwarf.h +++ b/include/llvm/MC/MCDwarf.h @@ -54,13 +54,13 @@ struct MCDwarfFile {  /// \brief Instances of this class represent the information from a  /// dwarf .loc directive.  class MCDwarfLoc { -  unsigned FileNum; -  unsigned Line; -  unsigned Column; +  uint32_t FileNum; +  uint32_t Line; +  uint16_t Column;    // Flags (see #define's below) -  unsigned Flags; -  unsigned Isa; -  unsigned Discriminator; +  uint8_t Flags; +  uint8_t Isa; +  uint32_t Discriminator;  // Flag that indicates the initial value of the is_stmt_start flag.  #define DWARF2_LINE_DEFAULT_IS_STMT 1 @@ -107,13 +107,22 @@ public:    void setLine(unsigned line) { Line = line; }    /// \brief Set the Column of this MCDwarfLoc. -  void setColumn(unsigned column) { Column = column; } +  void setColumn(unsigned column) { +    assert(column <= UINT16_MAX); +    Column = column; +  }    /// \brief Set the Flags of this MCDwarfLoc. -  void setFlags(unsigned flags) { Flags = flags; } +  void setFlags(unsigned flags) { +    assert(flags <= UINT8_MAX); +    Flags = flags; +  }    /// \brief Set the Isa of this MCDwarfLoc. -  void setIsa(unsigned isa) { Isa = isa; } +  void setIsa(unsigned isa) { +    assert(isa <= UINT8_MAX); +    Isa = isa; +  }    /// \brief Set the Discriminator of this MCDwarfLoc.    void setDiscriminator(unsigned discriminator) { diff --git a/include/llvm/MC/MCInstrDesc.h b/include/llvm/MC/MCInstrDesc.h index 3209a2ce0408..6a582e82d00e 100644 --- a/include/llvm/MC/MCInstrDesc.h +++ b/include/llvm/MC/MCInstrDesc.h @@ -154,7 +154,8 @@ public:    // A complex method to determine is a certain is deprecated or not, and return    // the reason for deprecation. -  bool (*ComplexDeprecationInfo)(MCInst &, MCSubtargetInfo &, std::string &); +  bool (*ComplexDeprecationInfo)(MCInst &, const MCSubtargetInfo &, +                                 std::string &);    /// \brief Returns the value of the specific constraint if    /// it is set. Returns -1 if it is not set. @@ -170,7 +171,7 @@ public:    /// \brief Returns true if a certain instruction is deprecated and if so    /// returns the reason in \p Info. -  bool getDeprecatedInfo(MCInst &MI, MCSubtargetInfo &STI, +  bool getDeprecatedInfo(MCInst &MI, const MCSubtargetInfo &STI,                           std::string &Info) const;    /// \brief Return the opcode number for this descriptor. diff --git a/include/llvm/MC/MCSchedule.h b/include/llvm/MC/MCSchedule.h index 1adfedd2638a..c09791631056 100644 --- a/include/llvm/MC/MCSchedule.h +++ b/include/llvm/MC/MCSchedule.h @@ -224,25 +224,9 @@ struct MCSchedModel {      return &SchedClassTable[SchedClassIdx];    } -  // /\brief Returns a default initialized model. Used for unknown processors. -  static MCSchedModel GetDefaultSchedModel() { -    MCSchedModel Ret = { DefaultIssueWidth, -                         DefaultMicroOpBufferSize, -                         DefaultLoopMicroOpBufferSize, -                         DefaultLoadLatency, -                         DefaultHighLatency, -                         DefaultMispredictPenalty, -                         false, -                         true, -                         0, -                         nullptr, -                         nullptr, -                         0, -                         0, -                         nullptr -                       }; -    return Ret; -  } +  /// Returns the default initialized model. +  static const MCSchedModel &GetDefaultSchedModel() { return Default; } +  static const MCSchedModel Default;  };  } // End llvm namespace diff --git a/include/llvm/MC/MCSubtargetInfo.h b/include/llvm/MC/MCSubtargetInfo.h index b8ad02fbe696..d5ad4eebf9ef 100644 --- a/include/llvm/MC/MCSubtargetInfo.h +++ b/include/llvm/MC/MCSubtargetInfo.h @@ -37,22 +37,26 @@ class MCSubtargetInfo {    const MCWriteProcResEntry *WriteProcResTable;    const MCWriteLatencyEntry *WriteLatencyTable;    const MCReadAdvanceEntry *ReadAdvanceTable; -  MCSchedModel CPUSchedModel; +  const MCSchedModel *CPUSchedModel;    const InstrStage *Stages;            // Instruction itinerary stages    const unsigned *OperandCycles;       // Itinerary operand cycles    const unsigned *ForwardingPaths;     // Forwarding paths    FeatureBitset FeatureBits;           // Feature bits for current CPU + FS +  MCSubtargetInfo() = delete; +  MCSubtargetInfo &operator=(MCSubtargetInfo &&) = delete; +  MCSubtargetInfo &operator=(const MCSubtargetInfo &) = delete; +  public: -  void InitMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS, -                           ArrayRef<SubtargetFeatureKV> PF, -                           ArrayRef<SubtargetFeatureKV> PD, -                           const SubtargetInfoKV *ProcSched, -                           const MCWriteProcResEntry *WPR, -                           const MCWriteLatencyEntry *WL, -                           const MCReadAdvanceEntry *RA, const InstrStage *IS, -                           const unsigned *OC, const unsigned *FP); +  MCSubtargetInfo(const MCSubtargetInfo &) = default; +  MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS, +                  ArrayRef<SubtargetFeatureKV> PF, +                  ArrayRef<SubtargetFeatureKV> PD, +                  const SubtargetInfoKV *ProcSched, +                  const MCWriteProcResEntry *WPR, const MCWriteLatencyEntry *WL, +                  const MCReadAdvanceEntry *RA, const InstrStage *IS, +                  const unsigned *OC, const unsigned *FP);    /// getTargetTriple - Return the target triple string.    const Triple &getTargetTriple() const { return TargetTriple; } @@ -74,12 +78,16 @@ public:      FeatureBits = FeatureBits_;    } -  /// InitMCProcessorInfo - Set or change the CPU (optionally supplemented with -  /// feature string). Recompute feature bits and scheduling model. +protected: +  /// Initialize the scheduling model and feature bits. +  /// +  /// FIXME: Find a way to stick this in the constructor, since it should only +  /// be called during initialization.    void InitMCProcessorInfo(StringRef CPU, StringRef FS); -  /// InitCPUSchedModel - Recompute scheduling model based on CPU. -  void InitCPUSchedModel(StringRef CPU); +public: +  /// Set the features to the default for the given CPU. +  void setDefaultFeatures(StringRef CPU);    /// ToggleFeature - Toggle a feature and returns the re-computed feature    /// bits. This version does not change the implied bits. @@ -99,11 +107,10 @@ public:    /// getSchedModelForCPU - Get the machine model of a CPU.    /// -  MCSchedModel getSchedModelForCPU(StringRef CPU) const; +  const MCSchedModel &getSchedModelForCPU(StringRef CPU) const; -  /// getSchedModel - Get the machine model for this subtarget's CPU. -  /// -  const MCSchedModel &getSchedModel() const { return CPUSchedModel; } +  /// Get the machine model for this subtarget's CPU. +  const MCSchedModel &getSchedModel() const { return *CPUSchedModel; }    /// Return an iterator at the first process resource consumed by the given    /// scheduling class. @@ -151,7 +158,7 @@ public:    void initInstrItins(InstrItineraryData &InstrItins) const;    /// Check whether the CPU string is valid. -  bool isCPUStringValid(StringRef CPU) { +  bool isCPUStringValid(StringRef CPU) const {      auto Found = std::find_if(ProcDesc.begin(), ProcDesc.end(),                                [=](const SubtargetFeatureKV &KV) {                                  return CPU == KV.Key;  diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h index 17e6b857cf20..b2910dfccd63 100644 --- a/include/llvm/MC/MCSymbol.h +++ b/include/llvm/MC/MCSymbol.h @@ -114,12 +114,12 @@ protected:    /// The alignment is stored as log2(align) + 1.  This allows all values from    /// 0 to 2^31 to be stored which is every power of 2 representable by an    /// unsigned. -  static const unsigned NumCommonAlignmentBits = 5; +  enum : unsigned { NumCommonAlignmentBits = 5 };    unsigned CommonAlignLog2 : NumCommonAlignmentBits;    /// The Flags field is used by object file implementations to store    /// additional per symbol information which is not easily classified. -  static const unsigned NumFlagsBits = 16; +  enum : unsigned { NumFlagsBits = 16 };    mutable uint32_t Flags : NumFlagsBits;    /// Index field, for use by the object file implementation. diff --git a/include/llvm/MC/MCSymbolMachO.h b/include/llvm/MC/MCSymbolMachO.h index 166ae9e755a1..5b0321fe9f73 100644 --- a/include/llvm/MC/MCSymbolMachO.h +++ b/include/llvm/MC/MCSymbolMachO.h @@ -7,7 +7,7 @@  //  //===----------------------------------------------------------------------===//  #ifndef LLVM_MC_MCSYMBOLMACHO_H -#define setIsWeakExternal +#define LLVM_MC_MCSYMBOLMACHO_H  #include "llvm/MC/MCSymbol.h" diff --git a/include/llvm/MC/MCTargetOptions.h b/include/llvm/MC/MCTargetOptions.h index ce28a196e974..7f4f23eda27f 100644 --- a/include/llvm/MC/MCTargetOptions.h +++ b/include/llvm/MC/MCTargetOptions.h @@ -55,7 +55,7 @@ inline bool operator==(const MCTargetOptions &LHS, const MCTargetOptions &RHS) {            ARE_EQUAL(ShowMCInst) &&            ARE_EQUAL(AsmVerbose) &&            ARE_EQUAL(DwarfVersion) && -	  ARE_EQUAL(ABIName)); +          ARE_EQUAL(ABIName));  #undef ARE_EQUAL  }  | 
