Assembly code generator for Windows 64-bit

This commit is contained in:
tevador
2018-12-13 23:11:55 +01:00
parent c9102ee88c
commit cb0721056a
16 changed files with 8082 additions and 83 deletions
+1 -22
View File
@@ -22,37 +22,17 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
#include <cstdint>
#include <ostream>
#include "common.hpp"
#include "Instruction.hpp"
class Pcg32;
namespace RandomX {
struct Instruction {
uint8_t opcode;
uint8_t loca;
uint8_t rega;
uint8_t locb;
uint8_t regb;
uint8_t locc;
uint8_t regc;
uint8_t imm0;
uint32_t addr0;
union {
uint32_t addr1;
int32_t imm1;
};
};
static_assert(sizeof(Instruction) == 16, "Invalid alignment of struct Instruction");
class Program {
public:
Instruction& operator()(uint64_t pc) {
return programBuffer[pc];
}
const char* getName(Instruction& instr) {
return instrNames[instr.opcode];
}
void initialize(Pcg32& gen);
friend std::ostream& operator<<(std::ostream& os, const Program& p) {
p.print(os);
@@ -60,7 +40,6 @@ namespace RandomX {
}
private:
void print(std::ostream&) const;
static const char* instrNames[256];
Instruction programBuffer[ProgramLength];
};
}