Mass rename Ebb and relatives to Block (#1365)

* Manually rename BasicBlock to BlockPredecessor

BasicBlock is a pair of (Ebb, Inst) that is used to represent the
basic block subcomponent of an Ebb that is a predecessor to an Ebb.

Eventually we will be able to remove this struct, but for now it
makes sense to give it a non-conflicting name so that we can start
to transition Ebb to represent a basic block.

I have not updated any comments that refer to BasicBlock, as
eventually we will remove BlockPredecessor and replace with Block,
which is a basic block, so the comments will become correct.

* Manually rename SSABuilder block types to avoid conflict

SSABuilder has its own Block and BlockData types. These along with
associated identifier will cause conflicts in a later commit, so
they are renamed to be more verbose here.

* Automatically rename 'Ebb' to 'Block' in *.rs

* Automatically rename 'EBB' to 'block' in *.rs

* Automatically rename 'ebb' to 'block' in *.rs

* Automatically rename 'extended basic block' to 'basic block' in *.rs

* Automatically rename 'an basic block' to 'a basic block' in *.rs

* Manually update comment for `Block`

`Block`'s wikipedia article required an update.

* Automatically rename 'an `Block`' to 'a `Block`' in *.rs

* Automatically rename 'extended_basic_block' to 'basic_block' in *.rs

* Automatically rename 'ebb' to 'block' in *.clif

* Manually rename clif constant that contains 'ebb' as substring to avoid conflict

* Automatically rename filecheck uses of 'EBB' to 'BB'

'regex: EBB' -> 'regex: BB'
'$EBB' -> '$BB'

* Automatically rename 'EBB' 'Ebb' to 'block' in *.clif

* Automatically rename 'an block' to 'a block' in *.clif

* Fix broken testcase when function name length increases

Test function names are limited to 16 characters. This causes
the new longer name to be truncated and fail a filecheck test. An
outdated comment was also fixed.
This commit is contained in:
Ryan Hunt
2020-02-07 10:46:47 -06:00
committed by GitHub
parent a136d1cb00
commit 832666c45e
370 changed files with 8090 additions and 7988 deletions

View File

@@ -1,7 +1,7 @@
//! Source map associating entities with their source locations.
//!
//! When the parser reads in a source file, it records the locations of the
//! definitions of entities like instructions, EBBs, and values.
//! definitions of entities like instructions, blocks, and values.
//!
//! The `SourceMap` struct defined in this module makes this mapping available
//! to parser clients.
@@ -10,7 +10,7 @@ use crate::error::{Location, ParseResult};
use crate::lexer::split_entity_name;
use cranelift_codegen::ir::entities::AnyEntity;
use cranelift_codegen::ir::{
Ebb, FuncRef, GlobalValue, Heap, JumpTable, SigRef, StackSlot, Table, Value,
Block, FuncRef, GlobalValue, Heap, JumpTable, SigRef, StackSlot, Table, Value,
};
use std::collections::HashMap;
@@ -28,9 +28,9 @@ impl SourceMap {
self.locations.contains_key(&v.into())
}
/// Look up a EBB entity.
pub fn contains_ebb(&self, ebb: Ebb) -> bool {
self.locations.contains_key(&ebb.into())
/// Look up a block entity.
pub fn contains_block(&self, block: Block) -> bool {
self.locations.contains_key(&block.into())
}
/// Look up a stack slot entity.
@@ -79,11 +79,11 @@ impl SourceMap {
Some(v.into())
}
}),
"ebb" => Ebb::with_number(num).and_then(|ebb| {
if !self.contains_ebb(ebb) {
"block" => Block::with_number(num).and_then(|block| {
if !self.contains_block(block) {
None
} else {
Some(ebb.into())
Some(block.into())
}
}),
"ss" => StackSlot::with_number(num).and_then(|ss| {
@@ -158,8 +158,8 @@ impl SourceMap {
self.def_entity(entity.into(), loc)
}
/// Define the ebb `entity`.
pub fn def_ebb(&mut self, entity: Ebb, loc: Location) -> ParseResult<()> {
/// Define the block `entity`.
pub fn def_block(&mut self, entity: Block, loc: Location) -> ParseResult<()> {
self.def_entity(entity.into(), loc)
}
@@ -218,8 +218,8 @@ mod tests {
let tf = parse_test(
"function %detail() {
ss10 = incoming_arg 13
jt10 = jump_table [ebb0]
ebb0(v4: i32, v7: i32):
jt10 = jump_table [block0]
block0(v4: i32, v7: i32):
v10 = iadd v4, v7
}",
ParseOptions::default(),
@@ -231,7 +231,7 @@ mod tests {
assert_eq!(map.lookup_str("ss1"), None);
assert_eq!(map.lookup_str("ss10").unwrap().to_string(), "ss10");
assert_eq!(map.lookup_str("jt10").unwrap().to_string(), "jt10");
assert_eq!(map.lookup_str("ebb0").unwrap().to_string(), "ebb0");
assert_eq!(map.lookup_str("block0").unwrap().to_string(), "block0");
assert_eq!(map.lookup_str("v4").unwrap().to_string(), "v4");
assert_eq!(map.lookup_str("v7").unwrap().to_string(), "v7");
assert_eq!(map.lookup_str("v10").unwrap().to_string(), "v10");