Rename Cond -> Condition

This commit is contained in:
gdkchan 2019-01-22 21:32:37 -02:00
commit 0acdbe7a6d
13 changed files with 33 additions and 33 deletions

View file

@ -1,6 +1,6 @@
namespace ChocolArm64.Decoders namespace ChocolArm64.Decoders
{ {
enum Cond enum Condition
{ {
Eq = 0, Eq = 0,
Ne = 1, Ne = 1,

View file

@ -161,7 +161,7 @@ namespace ChocolArm64.Decoders
//Note: On ARM32, most instructions have conditional execution, //Note: On ARM32, most instructions have conditional execution,
//so there's no "Always" (unconditional) branch like on ARM64. //so there's no "Always" (unconditional) branch like on ARM64.
//We need to check if the condition is "Always" instead. //We need to check if the condition is "Always" instead.
return IsAarch32Branch(op) && op.Cond >= Cond.Al; return IsAarch32Branch(op) && op.Cond >= Condition.Al;
} }
private static bool IsAarch32Branch(OpCode64 opCode) private static bool IsAarch32Branch(OpCode64 opCode)

View file

@ -2,7 +2,7 @@ namespace ChocolArm64.Decoders
{ {
interface IOpCode32 : IOpCode64 interface IOpCode32 : IOpCode64
{ {
Cond Cond { get; } Condition Cond { get; }
uint GetPc(); uint GetPc();
} }

View file

@ -2,6 +2,6 @@ namespace ChocolArm64.Decoders
{ {
interface IOpCodeCond64 : IOpCode64 interface IOpCodeCond64 : IOpCode64
{ {
Cond Cond { get; } Condition Cond { get; }
} }
} }

View file

@ -5,13 +5,13 @@ namespace ChocolArm64.Decoders
{ {
class OpCode32 : OpCode64 class OpCode32 : OpCode64
{ {
public Cond Cond { get; protected set; } public Condition Cond { get; protected set; }
public OpCode32(Inst inst, long position, int opCode) : base(inst, position, opCode) public OpCode32(Inst inst, long position, int opCode) : base(inst, position, opCode)
{ {
RegisterSize = RegisterSize.Int32; RegisterSize = RegisterSize.Int32;
Cond = (Cond)((uint)opCode >> 28); Cond = (Condition)((uint)opCode >> 28);
} }
public uint GetPc() public uint GetPc()

View file

@ -11,14 +11,14 @@ namespace ChocolArm64.Decoders
uint pc = GetPc(); uint pc = GetPc();
//When the codition is never, the instruction is BLX to Thumb mode. //When the codition is never, the instruction is BLX to Thumb mode.
if (Cond != Cond.Nv) if (Cond != Condition.Nv)
{ {
pc &= ~3u; pc &= ~3u;
} }
Imm = pc + DecoderHelper.DecodeImm24_2(opCode); Imm = pc + DecoderHelper.DecodeImm24_2(opCode);
if (Cond == Cond.Nv) if (Cond == Condition.Nv)
{ {
long H = (opCode >> 23) & 2; long H = (opCode >> 23) & 2;

View file

@ -4,7 +4,7 @@ namespace ChocolArm64.Decoders
{ {
class OpCodeBImmCond64 : OpCodeBImm64, IOpCodeCond64 class OpCodeBImmCond64 : OpCodeBImm64, IOpCodeCond64
{ {
public Cond Cond { get; private set; } public Condition Cond { get; private set; }
public OpCodeBImmCond64(Inst inst, long position, int opCode) : base(inst, position, opCode) public OpCodeBImmCond64(Inst inst, long position, int opCode) : base(inst, position, opCode)
{ {
@ -17,7 +17,7 @@ namespace ChocolArm64.Decoders
return; return;
} }
Cond = (Cond)(opCode & 0xf); Cond = (Condition)(opCode & 0xf);
Imm = position + DecoderHelper.DecodeImmS19_2(opCode); Imm = position + DecoderHelper.DecodeImmS19_2(opCode);
} }

View file

@ -8,7 +8,7 @@ namespace ChocolArm64.Decoders
public int Nzcv { get; private set; } public int Nzcv { get; private set; }
protected int RmImm; protected int RmImm;
public Cond Cond { get; private set; } public Condition Cond { get; private set; }
public OpCodeCcmp64(Inst inst, long position, int opCode) : base(inst, position, opCode) public OpCodeCcmp64(Inst inst, long position, int opCode) : base(inst, position, opCode)
{ {
@ -22,7 +22,7 @@ namespace ChocolArm64.Decoders
} }
Nzcv = (opCode >> 0) & 0xf; Nzcv = (opCode >> 0) & 0xf;
Cond = (Cond)((opCode >> 12) & 0xf); Cond = (Condition)((opCode >> 12) & 0xf);
RmImm = (opCode >> 16) & 0x1f; RmImm = (opCode >> 16) & 0x1f;
Rd = RegisterAlias.Zr; Rd = RegisterAlias.Zr;

View file

@ -6,12 +6,12 @@ namespace ChocolArm64.Decoders
{ {
public int Rm { get; private set; } public int Rm { get; private set; }
public Cond Cond { get; private set; } public Condition Cond { get; private set; }
public OpCodeCsel64(Inst inst, long position, int opCode) : base(inst, position, opCode) public OpCodeCsel64(Inst inst, long position, int opCode) : base(inst, position, opCode)
{ {
Rm = (opCode >> 16) & 0x1f; Rm = (opCode >> 16) & 0x1f;
Cond = (Cond)((opCode >> 12) & 0xf); Cond = (Condition)((opCode >> 12) & 0xf);
} }
} }
} }

View file

@ -6,12 +6,12 @@ namespace ChocolArm64.Decoders
{ {
public int Nzcv { get; private set; } public int Nzcv { get; private set; }
public Cond Cond { get; private set; } public Condition Cond { get; private set; }
public OpCodeSimdFcond64(Inst inst, long position, int opCode) : base(inst, position, opCode) public OpCodeSimdFcond64(Inst inst, long position, int opCode) : base(inst, position, opCode)
{ {
Nzcv = (opCode >> 0) & 0xf; Nzcv = (opCode >> 0) & 0xf;
Cond = (Cond)((opCode >> 12) & 0xf); Cond = (Condition)((opCode >> 12) & 0xf);
} }
} }
} }

View file

@ -6,7 +6,7 @@ namespace ChocolArm64.Decoders
{ {
public OpCodeT16(Inst inst, long position, int opCode) : base(inst, position, opCode) public OpCodeT16(Inst inst, long position, int opCode) : base(inst, position, opCode)
{ {
Cond = Cond.Al; Cond = Condition.Al;
OpCodeSizeInBytes = 2; OpCodeSizeInBytes = 2;
} }

View file

@ -102,7 +102,7 @@ namespace ChocolArm64.Instructions
EmitBranch(context, ilOp); EmitBranch(context, ilOp);
} }
private static void EmitBranch(ILEmitterCtx context, Cond cond) private static void EmitBranch(ILEmitterCtx context, Condition cond)
{ {
OpCodeBImm64 op = (OpCodeBImm64)context.CurrOp; OpCodeBImm64 op = (OpCodeBImm64)context.CurrOp;

View file

@ -108,7 +108,7 @@ namespace ChocolArm64.Translation
//used by some unconditional instructions. //used by some unconditional instructions.
ILLabel lblSkip = null; ILLabel lblSkip = null;
if (CurrOp is OpCode32 op && op.Cond < Cond.Al) if (CurrOp is OpCode32 op && op.Cond < Condition.Al)
{ {
lblSkip = new ILLabel(); lblSkip = new ILLabel();
@ -138,11 +138,11 @@ namespace ChocolArm64.Translation
_ilBlock.Add(new ILBarrier()); _ilBlock.Add(new ILBarrier());
} }
private Cond GetInverseCond(Cond cond) private Condition GetInverseCond(Condition cond)
{ {
//Bit 0 of all conditions is basically a negation bit, so //Bit 0 of all conditions is basically a negation bit, so
//inverting this bit has the effect of inverting the condition. //inverting this bit has the effect of inverting the condition.
return (Cond)((int)cond ^ 1); return (Condition)((int)cond ^ 1);
} }
private void EmitSynchronization() private void EmitSynchronization()
@ -292,21 +292,21 @@ namespace ChocolArm64.Translation
Stloc(CmpOptTmp1Index, IoType.Int); Stloc(CmpOptTmp1Index, IoType.Int);
} }
private Dictionary<Cond, OpCode> _branchOps = new Dictionary<Cond, OpCode>() private Dictionary<Condition, OpCode> _branchOps = new Dictionary<Condition, OpCode>()
{ {
{ Cond.Eq, OpCodes.Beq }, { Condition.Eq, OpCodes.Beq },
{ Cond.Ne, OpCodes.Bne_Un }, { Condition.Ne, OpCodes.Bne_Un },
{ Cond.GeUn, OpCodes.Bge_Un }, { Condition.GeUn, OpCodes.Bge_Un },
{ Cond.LtUn, OpCodes.Blt_Un }, { Condition.LtUn, OpCodes.Blt_Un },
{ Cond.GtUn, OpCodes.Bgt_Un }, { Condition.GtUn, OpCodes.Bgt_Un },
{ Cond.LeUn, OpCodes.Ble_Un }, { Condition.LeUn, OpCodes.Ble_Un },
{ Cond.Ge, OpCodes.Bge }, { Condition.Ge, OpCodes.Bge },
{ Cond.Lt, OpCodes.Blt }, { Condition.Lt, OpCodes.Blt },
{ Cond.Gt, OpCodes.Bgt }, { Condition.Gt, OpCodes.Bgt },
{ Cond.Le, OpCodes.Ble } { Condition.Le, OpCodes.Ble }
}; };
public void EmitCondBranch(ILLabel target, Cond cond) public void EmitCondBranch(ILLabel target, Condition cond)
{ {
OpCode ilOp; OpCode ilOp;