IntOperand* TernaryOp<Operator::DATA_SEGMENT_ALIGN>::eval( const Module& pModule, const TargetLDBackend& pBackend) { /* This is equivalent to either (ALIGN(maxpagesize) + (. & (maxpagesize - 1))) or (ALIGN(maxpagesize) + (. & (maxpagesize - commonpagesize))) */ IntOperand* res = result(); uint64_t dot = m_pOperand[0]->value(); uint64_t maxPageSize = m_pOperand[1]->value(); uint64_t commonPageSize = m_pOperand[2]->value(); uint64_t form1 = 0, form2 = 0; alignAddress(dot, maxPageSize); form1 = dot + (dot & (maxPageSize - 1)); form2 = dot + (dot & (maxPageSize - commonPageSize)); if (form1 <= form2) res->setValue(form1); else res->setValue(form2); return res; }
IntOperand* UnaryOp<Operator::BITWISE_NOT>::eval( const Module& pModule, const TargetLDBackend& pBackend) { IntOperand* res = result(); res->setValue(~m_pOperand->value()); return res; }
IntOperand* UnaryOp<Operator::UNARY_MINUS>::eval( const Module& pModule, const TargetLDBackend& pBackend) { IntOperand* res = result(); res->setValue(-m_pOperand->value()); return res; }
IntOperand* UnaryOp<Operator::DATA_SEGMENT_END>::eval( const Module& pModule, const TargetLDBackend& pBackend) { IntOperand* res = result(); res->setValue(m_pOperand->value()); return res; }
IntOperand* TernaryOp<Operator::TERNARY_IF>::eval( const Module& pModule, const TargetLDBackend& pBackend) { IntOperand* res = result(); if (m_pOperand[0]->value()) res->setValue(m_pOperand[1]->value()); else res->setValue(m_pOperand[2]->value()); return res; }
IntOperand* UnaryOp<Operator::ALIGNOF>::eval(const Module& pModule, const TargetLDBackend& pBackend) { IntOperand* res = result(); const LDSection* sect = NULL; switch (m_pOperand->type()) { case Operand::SECTION: sect = pModule.getSection(llvm::cast<SectOperand>(m_pOperand)->name()); break; case Operand::SECTION_DESC: sect = llvm::cast<SectDescOperand>(m_pOperand)->outputDesc()->getSection(); break; default: assert(0); break; } assert(sect != NULL); res->setValue(sect->align()); return res; }