[meta] Generate full documentation for instructions in InstBuilder;
This commit is contained in:
@@ -97,7 +97,7 @@ pub struct InstructionContent {
|
||||
pub opcode_number: OpcodeNumber,
|
||||
|
||||
/// Documentation string.
|
||||
doc: String,
|
||||
pub doc: String,
|
||||
|
||||
/// Input operands. This can be a mix of SSA value operands and other operand kinds.
|
||||
pub operands_in: Vec<Operand>,
|
||||
@@ -162,16 +162,6 @@ impl Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn doc_comment_first_line(&self) -> &str {
|
||||
for line in self.doc.split("\n") {
|
||||
let stripped = line.trim();
|
||||
if stripped.len() > 0 {
|
||||
return stripped;
|
||||
}
|
||||
}
|
||||
""
|
||||
}
|
||||
|
||||
pub fn all_typevars(&self) -> Vec<&TypeVar> {
|
||||
match &self.polymorphic_info {
|
||||
Some(poly) => {
|
||||
|
||||
@@ -930,7 +930,7 @@ fn gen_inst_builder(inst: &Instruction, format: &InstructionFormat, fmt: &mut Fo
|
||||
rtype
|
||||
);
|
||||
|
||||
fmt.doc_comment(format!("`{}`\n\n{}", inst, inst.doc_comment_first_line()));
|
||||
fmt.doc_comment(&inst.doc);
|
||||
fmt.line("#[allow(non_snake_case)]");
|
||||
fmtln!(fmt, "fn {} {{", proto);
|
||||
fmt.indent(|fmt| {
|
||||
|
||||
Reference in New Issue
Block a user