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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 215363004: Support for multiple register values (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 M(UnboxFloat64x2) \ 772 M(UnboxFloat64x2) \
773 M(BinaryFloat64x2Op) \ 773 M(BinaryFloat64x2Op) \
774 M(Float64x2Zero) \ 774 M(Float64x2Zero) \
775 M(Float64x2Constructor) \ 775 M(Float64x2Constructor) \
776 M(Float64x2Splat) \ 776 M(Float64x2Splat) \
777 M(Float32x4ToFloat64x2) \ 777 M(Float32x4ToFloat64x2) \
778 M(Float64x2ToFloat32x4) \ 778 M(Float64x2ToFloat32x4) \
779 M(Simd64x2Shuffle) \ 779 M(Simd64x2Shuffle) \
780 M(Float64x2ZeroArg) \ 780 M(Float64x2ZeroArg) \
781 M(Float64x2OneArg) \ 781 M(Float64x2OneArg) \
782 M(ExtractNthOutput) \
782 783
783 784
784 #define FORWARD_DECLARATION(type) class type##Instr; 785 #define FORWARD_DECLARATION(type) class type##Instr;
785 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) 786 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
786 #undef FORWARD_DECLARATION 787 #undef FORWARD_DECLARATION
787 788
788 789
789 // Functions required in all concrete instruction classes. 790 // Functions required in all concrete instruction classes.
790 #define DECLARE_INSTRUCTION(type) \ 791 #define DECLARE_INSTRUCTION(type) \
791 virtual Tag tag() const { return k##type; } \ 792 virtual Tag tag() const { return k##type; } \
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 void ClearTempIndex() { temp_index_ = -1; } 1758 void ClearTempIndex() { temp_index_ = -1; }
1758 1759
1759 intptr_t ssa_temp_index() const { return ssa_temp_index_; } 1760 intptr_t ssa_temp_index() const { return ssa_temp_index_; }
1760 void set_ssa_temp_index(intptr_t index) { 1761 void set_ssa_temp_index(intptr_t index) {
1761 ASSERT(index >= 0); 1762 ASSERT(index >= 0);
1762 ASSERT(is_used()); 1763 ASSERT(is_used());
1763 ssa_temp_index_ = index; 1764 ssa_temp_index_ = index;
1764 } 1765 }
1765 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } 1766 bool HasSSATemp() const { return ssa_temp_index_ >= 0; }
1766 void ClearSSATempIndex() { ssa_temp_index_ = -1; } 1767 void ClearSSATempIndex() { ssa_temp_index_ = -1; }
1767 1768 bool HasPairRepresentation() const {
1769 return (representation() == kPairOfTagged) ||
1770 (representation() == kPairOfUnboxedDouble);
1771 }
1768 bool is_used() const { return (use_kind_ != kEffect); } 1772 bool is_used() const { return (use_kind_ != kEffect); }
1769 void set_use_kind(UseKind kind) { use_kind_ = kind; } 1773 void set_use_kind(UseKind kind) { use_kind_ = kind; }
1770 1774
1771 // Compile time type of the definition, which may be requested before type 1775 // Compile time type of the definition, which may be requested before type
1772 // propagation during graph building. 1776 // propagation during graph building.
1773 CompileType* Type() { 1777 CompileType* Type() {
1774 if (type_ == NULL) { 1778 if (type_ == NULL) {
1775 type_ = ComputeInitialType(); 1779 type_ = ComputeInitialType();
1776 } 1780 }
1777 return type_; 1781 return type_;
(...skipping 5501 matching lines...) Expand 10 before | Expand all | Expand 10 after
7279 } 7283 }
7280 7284
7281 ZoneGrowableArray<Value*>* inputs_; 7285 ZoneGrowableArray<Value*>* inputs_;
7282 7286
7283 const MethodRecognizer::Kind recognized_kind_; 7287 const MethodRecognizer::Kind recognized_kind_;
7284 7288
7285 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); 7289 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
7286 }; 7290 };
7287 7291
7288 7292
7293 class ExtractNthOutputInstr : public TemplateDefinition<1> {
7294 public:
7295 // Extract the Nth output register from value.
7296 ExtractNthOutputInstr(Value* value,
7297 intptr_t n,
7298 Representation definition_rep,
7299 intptr_t definition_cid)
7300 : index_(n),
7301 definition_rep_(definition_rep),
7302 definition_cid_(definition_cid) {
7303 SetInputAt(0, value);
7304 }
7305
7306 Value* value() const { return inputs_[0]; }
7307
7308 DECLARE_INSTRUCTION(ExtractNthOutput)
7309
7310 virtual CompileType ComputeType() const;
7311 virtual void PrintOperandsTo(BufferFormatter* f) const;
7312 virtual bool CanDeoptimize() const { return false; }
7313
7314 intptr_t index() const { return index_; }
7315
7316 virtual Representation representation() const {
7317 return definition_rep_;
7318 }
7319
7320 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7321 ASSERT(idx == 0);
7322 if (representation() == kTagged) {
7323 return kPairOfTagged;
7324 } else if (representation() == kUnboxedDouble) {
7325 return kPairOfUnboxedDouble;
7326 }
7327 UNREACHABLE();
7328 return definition_rep_;
7329 }
7330
7331 virtual bool AllowsCSE() const { return true; }
7332 virtual EffectSet Effects() const { return EffectSet::None(); }
7333 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7334 virtual bool AttributesEqual(Instruction* other) const {
7335 ExtractNthOutputInstr* other_extract = other->AsExtractNthOutput();
7336 return (other_extract->representation() == representation()) &&
7337 (other_extract->index() == index());
7338 }
7339
7340 virtual bool MayThrow() const { return false; }
7341
7342 private:
7343 const intptr_t index_;
7344 const Representation definition_rep_;
7345 const intptr_t definition_cid_;
7346 DISALLOW_COPY_AND_ASSIGN(ExtractNthOutputInstr);
7347 };
7348
7349
7289 class MergedMathInstr : public Definition { 7350 class MergedMathInstr : public Definition {
7290 public: 7351 public:
7291 enum Kind { 7352 enum Kind {
7292 kTruncDivMod, 7353 kTruncDivMod,
7293 kTruncDivRem,
7294 kSinCos, 7354 kSinCos,
7295 }; 7355 };
7296 7356
7297 MergedMathInstr(ZoneGrowableArray<Value*>* inputs, 7357 MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
7298 intptr_t original_deopt_id, 7358 intptr_t original_deopt_id,
7299 MergedMathInstr::Kind kind); 7359 MergedMathInstr::Kind kind);
7300 7360
7301 static intptr_t InputCountFor(MergedMathInstr::Kind kind) { 7361 static intptr_t InputCountFor(MergedMathInstr::Kind kind) {
7302 if (kind == kTruncDivMod) { 7362 if (kind == kTruncDivMod) {
7303 return 2; 7363 return 2;
7304 } else if (kind == kSinCos) { 7364 } else if (kind == kSinCos) {
7305 return 1; 7365 return 1;
7306 } else { 7366 } else {
7307 UNIMPLEMENTED(); 7367 UNIMPLEMENTED();
7308 return -1; 7368 return -1;
7309 } 7369 }
7310 } 7370 }
7311 7371
7312 MergedMathInstr::Kind kind() const { return kind_; } 7372 MergedMathInstr::Kind kind() const { return kind_; }
7313 7373
7314 virtual intptr_t InputCount() const { return inputs_->length(); } 7374 virtual intptr_t InputCount() const { return inputs_->length(); }
7315 7375
7316 virtual Value* InputAt(intptr_t i) const { 7376 virtual Value* InputAt(intptr_t i) const {
7317 return (*inputs_)[i]; 7377 return (*inputs_)[i];
7318 } 7378 }
7319 7379
7380 static intptr_t OutputIndexOf(intptr_t kind);
7381 static intptr_t OutputIndexOf(Token::Kind token);
7382
7320 virtual CompileType ComputeType() const; 7383 virtual CompileType ComputeType() const;
7321 virtual void PrintOperandsTo(BufferFormatter* f) const; 7384 virtual void PrintOperandsTo(BufferFormatter* f) const;
7322 7385
7323 virtual bool CanDeoptimize() const { 7386 virtual bool CanDeoptimize() const {
7324 if (kind_ == kTruncDivMod) { 7387 if (kind_ == kTruncDivMod) {
7325 return true; 7388 return true;
7326 } else if (kind_ == kSinCos) { 7389 } else if (kind_ == kSinCos) {
7327 return false; 7390 return false;
7328 } else { 7391 } else {
7329 UNIMPLEMENTED(); 7392 UNIMPLEMENTED();
7330 return false; 7393 return false;
7331 } 7394 }
7332 } 7395 }
7333 7396
7334 virtual Representation representation() const { 7397 virtual Representation representation() const {
7335 if (kind_ == kTruncDivMod) { 7398 if (kind_ == kTruncDivMod) {
7336 return kTagged; 7399 return kPairOfTagged;
7337 } else if (kind_ == kSinCos) { 7400 } else if (kind_ == kSinCos) {
7338 return kTagged; 7401 return kPairOfUnboxedDouble;
7339 } else { 7402 } else {
7340 UNIMPLEMENTED(); 7403 UNIMPLEMENTED();
7341 return kTagged; 7404 return kTagged;
7342 } 7405 }
7343 } 7406 }
7344 7407
7345 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7408 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7346 ASSERT((0 <= idx) && (idx < InputCount())); 7409 ASSERT((0 <= idx) && (idx < InputCount()));
7347 if (kind_ == kTruncDivMod) { 7410 if (kind_ == kTruncDivMod) {
7348 return kTagged; 7411 return kTagged;
7349 } else if (kind_ == kSinCos) { 7412 } else if (kind_ == kSinCos) {
7350 return kUnboxedDouble; 7413 return kUnboxedDouble;
7351 } else { 7414 } else {
7352 UNIMPLEMENTED(); 7415 UNIMPLEMENTED();
7353 return kTagged; 7416 return kTagged;
7354 } 7417 }
7355 } 7418 }
7356 7419
7357 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 7420 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
7358 7421
7359 // Returns the result index for one of the merged instructjons
7360 static intptr_t ResultIndexOf(MethodRecognizer::Kind kind);
7361 static intptr_t ResultIndexOf(Token::Kind token);
7362
7363 DECLARE_INSTRUCTION(MergedMath) 7422 DECLARE_INSTRUCTION(MergedMath)
7364 7423
7365 virtual bool AllowsCSE() const { return true; } 7424 virtual bool AllowsCSE() const { return true; }
7366 virtual EffectSet Effects() const { return EffectSet::None(); } 7425 virtual EffectSet Effects() const { return EffectSet::None(); }
7367 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7426 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7368 virtual bool AttributesEqual(Instruction* other) const { 7427 virtual bool AttributesEqual(Instruction* other) const {
7369 MergedMathInstr* other_invoke = other->AsMergedMath(); 7428 MergedMathInstr* other_invoke = other->AsMergedMath();
7370 return other_invoke->kind() == kind(); 7429 return other_invoke->kind() == kind();
7371 } 7430 }
7372 7431
7373 virtual bool MayThrow() const { return false; } 7432 virtual bool MayThrow() const { return false; }
7374 7433
7375 static const char* KindToCString(MergedMathInstr::Kind kind) { 7434 static const char* KindToCString(MergedMathInstr::Kind kind) {
7376 if (kind == kTruncDivMod) return "TruncDivMod"; 7435 if (kind == kTruncDivMod) return "TruncDivMod";
7377 if (kind == kSinCos) return "SinCos"; 7436 if (kind == kSinCos) return "SinCos";
7378 UNIMPLEMENTED(); 7437 UNIMPLEMENTED();
7379 return ""; 7438 return "";
7380 } 7439 }
7381 7440
7382 private: 7441 private:
7383 virtual void RawSetInputAt(intptr_t i, Value* value) { 7442 virtual void RawSetInputAt(intptr_t i, Value* value) {
7384 (*inputs_)[i] = value; 7443 (*inputs_)[i] = value;
7385 } 7444 }
7386
7387 ZoneGrowableArray<Value*>* inputs_; 7445 ZoneGrowableArray<Value*>* inputs_;
7388 MergedMathInstr::Kind kind_; 7446 MergedMathInstr::Kind kind_;
7389
7390 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr); 7447 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr);
7391 }; 7448 };
7392 7449
7393 7450
7394 class CheckClassInstr : public TemplateInstruction<1> { 7451 class CheckClassInstr : public TemplateInstruction<1> {
7395 public: 7452 public:
7396 CheckClassInstr(Value* value, 7453 CheckClassInstr(Value* value,
7397 intptr_t deopt_id, 7454 intptr_t deopt_id,
7398 const ICData& unary_checks); 7455 const ICData& unary_checks);
7399 7456
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
7723 ForwardInstructionIterator* current_iterator_; 7780 ForwardInstructionIterator* current_iterator_;
7724 7781
7725 private: 7782 private:
7726 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 7783 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
7727 }; 7784 };
7728 7785
7729 7786
7730 } // namespace dart 7787 } // namespace dart
7731 7788
7732 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7789 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698