mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 22:35:43 +08:00
ba67fb275e
* `table.sort` was improved further. It now guarentees N*log(N) time complexity in the worst case. * Fix https://github.com/Roblox/luau/issues/880 We are also working on fixing final bugs and crashes in the new type solver. On the CodeGen front we have a few things going on: * We have a smarter register allocator for the x86 JIT * We lower more instructions on arm64 * The vector constructor builtin is now translated to IR --------- Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
86 lines
1.9 KiB
C++
86 lines
1.9 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include <bitset>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace Luau
|
|
{
|
|
namespace CodeGen
|
|
{
|
|
|
|
struct IrBlock;
|
|
struct IrFunction;
|
|
|
|
void updateUseCounts(IrFunction& function);
|
|
|
|
void updateLastUseLocations(IrFunction& function);
|
|
|
|
uint32_t getNextInstUse(IrFunction& function, uint32_t targetInstIdx, uint32_t startInstIdx);
|
|
|
|
// Returns how many values are coming into the block (live in) and how many are coming out of the block (live out)
|
|
std::pair<uint32_t, uint32_t> getLiveInOutValueCount(IrFunction& function, IrBlock& block);
|
|
uint32_t getLiveInValueCount(IrFunction& function, IrBlock& block);
|
|
uint32_t getLiveOutValueCount(IrFunction& function, IrBlock& block);
|
|
|
|
struct RegisterSet
|
|
{
|
|
std::bitset<256> regs;
|
|
|
|
// If variadic sequence is active, we track register from which it starts
|
|
bool varargSeq = false;
|
|
uint8_t varargStart = 0;
|
|
};
|
|
|
|
struct CfgInfo
|
|
{
|
|
std::vector<uint32_t> predecessors;
|
|
std::vector<uint32_t> predecessorsOffsets;
|
|
|
|
std::vector<uint32_t> successors;
|
|
std::vector<uint32_t> successorsOffsets;
|
|
|
|
std::vector<RegisterSet> in;
|
|
std::vector<RegisterSet> def;
|
|
std::vector<RegisterSet> out;
|
|
|
|
RegisterSet captured;
|
|
};
|
|
|
|
void computeCfgInfo(IrFunction& function);
|
|
|
|
struct BlockIteratorWrapper
|
|
{
|
|
const uint32_t* itBegin = nullptr;
|
|
const uint32_t* itEnd = nullptr;
|
|
|
|
bool empty() const
|
|
{
|
|
return itBegin == itEnd;
|
|
}
|
|
|
|
size_t size() const
|
|
{
|
|
return size_t(itEnd - itBegin);
|
|
}
|
|
|
|
const uint32_t* begin() const
|
|
{
|
|
return itBegin;
|
|
}
|
|
|
|
const uint32_t* end() const
|
|
{
|
|
return itEnd;
|
|
}
|
|
};
|
|
|
|
BlockIteratorWrapper predecessors(const CfgInfo& cfg, uint32_t blockIdx);
|
|
BlockIteratorWrapper successors(const CfgInfo& cfg, uint32_t blockIdx);
|
|
|
|
} // namespace CodeGen
|
|
} // namespace Luau
|