split critical edges during x86 register allocation - #87
Merged
Merged
Conversation
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
x86gen.hppLines 1719-1728 1719 initial_state[info.fixed.id()] = vreg(arg);
1720 }
1721 _blocks[0]->set_regalloc(initial_state);
1722
! 1723 for (size_t block_index = 0; block_index < _blocks.size(); block_index++) {
! 1724 X86Block* block = _blocks[block_index];
1725 if (block->regalloc()) {
1726 load_state(reg_file, block->regalloc());
1727 }Lines 1848-1869 1848
1849 if (std::holds_alternative<X86Block*>(inst->imm())) {
1850 X86Block* target = std::get<X86Block*>(inst->imm());
1851 if (target->regalloc()) {
! 1852 if (inst->kind() != X86Inst::Kind::Jmp) {
! 1853 X86Block* edge = _builder.build_block();
! 1854 edge->set_name(block->name());
! 1855 Reg* state = (Reg*) _allocator.alloc(sizeof(Reg) * reg_file.size(), alignof(Reg));
! 1856 for (size_t it = 0; it < reg_file.size(); it++) {
! 1857 state[it] = reg_file[Reg::phys(it)];
! 1858 }
! 1859 edge->set_regalloc(state);
! 1860 _builder.move_before(edge, nullptr);
! 1861 _builder.jmp(target)->set_name(inst->name());
! 1862 _blocks.insert(_blocks.begin() + block_index + 1, edge);
! 1863 inst->set_imm(edge);
! 1864 continue;
! 1865 }
1866 // Restore regalloc state
1867 if (target->name() < block->name()) {
1868 // Backedge
1869 assert(target->loop());Lines 1919-1930 1919 }
1920 }
1921 }
1922
! 1923 for (size_t it = 0; it < _blocks.size(); it++) {
! 1924 _blocks[it]->set_name(it);
! 1925 }
! 1926
1927 #ifdef METAJIT_DEBUG
1928 for (X86Block* block : _blocks) {
1929 if (block->regalloc()) {
1930 _builder.move_to_begin(block); |
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
x86gen.hppLines 1719-1728 1719 initial_state[info.fixed.id()] = vreg(arg);
1720 }
1721 _blocks[0]->set_regalloc(initial_state);
1722
! 1723 for (size_t block_index = 0; block_index < _blocks.size(); block_index++) {
! 1724 X86Block* block = _blocks[block_index];
1725 if (block->regalloc()) {
1726 load_state(reg_file, block->regalloc());
1727 }Lines 1848-1869 1848
1849 if (std::holds_alternative<X86Block*>(inst->imm())) {
1850 X86Block* target = std::get<X86Block*>(inst->imm());
1851 if (target->regalloc()) {
! 1852 if (inst->kind() != X86Inst::Kind::Jmp) {
! 1853 X86Block* edge = _builder.build_block();
! 1854 edge->set_name(block->name());
! 1855 Reg* state = (Reg*) _allocator.alloc(sizeof(Reg) * reg_file.size(), alignof(Reg));
! 1856 for (size_t it = 0; it < reg_file.size(); it++) {
! 1857 state[it] = reg_file[Reg::phys(it)];
! 1858 }
! 1859 edge->set_regalloc(state);
! 1860 _builder.move_before(edge, nullptr);
! 1861 _builder.jmp(target)->set_name(inst->name());
! 1862 _blocks.insert(_blocks.begin() + block_index + 1, edge);
! 1863 inst->set_imm(edge);
! 1864 continue;
! 1865 }
1866 // Restore regalloc state
1867 if (target->name() < block->name()) {
1868 // Backedge
1869 assert(target->loop());Lines 1919-1930 1919 }
1920 }
1921 }
1922
! 1923 for (size_t it = 0; it < _blocks.size(); it++) {
! 1924 _blocks[it]->set_name(it);
! 1925 }
! 1926
1927 #ifdef METAJIT_DEBUG
1928 for (X86Block* block : _blocks) {
1929 if (block->regalloc()) {
1930 _builder.move_to_begin(block); |
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
x86gen.hppLines 1719-1728 1719 initial_state[info.fixed.id()] = vreg(arg);
1720 }
1721 _blocks[0]->set_regalloc(initial_state);
1722
! 1723 for (size_t block_index = 0; block_index < _blocks.size(); block_index++) {
! 1724 X86Block* block = _blocks[block_index];
1725 if (block->regalloc()) {
1726 load_state(reg_file, block->regalloc());
1727 }Lines 1848-1869 1848
1849 if (std::holds_alternative<X86Block*>(inst->imm())) {
1850 X86Block* target = std::get<X86Block*>(inst->imm());
1851 if (target->regalloc()) {
! 1852 if (inst->kind() != X86Inst::Kind::Jmp) {
! 1853 X86Block* edge = _builder.build_block();
! 1854 edge->set_name(block->name());
! 1855 Reg* state = (Reg*) _allocator.alloc(sizeof(Reg) * reg_file.size(), alignof(Reg));
! 1856 for (size_t it = 0; it < reg_file.size(); it++) {
! 1857 state[it] = reg_file[Reg::phys(it)];
! 1858 }
! 1859 edge->set_regalloc(state);
! 1860 _builder.move_before(edge, nullptr);
! 1861 _builder.jmp(target)->set_name(inst->name());
! 1862 _blocks.insert(_blocks.begin() + block_index + 1, edge);
! 1863 inst->set_imm(edge);
! 1864 continue;
! 1865 }
1866 // Restore regalloc state
1867 if (target->name() < block->name()) {
1868 // Backedge
1869 assert(target->loop());Lines 1919-1930 1919 }
1920 }
1921 }
1922
! 1923 for (size_t it = 0; it < _blocks.size(); it++) {
! 1924 _blocks[it]->set_name(it);
! 1925 }
! 1926
1927 #ifdef METAJIT_DEBUG
1928 for (X86Block* block : _blocks) {
1929 if (block->regalloc()) {
1930 _builder.move_to_begin(block); |
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
x86gen.hppLines 1719-1728 1719 initial_state[info.fixed.id()] = vreg(arg);
1720 }
1721 _blocks[0]->set_regalloc(initial_state);
1722
! 1723 for (size_t block_index = 0; block_index < _blocks.size(); block_index++) {
! 1724 X86Block* block = _blocks[block_index];
1725 if (block->regalloc()) {
1726 load_state(reg_file, block->regalloc());
1727 }Lines 1848-1869 1848
1849 if (std::holds_alternative<X86Block*>(inst->imm())) {
1850 X86Block* target = std::get<X86Block*>(inst->imm());
1851 if (target->regalloc()) {
! 1852 if (inst->kind() != X86Inst::Kind::Jmp) {
! 1853 X86Block* edge = _builder.build_block();
! 1854 edge->set_name(block->name());
! 1855 Reg* state = (Reg*) _allocator.alloc(sizeof(Reg) * reg_file.size(), alignof(Reg));
! 1856 for (size_t it = 0; it < reg_file.size(); it++) {
! 1857 state[it] = reg_file[Reg::phys(it)];
! 1858 }
! 1859 edge->set_regalloc(state);
! 1860 _builder.move_before(edge, nullptr);
! 1861 _builder.jmp(target)->set_name(inst->name());
! 1862 _blocks.insert(_blocks.begin() + block_index + 1, edge);
! 1863 inst->set_imm(edge);
! 1864 continue;
! 1865 }
1866 // Restore regalloc state
1867 if (target->name() < block->name()) {
1868 // Backedge
1869 assert(target->loop());Lines 1919-1930 1919 }
1920 }
1921 }
1922
! 1923 for (size_t it = 0; it < _blocks.size(); it++) {
! 1924 _blocks[it]->set_name(it);
! 1925 }
! 1926
1927 #ifdef METAJIT_DEBUG
1928 for (X86Block* block : _blocks) {
1929 if (block->regalloc()) {
1930 _builder.move_to_begin(block); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.