| Index: src/sh4/constants-sh4.cc
|
| diff --git a/src/data-flow.cc b/src/sh4/constants-sh4.cc
|
| similarity index 56%
|
| copy from src/data-flow.cc
|
| copy to src/sh4/constants-sh4.cc
|
| index 6a3b05cc86d98b5758ab9115a94f02d6ec798b6b..a1b06d2ebf37d6ed54bc23aba05eeda0c2ad3aa7 100644
|
| --- a/src/data-flow.cc
|
| +++ b/src/sh4/constants-sh4.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2010 the V8 project authors. All rights reserved.
|
| +// Copyright 2011-2012 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -27,40 +27,63 @@
|
|
|
| #include "v8.h"
|
|
|
| -#include "data-flow.h"
|
| -#include "scopes.h"
|
| +#if defined(V8_TARGET_ARCH_SH4)
|
| +
|
| +#include "constants-sh4.h"
|
| +
|
|
|
| namespace v8 {
|
| namespace internal {
|
|
|
| -#ifdef DEBUG
|
| -void BitVector::Print() {
|
| - bool first = true;
|
| - PrintF("{");
|
| - for (int i = 0; i < length(); i++) {
|
| - if (Contains(i)) {
|
| - if (!first) PrintF(",");
|
| - first = false;
|
| - PrintF("%d", i);
|
| - }
|
| +// These register names are defined in a way to match the native disassembler
|
| +// formatting. See for example the command "objdump -d <binary file>".
|
| +const char* Registers::names_[kNumRegisters] = {
|
| + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
| + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
| +};
|
| +
|
| +
|
| +// List of alias names which can be used when referring to SH4 registers.
|
| +const Registers::RegisterAlias Registers::aliases_[] = {
|
| + {14, "fp"},
|
| + {15, "sp"},
|
| + {kNoRegister, NULL}
|
| +};
|
| +
|
| +
|
| +const char* Registers::Name(int reg) {
|
| + const char* result;
|
| + if ((0 <= reg) && (reg < kNumRegisters)) {
|
| + result = names_[reg];
|
| + } else {
|
| + result = "noreg";
|
| }
|
| - PrintF("}");
|
| + return result;
|
| }
|
| -#endif
|
|
|
|
|
| -void BitVector::Iterator::Advance() {
|
| - current_++;
|
| - uint32_t val = current_value_;
|
| - while (val == 0) {
|
| - current_index_++;
|
| - if (Done()) return;
|
| - val = target_->data_[current_index_];
|
| - current_ = current_index_ << 5;
|
| +int Registers::Number(const char* name) {
|
| + // Look through the canonical names.
|
| + for (int i = 0; i < kNumRegisters; i++) {
|
| + if (strcmp(names_[i], name) == 0) {
|
| + return i;
|
| + }
|
| + }
|
| +
|
| + // Look through the alias names.
|
| + int i = 0;
|
| + while (aliases_[i].reg != kNoRegister) {
|
| + if (strcmp(aliases_[i].name, name) == 0) {
|
| + return aliases_[i].reg;
|
| + }
|
| + i++;
|
| }
|
| - val = SkipZeroBytes(val);
|
| - val = SkipZeroBits(val);
|
| - current_value_ = val >> 1;
|
| +
|
| + // No register with the requested name found.
|
| + return kNoRegister;
|
| }
|
|
|
| +
|
| } } // namespace v8::internal
|
| +
|
| +#endif // V8_TARGET_ARCH_SH4
|
|
|