private void copySpaces(SleighLanguage language) {
			insertSpace(new ConstantSpace(this));
			insertSpace(
				new OtherSpace(this, SpaceNames.OTHER_SPACE_NAME, SpaceNames.OTHER_SPACE_INDEX));
			AddressSpace[] spaces = language.getAddressFactory().getAllAddressSpaces();
			for (AddressSpace spc : spaces) {
				if (spc.getUnique() < 2) {
					continue;
				}
				AddrSpace resSpace;
				int sz = spc.getSize();
				if (spc instanceof SegmentedAddressSpace) {
					// TODO: SegmentedAddressSpace shouldn't really return 21
					sz = 32;
				}
				if (sz > 64) {
					sz = 64;
				}
				int bytesize = (sz + 7) / 8; // Convert bits to bytes
				switch (spc.getType()) {
					case AddressSpace.TYPE_UNIQUE:
						resSpace = new UniqueSpace(this, spc.getUnique(), 0);
						break;
					case AddressSpace.TYPE_OTHER:
						resSpace = new OtherSpace(this, spc.getName(), spc.getUnique());
						break;
					case AddressSpace.TYPE_RAM:
						resSpace = new AddrSpace(this, spacetype.IPTR_PROCESSOR, spc.getName(),
							bytesize, spc.getAddressableUnitSize(), spc.getUnique(),
							AddrSpace.hasphysical, 1);
						break;
					case AddressSpace.TYPE_REGISTER:
						resSpace = new AddrSpace(this, spacetype.IPTR_PROCESSOR, spc.getName(),
							bytesize, spc.getAddressableUnitSize(), spc.getUnique(),
							AddrSpace.hasphysical, 0);
						break;
					default:
						resSpace = null;
				}
				if (resSpace == null) {
					break;
				}
				insertSpace(resSpace);
			}
			setDefaultSpace(language.getDefaultSpace().getUnique());
		}
This class wraps on existing SleighLanguage with the SleighBase interface expected by
PcodeCompile. It populates the symbol table with user-defined operations and the global
VarnodeSymbol objects, which typically includes all the general purpose registers.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/PcodeParser.java