From 4f187fdafdac0cf4a8b83964c89d79741dbd813e Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 21 Aug 2015 17:53:44 +0200 Subject: Adapt the PowerPC port to the new builtin representation. __builtin_get_spr() and __builtin_set_spr() work, but horrible error message if the SPR argument is not a constant. powerpc/AsmToJSON.ml needs updating. --- powerpc/Machregs.v | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'powerpc/Machregs.v') diff --git a/powerpc/Machregs.v b/powerpc/Machregs.v index 3b7cbb76..b9af652a 100644 --- a/powerpc/Machregs.v +++ b/powerpc/Machregs.v @@ -163,11 +163,9 @@ Fixpoint destroyed_by_clobber (cl: list string): list mreg := Definition destroyed_by_builtin (ef: external_function): list mreg := match ef with | EF_builtin _ _ => F13 :: nil - | EF_vload _ => nil - | EF_vstore _ => nil - | EF_vload_global _ _ _ => R11 :: nil - | EF_vstore_global Mint64 _ _ => R10 :: R11 :: R12 :: nil - | EF_vstore_global _ _ _ => R11 :: R12 :: nil + | EF_vload _ => R11 :: nil + | EF_vstore Mint64 => R10 :: R11 :: R12 :: nil + | EF_vstore _ => R11 :: R12 :: nil | EF_memcpy _ _ => R11 :: R12 :: F13 :: nil | EF_inline_asm txt sg clob => destroyed_by_clobber clob | _ => nil @@ -203,3 +201,23 @@ Definition two_address_op (op: operation) : bool := | Oroli _ _ => true | _ => false end. + +(* Constraints on constant propagation for builtins *) + +Definition builtin_get_spr := ident_of_string "__builtin_get_spr". +Definition builtin_set_spr := ident_of_string "__builtin_set_spr". + +Definition builtin_constraints (ef: external_function) : + list builtin_arg_constraint := + match ef with + | EF_builtin id sg => + if ident_eq id builtin_get_spr then OK_const :: nil + else if ident_eq id builtin_set_spr then OK_const :: OK_default :: nil + else nil + | EF_vload _ => OK_addrany :: nil + | EF_vstore _ => OK_addrany :: OK_default :: nil + | EF_memcpy _ _ => OK_addrstack :: OK_addrstack :: nil + | EF_annot txt targs => map (fun _ => OK_all) targs + | EF_debug kind txt targs => map (fun _ => OK_all) targs + | _ => nil + end. -- cgit From 75d50c12ee220fecf955b1626c78b78636cbca92 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 1 Sep 2015 16:44:29 +0200 Subject: Added the gcc builtin prefetch. This commit implements the gcc __builtin_prefetch in a form with all arguments for the powerpc architecture. The resulting instructions are the dcbt and dcbtst instructions in Server Category. --- powerpc/Machregs.v | 2 ++ 1 file changed, 2 insertions(+) (limited to 'powerpc/Machregs.v') diff --git a/powerpc/Machregs.v b/powerpc/Machregs.v index b9af652a..62a4a0a5 100644 --- a/powerpc/Machregs.v +++ b/powerpc/Machregs.v @@ -206,6 +206,7 @@ Definition two_address_op (op: operation) : bool := Definition builtin_get_spr := ident_of_string "__builtin_get_spr". Definition builtin_set_spr := ident_of_string "__builtin_set_spr". +Definition builtin_prefetch := ident_of_string "__builtin_prefetch". Definition builtin_constraints (ef: external_function) : list builtin_arg_constraint := @@ -213,6 +214,7 @@ Definition builtin_constraints (ef: external_function) : | EF_builtin id sg => if ident_eq id builtin_get_spr then OK_const :: nil else if ident_eq id builtin_set_spr then OK_const :: OK_default :: nil + else if ident_eq id builtin_prefetch then OK_addrany :: OK_const :: OK_const :: nil else nil | EF_vload _ => OK_addrany :: nil | EF_vstore _ => OK_addrany :: OK_default :: nil -- cgit From db8e35c6abf58c82853b94f416aa76b33efc1f65 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 2 Sep 2015 13:50:24 +0200 Subject: Added builtin for dcbtls THis commit adds a builtin function for the dcbtls instruction. Additionaly it changes the printing of the dcbt and dcbtst instruction to embedded mode and adds support for different address variants. --- powerpc/Machregs.v | 2 ++ 1 file changed, 2 insertions(+) (limited to 'powerpc/Machregs.v') diff --git a/powerpc/Machregs.v b/powerpc/Machregs.v index 62a4a0a5..14edb89d 100644 --- a/powerpc/Machregs.v +++ b/powerpc/Machregs.v @@ -207,6 +207,7 @@ Definition two_address_op (op: operation) : bool := Definition builtin_get_spr := ident_of_string "__builtin_get_spr". Definition builtin_set_spr := ident_of_string "__builtin_set_spr". Definition builtin_prefetch := ident_of_string "__builtin_prefetch". +Definition builtin_dcbtls := ident_of_string "__builtin_dcbtls". Definition builtin_constraints (ef: external_function) : list builtin_arg_constraint := @@ -215,6 +216,7 @@ Definition builtin_constraints (ef: external_function) : if ident_eq id builtin_get_spr then OK_const :: nil else if ident_eq id builtin_set_spr then OK_const :: OK_default :: nil else if ident_eq id builtin_prefetch then OK_addrany :: OK_const :: OK_const :: nil + else if ident_eq id builtin_dcbtls then OK_addrany::OK_const::nil else nil | EF_vload _ => OK_addrany :: nil | EF_vstore _ => OK_addrany :: OK_default :: nil -- cgit From cfee340dc514e2cfbc5df910f7aa687e78a54d41 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 2 Sep 2015 17:17:00 +0200 Subject: Added builtin for the icbtls instruction. This commit adds a builtin for the icbtls instruction. --- powerpc/Machregs.v | 2 ++ 1 file changed, 2 insertions(+) (limited to 'powerpc/Machregs.v') diff --git a/powerpc/Machregs.v b/powerpc/Machregs.v index 14edb89d..66d21021 100644 --- a/powerpc/Machregs.v +++ b/powerpc/Machregs.v @@ -208,6 +208,7 @@ Definition builtin_get_spr := ident_of_string "__builtin_get_spr". Definition builtin_set_spr := ident_of_string "__builtin_set_spr". Definition builtin_prefetch := ident_of_string "__builtin_prefetch". Definition builtin_dcbtls := ident_of_string "__builtin_dcbtls". +Definition builtin_icbtls := ident_of_string "__builtin_icbtls". Definition builtin_constraints (ef: external_function) : list builtin_arg_constraint := @@ -217,6 +218,7 @@ Definition builtin_constraints (ef: external_function) : else if ident_eq id builtin_set_spr then OK_const :: OK_default :: nil else if ident_eq id builtin_prefetch then OK_addrany :: OK_const :: OK_const :: nil else if ident_eq id builtin_dcbtls then OK_addrany::OK_const::nil + else if ident_eq id builtin_icbtls then OK_addrany::OK_const::nil else nil | EF_vload _ => OK_addrany :: nil | EF_vstore _ => OK_addrany :: OK_default :: nil -- cgit From c74211d87eb53cb310703dec2c504b26d7f24bdf Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 3 Sep 2015 13:22:28 +0200 Subject: Added builtin for mbar instruction. This commit adds a builtin function for the mbar instruction. --- powerpc/Machregs.v | 2 ++ 1 file changed, 2 insertions(+) (limited to 'powerpc/Machregs.v') diff --git a/powerpc/Machregs.v b/powerpc/Machregs.v index 66d21021..402f07d1 100644 --- a/powerpc/Machregs.v +++ b/powerpc/Machregs.v @@ -209,6 +209,7 @@ Definition builtin_set_spr := ident_of_string "__builtin_set_spr". Definition builtin_prefetch := ident_of_string "__builtin_prefetch". Definition builtin_dcbtls := ident_of_string "__builtin_dcbtls". Definition builtin_icbtls := ident_of_string "__builtin_icbtls". +Definition builtin_mbar := ident_of_string "__builtin_mbar". Definition builtin_constraints (ef: external_function) : list builtin_arg_constraint := @@ -219,6 +220,7 @@ Definition builtin_constraints (ef: external_function) : else if ident_eq id builtin_prefetch then OK_addrany :: OK_const :: OK_const :: nil else if ident_eq id builtin_dcbtls then OK_addrany::OK_const::nil else if ident_eq id builtin_icbtls then OK_addrany::OK_const::nil + else if ident_eq id builtin_mbar then OK_const::nil else nil | EF_vload _ => OK_addrany :: nil | EF_vstore _ => OK_addrany :: OK_default :: nil -- cgit