Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private List<AsmInstruction> performColoring(List<AsmInstruction> program) {
- AlphaSubstitution colorSubstitution = new AlphaSubstitution();
- for (InterferenceNode node : graph.allNodes()) {
- colorSubstitution.addSubstitution(node.register.getName(), node.color.x86Name());
- }
- List<AsmInstruction> coloredProgram = program.stream().
- flatMap(inst -> colorInstruction(inst, colorSubstitution)).
- collect(Collectors.toList());
- coloredProgram.addAll(0, generateSaveStackSpaceInstructions());
- return coloredProgram;
- }
- private List<AsmInstruction> generateSaveStackSpaceInstructions() {
- return Arrays.asList(AsmInstruction.push(new X86Register(Reg.rbp)),
- AsmInstruction.mov(new X86Register(Reg.rbp), new X86Register(Reg.rsp)),
- AsmInstruction.sub(new X86Register(Reg.rsp), new ConstImmediate(nextStackLocation)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement