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 15namespace mcld 16{ 17 18class Operand; 19class IntOperand; 20class Module; 21class TargetLDBackend; 22 23/** \class NullaryOp 24 * \brief This class defines the interfaces to an nullary operator token. 25 */ 26 27template<Operator::Type TYPE> 28class NullaryOp : public Operator 29{ 30private: 31 friend class Operator; 32 33 NullaryOp() 34 : Operator(Operator::NULLARY, TYPE) 35 {} 36 37public: 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 49template<> 50IntOperand* NullaryOp<Operator::SIZEOF_HEADERS>::eval(const Module&, 51 const TargetLDBackend&); 52template<> 53IntOperand* NullaryOp<Operator::MAXPAGESIZE>::eval(const Module&, 54 const TargetLDBackend&); 55 56template<> 57IntOperand* NullaryOp<Operator::COMMONPAGESIZE>::eval(const Module&, 58 const TargetLDBackend&); 59 60} // namespace of mcld 61 62#endif 63