1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef V8_LITHIUM_INL_H_
6 #define V8_LITHIUM_INL_H_
8 #include "src/lithium.h"
10 #if V8_TARGET_ARCH_IA32
11 #include "src/ia32/lithium-ia32.h" // NOLINT
12 #elif V8_TARGET_ARCH_X64
13 #include "src/x64/lithium-x64.h" // NOLINT
14 #elif V8_TARGET_ARCH_ARM64
15 #include "src/arm64/lithium-arm64.h" // NOLINT
16 #elif V8_TARGET_ARCH_ARM
17 #include "src/arm/lithium-arm.h" // NOLINT
18 #elif V8_TARGET_ARCH_MIPS
19 #include "src/mips/lithium-mips.h" // NOLINT
20 #elif V8_TARGET_ARCH_MIPS64
21 #include "src/mips64/lithium-mips64.h" // NOLINT
22 #elif V8_TARGET_ARCH_PPC
23 #include "src/ppc/lithium-ppc.h" // NOLINT
24 #elif V8_TARGET_ARCH_X87
25 #include "src/x87/lithium-x87.h" // NOLINT
27 #error "Unknown architecture."
33 TempIterator::TempIterator(LInstruction* instr)
34 : instr_(instr), limit_(instr->TempCount()), current_(0) {
39 bool TempIterator::Done() { return current_ >= limit_; }
42 LOperand* TempIterator::Current() {
44 return instr_->TempAt(current_);
48 void TempIterator::SkipUninteresting() {
49 while (current_ < limit_ && instr_->TempAt(current_) == NULL) ++current_;
53 void TempIterator::Advance() {
59 InputIterator::InputIterator(LInstruction* instr)
60 : instr_(instr), limit_(instr->InputCount()), current_(0) {
65 bool InputIterator::Done() { return current_ >= limit_; }
68 LOperand* InputIterator::Current() {
70 DCHECK(instr_->InputAt(current_) != NULL);
71 return instr_->InputAt(current_);
75 void InputIterator::Advance() {
81 void InputIterator::SkipUninteresting() {
82 while (current_ < limit_) {
83 LOperand* current = instr_->InputAt(current_);
84 if (current != NULL && !current->IsConstantOperand()) break;
90 UseIterator::UseIterator(LInstruction* instr)
91 : input_iterator_(instr), env_iterator_(instr->environment()) {}
94 bool UseIterator::Done() {
95 return input_iterator_.Done() && env_iterator_.Done();
99 LOperand* UseIterator::Current() {
101 LOperand* result = input_iterator_.Done() ? env_iterator_.Current()
102 : input_iterator_.Current();
103 DCHECK(result != NULL);
108 void UseIterator::Advance() {
109 input_iterator_.Done() ? env_iterator_.Advance() : input_iterator_.Advance();
111 } // namespace internal
114 #endif // V8_LITHIUM_INL_H_