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 16namespace mcld { 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 private: 30 friend class Operator; 31 32 NullaryOp() : Operator(Operator::NULLARY, TYPE) {} 33 34 public: 35 ~NullaryOp() {} 36 37 IntOperand* eval(const Module& pModule, const TargetLDBackend& pBackend); 38 39 void appendOperand(Operand* pOperand) { assert(0); } 40}; 41 42template <> 43IntOperand* NullaryOp<Operator::SIZEOF_HEADERS>::eval(const Module&, 44 const TargetLDBackend&); 45template <> 46IntOperand* NullaryOp<Operator::MAXPAGESIZE>::eval(const Module&, 47 const TargetLDBackend&); 48 49template <> 50IntOperand* NullaryOp<Operator::COMMONPAGESIZE>::eval(const Module&, 51 const TargetLDBackend&); 52 53} // namespace mcld 54 55#endif // MCLD_SCRIPT_NULLARYOP_H_ 56