• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- MipsRelocationFactory.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 MIPS_RELOCATION_FACTORY_H
10 #define MIPS_RELOCATION_FACTORY_H
11 #ifdef ENABLE_UNITTEST
12 #include <gtest.h>
13 #endif
14 
15 #include <mcld/LD/RelocationFactory.h>
16 #include <mcld/Support/GCFactory.h>
17 #include "MipsLDBackend.h"
18 
19 namespace mcld
20 {
21 
22 /** \class MipsRelocationFactory
23  *  \brief MipsRelocationFactory creates and destroys the Mips relocations.
24  */
25 class MipsRelocationFactory : public RelocationFactory
26 {
27 public:
28   /** \enum Reloc
29    *  \brief Reloc is the result of applying functions.
30    */
31   enum Result
32   {
33     OK,
34     Overflow,
35     BadReloc
36   };
37 
38 public:
39   MipsRelocationFactory(size_t pNum, MipsGNULDBackend& pParent);
40 
41   void applyRelocation(Relocation& pRelocation, const MCLDInfo& pLDInfo);
42 
getTarget()43   MipsGNULDBackend& getTarget()
44   { return m_Target; }
45 
getTarget()46   const MipsGNULDBackend& getTarget() const
47   { return m_Target; }
48 
49   // Get last calculated AHL.
getAHL()50   int32_t getAHL() const
51   { return m_AHL; }
52 
53   // Set last calculated AHL.
setAHL(int32_t pAHL)54   void setAHL(int32_t pAHL)
55   { m_AHL = pAHL; }
56 
57 private:
58   MipsGNULDBackend& m_Target;
59   int32_t m_AHL;
60 };
61 
62 } // namespace of mcld
63 
64 #endif
65