Project

General

Profile

« Previous | Next » 

Revision 695db4da

Added by Guillaume DAVY over 4 years ago

Ada: - Replace MStep and Mbranch output by Null to have compilable Ada.
- Correct pp_value to print state access when the variable is memory

View differences:

src/backends/Ada/ada_backend_common.ml
277 277
let pp_var_name fmt id =
278 278
  fprintf fmt "%a" pp_clean_ada_identifier id.var_id
279 279

  
280
(** Print the complete name of variable state.
281
   @param fmt the formater to print on
282
   @param var the variable
283
**)
284
let pp_access_var fmt var =
285
  fprintf fmt "%t.%a" pp_state_name pp_var_name var
286

  
280 287
(** Print a variable declaration
281 288
   @param mode input/output mode of the parameter
282 289
   @param pp_name a format printer wich print the variable name
......
519 526

  
520 527
  (** Printing function for values.
521 528

  
529
      @param m the machine to know the state variable
522 530
      @param fmt the formater to use
523 531
      @param value the value to print. Should be a
524 532
             {!type:Machine_code_types.value_t} value
525 533
   **)
526
  let rec pp_value fmt value =
534
  let rec pp_value m fmt value =
527 535
    match value.value_desc with
528 536
    | Cst c             -> pp_ada_const fmt c
529
    | Var var_name      -> pp_var_name fmt var_name
530
    | Fun (f_ident, vl) -> pp_basic_lib_fun pp_value f_ident fmt vl
537
    | Var var      ->
538
        if is_memory m var then
539
          pp_access_var fmt var
540
        else
541
          pp_var_name fmt var
542
    | Fun (f_ident, vl) -> pp_basic_lib_fun (pp_value m) f_ident fmt vl
531 543
    | _                 ->
532 544
      raise (Ada_not_supported
533 545
               "unsupported: Ada_backend.adb.pp_value does not support this value type")

Also available in: Unified diff