3030import java .util .List ;
3131import java .util .Map ;
3232import java .util .stream .Collectors ;
33- import java .util .stream .Stream ;
3433import vadl .cppCodeGen .FunctionCodeGenerator ;
3534import vadl .cppCodeGen .SymbolTable ;
3635import vadl .cppCodeGen .context .CGenContext ;
4342import vadl .gcb .valuetypes .TargetName ;
4443import vadl .gcb .valuetypes .VariantKind ;
4544import vadl .lcb .passes .llvmLowering .domain .LlvmLoweringRecord ;
46- import vadl .lcb .passes .llvmLowering .tablegen .model .tableGenOperand .TableGenInstructionOperand ;
47- import vadl .lcb .passes .llvmLowering .tablegen .model .tableGenOperand .tableGenParameter .TableGenParameterTypeAndName ;
4845import vadl .lcb .passes .relocation .GenerateLinkerComponentsPass ;
4946import vadl .utils .Pair ;
5047import vadl .viam .Format ;
@@ -423,12 +420,9 @@ private List<Pair<Format.Field, ExpressionNode>> reorderParameters(
423420
424421 var llvmRecord = ensureNonNull (machineInstructionRecords .get (instruction ),
425422 () -> Diagnostic .error ("Cannot find llvmRecord for instruction used in pseudo instruction" ,
426- instruction .sourceLocation ()));
423+ instruction .sourceLocation ()));
427424
428- var order = Stream .concat (
429- llvmRecord .info ().outputs ().stream ().map (op -> getFormatField (op , instruction )),
430- llvmRecord .info ().inputs ().stream ().map (op -> getFormatField (op , instruction ))
431- ).toList ();
425+ var order = llvmRecord .info ().outputInputOperandsFormatFields ();
432426
433427 for (var item : order ) {
434428 var l = ensureNonNull (lookup .get (item ),
@@ -440,20 +434,6 @@ private List<Pair<Format.Field, ExpressionNode>> reorderParameters(
440434 return result ;
441435 }
442436
443- private Format .Field getFormatField (TableGenInstructionOperand operand , Instruction instruction ) {
444- for (var field : instruction .format ().fields ()) {
445- if (field .identifier .simpleName ().equals (getParameterName (operand ))) {
446- return field ;
447- }
448- }
449- throw Diagnostic .error ("Cannot find format's field in pseudo instruction " ,
450- instruction .sourceLocation ()).build ();
451- }
452-
453- private String getParameterName (TableGenInstructionOperand operand ) {
454- return ((TableGenParameterTypeAndName ) operand .parameter ()).name ();
455- }
456-
457437 @ Override
458438 public String genFunctionSignature () {
459439 return "std::vector<MCInst> %sMCInstExpander::%s_%s" .formatted (targetName .value (),
0 commit comments