[meta] Make Builders build() instead of finish();

This commit is contained in:
Benjamin Bouvier
2019-05-28 15:01:14 +02:00
parent d9277f249b
commit 70f79d23bf
19 changed files with 156 additions and 159 deletions

View File

@@ -12,39 +12,39 @@ pub fn define() -> Vec<OperandKind> {
// This is primarliy used in control flow instructions.
let ebb = create("ebb", "An extended basic block in the same function.")
.default_member("destination")
.finish();
.build();
kinds.push(ebb);
// A reference to a stack slot declared in the function preamble.
let stack_slot = create("stack_slot", "A stack slot").finish();
let stack_slot = create("stack_slot", "A stack slot").build();
kinds.push(stack_slot);
// A reference to a global value.
let global_value = create("global_value", "A global value.").finish();
let global_value = create("global_value", "A global value.").build();
kinds.push(global_value);
// A reference to a function signature declared in the function preamble.
// This is used to provide the call signature in a call_indirect instruction.
let sig_ref = create("sig_ref", "A function signature.").finish();
let sig_ref = create("sig_ref", "A function signature.").build();
kinds.push(sig_ref);
// A reference to an external function declared in the function preamble.
// This is used to provide the callee and signature in a call instruction.
let func_ref = create("func_ref", "An external function.").finish();
let func_ref = create("func_ref", "An external function.").build();
kinds.push(func_ref);
// A reference to a jump table declared in the function preamble.
let jump_table = create("jump_table", "A jump table.")
.default_member("table")
.finish();
.build();
kinds.push(jump_table);
// A reference to a heap declared in the function preamble.
let heap = create("heap", "A heap.").finish();
let heap = create("heap", "A heap.").build();
kinds.push(heap);
// A reference to a table declared in the function preamble.
let table = create("table", "A table.").finish();
let table = create("table", "A table.").build();
kinds.push(table);
// A variable-sized list of value operands. Use for Ebb and function call arguments.
@@ -58,7 +58,7 @@ pub fn define() -> Vec<OperandKind> {
returned from an instruction.
"#,
)
.finish();
.build();
kinds.push(varargs);
return kinds;

View File

@@ -11,7 +11,7 @@ pub fn define() -> Vec<OperandKind> {
// IntType type.
let imm64 = Builder::new_imm("imm64")
.doc("A 64-bit immediate integer.")
.finish();
.build();
kinds.push(imm64);
// An unsigned 8-bit immediate integer operand.
@@ -20,13 +20,13 @@ pub fn define() -> Vec<OperandKind> {
// immediate bit counts on shift instructions.
let uimm8 = Builder::new_imm("uimm8")
.doc("An 8-bit immediate unsigned integer.")
.finish();
.build();
kinds.push(uimm8);
// An unsigned 32-bit immediate integer operand.
let uimm32 = Builder::new_imm("uimm32")
.doc("A 32-bit immediate unsigned integer.")
.finish();
.build();
kinds.push(uimm32);
// A 32-bit immediate signed offset.
@@ -36,7 +36,7 @@ pub fn define() -> Vec<OperandKind> {
let offset32 = Builder::new_imm("offset32")
.doc("A 32-bit immediate signed offset.")
.default_member("offset")
.finish();
.build();
kinds.push(offset32);
// A 32-bit immediate floating point operand.
@@ -44,7 +44,7 @@ pub fn define() -> Vec<OperandKind> {
// IEEE 754-2008 binary32 interchange format.
let ieee32 = Builder::new_imm("ieee32")
.doc("A 32-bit immediate floating point number.")
.finish();
.build();
kinds.push(ieee32);
// A 64-bit immediate floating point operand.
@@ -52,7 +52,7 @@ pub fn define() -> Vec<OperandKind> {
// IEEE 754-2008 binary64 interchange format.
let ieee64 = Builder::new_imm("ieee64")
.doc("A 64-bit immediate floating point number.")
.finish();
.build();
kinds.push(ieee64);
// An immediate boolean operand.
@@ -62,7 +62,7 @@ pub fn define() -> Vec<OperandKind> {
let boolean = Builder::new_imm("boolean")
.doc("An immediate boolean.")
.rust_type("bool")
.finish();
.build();
kinds.push(boolean);
// A condition code for comparing integer values.
@@ -83,7 +83,7 @@ pub fn define() -> Vec<OperandKind> {
.doc("An integer comparison condition code.")
.default_member("cond")
.rust_type("ir::condcodes::IntCC")
.finish();
.build();
kinds.push(intcc);
// A condition code for comparing floating point values. This enumerated operand kind is used
@@ -107,7 +107,7 @@ pub fn define() -> Vec<OperandKind> {
.doc("A floating point comparison condition code")
.default_member("cond")
.rust_type("ir::condcodes::FloatCC")
.finish();
.build();
kinds.push(floatcc);
// Flags for memory operations like :clif:inst:`load` and :clif:inst:`store`.
@@ -115,14 +115,14 @@ pub fn define() -> Vec<OperandKind> {
.doc("Memory operation flags")
.default_member("flags")
.rust_type("ir::MemFlags")
.finish();
.build();
kinds.push(memflags);
// A register unit in the current target ISA.
let regunit = Builder::new_imm("regunit")
.doc("A register unit in the target ISA")
.rust_type("isa::RegUnit")
.finish();
.build();
kinds.push(regunit);
// A trap code indicating the reason for trapping.
@@ -138,7 +138,7 @@ pub fn define() -> Vec<OperandKind> {
.doc("A trap reason code.")
.default_member("code")
.rust_type("ir::TrapCode")
.finish();
.build();
kinds.push(trapcode);
return kinds;

View File

@@ -56,7 +56,7 @@ pub fn define(
TypeSetBuilder::new()
.ints(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let Bool = &TypeVar::new(
@@ -65,19 +65,19 @@ pub fn define(
TypeSetBuilder::new()
.bools(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let iB = &TypeVar::new(
"iB",
"A scalar integer type",
TypeSetBuilder::new().ints(Interval::All).finish(),
TypeSetBuilder::new().ints(Interval::All).build(),
);
let iAddr = &TypeVar::new(
"iAddr",
"An integer address type",
TypeSetBuilder::new().ints(32..64).finish(),
TypeSetBuilder::new().ints(32..64).build(),
);
let Testable = &TypeVar::new(
@@ -86,7 +86,7 @@ pub fn define(
TypeSetBuilder::new()
.ints(Interval::All)
.bools(Interval::All)
.finish(),
.build(),
);
let TxN = &TypeVar::new(
@@ -98,7 +98,7 @@ pub fn define(
.bools(Interval::All)
.simd_lanes(Interval::All)
.includes_scalars(false)
.finish(),
.build(),
);
let Any = &TypeVar::new(
@@ -110,7 +110,7 @@ pub fn define(
.bools(Interval::All)
.simd_lanes(Interval::All)
.includes_scalars(true)
.finish(),
.build(),
);
let Mem = &TypeVar::new(
@@ -120,7 +120,7 @@ pub fn define(
.ints(Interval::All)
.floats(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let MemTo = &TypeVar::new(
@@ -130,7 +130,7 @@ pub fn define(
.ints(Interval::All)
.floats(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let addr = &operand("addr", iAddr);
@@ -261,7 +261,7 @@ pub fn define(
let Entry = &TypeVar::new(
"Entry",
"A scalar integer type",
TypeSetBuilder::new().ints(Interval::All).finish(),
TypeSetBuilder::new().ints(Interval::All).build(),
);
let entry = &operand_doc("entry", Entry, "entry of jump table");
@@ -589,7 +589,7 @@ pub fn define(
let iExt8 = &TypeVar::new(
"iExt8",
"An integer type with more than 8 bits",
TypeSetBuilder::new().ints(16..64).finish(),
TypeSetBuilder::new().ints(16..64).build(),
);
let x = &operand("x", iExt8);
let a = &operand("a", iExt8);
@@ -679,7 +679,7 @@ pub fn define(
let iExt16 = &TypeVar::new(
"iExt16",
"An integer type with more than 16 bits",
TypeSetBuilder::new().ints(32..64).finish(),
TypeSetBuilder::new().ints(32..64).build(),
);
let x = &operand("x", iExt16);
let a = &operand("a", iExt16);
@@ -769,7 +769,7 @@ pub fn define(
let iExt32 = &TypeVar::new(
"iExt32",
"An integer type with more than 32 bits",
TypeSetBuilder::new().ints(64..64).finish(),
TypeSetBuilder::new().ints(64..64).build(),
);
let x = &operand("x", iExt32);
let a = &operand("a", iExt32);
@@ -939,7 +939,7 @@ pub fn define(
let HeapOffset = &TypeVar::new(
"HeapOffset",
"An unsigned heap offset",
TypeSetBuilder::new().ints(32..64).finish(),
TypeSetBuilder::new().ints(32..64).build(),
);
let H = &operand("H", heap);
@@ -968,7 +968,7 @@ pub fn define(
let TableOffset = &TypeVar::new(
"TableOffset",
"An unsigned table offset",
TypeSetBuilder::new().ints(32..64).finish(),
TypeSetBuilder::new().ints(32..64).build(),
);
let T = &operand("T", table);
let p = &operand("p", TableOffset);
@@ -1337,7 +1337,7 @@ pub fn define(
.bools(Interval::All)
.simd_lanes(1..128)
.includes_scalars(true)
.finish(),
.build(),
);
let x = &operand_doc("x", Any128, "Low-numbered lanes");
@@ -1903,7 +1903,7 @@ pub fn define(
.bools(Interval::All)
.simd_lanes(Interval::All)
.includes_scalars(true)
.finish(),
.build(),
);
let x = &operand("x", bits);
let y = &operand("y", bits);
@@ -2272,7 +2272,7 @@ pub fn define(
TypeSetBuilder::new()
.floats(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let Cond = &operand("Cond", floatcc);
let x = &operand("x", Float);
@@ -2628,7 +2628,7 @@ pub fn define(
TypeSetBuilder::new()
.bools(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let BoolTo = &TypeVar::new(
@@ -2637,7 +2637,7 @@ pub fn define(
TypeSetBuilder::new()
.bools(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let x = &operand("x", Bool);
@@ -2665,7 +2665,7 @@ pub fn define(
TypeSetBuilder::new()
.bools(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let x = &operand("x", Bool);
let a = &operand("a", BoolTo);
@@ -2692,7 +2692,7 @@ pub fn define(
TypeSetBuilder::new()
.ints(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let x = &operand("x", Bool);
let a = &operand("a", IntTo);
@@ -2731,7 +2731,7 @@ pub fn define(
TypeSetBuilder::new()
.ints(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let IntTo = &TypeVar::new(
@@ -2740,7 +2740,7 @@ pub fn define(
TypeSetBuilder::new()
.ints(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let x = &operand("x", Int);
let a = &operand("a", IntTo);
@@ -2771,7 +2771,7 @@ pub fn define(
TypeSetBuilder::new()
.ints(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let x = &operand("x", Int);
let a = &operand("a", IntTo);
@@ -2822,7 +2822,7 @@ pub fn define(
TypeSetBuilder::new()
.floats(Interval::All)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let x = &operand("x", Float);
let a = &operand("a", FloatTo);
@@ -2976,7 +2976,7 @@ pub fn define(
TypeSetBuilder::new()
.ints(16..64)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let x = &operand("x", WideInt);
let lo = &operand_doc("lo", &WideInt.half_width(), "The low bits of `x`");
@@ -3006,7 +3006,7 @@ pub fn define(
TypeSetBuilder::new()
.ints(8..32)
.simd_lanes(Interval::All)
.finish(),
.build(),
);
let lo = &operand("lo", NarrowInt);
@@ -3033,5 +3033,5 @@ pub fn define(
.is_ghost(true),
);
ig.finish()
ig.build()
}

View File

@@ -766,8 +766,8 @@ pub fn define(insts: &InstructionGroup, immediates: &OperandKinds) -> TransformG
let mut groups = TransformGroups::new();
narrow.finish_and_add_to(&mut groups);
let expand_id = expand.finish_and_add_to(&mut groups);
narrow.build_and_add_to(&mut groups);
let expand_id = expand.build_and_add_to(&mut groups);
// Expansions using CPU flags.
let mut expand_flags = TransformGroupBuilder::new(
@@ -802,12 +802,12 @@ pub fn define(insts: &InstructionGroup, immediates: &OperandKinds) -> TransformG
],
);
expand_flags.finish_and_add_to(&mut groups);
expand_flags.build_and_add_to(&mut groups);
// XXX The order of declarations unfortunately matters to be compatible with the Python code.
// When it's all migrated, we can put this next to the narrow/expand finish_and_add_to calls
// When it's all migrated, we can put this next to the narrow/expand build_and_add_to calls
// above.
widen.finish_and_add_to(&mut groups);
widen.build_and_add_to(&mut groups);
groups
}

View File

@@ -160,5 +160,5 @@ pub fn define() -> SettingGroup {
true,
);
settings.finish()
settings.build()
}