Salome HOME
Copyrights update 2015.
[modules/med.git] / src / INTERP_KERNEL / ExprEval / InterpKernelAsmX86.hxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __INTERPKERNELASMX86_HXX__
22 #define __INTERPKERNELASMX86_HXX__
23
24 #include "INTERPKERNELDefines.hxx"
25 #include "InterpKernelException.hxx"
26
27 #include <vector>
28 #include <string>
29
30 namespace INTERP_KERNEL
31 {
32   class AsmX86
33   {
34   public:
35     std::vector<char> convertIntoMachineLangage(const std::vector<std::string>& asmb) const;
36     char *copyToExecMemZone(const std::vector<char>& ml, unsigned& offset) const;
37   private:
38     void convertOneInstructionInML(const std::string& inst, std::vector<char>& ml) const;
39   private:
40     static void convertMov(const std::string& inst, std::vector<char>& ml);
41     static void convertPush(const std::string& inst, std::vector<char>& ml);
42     static void convertPop(const std::string& inst, std::vector<char>& ml);
43     static void convertFld(const std::string& inst, std::vector<char>& ml);
44     static void convertFaddp(const std::string& inst, std::vector<char>& ml);
45     static void convertFsubp(const std::string& inst, std::vector<char>& ml);
46     static void convertFmulp(const std::string& inst, std::vector<char>& ml);
47     static void convertFdivp(const std::string& inst, std::vector<char>& ml);
48     static void convertFcos(const std::string& inst, std::vector<char>& ml);
49     static void convertFsin(const std::string& inst, std::vector<char>& ml);
50     static void convertFabs(const std::string& inst, std::vector<char>& ml);
51     static void convertFchs(const std::string& inst, std::vector<char>& ml);
52     static void convertFsqrt(const std::string& inst, std::vector<char>& ml);
53     static void convertSub(const std::string& inst, std::vector<char>& ml);
54     static void convertAdd(const std::string& inst, std::vector<char>& ml);
55     static void convertRet(const std::string& inst, std::vector<char>& ml);
56     static void convertLeave(const std::string& inst, std::vector<char>& ml);
57     static void convertMovsd(const std::string& inst, std::vector<char>& ml);
58     static void convertFst(const std::string& inst, std::vector<char>& ml);
59     //
60     static void convertMovToEsp(const std::string& inst1, const std::string& inst2, std::vector<char>& ml);
61     static void appendAddress(const std::string& addr, int nbOfByte, std::vector<char>& ml);
62   private:
63     static const int NB_OF_OPS=19;
64     static const char *OPS[NB_OF_OPS];
65   };
66 }
67
68 #endif