• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- NullaryOp.cpp ------------------------------------------------------===//
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 #include "mcld/Script/NullaryOp.h"
10 
11 #include "mcld/Script/Operand.h"
12 #include "mcld/Target/TargetLDBackend.h"
13 
14 namespace mcld {
15 //===----------------------------------------------------------------------===//
16 // NullaryOp
17 //===----------------------------------------------------------------------===//
18 template <>
eval(const Module & pModule,const TargetLDBackend & pBackend)19 IntOperand* NullaryOp<Operator::SIZEOF_HEADERS>::eval(
20     const Module& pModule,
21     const TargetLDBackend& pBackend) {
22   IntOperand* res = result();
23   res->setValue(pBackend.sectionStartOffset());
24   return res;
25 }
26 
27 template <>
eval(const Module & pModule,const TargetLDBackend & pBackend)28 IntOperand* NullaryOp<Operator::MAXPAGESIZE>::eval(
29     const Module& pModule,
30     const TargetLDBackend& pBackend) {
31   IntOperand* res = result();
32   res->setValue(pBackend.abiPageSize());
33   return res;
34 }
35 
36 template <>
eval(const Module & pModule,const TargetLDBackend & pBackend)37 IntOperand* NullaryOp<Operator::COMMONPAGESIZE>::eval(
38     const Module& pModule,
39     const TargetLDBackend& pBackend) {
40   IntOperand* res = result();
41   res->setValue(pBackend.commonPageSize());
42   return res;
43 }
44 
45 }  // namespace mcld
46