Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/machnode.hpp @ 3853:11211f7cb5a0
7079317: Incorrect branch's destination block in PrintoOptoAssembly output
Summary: save/restore label and block in scratch_emit_size()
Reviewed-by: never
author | kvn |
---|---|
date | Tue, 16 Aug 2011 11:53:57 -0700 |
parents | 95134e034042 |
children | f03a3c8bd5e5 |
comparison
equal
deleted
inserted
replaced
3852:fdb992d83a87 | 3853:11211f7cb5a0 |
---|---|
183 virtual MachNode *cisc_version(int offset, Compile* C); | 183 virtual MachNode *cisc_version(int offset, Compile* C); |
184 // Modify this instruction's register mask to use stack version for cisc_operand | 184 // Modify this instruction's register mask to use stack version for cisc_operand |
185 virtual void use_cisc_RegMask(); | 185 virtual void use_cisc_RegMask(); |
186 | 186 |
187 // Support for short branches | 187 // Support for short branches |
188 virtual MachNode *short_branch_version(Compile* C) { return NULL; } | |
189 bool may_be_short_branch() const { return (flags() & Flag_may_be_short_branch) != 0; } | 188 bool may_be_short_branch() const { return (flags() & Flag_may_be_short_branch) != 0; } |
190 | 189 |
191 // Avoid back to back some instructions on some CPUs. | 190 // Avoid back to back some instructions on some CPUs. |
192 bool avoid_back_to_back() const { return (flags() & Flag_avoid_back_to_back) != 0; } | 191 bool avoid_back_to_back() const { return (flags() & Flag_avoid_back_to_back) != 0; } |
193 | 192 |
270 virtual const MachOper* memory_operand() const { return NULL; } | 269 virtual const MachOper* memory_operand() const { return NULL; } |
271 | 270 |
272 // Call "get_base_and_disp" to decide which category of memory is used here. | 271 // Call "get_base_and_disp" to decide which category of memory is used here. |
273 virtual const class TypePtr *adr_type() const; | 272 virtual const class TypePtr *adr_type() const; |
274 | 273 |
275 // Negate conditional branches. Error for non-branch Nodes | |
276 virtual void negate(); | |
277 | |
278 // Apply peephole rule(s) to this instruction | 274 // Apply peephole rule(s) to this instruction |
279 virtual MachNode *peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C ); | 275 virtual MachNode *peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C ); |
280 | 276 |
281 // Top-level ideal Opcode matched | 277 // Top-level ideal Opcode matched |
282 virtual int ideal_Opcode() const { return Op_Node; } | 278 virtual int ideal_Opcode() const { return Op_Node; } |
283 | |
284 // Set the branch inside jump MachNodes. Error for non-branch Nodes. | |
285 virtual void label_set( Label* label, uint block_num ); | |
286 | 279 |
287 // Adds the label for the case | 280 // Adds the label for the case |
288 virtual void add_case_label( int switch_val, Label* blockLabel); | 281 virtual void add_case_label( int switch_val, Label* blockLabel); |
289 | 282 |
290 // Set the absolute address for methods | 283 // Set the absolute address for methods |
512 virtual const char *Name() const { return "MachSpillCopy"; } | 505 virtual const char *Name() const { return "MachSpillCopy"; } |
513 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | 506 virtual void format( PhaseRegAlloc *, outputStream *st ) const; |
514 #endif | 507 #endif |
515 }; | 508 }; |
516 | 509 |
510 //------------------------------MachBranchNode-------------------------------- | |
511 // Abstract machine branch Node | |
512 class MachBranchNode : public MachIdealNode { | |
513 public: | |
514 MachBranchNode() : MachIdealNode() { | |
515 init_class_id(Class_MachBranch); | |
516 } | |
517 virtual void label_set(Label* label, uint block_num) = 0; | |
518 virtual void save_label(Label** label, uint* block_num) = 0; | |
519 | |
520 // Support for short branches | |
521 virtual MachNode *short_branch_version(Compile* C) { return NULL; } | |
522 | |
523 virtual bool pinned() const { return true; }; | |
524 }; | |
525 | |
517 //------------------------------MachNullChkNode-------------------------------- | 526 //------------------------------MachNullChkNode-------------------------------- |
518 // Machine-dependent null-pointer-check Node. Points a real MachNode that is | 527 // Machine-dependent null-pointer-check Node. Points a real MachNode that is |
519 // also some kind of memory op. Turns the indicated MachNode into a | 528 // also some kind of memory op. Turns the indicated MachNode into a |
520 // conditional branch with good latency on the ptr-not-null path and awful | 529 // conditional branch with good latency on the ptr-not-null path and awful |
521 // latency on the pointer-is-null path. | 530 // latency on the pointer-is-null path. |
522 | 531 |
523 class MachNullCheckNode : public MachIdealNode { | 532 class MachNullCheckNode : public MachBranchNode { |
524 public: | 533 public: |
525 const uint _vidx; // Index of memop being tested | 534 const uint _vidx; // Index of memop being tested |
526 MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachIdealNode(), _vidx(vidx) { | 535 MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachBranchNode(), _vidx(vidx) { |
527 init_class_id(Class_MachNullCheck); | 536 init_class_id(Class_MachNullCheck); |
528 init_flags(Flag_is_Branch); | |
529 add_req(ctrl); | 537 add_req(ctrl); |
530 add_req(memop); | 538 add_req(memop); |
531 } | 539 } |
540 virtual uint size_of() const { return sizeof(*this); } | |
532 | 541 |
533 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | 542 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; |
534 virtual void label_set(Label* label, uint block_num); | 543 virtual void label_set(Label* label, uint block_num); |
535 virtual bool pinned() const { return true; }; | 544 virtual void save_label(Label** label, uint* block_num); |
536 virtual void negate() { } | 545 virtual void negate() { } |
537 virtual const class Type *bottom_type() const { return TypeTuple::IFBOTH; } | 546 virtual const class Type *bottom_type() const { return TypeTuple::IFBOTH; } |
538 virtual uint ideal_reg() const { return NotAMachineReg; } | 547 virtual uint ideal_reg() const { return NotAMachineReg; } |
539 virtual const RegMask &in_RegMask(uint) const; | 548 virtual const RegMask &in_RegMask(uint) const; |
540 virtual const RegMask &out_RegMask() const { return RegMask::Empty; } | 549 virtual const RegMask &out_RegMask() const { return RegMask::Empty; } |
576 #endif | 585 #endif |
577 }; | 586 }; |
578 | 587 |
579 //------------------------------MachIfNode------------------------------------- | 588 //------------------------------MachIfNode------------------------------------- |
580 // Machine-specific versions of IfNodes | 589 // Machine-specific versions of IfNodes |
581 class MachIfNode : public MachNode { | 590 class MachIfNode : public MachBranchNode { |
582 virtual uint size_of() const { return sizeof(*this); } // Size is bigger | 591 virtual uint size_of() const { return sizeof(*this); } // Size is bigger |
583 public: | 592 public: |
584 float _prob; // Probability branch goes either way | 593 float _prob; // Probability branch goes either way |
585 float _fcnt; // Frequency counter | 594 float _fcnt; // Frequency counter |
586 MachIfNode() : MachNode() { | 595 MachIfNode() : MachBranchNode() { |
587 init_class_id(Class_MachIf); | 596 init_class_id(Class_MachIf); |
588 } | 597 } |
598 // Negate conditional branches. | |
599 virtual void negate() = 0; | |
589 #ifndef PRODUCT | 600 #ifndef PRODUCT |
590 virtual void dump_spec(outputStream *st) const; | 601 virtual void dump_spec(outputStream *st) const; |
591 #endif | 602 #endif |
592 }; | 603 }; |
593 | 604 |
594 //------------------------------MachGotoNode----------------------------------- | 605 //------------------------------MachGotoNode----------------------------------- |
595 // Machine-specific versions of GotoNodes | 606 // Machine-specific versions of GotoNodes |
596 class MachGotoNode : public MachNode { | 607 class MachGotoNode : public MachBranchNode { |
597 public: | 608 public: |
598 MachGotoNode() : MachNode() { | 609 MachGotoNode() : MachBranchNode() { |
599 init_class_id(Class_MachGoto); | 610 init_class_id(Class_MachGoto); |
600 } | 611 } |
601 }; | 612 }; |
602 | 613 |
603 //------------------------------MachFastLockNode------------------------------------- | 614 //------------------------------MachFastLockNode------------------------------------- |