Commit 0aed2067 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[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/1161926Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54898}
parent 2b77c68b
......@@ -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;
......
......@@ -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: {
......
......@@ -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);
}
......
......@@ -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.
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment