Home | History | Annotate | Download | only in Fragment
      1 //===- FillFragment.h -----------------------------------------------------===//
      2 //
      3 //                     The MCLinker Project
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 #ifndef MCLD_FRAGMENT_FILLFRAGMENT_H_
     10 #define MCLD_FRAGMENT_FILLFRAGMENT_H_
     11 
     12 #include "mcld/Fragment/Fragment.h"
     13 
     14 #include <llvm/Support/DataTypes.h>
     15 
     16 namespace mcld {
     17 
     18 class SectionData;
     19 
     20 class FillFragment : public Fragment {
     21  public:
     22   FillFragment(int64_t pValue,
     23                unsigned int pValueSize,
     24                uint64_t pSize,
     25                SectionData* pSD = NULL);
     26 
     27   int64_t getValue() const { return m_Value; }
     28 
     29   unsigned getValueSize() const { return m_ValueSize; }
     30 
     31   static bool classof(const Fragment* F) {
     32     return F->getKind() == Fragment::Fillment;
     33   }
     34 
     35   static bool classof(const FillFragment*) { return true; }
     36 
     37   size_t size() const { return m_Size; }
     38 
     39  private:
     40   /// m_Value - Value used for filling bytes
     41   int64_t m_Value;
     42 
     43   /// m_ValueSize - The size (in bytes) of \arg Value to use when filling, or 0
     44   /// if this is a virtual fill fragment.
     45   unsigned int m_ValueSize;
     46 
     47   /// m_Size - The number of bytes to insert.
     48   uint64_t m_Size;
     49 };
     50 
     51 }  // namespace mcld
     52 
     53 #endif  // MCLD_FRAGMENT_FILLFRAGMENT_H_
     54