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