• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- RpnEvaluator.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_RPNEVALUATOR_H_
10 #define MCLD_SCRIPT_RPNEVALUATOR_H_
11 
12 #include <cstdint>
13 
14 namespace mcld {
15 
16 class Module;
17 class RpnExpr;
18 class TargetLDBackend;
19 
20 /** \class RpnEvaluator
21  *  \brief RpnEvaluator evaluate a rpn expression
22  */
23 class RpnEvaluator {
24  public:
25   RpnEvaluator(const Module& pModule, const TargetLDBackend& pBackend);
26 
27   // evaluate a valid expression and set the value in the second parameter
28   bool eval(const RpnExpr& pExpr, uint64_t& pResult);
29 
30  private:
31   const Module& m_Module;
32   const TargetLDBackend& m_Backend;
33 };
34 
35 }  // namespace mcld
36 
37 #endif  // MCLD_SCRIPT_RPNEVALUATOR_H_
38