dynarmic/src/frontend_arm/ir_emitter.h
2016-07-01 21:01:06 +08:00

51 lines
1.4 KiB
C++

/* This file is part of the dynarmic project.
* Copyright (c) 2016 MerryMage
* This software may be used and distributed according to the terms of the GNU
* General Public License version 2 or any later version.
*/
#pragma once
#include "frontend_arm/arm_types.h"
#include "frontend_arm/ir/ir.h"
#include "frontend_arm/ir/opcodes.h"
namespace Dynarmic {
namespace Arm {
class IREmitter {
public:
IR::Block block = Dynarmic::IR::Block({0, false, false});
struct ResultAndCarry {
IR::ValuePtr result;
IR::ValuePtr carry;
};
void Unimplemented();
IR::ValuePtr Imm8(u8 value);
IR::ValuePtr GetRegister(Reg source_reg);
void SetRegister(const Reg dest_reg, IR::ValuePtr value);
IR::ValuePtr GetCFlag();
void SetNFlag(IR::ValuePtr value);
void SetZFlag(IR::ValuePtr value);
void SetCFlag(IR::ValuePtr value);
IR::ValuePtr LeastSignificantByte(IR::ValuePtr value);
IR::ValuePtr MostSignificantBit(IR::ValuePtr value);
IR::ValuePtr IsZero(IR::ValuePtr value);
ResultAndCarry LogicalShiftLeft(IR::ValuePtr value_in, IR::ValuePtr shift_amount, IR::ValuePtr carry_in);
ResultAndCarry LogicalShiftRight(IR::ValuePtr value_in, IR::ValuePtr shift_amount, IR::ValuePtr carry_in);
private:
IR::ValuePtr Inst(IR::Opcode op, std::initializer_list<IR::ValuePtr> args);
IR::ValuePtr RegRef(Reg reg);
void AddToBlock(IR::ValuePtr value);
};
} // namespace Arm
} // namespace Dynarmic