Rose: Move all literal operations into program

Replace the RoseLiteral structure with more program instructions; now,
instead of each literal ID leading to a RoseLiteral, it simply has a
program to run (and a delay rebuild program).

This commit also makes some other improvements:

 * CHECK_STATE instruction, for use instead of a sparse iterator over a
   single element.
 * Elide some checks (CHECK_LIT_EARLY, ANCHORED_DELAY, etc) when not
   needed.
 * Flatten PUSH_DELAYED behaviour to one instruction per delayed
   literal, rather than the mask/index-list approach used before.
 * Simple program cache at compile time for deduplication.
This commit is contained in:
Justin Viiret
2015-12-18 15:24:52 +11:00
committed by Matthew Barr
parent 255d84a83a
commit 10cda4cc33
11 changed files with 843 additions and 628 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Intel Corporation
* Copyright (c) 2015-2016, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -258,7 +258,6 @@ void allocateFinalLiteralId(RoseBuildImpl &tbi) {
set<u32> anch;
set<u32> norm;
set<u32> norm_benefits;
set<u32> delay;
/* undelayed ids come first */
@@ -281,12 +280,8 @@ void allocateFinalLiteralId(RoseBuildImpl &tbi) {
continue;
}
const rose_literal_info &info = tbi.literal_info[i];
if (info.requires_benefits) {
assert(!tbi.isDelayed(i));
norm_benefits.insert(i);
DEBUG_PRINTF("%u has benefits\n", i);
} else if (tbi.isDelayed(i)) {
if (tbi.isDelayed(i)) {
assert(!tbi.literal_info[i].requires_benefits);
delay.insert(i);
} else if (tbi.literals.right.at(i).table == ROSE_ANCHORED) {
anch.insert(i);
@@ -295,12 +290,7 @@ void allocateFinalLiteralId(RoseBuildImpl &tbi) {
}
}
/* normal lits first (with benefits confirm)*/
allocateFinalIdToSet(g, norm_benefits, &tbi.literal_info,
&tbi.final_id_to_literal, &next_final_id);
/* other normal lits (without benefits)*/
tbi.nonbenefits_base_id = next_final_id;
/* normal lits */
allocateFinalIdToSet(g, norm, &tbi.literal_info, &tbi.final_id_to_literal,
&next_final_id);