Skip to content

Commit

Permalink
RA: Removes VLA usage
Browse files Browse the repository at this point in the history
Just like #3508, clang-18 complains about VLA usage.

This vector is relatively small, only around 18 elements but is
semi-dynamic depending on arch and if FEXCore is targeting Linux or
Win32.
  • Loading branch information
Sonicadvance1 committed Mar 30, 2024
1 parent 2ad170b commit fedc24b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions FEXCore/Source/Interface/IR/Passes/RegisterAllocationPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ namespace {
bool RunAllocateVirtualRegisters(IREmitter *IREmit);

uint64_t OriginalRIP;

fextl::vector<LiveRange*> StaticMaps;
};

ConstrainedRAPass::ConstrainedRAPass(FEXCore::IR::Pass* _CompactionPass, bool _SupportsAVX)
Expand Down Expand Up @@ -550,7 +552,7 @@ namespace {

auto GprSize = Graph->Set.Classes[GPRFixedClass.Val].PhysicalCount;
auto MapsSize = Graph->Set.Classes[GPRFixedClass.Val].PhysicalCount + Graph->Set.Classes[FPRFixedClass.Val].PhysicalCount;
LiveRange* StaticMaps[MapsSize];
StaticMaps.resize(MapsSize);

// Get a StaticMap entry from context offset
const auto GetStaticMapFromOffset = [&](uint32_t Offset) -> LiveRange** {
Expand Down Expand Up @@ -625,7 +627,7 @@ namespace {
// - Mark read-aliases
// - Demote read-aliases if SRA reg is written before the alias's last read
for (auto [BlockNode, BlockHeader] : IR->GetBlocks()) {
memset(StaticMaps, 0, MapsSize * sizeof(LiveRange*));
memset(StaticMaps.data(), 0, MapsSize * sizeof(LiveRange*));
for (auto [CodeNode, IROp] : IR->GetCode(BlockNode)) {
const auto Node = IR->GetID(CodeNode);
auto& NodeLiveRange = LiveRanges[Node.Value];
Expand Down

0 comments on commit fedc24b

Please sign in to comment.