Home | History | Annotate | Download | only in Script
      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_NULLOP_H
     10 #define MCLD_SCRIPT_NULLOP_H
     11 
     12 #include <mcld/Script/Operator.h>
     13 #include <cassert>
     14 
     15 namespace mcld
     16 {
     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 {
     30 private:
     31   friend class Operator;
     32 
     33   NullaryOp()
     34     : Operator(Operator::NULLARY, TYPE)
     35   {}
     36 
     37 public:
     38   ~NullaryOp()
     39   {}
     40 
     41   IntOperand* eval(const Module& pModule, const TargetLDBackend& pBackend);
     42 
     43   void appendOperand(Operand* pOperand)
     44   {
     45     assert(0);
     46   }
     47 };
     48 
     49 template<>
     50 IntOperand* NullaryOp<Operator::SIZEOF_HEADERS>::eval(const Module&,
     51                                                       const TargetLDBackend&);
     52 template<>
     53 IntOperand* NullaryOp<Operator::MAXPAGESIZE>::eval(const Module&,
     54                                                    const TargetLDBackend&);
     55 
     56 template<>
     57 IntOperand* NullaryOp<Operator::COMMONPAGESIZE>::eval(const Module&,
     58                                                       const TargetLDBackend&);
     59 
     60 } // namespace of mcld
     61 
     62 #endif
     63