+ List<MachineRegisterGroup> registerGroupsModifiable = new ArrayList<>();
+ MachineDefinition machDef = getMachine().getDefinition();
+ if (!machDef.getUnsortedRegisters().isEmpty())
+ registerGroupsModifiable.add(new MachineRegisterGroup(this, "<unsorted>", machDef.getUnsortedRegisters()));
+ addRegisterGroups(null, registerGroupsModifiable, machDef.getRegisterGroups());
+ this.registerGroups = Collections.unmodifiableList(registerGroupsModifiable);
+ }
+
+ private void addRegisterGroups(String base, List<MachineRegisterGroup> target, List<RegisterGroup> registerGroups)
+ {
+ for (RegisterGroup rg : registerGroups)
+ {
+ String name = (base == null ? "" : base + '.') + rg.id();
+ target.add(new MachineRegisterGroup(this, name, rg.getRegisters()));
+ addRegisterGroups(name, target, rg.getSubGroups());
+ }