@@ -845,11 +845,19 @@ static void AddPCDisp(Instruction &inst, int64_t disp) {
845
845
Operand::Address::kAddressCalculation );
846
846
}
847
847
848
- static void AddNextPC (Instruction &inst) {
848
+ static void DecodeFallThroughPC (Instruction &inst) {
849
+ Operand not_taken_op = {};
850
+ not_taken_op.action = Operand::kActionRead ;
851
+ not_taken_op.type = Operand::kTypeAddress ;
852
+ not_taken_op.size = kPCWidth ;
853
+ not_taken_op.addr .address_size = kPCWidth ;
854
+ not_taken_op.addr .base_reg .name = " PC" ;
855
+ not_taken_op.addr .base_reg .size = kPCWidth ;
856
+ not_taken_op.addr .displacement = kInstructionSize ;
857
+ not_taken_op.addr .kind = Operand::Address::kControlFlowTarget ;
858
+ inst.operands .push_back (not_taken_op);
849
859
850
- // add +4 as the PC displacement
851
- // emit an address computation operand
852
- AddPCDisp (inst, kInstructionSize );
860
+ inst.branch_not_taken_pc = inst.next_pc ;
853
861
}
854
862
855
863
// Base+offset memory operands are equivalent to indexing into an array.
@@ -1265,7 +1273,7 @@ bool TryDecodeRET_64R_BRANCH_REG(const InstData &data, Instruction &inst) {
1265
1273
// BLR <Xn>
1266
1274
bool TryDecodeBLR_64_BRANCH_REG (const InstData &data, Instruction &inst) {
1267
1275
AddRegOperand (inst, kActionRead , kRegX , kUseAsValue , data.Rn );
1268
- AddNextPC (inst);
1276
+ DecodeFallThroughPC (inst);
1269
1277
return true ;
1270
1278
}
1271
1279
@@ -1744,21 +1752,6 @@ bool TryDecodeB_ONLY_BRANCH_IMM(const InstData &data, Instruction &inst) {
1744
1752
return true ;
1745
1753
}
1746
1754
1747
- static void DecodeFallThroughPC (Instruction &inst) {
1748
- Operand not_taken_op = {};
1749
- not_taken_op.action = Operand::kActionRead ;
1750
- not_taken_op.type = Operand::kTypeAddress ;
1751
- not_taken_op.size = kPCWidth ;
1752
- not_taken_op.addr .address_size = kPCWidth ;
1753
- not_taken_op.addr .base_reg .name = " PC" ;
1754
- not_taken_op.addr .base_reg .size = kPCWidth ;
1755
- not_taken_op.addr .displacement = kInstructionSize ;
1756
- not_taken_op.addr .kind = Operand::Address::kControlFlowTarget ;
1757
- inst.operands .push_back (not_taken_op);
1758
-
1759
- inst.branch_not_taken_pc = inst.next_pc ;
1760
- }
1761
-
1762
1755
// Decode a relative branch target.
1763
1756
static void DecodeConditionalBranch (Instruction &inst, int64_t disp) {
1764
1757
@@ -1848,7 +1841,7 @@ bool TryDecodeBL_ONLY_BRANCH_IMM(const InstData &data, Instruction &inst) {
1848
1841
(data.imm26 .simm26 << 2ULL ));
1849
1842
inst.branch_not_taken_pc = inst.next_pc ;
1850
1843
AddPCDisp (inst, data.imm26 .simm26 << 2LL );
1851
- AddNextPC (inst); // Decodes the return address.
1844
+ DecodeFallThroughPC (inst); // Decodes the return address.
1852
1845
return true ;
1853
1846
}
1854
1847
0 commit comments