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