1 //===- NullaryOp.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_SCRIPT_NULLARYOP_H_
10 #define MCLD_SCRIPT_NULLARYOP_H_
11 
12 #include "mcld/Script/Operator.h"
13 
14 #include <cassert>
15 
16 namespace mcld {
17 
18 class Operand;
19 class IntOperand;
20 class Module;
21 class TargetLDBackend;
22 
23 /** \class NullaryOp
24  *  \brief This class defines the interfaces to an nullary operator token.
25  */
26 
27 template <Operator::Type TYPE>
28 class NullaryOp : public Operator {
29  private:
30   friend class Operator;
31 
NullaryOp()32   NullaryOp() : Operator(Operator::NULLARY, TYPE) {}
33 
34  public:
~NullaryOp()35   ~NullaryOp() {}
36 
37   IntOperand* eval(const Module& pModule, const TargetLDBackend& pBackend);
38 
appendOperand(Operand * pOperand)39   void appendOperand(Operand* pOperand) { assert(0); }
40 };
41 
42 template <>
43 IntOperand* NullaryOp<Operator::SIZEOF_HEADERS>::eval(const Module&,
44                                                       const TargetLDBackend&);
45 template <>
46 IntOperand* NullaryOp<Operator::MAXPAGESIZE>::eval(const Module&,
47                                                    const TargetLDBackend&);
48 
49 template <>
50 IntOperand* NullaryOp<Operator::COMMONPAGESIZE>::eval(const Module&,
51                                                       const TargetLDBackend&);
52 
53 }  // namespace mcld
54 
55 #endif  // MCLD_SCRIPT_NULLARYOP_H_
56