Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: src/sh4/constants-sh4.cc

Issue 11275184: First draft of the sh4 port Base URL: http://github.com/v8/v8.git@master
Patch Set: Use GYP and fixe some typos Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/sh4/constants-sh4.h ('k') | src/sh4/cpu-sh4.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/sh4/constants-sh4.h ('k') | src/sh4/cpu-sh4.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698