//===- Operator.cpp -------------------------------------------------------===// // // The MCLinker Project // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include "mcld/Script/Operator.h" #include "mcld/Script/BinaryOp.h" #include "mcld/Script/NullaryOp.h" #include "mcld/Script/Operand.h" #include "mcld/Script/UnaryOp.h" #include "mcld/Script/TernaryOp.h" #include "mcld/Support/raw_ostream.h" namespace mcld { //===----------------------------------------------------------------------===// // Operator //===----------------------------------------------------------------------===// const char* Operator::OpNames[] = { "+", "-", "!", "~", "*", "/", "%", "+", "-", "<<", ">>", "<", "<=", ">", ">=", "==", "!=", "&", "^", "|", "&&", "||", "?:", "=", "+=", "-=", "*=", "/=", "&=", "|=", "<<=", ">>=", "ABSOLUTE", "ADDR", "ALIGN", "ALIGNOF", "BLOCK", "DATA_SEGMENT_ALIGN", "DATA_SEGMENT_END", "DATA_SEGMENT_RELRO_END", "DEFINED", "LENGTH", "LOADADDR", "MAX", "MIN", "NEXT", "ORIGIN", "SEGMENT_START", "SIZEOF", "SIZEOF_HEADERS", "MAXPAGESIZE", "COMMONPAGESIZE"}; Operator::Operator(Arity pArity, Type pType) : ExprToken(ExprToken::OPERATOR), m_Arity(pArity), m_Type(pType) { m_pIntOperand = IntOperand::create(0); } Operator::~Operator() { } void Operator::dump() const { mcld::outs() << OpNames[type()]; } /* Nullary operator */ template <> Operator& Operator::create() { static NullaryOp op; return op; } template <> Operator& Operator::create() { static NullaryOp op; return op; } template <> Operator& Operator::create() { static NullaryOp op; return op; } /* Unary operator */ template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } template <> Operator& Operator::create() { static UnaryOp op; return op; } /* Binary operator */ template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } template <> Operator& Operator::create() { static BinaryOp op; return op; } /* Ternary operator */ template <> Operator& Operator::create() { static TernaryOp op; return op; } template <> Operator& Operator::create() { static TernaryOp op; return op; } } // namespace mcld