| OLD | NEW |
| 1 //===- subzero/unittest/unittest/AssemblerX8632/TestUtil.h ------*- C++ -*-===// | 1 //===- subzero/unittest/unittest/AssemblerX8632/TestUtil.h ------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // Utility classes for testing the X8632 Assembler. | 10 // Utility classes for testing the X8632 Assembler. |
| 11 // | 11 // |
| 12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
| 13 | 13 |
| 14 #ifndef ASSEMBLERX8632_TESTUTIL_H_ | 14 #ifndef ASSEMBLERX8632_TESTUTIL_H_ |
| 15 #define ASSEMBLERX8632_TESTUTIL_H_ | 15 #define ASSEMBLERX8632_TESTUTIL_H_ |
| 16 | 16 |
| 17 #include "IceAssemblerX8632.h" | 17 #include "IceAssemblerX8632.h" |
| 18 #include "IceDefs.h" |
| 18 | 19 |
| 19 #include "gtest/gtest.h" | 20 #include "gtest/gtest.h" |
| 20 | 21 |
| 21 #include <cassert> | 22 #include <cassert> |
| 22 #include <sys/mman.h> | 23 #include <sys/mman.h> |
| 23 | 24 |
| 24 namespace Ice { | 25 namespace Ice { |
| 25 namespace X8632 { | 26 namespace X8632 { |
| 26 namespace Test { | 27 namespace Test { |
| 27 | 28 |
| 28 class AssemblerX8632TestBase : public ::testing::Test { | 29 class AssemblerX8632TestBase : public ::testing::Test { |
| 29 protected: | 30 protected: |
| 30 using Address = AssemblerX8632::Traits::Address; | 31 using Address = AssemblerX8632::Traits::Address; |
| 31 using Cond = AssemblerX8632::Traits::Cond; | 32 using Cond = AssemblerX8632::Traits::Cond; |
| 32 using GPRRegister = AssemblerX8632::Traits::GPRRegister; | 33 using GPRRegister = AssemblerX8632::Traits::GPRRegister; |
| 33 using ByteRegister = AssemblerX8632::Traits::ByteRegister; | 34 using ByteRegister = AssemblerX8632::Traits::ByteRegister; |
| 34 using Label = ::Ice::X86Internal::Label; | 35 using Label = ::Ice::X8632::Label; |
| 35 using Traits = AssemblerX8632::Traits; | 36 using Traits = AssemblerX8632::Traits; |
| 36 using XmmRegister = AssemblerX8632::Traits::XmmRegister; | 37 using XmmRegister = AssemblerX8632::Traits::XmmRegister; |
| 37 using X87STRegister = AssemblerX8632::Traits::X87STRegister; | 38 using X87STRegister = AssemblerX8632::Traits::X87STRegister; |
| 38 | 39 |
| 39 AssemblerX8632TestBase() { reset(); } | 40 AssemblerX8632TestBase() { reset(); } |
| 40 | 41 |
| 41 void reset() { Assembler.reset(new AssemblerX8632()); } | 42 void reset() { Assembler = makeUnique<AssemblerX8632>(); } |
| 42 | 43 |
| 43 AssemblerX8632 *assembler() const { return Assembler.get(); } | 44 AssemblerX8632 *assembler() const { return Assembler.get(); } |
| 44 | 45 |
| 45 size_t codeBytesSize() const { return Assembler->getBufferView().size(); } | 46 size_t codeBytesSize() const { return Assembler->getBufferView().size(); } |
| 46 | 47 |
| 47 const uint8_t *codeBytes() const { | 48 const uint8_t *codeBytes() const { |
| 48 return static_cast<const uint8_t *>( | 49 return static_cast<const uint8_t *>( |
| 49 static_cast<const void *>(Assembler->getBufferView().data())); | 50 static_cast<const void *>(Assembler->getBufferView().data())); |
| 50 } | 51 } |
| 51 | 52 |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 | 841 |
| 841 bool NeedsEpilogue; | 842 bool NeedsEpilogue; |
| 842 uint32_t NumAllocatedDwords; | 843 uint32_t NumAllocatedDwords; |
| 843 }; | 844 }; |
| 844 | 845 |
| 845 } // end of namespace Test | 846 } // end of namespace Test |
| 846 } // end of namespace X8632 | 847 } // end of namespace X8632 |
| 847 } // end of namespace Ice | 848 } // end of namespace Ice |
| 848 | 849 |
| 849 #endif // ASSEMBLERX8632_TESTUTIL_H_ | 850 #endif // ASSEMBLERX8632_TESTUTIL_H_ |
| OLD | NEW |