[arm,ppc] Consolidate kPCReadOffset to kPcLoadDelta

We have two constants for the PC load delta; this CL
consolidates them into one. The CL does not change MIPS
as the two constants are defined to different values there.

Bug: v8:6666
Change-Id: If207a59dea3ef33756a5d7330217ab8a176bdf63
Reviewed-on: https://chromium-review.googlesource.com/1161926
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54898}
This commit is contained in:
Sigurd Schneider 2018-08-03 11:57:09 +02:00 committed by Commit Bot
parent 2b77c68bca
commit 0aed2067e4
5 changed files with 6 additions and 10 deletions

View File

@ -463,12 +463,8 @@ inline Hint NegateHint(Hint ignored) { return no_hint; }
//
class Instruction {
public:
enum {
kInstrSize = 4,
kInstrSizeLog2 = 2,
kPCReadOffset = 8
};
static constexpr int kInstrSize = 4;
static constexpr int kInstrSizeLog2 = 2;
// Difference between address of current opcode and value read from pc
// register.
static constexpr int kPcLoadDelta = 8;

View File

@ -669,7 +669,7 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
case 'A': {
// Print pc-relative address.
int offset = instr->Offset12Value();
byte* pc = reinterpret_cast<byte*>(instr) + Instruction::kPCReadOffset;
byte* pc = reinterpret_cast<byte*>(instr) + Instruction::kPcLoadDelta;
byte* addr;
switch (instr->PUField()) {
case db_x: {

View File

@ -736,7 +736,7 @@ int32_t Simulator::get_register(int reg) const {
// See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43949
if (reg >= num_registers) return 0;
// End stupid code.
return registers_[reg] + ((reg == pc) ? Instruction::kPCReadOffset : 0);
return registers_[reg] + ((reg == pc) ? Instruction::kPcLoadDelta : 0);
}

View File

@ -2758,7 +2758,7 @@ const Instr rtCallRedirInstr = TWI;
//
class Instruction {
public:
enum { kInstrSize = 4, kInstrSizeLog2 = 2, kPCReadOffset = 8 };
enum { kInstrSize = 4, kInstrSizeLog2 = 2, kPcLoadDelta = 8 };
// Helper macro to define static accessors.
// We use the cast to char* trick to bypass the strict anti-aliasing rules.

View File

@ -1513,7 +1513,7 @@ static void TestLoadLiteral(byte* buffer, Assembler* assm, bool* failure,
char expected_string[80];
snprintf(expected_string, sizeof(expected_string), expected_string_template,
abs(offset), offset,
progcounter + Instruction::kPCReadOffset + offset);
progcounter + Instruction::kPcLoadDelta + offset);
if (!DisassembleAndCompare(progcounter, kRawString, expected_string)) {
*failure = true;
}