[m-rev.] for post-commit review: foreign_proc attribute for livenes

Zoltan Somogyi zs at csse.unimelb.edu.au
Wed Jan 3 16:39:03 AEDT 2007


For post-commit review by Julien.

I looked for a section in the reference manual or user guide where the
new foreign_proc attribute should be documented, but I can't find one.
Instead, the documentation I found was full of references to `c_code'
pragmas, not `foreign_procs'.

Zoltan.

Eliminates names referring to `pragma c_code' in the LLDS backend in favor
of names referring to foreign_procs.

Add fields to structures representing the C code itself that says whether
or not the C code affects the liveness of lvals. This is intended as the basis
for future improvements in the optimization of such code.

Implement an extra foreign_proc attribute that allows programmers to set
the value of this field.

compiler/llds.m:
	Make the changes described above.

	Consistently put the field containing C code last in the function
	symbols that contain them.

compiler/prog_data.m:
	Make the changes described above.

	Rename some other function symbols to avoid ambiguity.

compiler/prog_io_pragma.m:
	Parse the new foreign_proc attribute.

compiler/pragma_c_gen.m:
	Rename the main predicates.

compiler/opt_util.m:
	Change some predicates into functions, for more convenient invocation.

compiler/livemap.m:
	Rename the predicates in this module to avoid ambiguity and the need
	for module qualification.

compiler/*.m:
	Conform to the changes above.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/basic_block.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/basic_block.m,v
retrieving revision 1.31
diff -u -b -r1.31 basic_block.m
--- compiler/basic_block.m	27 Dec 2006 03:22:26 -0000	1.31
+++ compiler/basic_block.m	30 Dec 2006 07:31:23 -0000
@@ -145,7 +145,7 @@
         ( list.last(BlockInstrs, LastInstr) ->
             LastInstr = LastUinstr - _,
             opt_util.possible_targets(LastUinstr, SideLabels, _SideCodeAddrs),
-            opt_util.can_instr_fall_through(LastUinstr, NextFallInto)
+            opt_util.can_instr_fall_through(LastUinstr) = NextFallInto
         ;
             SideLabels = [],
             NextFallInto = yes
@@ -174,7 +174,7 @@
     ( Uinstr0 = label(_) ->
         BlockInstrs = [],
         Rest = [Instr0 | Instrs0]
-    ; opt_util.can_instr_branch_away(Uinstr0, yes) ->
+    ; opt_util.can_instr_branch_away(Uinstr0) = yes ->
         BlockInstrs = [Instr0],
         Rest = Instrs0
     ;
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.167
diff -u -b -r1.167 code_gen.m
--- compiler/code_gen.m	1 Dec 2006 15:03:50 -0000	1.167
+++ compiler/code_gen.m	30 Dec 2006 04:05:02 -0000
@@ -250,7 +250,7 @@
             Args, ExtraArgs, MaybeTraceRuntimeCond, PragmaCode),
         Lang = get_foreign_language(Attributes),
         (   Lang = lang_c,
-            generate_pragma_c_code(CodeModel, Attributes,
+            generate_foreign_proc_code(CodeModel, Attributes,
                 PredId, ProcId, Args, ExtraArgs, MaybeTraceRuntimeCond,
                 PragmaCode, GoalInfo, Code, !CI)
         ;
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.338
diff -u -b -r1.338 code_info.m
--- compiler/code_info.m	19 Dec 2006 03:11:23 -0000	1.338
+++ compiler/code_info.m	30 Dec 2006 03:54:31 -0000
@@ -1911,18 +1911,18 @@
             % which is why we wrap the goal being committed across
             % inside MR_commit_{mark,cut}.
             Components = [
-                pragma_c_raw_code(
-                    "\t\tMR_save_transient_registers();\n",
-                    cannot_branch_away, live_lvals_info(set.init)),
-                pragma_c_raw_code(
-                    "\t\tMR_commit_mark();\n",
-                    cannot_branch_away, live_lvals_info(set.init)),
-                pragma_c_raw_code(
-                    "\t\tMR_restore_transient_registers();\n",
-                    cannot_branch_away, live_lvals_info(set.init))
+                foreign_proc_raw_code(cannot_branch_away,
+                    affects_liveness, live_lvals_info(set.init),
+                    "\t\tMR_save_transient_registers();\n"),
+                foreign_proc_raw_code(cannot_branch_away,
+                    doesnt_affect_liveness, live_lvals_info(set.init),
+                    "\t\tMR_commit_mark();\n"),
+                foreign_proc_raw_code(cannot_branch_away,
+                    affects_liveness, live_lvals_info(set.init),
+                    "\t\tMR_restore_transient_registers();\n")
             ],
             MarkCode = node([
-                pragma_c([], Components, proc_will_not_call_mercury,
+                foreign_proc_code([], Components, proc_will_not_call_mercury,
                     no, no, no, no, no, yes) - ""
             ])
         ;
@@ -1993,11 +1993,12 @@
             UseMinimalModel = yes,
             % See the comment in prepare_for_semi_commit above.
             Components = [
-                pragma_c_raw_code("\t\tMR_commit_cut();\n",
-                    cannot_branch_away, live_lvals_info(set.init))
+                foreign_proc_raw_code(cannot_branch_away,
+                    doesnt_affect_liveness, live_lvals_info(set.init),
+                    "\t\tMR_commit_cut();\n")
             ],
             CutCode = node([
-                pragma_c([], Components, proc_will_not_call_mercury,
+                foreign_proc_code([], Components, proc_will_not_call_mercury,
                     no, no, no, no, no, yes) - "commit for temp frame hijack"
             ])
         ;
Index: compiler/dupelim.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dupelim.m,v
retrieving revision 1.87
diff -u -b -r1.87 dupelim.m
--- compiler/dupelim.m	1 Dec 2006 15:03:55 -0000	1.87
+++ compiler/dupelim.m	30 Dec 2006 03:24:42 -0000
@@ -146,7 +146,7 @@
 
 add_pragma_pref_labels(Instr, !FoldFixed) :-
     (
-        Instr = pragma_c(_, _, _, MaybeFixedLabel, MaybeLayoutLabel,
+        Instr = foreign_proc_code(_, _, _, MaybeFixedLabel, MaybeLayoutLabel,
             MaybeOnlyLayoutLabel, _, _, _) - _
     ->
         (
@@ -350,7 +350,7 @@
         Instr1 = computed_goto(_, _),
         Instr = Instr1
     ;
-        Instr1 = arbitrary_c_code(_, _),
+        Instr1 = arbitrary_c_code(_, _, _),
         Instr = Instr1
     ;
         Instr1 = if_val(Rval1, CodeAddr),
@@ -426,7 +426,7 @@
         standardize_lval(Lval1, Lval),
         Instr = join_and_continue(Lval, Label)
     ;
-        Instr1 = pragma_c(_, _, _, _, _, _, _, _, _),
+        Instr1 = foreign_proc_code(_, _, _, _, _, _, _, _, _),
         Instr = Instr1
     ).
 
@@ -723,7 +723,7 @@
         ; Instr1 = label(_)
         ; Instr1 = goto(_)
         ; Instr1 = computed_goto(_, _)
-        ; Instr1 = arbitrary_c_code(_, _)
+        ; Instr1 = arbitrary_c_code(_, _, _)
         ; Instr1 = save_maxfr(_)
         ; Instr1 = restore_maxfr(_)
         ; Instr1 = discard_ticket
@@ -731,7 +731,7 @@
         ; Instr1 = incr_sp(_, _, _)
         ; Instr1 = decr_sp(_)
         ; Instr1 = decr_sp_and_return(_)
-        ; Instr1 = pragma_c(_, _, _, _, _, _, _, _, _)
+        ; Instr1 = foreign_proc_code(_, _, _, _, _, _, _, _, _)
         ; Instr1 = fork(_)
         ; Instr1 = init_sync_term(_, _)
         ; Instr1 = join_and_continue(_, _)
Index: compiler/dupproc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dupproc.m,v
retrieving revision 1.15
diff -u -b -r1.15 dupproc.m
--- compiler/dupproc.m	1 Nov 2006 02:31:05 -0000	1.15
+++ compiler/dupproc.m	30 Dec 2006 03:25:03 -0000
@@ -215,7 +215,7 @@
         standardize_labels(Targets, StdTargets, DupProcMap),
         StdInstr = computed_goto(Rval, StdTargets)
     ;
-        Instr = arbitrary_c_code(_, _),
+        Instr = arbitrary_c_code(_, _, _),
         StdInstr = Instr
     ;
         Instr = save_maxfr(_),
@@ -279,8 +279,9 @@
         standardize_label(Label, StdLabel, DupProcMap),
         StdInstr = join_and_continue(Lval, StdLabel)
     ;
-        Instr = pragma_c(_, _, _, _, _, _, _, _, _),
-        % The labels occurring in pragma_c instructions cannot be substituted.
+        Instr = foreign_proc_code(_, _, _, _, _, _, _, _, _),
+        % The labels occurring in foreign_proc_code instructions
+        % cannot be substituted.
         StdInstr = Instr
     ).
 
Index: compiler/exprn_aux.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/exprn_aux.m,v
retrieving revision 1.78
diff -u -b -r1.78 exprn_aux.m
--- compiler/exprn_aux.m	1 Nov 2006 02:31:05 -0000	1.78
+++ compiler/exprn_aux.m	30 Dec 2006 07:58:27 -0000
@@ -376,10 +376,10 @@
         transform_lval_in_rval(Transform, Rval0, Rval, !Acc),
         Uinstr = computed_goto(Rval, Labels)
     ;
-        Uinstr0 = arbitrary_c_code(Code, LiveLvals0),
+        Uinstr0 = arbitrary_c_code(AffectsLiveness, LiveLvals0, Code),
         transform_lval_in_live_lval_info(Transform, LiveLvals0, LiveLvals,
             !Acc),
-        Uinstr = arbitrary_c_code(Code, LiveLvals)
+        Uinstr = arbitrary_c_code(AffectsLiveness, LiveLvals, Code)
     ;
         Uinstr0 = if_val(Rval0, CodeAddr),
         transform_lval_in_rval(Transform, Rval0, Rval, !Acc),
@@ -431,12 +431,12 @@
 %       transform_lval_in_rval(Transform, Rval0, Rval, !Acc),
 %       Uinstr = discard_tickets_to(Rval)
     ;
-        Uinstr0 = pragma_c(Decls, Components0, MayCallMercury,
+        Uinstr0 = foreign_proc_code(Decls, Components0, MayCallMercury,
             MaybeLabel1, MaybeLabel2, MaybeLabel3, MaybeLabel4,
             ReferStackSlot, MayDupl),
         list.map_foldl(transform_lval_in_component(Transform),
             Components0, Components, !Acc),
-        Uinstr = pragma_c(Decls, Components, MayCallMercury,
+        Uinstr = foreign_proc_code(Decls, Components, MayCallMercury,
             MaybeLabel1, MaybeLabel2, MaybeLabel3, MaybeLabel4,
             ReferStackSlot, MayDupl)
     ;
@@ -450,31 +450,34 @@
     ).
 
 :- pred transform_lval_in_component(transform_lval(T)::in(transform_lval),
-    pragma_c_component::in, pragma_c_component::out, T::in, T::out) is det.
+    foreign_proc_component::in, foreign_proc_component::out, T::in, T::out)
+    is det.
 
 transform_lval_in_component(Transform, Component0, Component, !Acc) :-
     (
-        Component0 = pragma_c_inputs(Inputs0),
-        list.map_foldl(transform_lval_in_pragma_c_input(Transform),
+        Component0 = foreign_proc_inputs(Inputs0),
+        list.map_foldl(transform_lval_in_foreign_proc_input(Transform),
             Inputs0, Inputs, !Acc),
-        Component = pragma_c_inputs(Inputs)
+        Component = foreign_proc_inputs(Inputs)
     ;
-        Component0 = pragma_c_outputs(Outputs0),
-        list.map_foldl(transform_lval_in_pragma_c_output(Transform),
+        Component0 = foreign_proc_outputs(Outputs0),
+        list.map_foldl(transform_lval_in_foreign_proc_output(Transform),
             Outputs0, Outputs, !Acc),
-        Component = pragma_c_outputs(Outputs)
+        Component = foreign_proc_outputs(Outputs)
     ;
-        Component0 = pragma_c_user_code(_, _),
+        Component0 = foreign_proc_user_code(_, _, _),
         Component = Component0
     ;
-        Component0 = pragma_c_raw_code(Code, CanBranchAway, LvalSet0),
+        Component0 = foreign_proc_raw_code(CanBranchAway, AffectsLiveness,
+            LvalSet0, Code),
         transform_lval_in_live_lval_info(Transform, LvalSet0, LvalSet, !Acc),
-        Component = pragma_c_raw_code(Code, CanBranchAway, LvalSet)
+        Component = foreign_proc_raw_code(CanBranchAway, AffectsLiveness,
+            LvalSet, Code)
     ;
-        Component0 = pragma_c_fail_to(_),
+        Component0 = foreign_proc_fail_to(_),
         Component = Component0
     ;
-        Component0 = pragma_c_noop,
+        Component0 = foreign_proc_noop,
         Component = Component0
     ).
 
@@ -489,24 +492,26 @@
     list.map_foldl(Transform, Lvals0, Lvals, !Acc),
     set.list_to_set(Lvals, LvalSet).
 
-:- pred transform_lval_in_pragma_c_input(transform_lval(T)::in(transform_lval),
-    pragma_c_input::in, pragma_c_input::out, T::in, T::out) is det.
+:- pred transform_lval_in_foreign_proc_input(
+    transform_lval(T)::in(transform_lval),
+    foreign_proc_input::in, foreign_proc_input::out, T::in, T::out) is det.
 
-transform_lval_in_pragma_c_input(Transform, Out0, Out, !Acc) :-
-    Out0 = pragma_c_input(Name, VarType, IsDummy, OrigType, Rval0,
+transform_lval_in_foreign_proc_input(Transform, Out0, Out, !Acc) :-
+    Out0 = foreign_proc_input(Name, VarType, IsDummy, OrigType, Rval0,
         MaybeForeign, BoxPolicy),
     transform_lval_in_rval(Transform, Rval0, Rval, !Acc),
-    Out = pragma_c_input(Name, VarType, IsDummy, OrigType, Rval,
+    Out = foreign_proc_input(Name, VarType, IsDummy, OrigType, Rval,
         MaybeForeign, BoxPolicy).
 
-:- pred transform_lval_in_pragma_c_output(transform_lval(T)::in(transform_lval),
-    pragma_c_output::in, pragma_c_output::out, T::in, T::out) is det.
+:- pred transform_lval_in_foreign_proc_output(
+    transform_lval(T)::in(transform_lval),
+    foreign_proc_output::in, foreign_proc_output::out, T::in, T::out) is det.
 
-transform_lval_in_pragma_c_output(Transform, Out0, Out, !Acc) :-
-    Out0 = pragma_c_output(Lval0, VarType, IsDummy, OrigType, Name,
+transform_lval_in_foreign_proc_output(Transform, Out0, Out, !Acc) :-
+    Out0 = foreign_proc_output(Lval0, VarType, IsDummy, OrigType, Name,
         MaybeForeign, BoxPolicy),
     Transform(Lval0, Lval, !Acc),
-    Out = pragma_c_output(Lval, VarType, IsDummy, OrigType, Name,
+    Out = foreign_proc_output(Lval, VarType, IsDummy, OrigType, Name,
         MaybeForeign, BoxPolicy).
 
 transform_lval_in_rval(Transform, Rval0, Rval, !Acc) :-
Index: compiler/frameopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/frameopt.m,v
retrieving revision 1.109
diff -u -b -r1.109 frameopt.m
--- compiler/frameopt.m	11 Dec 2006 04:10:40 -0000	1.109
+++ compiler/frameopt.m	30 Dec 2006 07:32:00 -0000
@@ -521,7 +521,7 @@
     % This is the only situation in which the base case can be reached.
 divide_into_basic_blocks([Instr0 | Instrs0], ProcLabel, Instrs, !C) :-
     Instr0 = Uinstr0 - _Comment,
-    ( opt_util.can_instr_branch_away(Uinstr0, yes) ->
+    ( opt_util.can_instr_branch_away(Uinstr0) = yes ->
         (
             Instrs0 = [Instr1 | _],
             ( Instr1 = label(_) - _ ->
@@ -738,8 +738,8 @@
                 [], no, ordinary_block(NeedsFrame, is_not_dummy)),
             ( list.last(BlockInstrs, LastBlockInstr) ->
                 LastBlockInstr = LastBlockUinstr - _,
-                opt_util.can_instr_fall_through(LastBlockUinstr,
-                    NextFallIntoBool),
+                NextFallIntoBool =
+                    opt_util.can_instr_fall_through(LastBlockUinstr),
                 (
                     NextFallIntoBool = yes,
                     NextFallInto = yes(Label)
@@ -1085,10 +1085,10 @@
             ;
                 Uinstr = mkframe(_, _)
             ;
-                Uinstr = arbitrary_c_code(_, _)
+                Uinstr = arbitrary_c_code(_, _, _)
             ;
-                Uinstr = pragma_c(_, _, MayCallMercury, _, MaybeLayout,
-                    MaybeOnlyLayout, _, NeedStack, _),
+                Uinstr = foreign_proc_code(_, _, MayCallMercury, _,
+                    MaybeLayout, MaybeOnlyLayout, _, NeedStack, _),
                 (
                     MayCallMercury = proc_may_call_mercury
                 ;
@@ -1194,25 +1194,34 @@
         list.split_last_det(BlockInstrs0, AllButLastInstrs, LastInstr0)
     ->
         LastInstr0 = LastUinstr0 - Comment,
-        ( LastUinstr0 = goto(GotoTarget0) ->
+        (
+            LastUinstr0 = goto(GotoTarget0)
+        ->
             replace_labels_code_addr(GotoTarget0, PreExitDummyLabelMap,
                 GotoTarget),
             LastUinstr = goto(GotoTarget),
             LastInstr = LastUinstr - Comment,
             BlockInstrs = AllButLastInstrs ++ [LastInstr]
-        ; LastUinstr0 = if_val(Rval, GotoTarget0) ->
+        ;
+            LastUinstr0 = if_val(Rval, GotoTarget0)
+        ->
             replace_labels_code_addr(GotoTarget0, PreExitDummyLabelMap,
                 GotoTarget),
             LastUinstr = if_val(Rval, GotoTarget),
             LastInstr = LastUinstr - Comment,
             BlockInstrs = AllButLastInstrs ++ [LastInstr]
-        ; LastUinstr0 = computed_goto(Rval, GotoTargets0) ->
+        ;
+            LastUinstr0 = computed_goto(Rval, GotoTargets0)
+        ->
             replace_labels_label_list(GotoTargets0, PreExitDummyLabelMap,
                 GotoTargets),
             LastUinstr = computed_goto(Rval, GotoTargets),
             LastInstr = LastUinstr - Comment,
             BlockInstrs = AllButLastInstrs ++ [LastInstr]
-        ; LastUinstr0 = pragma_c(D, Comps0, MC, FNL, FL, FOL, NF0, S, MD) ->
+        ;
+            LastUinstr0 = foreign_proc_code(D, Comps0, MC, FNL, FL, FOL, NF0,
+                S, MD)
+        ->
             (
                 NF0 = no,
                 NF = no,
@@ -1223,7 +1232,8 @@
                 NF = yes(NFLabel),
                 replace_labels_comps(Comps0, PreExitDummyLabelMap, Comps)
             ),
-            LastUinstr = pragma_c(D, Comps, MC, FNL, FL, FOL, NF, S, MD),
+            LastUinstr = foreign_proc_code(D, Comps, MC, FNL, FL, FOL, NF,
+                S, MD),
             LastInstr = LastUinstr - Comment,
             BlockInstrs = AllButLastInstrs ++ [LastInstr]
         ;
@@ -1233,7 +1243,7 @@
         possible_targets(LastUinstr, SideLabels0, _SideCodeAddrs),
         list.filter(local_label(ProcLabel), SideLabels0, SideLabels),
         (
-            opt_util.can_instr_fall_through(LastUinstr, yes),
+            opt_util.can_instr_fall_through(LastUinstr) = yes,
             FollowingLabels = [NextLabel | _]
         ->
             MaybeFallThrough = yes(NextLabel)
@@ -1341,8 +1351,9 @@
         (
             Uinstr = llcall(_, _, _, _, _, _)
         ;
-            % Only may_call_mercury pragma_c's can clobber succip.
-            Uinstr = pragma_c(_, _, proc_may_call_mercury, _, _, _, _, _, _)
+            % Only may_call_mercury foreign_proc_codes can clobber succip.
+            Uinstr = foreign_proc_code(_, _, proc_may_call_mercury,
+                _, _, _, _, _, _)
         )
     ->
         CanClobberSuccip = yes
Index: compiler/global_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/global_data.m,v
retrieving revision 1.28
diff -u -b -r1.28 global_data.m
--- compiler/global_data.m	1 Dec 2006 15:03:56 -0000	1.28
+++ compiler/global_data.m	30 Dec 2006 03:32:43 -0000
@@ -917,9 +917,9 @@
         Instr  = if_val(Rval, CodeAddr),
         Rval = remap_rval(Remap, Rval0)
     ;
-        Instr0 = pragma_c(A, Comps0, B, C, D, E, F, G, H),
-        Instr  = pragma_c(A, Comps,  B, C, D, E, F, G, H),
-        Comps = list.map(remap_pragma_c_component(Remap), Comps0)
+        Instr0 = foreign_proc_code(A, Comps0, B, C, D, E, F, G, H),
+        Instr  = foreign_proc_code(A, Comps,  B, C, D, E, F, G, H),
+        Comps = list.map(remap_foreign_proc_component(Remap), Comps0)
     ;
         ( Instr0 = comment(_)
         ; Instr0 = livevals(_)
@@ -928,7 +928,7 @@
         ; Instr0 = label(_)
         ; Instr0 = goto(_)
         ; Instr0 = computed_goto(_, _)
-        ; Instr0 = arbitrary_c_code(_, _)
+        ; Instr0 = arbitrary_c_code(_, _, _)
         ; Instr0 = save_maxfr(_)
         ; Instr0 = restore_maxfr(_)
         ; Instr0 = incr_hp(_, _, _, _, _, _)
@@ -951,39 +951,39 @@
         Instr = Instr0
     ).
 
-:- func remap_pragma_c_component(static_cell_remap_info, pragma_c_component)
-    = pragma_c_component.
+:- func remap_foreign_proc_component(static_cell_remap_info,
+        foreign_proc_component) = foreign_proc_component.
 
-remap_pragma_c_component(Remap, Comp0) = Comp :-
+remap_foreign_proc_component(Remap, Comp0) = Comp :-
     (
-        Comp0 = pragma_c_inputs(Inputs0),
-        Comp  = pragma_c_inputs(Inputs),
-        Inputs = list.map(remap_pragma_c_input(Remap), Inputs0) 
-    ;
-        Comp0 = pragma_c_outputs(Outputs0),
-        Comp  = pragma_c_outputs(Outputs),
-        Outputs = list.map(remap_pragma_c_output(Remap), Outputs0)
-    ;
-        ( Comp0 = pragma_c_raw_code(_, _, _)
-        ; Comp0 = pragma_c_user_code(_, _)
-        ; Comp0 = pragma_c_fail_to(_)
-        ; Comp0 = pragma_c_noop
+        Comp0 = foreign_proc_inputs(Inputs0),
+        Comp  = foreign_proc_inputs(Inputs),
+        Inputs = list.map(remap_foreign_proc_input(Remap), Inputs0) 
+    ;
+        Comp0 = foreign_proc_outputs(Outputs0),
+        Comp  = foreign_proc_outputs(Outputs),
+        Outputs = list.map(remap_foreign_proc_output(Remap), Outputs0)
+    ;
+        ( Comp0 = foreign_proc_raw_code(_, _, _, _)
+        ; Comp0 = foreign_proc_user_code(_, _, _)
+        ; Comp0 = foreign_proc_fail_to(_)
+        ; Comp0 = foreign_proc_noop
         ),
         Comp = Comp0
     ).
 
-:- func remap_pragma_c_input(static_cell_remap_info, pragma_c_input)
-    = pragma_c_input.
+:- func remap_foreign_proc_input(static_cell_remap_info, foreign_proc_input)
+    = foreign_proc_input.
 
-remap_pragma_c_input(Remap, pragma_c_input(A, B, C, D, Rval0, E, F))
-    = pragma_c_input(A, B, C, D, Rval, E, F) :-
+remap_foreign_proc_input(Remap, foreign_proc_input(A, B, C, D, Rval0, E, F))
+        = foreign_proc_input(A, B, C, D, Rval, E, F) :-
     Rval = remap_rval(Remap, Rval0).
 
-:- func remap_pragma_c_output(static_cell_remap_info, pragma_c_output)
-    = pragma_c_output.
+:- func remap_foreign_proc_output(static_cell_remap_info, foreign_proc_output)
+    = foreign_proc_output.
 
-remap_pragma_c_output(Remap, pragma_c_output(Lval0, A, B, C, D, E, F))
-    = pragma_c_output(Lval, A, B, C, D, E, F) :-
+remap_foreign_proc_output(Remap, foreign_proc_output(Lval0, A, B, C, D, E, F))
+        = foreign_proc_output(Lval, A, B, C, D, E, F) :-
     Lval = remap_lval(Remap, Lval0).
 
 :- func remap_lval(static_cell_remap_info, lval) = lval.
@@ -1088,21 +1088,17 @@
     Remap = static_cell_remap_info(TypeNumRemap, ScalarCellGroupRemap),
     (
         DataName0 = scalar_common_ref(TypeNum0, _Offset),
-        (if
-            map.contains(TypeNumRemap, TypeNum0)
-        then
-            DataName = ScalarCellGroupRemap ^ det_elem(TypeNum0)
-                                            ^ det_elem(DataName0)
-        else
+        ( map.contains(TypeNumRemap, TypeNum0) ->
+            map.lookup(ScalarCellGroupRemap, TypeNum0, ScalarCellGroup),
+            map.lookup(ScalarCellGroup, DataName0, DataName)
+        ;
             DataName = DataName0
         )
     ;
         DataName0 = vector_common_ref(TypeNum0, Offset),
-        (if
-            map.search(TypeNumRemap, TypeNum0, TypeNum)
-        then
+        ( map.search(TypeNumRemap, TypeNum0, TypeNum) ->
             DataName = vector_common_ref(TypeNum, Offset)
-        else
+        ;
             DataName = DataName0
         )
     ;
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.419
diff -u -b -r1.419 hlds_out.m
--- compiler/hlds_out.m	3 Jan 2007 05:17:04 -0000	1.419
+++ compiler/hlds_out.m	3 Jan 2007 05:17:28 -0000
@@ -1998,13 +1998,13 @@
         io.write_string(Later, !IO),
         io.write_string("""), ", !IO),
         (
-            Treat = share,
+            Treat = shared_code_share,
             io.write_string("shared_code(""", !IO)
         ;
-            Treat = duplicate,
+            Treat = shared_code_duplicate,
             io.write_string("duplicated_code(""", !IO)
         ;
-            Treat = automatic,
+            Treat = shared_code_automatic,
             io.write_string("common_code(""", !IO)
         ),
         io.write_string(Shared, !IO),
Index: compiler/ite_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ite_gen.m,v
retrieving revision 1.94
diff -u -b -r1.94 ite_gen.m
--- compiler/ite_gen.m	15 Oct 2006 23:26:41 -0000	1.94
+++ compiler/ite_gen.m	30 Dec 2006 06:47:46 -0000
@@ -444,31 +444,31 @@
         ),
 
         PNegCondComponents = [
-            pragma_c_raw_code(
-                wrap_transient("\t\tMR_pneg_enter_cond();\n"),
-                cannot_branch_away, live_lvals_info(set.init))
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                live_lvals_info(set.init),
+                wrap_transient("\t\tMR_pneg_enter_cond();\n"))
         ],
         PNegThenComponents = [
-            pragma_c_raw_code(
-                wrap_transient("\t\tMR_pneg_enter_then();\n"),
-                cannot_branch_away, live_lvals_info(set.init))
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                live_lvals_info(set.init),
+                wrap_transient("\t\tMR_pneg_enter_then();\n"))
         ],
         PNegElseComponents = [
-            pragma_c_raw_code(
-                wrap_transient("\t\tMR_pneg_enter_else(" ++ CtxtStr ++ ");\n"),
-                cannot_branch_away, live_lvals_info(set.init))
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                live_lvals_info(set.init),
+                wrap_transient("\t\tMR_pneg_enter_else(" ++ CtxtStr ++ ");\n"))
         ],
         PNegCondCode = node([
-            pragma_c([], PNegCondComponents, proc_will_not_call_mercury,
-                no, no, no, no, yes, yes) - ""
+            foreign_proc_code([], PNegCondComponents,
+                proc_will_not_call_mercury, no, no, no, no, yes, yes) - ""
         ]),
         PNegThenCode = node([
-            pragma_c([], PNegThenComponents, proc_will_not_call_mercury,
-                no, no, no, no, yes, yes) - ""
+            foreign_proc_code([], PNegThenComponents,
+                proc_will_not_call_mercury, no, no, no, no, yes, yes) - ""
         ]),
         PNegElseCode = node([
-            pragma_c([], PNegElseComponents, proc_will_not_call_mercury,
-                no, no, no, no, yes, yes) - ""
+            foreign_proc_code([], PNegElseComponents,
+                proc_will_not_call_mercury, no, no, no, no, yes, yes) - ""
         ])
     ;
         PNegCondCode = empty,
Index: compiler/jumpopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/jumpopt.m,v
retrieving revision 1.98
diff -u -b -r1.98 jumpopt.m
--- compiler/jumpopt.m	7 Dec 2006 06:23:02 -0000	1.98
+++ compiler/jumpopt.m	30 Dec 2006 07:32:10 -0000
@@ -477,7 +477,7 @@
                     TargetInstr, DestInstr),
                 DestInstr = UdestInstr - _Destcomment,
                 Shorted = "shortcircuited jump: " ++ Comment0,
-                opt_util.can_instr_fall_through(UdestInstr, Canfallthrough),
+                opt_util.can_instr_fall_through(UdestInstr) = Canfallthrough,
                 (
                     Canfallthrough = no,
                     NewInstrs0 = [UdestInstr - Shorted]
@@ -693,11 +693,11 @@
             NewRemain = usual_case
         )
     ;
-        Uinstr0 = pragma_c(Decls, Components0, MayCallMercury,
+        Uinstr0 = foreign_proc_code(Decls, Components0, MayCallMercury,
             MaybeFixNoLayout, MaybeFixLayout, MaybeFixOnlyLayout,
             MaybeNoFix0, StackSlotRef, MaybeDup),
         some [!Redirect] (
-            list.map_foldl(short_pragma_component(Instrmap),
+            list.map_foldl(short_foreign_proc_component(Instrmap),
                 Components0, Components, no, !:Redirect),
             (
                 MaybeNoFix0 = yes(NoFix),
@@ -709,16 +709,16 @@
                 MaybeNoFix = no
             ),
 % These sanity checks are too strong, because we don't prohibit labels
-% appearing these slots of pragma_c instructions from appearing in Instrmap;
-% we only prohibit the use of those entries in Instrmap to optimize away these
-% labels.
+% appearing these slots of foreign_proc_code instructions from appearing
+% in Instrmap; we only prohibit the use of those entries in Instrmap
+% to optimize away these labels.
 %
 %           (
 %               MaybeFixNoLayout = yes(FixNoLayout),
 %               short_label(Instrmap, FixNoLayout, FixNoLayoutDest),
 %               FixNoLayoutDest \= FixNoLayout
 %           ->
-%               error("jump_opt_instr_list: pragma_c fix_no_layout")
+%               error("jump_opt_instr_list: foreign_proc_code fix_no_layout")
 %           ;
 %               true
 %           ),
@@ -727,7 +727,7 @@
 %               short_label(Instrmap, FixLayout, FixLayoutDest),
 %               FixLayoutDest \= FixLayout
 %           ->
-%               error("jump_opt_instr_list: pragma_c fix_layout")
+%               error("jump_opt_instr_list: foreign_proc_code fix_layout")
 %           ;
 %               true
 %           ),
@@ -736,7 +736,7 @@
 %               short_label(Instrmap, FixOnlyLayout, FixOnlyLayoutDest),
 %               FixOnlyLayoutDest \= FixOnlyLayout
 %           ->
-%               error("jump_opt_instr_list: pragma_c fix_only_layout")
+%               error("jump_opt_instr_list: foreign_proc_code fix_only_layout")
 %           ;
 %               true
 %           ),
@@ -746,7 +746,7 @@
             ;
                 !.Redirect = yes,
                 Comment = Comment0 ++ " (some redirects)",
-                Uinstr = pragma_c(Decls, Components, MayCallMercury,
+                Uinstr = foreign_proc_code(Decls, Components, MayCallMercury,
                     MaybeFixNoLayout, MaybeFixLayout, MaybeFixOnlyLayout,
                     MaybeNoFix, StackSlotRef, MaybeDup),
                 Instr = Uinstr - Comment,
@@ -781,7 +781,7 @@
             NewRemain = specified([Instr], Instrs0)
         )
     ;
-        ( Uinstr0 = arbitrary_c_code(_, _)
+        ( Uinstr0 = arbitrary_c_code(_, _, _)
         ; Uinstr0 = comment(_)
         ; Uinstr0 = livevals(_)
         ; Uinstr0 = label(_)
@@ -852,14 +852,14 @@
 :- func instr_may_be_duplicated(instr) = bool.
 
 instr_may_be_duplicated(Instr) = InstrMayBeDuplicated :-
-    ( Instr ^ pragma_c_fix_onlylayout = yes(_) ->
+    ( Instr ^ fproc_fix_onlylayout = yes(_) ->
         % This instruction is a trace event. Duplicating it would
         % increase code size, and may cost more in locality than
         % the benefit represented by the elimination of the jump.
         % When debugging is enabled, size is in any case more important
         % than the last bit of speed.
         InstrMayBeDuplicated = no
-    ; Instr ^ pragma_c_maybe_dupl = no ->
+    ; Instr ^ fproc_maybe_dupl = no ->
         InstrMayBeDuplicated = no
     ;
         InstrMayBeDuplicated = yes
@@ -1076,30 +1076,30 @@
 jumpopt.short_labels_lval(_, lvar(_), _) :-
     unexpected(this_file, "lvar lval in short_labels_lval").
 
-:- pred short_pragma_component(instrmap::in,
-    pragma_c_component::in, pragma_c_component::out,
+:- pred short_foreign_proc_component(instrmap::in,
+    foreign_proc_component::in, foreign_proc_component::out,
     bool::in, bool::out) is det.
 
-short_pragma_component(Instrmap, !Component, !Redirect) :-
+short_foreign_proc_component(Instrmap, !Component, !Redirect) :-
     (
-        !.Component = pragma_c_inputs(_)
+        !.Component = foreign_proc_inputs(_)
     ;
-        !.Component = pragma_c_outputs(_)
+        !.Component = foreign_proc_outputs(_)
     ;
-        !.Component = pragma_c_user_code(_, _)
+        !.Component = foreign_proc_user_code(_, _, _)
     ;
-        !.Component = pragma_c_raw_code(_, _, _)
+        !.Component = foreign_proc_raw_code(_, _, _, _)
     ;
-        !.Component = pragma_c_fail_to(Label0),
+        !.Component = foreign_proc_fail_to(Label0),
         short_label(Instrmap, Label0, Label),
-        !:Component = pragma_c_fail_to(Label),
+        !:Component = foreign_proc_fail_to(Label),
         ( Label = Label0 ->
             true
         ;
             !:Redirect = yes
         )
     ;
-        !.Component = pragma_c_noop
+        !.Component = foreign_proc_noop
     ).
 
 %-----------------------------------------------------------------------------%
Index: compiler/labelopt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/labelopt.m,v
retrieving revision 1.34
diff -u -b -r1.34 labelopt.m
--- compiler/labelopt.m	15 Oct 2006 23:26:42 -0000	1.34
+++ compiler/labelopt.m	30 Dec 2006 07:32:18 -0000
@@ -127,7 +127,7 @@
             !.Fallthrough = no,
             eliminate_instr(Instr0, no, !RevInstrs, !Mod)
         ),
-        opt_util.can_instr_fall_through(Uinstr0, Canfallthrough),
+        opt_util.can_instr_fall_through(Uinstr0) = Canfallthrough,
         (
             Canfallthrough = yes
         ;
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.84
diff -u -b -r1.84 layout_out.m
--- compiler/layout_out.m	3 Jan 2007 05:17:06 -0000	1.84
+++ compiler/layout_out.m	3 Jan 2007 05:17:28 -0000
@@ -830,8 +830,8 @@
 trace_port_to_string(port_neg_failure) =         "NEG_FAILURE".
 trace_port_to_string(port_disj) =                "DISJ".
 trace_port_to_string(port_switch) =              "SWITCH".
-trace_port_to_string(port_nondet_pragma_first) = "PRAGMA_FIRST".
-trace_port_to_string(port_nondet_pragma_later) = "PRAGMA_LATER".
+trace_port_to_string(port_nondet_foreign_proc_first) = "FOREIGN_PROC_FIRST".
+trace_port_to_string(port_nondet_foreign_proc_later) = "FOREIGN_PROC_LATER".
 trace_port_to_string(port_user) =                "USER".
 
 %-----------------------------------------------------------------------------%
Index: compiler/livemap.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/livemap.m,v
retrieving revision 1.82
diff -u -b -r1.82 livemap.m
--- compiler/livemap.m	1 Nov 2006 02:31:07 -0000	1.82
+++ compiler/livemap.m	30 Dec 2006 07:32:35 -0000
@@ -33,7 +33,7 @@
     %
     % We can compute this set only if the procedure contains no C code.
     %
-:- pred livemap.build(list(instruction)::in, maybe(livemap)::out) is det.
+:- pred build_livemap(list(instruction)::in, maybe(livemap)::out) is det.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -42,6 +42,7 @@
 
 :- import_module libs.compiler_util.
 :- import_module ll_backend.opt_util.
+:- import_module parse_tree.prog_data.
 
 :- import_module bool.
 :- import_module pair.
@@ -62,24 +63,24 @@
     % scan, this time with more knowledge about more labels, until we
     % get to a fixpoint.
 
-livemap.build(Instrs, MaybeLivemap) :-
+build_livemap(Instrs, MaybeLivemap) :-
     map.init(Livemap0),
     list.reverse(Instrs, BackInstrs),
-    livemap.build_2(BackInstrs, Livemap0, MaybeLivemap).
+    build_livemap_fixpoint(BackInstrs, Livemap0, MaybeLivemap).
 
-:- pred livemap.build_2(list(instruction)::in, livemap::in,
+:- pred build_livemap_fixpoint(list(instruction)::in, livemap::in,
     maybe(livemap)::out) is det.
 
-livemap.build_2(Backinstrs, Livemap0, MaybeLivemap) :-
+build_livemap_fixpoint(Backinstrs, Livemap0, MaybeLivemap) :-
     set.init(Livevals0),
-    livemap.build_livemap(Backinstrs, Livevals0, no, ContainsUserCode,
+    livemap_do_build(Backinstrs, Livevals0, no, ContainsBadUserCode,
         Livemap0, Livemap1),
-    ( ContainsUserCode = yes ->
+    ( ContainsBadUserCode = yes ->
         MaybeLivemap = no
     ; livemap.equal_livemaps(Livemap0, Livemap1) ->
         MaybeLivemap = yes(Livemap1)
     ;
-        livemap.build_2(Backinstrs, Livemap1, MaybeLivemap)
+        build_livemap_fixpoint(Backinstrs, Livemap1, MaybeLivemap)
     ).
 
     % Check whether the two livemaps agree on the set of live lvals
@@ -89,22 +90,22 @@
     % The domain of Livemap2 should always be every label in the procedure.
     % as should the domain of Livemap1 in every call after the first.
     %
-:- pred livemap.equal_livemaps(livemap::in, livemap::in) is semidet.
+:- pred equal_livemaps(livemap::in, livemap::in) is semidet.
 
-livemap.equal_livemaps(Livemap1, Livemap2) :-
+equal_livemaps(Livemap1, Livemap2) :-
     map.keys(Livemap1, Labels),
     map.keys(Livemap2, Labels),
     livemap.equal_livemaps_keys(Labels, Livemap1, Livemap2).
 
-:- pred livemap.equal_livemaps_keys(list(label)::in, livemap::in, livemap::in)
+:- pred equal_livemaps_keys(list(label)::in, livemap::in, livemap::in)
     is semidet.
 
-livemap.equal_livemaps_keys([], _Livemap1, _Livemap2).
-livemap.equal_livemaps_keys([Label | Labels], Livemap1, Livemap2) :-
+equal_livemaps_keys([], _Livemap1, _Livemap2).
+equal_livemaps_keys([Label | Labels], Livemap1, Livemap2) :-
     map.lookup(Livemap1, Label, Liveset1),
     map.lookup(Livemap2, Label, Liveset2),
     set.equal(Liveset1, Liveset2),
-    livemap.equal_livemaps_keys(Labels, Livemap1, Livemap2).
+    equal_livemaps_keys(Labels, Livemap1, Livemap2).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -112,21 +113,21 @@
     % Build up a map of what lvals are live at each label.
     % The input instruction sequence is reversed.
     %
-:- pred livemap.build_livemap(list(instruction)::in, lvalset::in,
+:- pred livemap_do_build(list(instruction)::in, lvalset::in,
     bool::in, bool::out, livemap::in, livemap::out) is det.
 
-livemap.build_livemap([], _, !ContainsUserCode, !Livemap).
-livemap.build_livemap([Instr0 | Instrs0], Livevals0,
-        !ContainsUserCode, !Livemap) :-
-    livemap.build_livemap_instr(Instr0, Instrs0, Instrs1,
-        Livevals0, Livevals1, !ContainsUserCode, !Livemap),
-    livemap.build_livemap(Instrs1, Livevals1, !ContainsUserCode, !Livemap).
+livemap_do_build([], _, !ContainsBadUserCode, !Livemap).
+livemap_do_build([Instr0 | Instrs0], Livevals0,
+        !ContainsBadUserCode, !Livemap) :-
+    livemap_do_build_instr(Instr0, Instrs0, Instrs1,
+        Livevals0, Livevals1, !ContainsBadUserCode, !Livemap),
+    livemap_do_build(Instrs1, Livevals1, !ContainsBadUserCode, !Livemap).
 
-:- pred livemap.build_livemap_instr(instruction::in, list(instruction)::in,
+:- pred livemap_do_build_instr(instruction::in, list(instruction)::in,
     list(instruction)::out, lvalset::in, lvalset::out,
     bool::in, bool::out, livemap::in, livemap::out) is det.
 
-livemap.build_livemap_instr(Instr0, !Instrs, !Livevals, !ContainsUserCode,
+livemap_do_build_instr(Instr0, !Instrs, !Livevals, !ContainsBadUserCode,
         !Livemap) :-
     Instr0 = Uinstr0 - _,
     (
@@ -161,13 +162,13 @@
         map.set(!.Livemap, Label, !.Livevals, !:Livemap)
     ;
         Uinstr0 = goto(CodeAddr),
-        opt_util.livevals_addr(CodeAddr, LivevalsNeeded),
+        LivevalsNeeded = opt_util.livevals_addr(CodeAddr),
         livemap.look_for_livevals(!Instrs, !Livevals, "goto",
             LivevalsNeeded, Found),
         ( Found = yes ->
             true
         ; CodeAddr = code_label(Label) ->
-            livemap.insert_label_livevals(!.Livemap, Label,
+            livemap_insert_label_livevals(!.Livemap, Label,
                 set.init, !:Livevals)
         ;
             ( CodeAddr = do_redo
@@ -179,7 +180,7 @@
         ;
             unexpected(this_file, "unknown label type in build_livemap")
         ),
-        livemap.special_code_addr(CodeAddr, MaybeSpecial),
+        livemap_special_code_addr(CodeAddr, MaybeSpecial),
         (
             MaybeSpecial = yes(Special),
             set.insert(!.Livevals, Special, !:Livevals)
@@ -189,7 +190,7 @@
     ;
         Uinstr0 = computed_goto(Rval, Labels),
         livemap.make_live_in_rvals([Rval], set.init, !:Livevals),
-        list.foldl(livemap.insert_label_livevals(!.Livemap), Labels,
+        list.foldl(livemap_insert_label_livevals(!.Livemap), Labels,
             !Livevals)
     ;
         Uinstr0 = if_val(Rval, CodeAddr),
@@ -208,12 +209,12 @@
             Found = no,
             livemap.make_live_in_rvals([Rval], !Livevals),
             ( CodeAddr = code_label(Label) ->
-                livemap.insert_label_livevals(!.Livemap, Label, !Livevals)
+                livemap_insert_label_livevals(!.Livemap, Label, !Livevals)
             ;
                 true
             )
         ),
-        livemap.special_code_addr(CodeAddr, MaybeSpecial),
+        livemap_special_code_addr(CodeAddr, MaybeSpecial),
         (
             MaybeSpecial = yes(Special),
             set.insert(!.Livevals, Special, !:Livevals)
@@ -288,73 +289,106 @@
     ;
         Uinstr0 = join_and_continue(_, _)
     ;
-        Uinstr0 = arbitrary_c_code(_, LiveLvalInfo),
-        livemap.build_live_lval_info(LiveLvalInfo,
-            !Livevals, !ContainsUserCode)
-    ;
-        Uinstr0 = pragma_c(_, Components, _, _, _, _, _, _, _),
-        livemap.build_livemap_pragma_components(Components,
-            !Livevals, !ContainsUserCode)
+        Uinstr0 = arbitrary_c_code(AffectsLiveness, LiveLvalInfo, Code),
+        build_live_lval_info(AffectsLiveness, LiveLvalInfo, Code,
+            !Livevals, !ContainsBadUserCode)
+    ;
+        Uinstr0 = foreign_proc_code(_, Components, _, _, _, _, _, _, _),
+        build_livemap_foreign_proc_components(Components,
+            !Livevals, !ContainsBadUserCode)
     ).
 
-:- pred livemap.build_livemap_pragma_components(list(pragma_c_component)::in,
+:- pred build_livemap_foreign_proc_components(list(foreign_proc_component)::in,
     lvalset::in, lvalset::out, bool::in, bool::out) is det.
 
-livemap.build_livemap_pragma_components([], !Livevals, !ContainsUserCode).
-livemap.build_livemap_pragma_components([Component | Components],
-        !Livevals, !ContainsUserCode) :-
+build_livemap_foreign_proc_components([], !Livevals, !ContainsBadUserCode).
+build_livemap_foreign_proc_components([Component | Components],
+        !Livevals, !ContainsBadUserCode) :-
     (
-        Component = pragma_c_inputs(Inputs),
-        livemap.build_livemap_pragma_inputs(Inputs,
-            !Livevals)
+        Component = foreign_proc_inputs(Inputs),
+        build_livemap_foreign_proc_inputs(Inputs, !Livevals)
     ;
-        Component = pragma_c_outputs(_)
+        Component = foreign_proc_outputs(_)
     ;
-        Component = pragma_c_user_code(_, _),
-        !:ContainsUserCode = yes
+        Component = foreign_proc_user_code(_, AffectsLiveness, Code),
+        (
+            AffectsLiveness = affects_liveness,
+            !:ContainsBadUserCode = yes
     ;
-        Component = pragma_c_raw_code(_, _, LiveLvalInfo),
-        livemap.build_live_lval_info(LiveLvalInfo,
-            !Livevals, !ContainsUserCode)
+            AffectsLiveness = default_affects_liveness,
+            ( Code = "" ->
+                true
     ;
-        Component = pragma_c_fail_to(_)
+                % We should take the contents of the Code into account here.
+                % For now, we just assume the worst.
+                !:ContainsBadUserCode = yes
+            )
     ;
-        Component = pragma_c_noop
+            AffectsLiveness = doesnt_affect_liveness
+        )
+    ;
+        Component = foreign_proc_raw_code(_Context, AffectsLiveness,
+            LiveLvalInfo, Code),
+        build_live_lval_info(AffectsLiveness, LiveLvalInfo, Code,
+            !Livevals, !ContainsBadUserCode)
+    ;
+        Component = foreign_proc_fail_to(_)
+    ;
+        Component = foreign_proc_noop
     ),
-    livemap.build_livemap_pragma_components(Components,
-        !Livevals, !ContainsUserCode).
+    build_livemap_foreign_proc_components(Components,
+        !Livevals, !ContainsBadUserCode).
 
-:- pred livemap.build_live_lval_info(c_code_live_lvals::in,
-    lvalset::in, lvalset::out, bool::in, bool::out) is det.
+:- pred build_live_lval_info(affects_liveness::in, c_code_live_lvals::in,
+    string::in, lvalset::in, lvalset::out, bool::in, bool::out) is det.
 
-livemap.build_live_lval_info(no_live_lvals_info, !Livevals, _, yes).
-livemap.build_live_lval_info(live_lvals_info(LiveLvalSet), !Livevals,
-        !DontValueNumber) :-
+build_live_lval_info(AffectsLiveness, LiveLvalInfo, Code,
+        !Livevals, !ContainsBadUserCode) :-
+    (
+        AffectsLiveness = affects_liveness,
+        !:ContainsBadUserCode = yes
+    ;
+        AffectsLiveness = default_affects_liveness,
+        ( Code = "" ->
+            true
+        ;
+            % We should take the contents of the Code into account here.
+            % For now, we just assume the worst.
+            !:ContainsBadUserCode = yes
+        )
+    ;
+        AffectsLiveness = doesnt_affect_liveness,
+        (
+            LiveLvalInfo = no_live_lvals_info,
+            !:ContainsBadUserCode = yes
+        ;
+            LiveLvalInfo = live_lvals_info(LiveLvalSet),
     set.to_sorted_list(LiveLvalSet, LiveLvals),
-    livemap.insert_proper_livevals(LiveLvals, !Livevals).
+            livemap_insert_proper_livevals(LiveLvals, !Livevals)
+        )
+    ).
 
-:- pred livemap.build_livemap_pragma_inputs(list(pragma_c_input)::in,
+:- pred build_livemap_foreign_proc_inputs(list(foreign_proc_input)::in,
     lvalset::in, lvalset::out) is det.
 
-livemap.build_livemap_pragma_inputs([], !Livevals).
-livemap.build_livemap_pragma_inputs([Input | Inputs], !Livevals) :-
-    Input = pragma_c_input(_, _, _, _, Rval, _, _),
+build_livemap_foreign_proc_inputs([], !Livevals).
+build_livemap_foreign_proc_inputs([Input | Inputs], !Livevals) :-
+    Input = foreign_proc_input(_, _, _, _, Rval, _, _),
     ( Rval = lval(Lval) ->
-        livemap.insert_proper_liveval(Lval, !Livevals)
+        livemap_insert_proper_liveval(Lval, !Livevals)
     ;
         true
     ),
-    livemap.build_livemap_pragma_inputs(Inputs, !Livevals).
+    build_livemap_foreign_proc_inputs(Inputs, !Livevals).
 
-:- pred livemap.look_for_livevals(list(instruction)::in,
+:- pred look_for_livevals(list(instruction)::in,
     list(instruction)::out, lvalset::in, lvalset::out, string::in,
     bool::in, bool::out) is det.
 
-livemap.look_for_livevals(Instrs0, Instrs, !Livevals,
-        Site, Compulsory, Found) :-
+look_for_livevals(Instrs0, Instrs, !Livevals, Site, Compulsory, Found) :-
     opt_util.skip_comments(Instrs0, Instrs1),
     ( Instrs1 = [livevals(Livevals1) - _ | Instrs2] ->
-        livemap.filter_livevals(Livevals1, !:Livevals),
+        livemap_filter_livevals(Livevals1, !:Livevals),
         Instrs = Instrs2,
         Found = yes
     ; Compulsory = yes ->
@@ -366,38 +400,37 @@
 
     % What lval (if any) is consulted when we branch to a code address?
     %
-:- pred livemap.special_code_addr(code_addr::in, maybe(lval)::out) is det.
+:- pred livemap_special_code_addr(code_addr::in, maybe(lval)::out) is det.
 
-livemap.special_code_addr(code_label(_), no).
-livemap.special_code_addr(code_imported_proc(_), no).
-livemap.special_code_addr(code_succip, yes(succip)).
-livemap.special_code_addr(do_succeed(_), yes(succip_slot(lval(curfr)))).
-livemap.special_code_addr(do_redo, yes(redoip_slot(lval(maxfr)))).
-livemap.special_code_addr(do_trace_redo_fail_shallow, no).
-livemap.special_code_addr(do_trace_redo_fail_deep, no).
-livemap.special_code_addr(do_fail, no).
-livemap.special_code_addr(do_call_closure(_), no).
-livemap.special_code_addr(do_call_class_method(_), no).
-livemap.special_code_addr(do_not_reached, no).
+livemap_special_code_addr(code_label(_), no).
+livemap_special_code_addr(code_imported_proc(_), no).
+livemap_special_code_addr(code_succip, yes(succip)).
+livemap_special_code_addr(do_succeed(_), yes(succip_slot(lval(curfr)))).
+livemap_special_code_addr(do_redo, yes(redoip_slot(lval(maxfr)))).
+livemap_special_code_addr(do_trace_redo_fail_shallow, no).
+livemap_special_code_addr(do_trace_redo_fail_deep, no).
+livemap_special_code_addr(do_fail, no).
+livemap_special_code_addr(do_call_closure(_), no).
+livemap_special_code_addr(do_call_class_method(_), no).
+livemap_special_code_addr(do_not_reached, no).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- pred livemap.make_live_in_rvals(list(rval)::in, lvalset::in, lvalset::out)
-    is det.
+:- pred make_live_in_rvals(list(rval)::in, lvalset::in, lvalset::out) is det.
 
-livemap.make_live_in_rvals([], !Live).
-livemap.make_live_in_rvals([Rval | Rvals], !Live) :-
-    livemap.make_live_in_rval(Rval, !Live),
-    livemap.make_live_in_rvals(Rvals, !Live).
+make_live_in_rvals([], !Live).
+make_live_in_rvals([Rval | Rvals], !Live) :-
+    make_live_in_rval(Rval, !Live),
+    make_live_in_rvals(Rvals, !Live).
 
     % Set all lvals found in this rval to live, with the exception of fields,
     % since they are treated specially (the later stages consider them
     % to be live even if they are not explicitly in the live set).
     %
-:- pred livemap.make_live_in_rval(rval::in, lvalset::in, lvalset::out) is det.
+:- pred make_live_in_rval(rval::in, lvalset::in, lvalset::out) is det.
 
-livemap.make_live_in_rval(lval(Lval), !Live) :-
+make_live_in_rval(lval(Lval), !Live) :-
     % XXX maybe we should treat mem_refs the same way as field refs
     ( Lval = field(_, _, _) ->
         true
@@ -405,66 +438,65 @@
         set.insert(!.Live, Lval, !:Live)
     ),
     opt_util.lval_access_rvals(Lval, AccessRvals),
-    livemap.make_live_in_rvals(AccessRvals, !Live).
-livemap.make_live_in_rval(mkword(_, Rval), !Live) :-
-    livemap.make_live_in_rval(Rval, !Live).
-livemap.make_live_in_rval(const(_), !Live).
-livemap.make_live_in_rval(unop(_, Rval), !Live) :-
-    livemap.make_live_in_rval(Rval, !Live).
-livemap.make_live_in_rval(binop(_, Rval1, Rval2), !Live) :-
-    livemap.make_live_in_rval(Rval1, !Live),
-    livemap.make_live_in_rval(Rval2, !Live).
-livemap.make_live_in_rval(var(_), _, _) :-
+    make_live_in_rvals(AccessRvals, !Live).
+make_live_in_rval(mkword(_, Rval), !Live) :-
+    make_live_in_rval(Rval, !Live).
+make_live_in_rval(const(_), !Live).
+make_live_in_rval(unop(_, Rval), !Live) :-
+    make_live_in_rval(Rval, !Live).
+make_live_in_rval(binop(_, Rval1, Rval2), !Live) :-
+    make_live_in_rval(Rval1, !Live),
+    make_live_in_rval(Rval2, !Live).
+make_live_in_rval(var(_), _, _) :-
     unexpected(this_file, "var rval should not propagate to the optimizer").
-livemap.make_live_in_rval(mem_addr(MemRef), !Live) :-
-    livemap.make_live_in_mem_ref(MemRef, !Live).
+make_live_in_rval(mem_addr(MemRef), !Live) :-
+    make_live_in_mem_ref(MemRef, !Live).
 
-:- pred livemap.make_live_in_mem_ref(mem_ref::in, lvalset::in, lvalset::out)
-    is det.
+:- pred make_live_in_mem_ref(mem_ref::in, lvalset::in, lvalset::out) is det.
 
-livemap.make_live_in_mem_ref(stackvar_ref(Rval), !Live) :-
-    livemap.make_live_in_rval(Rval, !Live).
-livemap.make_live_in_mem_ref(framevar_ref(Rval), !Live) :-
-    livemap.make_live_in_rval(Rval, !Live).
-livemap.make_live_in_mem_ref(heap_ref(Rval1, _, Rval2), !Live) :-
-    livemap.make_live_in_rval(Rval1, !Live),
-    livemap.make_live_in_rval(Rval2, !Live).
+make_live_in_mem_ref(stackvar_ref(Rval), !Live) :-
+    make_live_in_rval(Rval, !Live).
+make_live_in_mem_ref(framevar_ref(Rval), !Live) :-
+    make_live_in_rval(Rval, !Live).
+make_live_in_mem_ref(heap_ref(Rval1, _, Rval2), !Live) :-
+    make_live_in_rval(Rval1, !Live),
+    make_live_in_rval(Rval2, !Live).
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
-:- pred livemap.filter_livevals(lvalset::in, lvalset::out) is det.
+:- pred livemap_filter_livevals(lvalset::in, lvalset::out) is det.
 
-livemap.filter_livevals(Livevals0, Livevals) :-
+livemap_filter_livevals(Livevals0, Livevals) :-
     set.to_sorted_list(Livevals0, Livelist),
     set.init(Livevals1),
-    livemap.insert_proper_livevals(Livelist, Livevals1, Livevals).
+    livemap_insert_proper_livevals(Livelist, Livevals1, Livevals).
 
-:- pred livemap.insert_label_livevals(livemap::in, label::in,
+:- pred livemap_insert_label_livevals(livemap::in, label::in,
     lvalset::in, lvalset::out) is det.
 
-livemap.insert_label_livevals(Livemap, Label, !Livevals) :-
+livemap_insert_label_livevals(Livemap, Label, !Livevals) :-
     ( map.search(Livemap, Label, LabelLivevals) ->
         set.to_sorted_list(LabelLivevals, Livelist),
-        livemap.insert_proper_livevals(Livelist, !Livevals)
+        livemap_insert_proper_livevals(Livelist, !Livevals)
     ;
         true
     ).
 
-:- pred livemap.insert_proper_livevals(list(lval)::in, lvalset::in,
+:- pred livemap_insert_proper_livevals(list(lval)::in, lvalset::in,
     lvalset::out) is det.
 
-livemap.insert_proper_livevals([], !Livevals).
-livemap.insert_proper_livevals([Live | Livelist], !Livevals) :-
-    livemap.insert_proper_liveval(Live, !Livevals),
-    livemap.insert_proper_livevals(Livelist, !Livevals).
+livemap_insert_proper_livevals([], !Livevals).
+livemap_insert_proper_livevals([Live | Livelist], !Livevals) :-
+    livemap_insert_proper_liveval(Live, !Livevals),
+    livemap_insert_proper_livevals(Livelist, !Livevals).
 
     % Don't insert references to locations on the heap.
     %
-:- pred livemap.insert_proper_liveval(lval::in, lvalset::in, lvalset::out)
+:- pred livemap_insert_proper_liveval(lval::in, lvalset::in, lvalset::out)
     is det.
 
-livemap.insert_proper_liveval(Live, !Livevals) :-
+livemap_insert_proper_liveval(Live, !Livevals) :-
     ( Live = field(_, _, _) ->
         true
     ;
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.342
diff -u -b -r1.342 llds.m
--- compiler/llds.m	1 Nov 2006 02:31:07 -0000	1.342
+++ compiler/llds.m	30 Dec 2006 03:52:20 -0000
@@ -300,7 +300,7 @@
             % (rval+1)th label in the list. e.g. computed_goto(2, [A, B, C, D])
             % will branch to label C.
 
-    ;       arbitrary_c_code(string, c_code_live_lvals)
+    ;       arbitrary_c_code(affects_liveness, c_code_live_lvals, string)
             % Do whatever is specified by the string, which can be any piece
             % of C code that does not have any non-local flow of control.
 
@@ -423,16 +423,16 @@
             % Pick up the return address from its slot in the stack frame,
             % decrement the det stack pointer, and jump to the return address.
 
-    ;       pragma_c(
-                pragma_c_decls          :: list(pragma_c_decl),
-                pragma_c_components     :: list(pragma_c_component),
-                pragma_c_may_call_merc  :: proc_may_call_mercury,
-                pragma_c_fix_nolayout   :: maybe(label),
-                pragma_c_fix_layout     :: maybe(label),
-                pragma_c_fix_onlylayout :: maybe(label),
-                pragma_c_nofix          :: maybe(label),
-                pragma_c_stack_slot_ref :: bool,
-                pragma_c_maybe_dupl     :: bool
+    ;       foreign_proc_code(
+                fproc_decls             :: list(foreign_proc_decl),
+                fproc_components        :: list(foreign_proc_component),
+                fproc_may_call_merc     :: proc_may_call_mercury,
+                fproc_fix_nolayout      :: maybe(label),
+                fproc_fix_layout        :: maybe(label),
+                fproc_fix_onlylayout    :: maybe(label),
+                fproc_nofix             :: maybe(label),
+                fproc_stack_slot_ref    :: bool,
+                fproc_maybe_dupl        :: bool
             )
             % The first argument says what local variable declarations
             % are required for the following components, which in turn
@@ -446,9 +446,9 @@
             %
             % The third argument says whether the user C code components
             % may call Mercury; certain optimizations can be performed
-            % across pragma_c instructions that cannot call Mercury.
+            % across foreign_proc_code instructions that cannot call Mercury.
             %
-            % Some components in some pragma_c instructions refer to
+            % Some components in some foreign_proc_code instructions refer to
             % a Mercury label. If they do, we must prevent the label
             % from being optimized away. To make it known to labelopt,
             % we mention it in the fourth, fifth or sixth arg. The fourth
@@ -463,7 +463,7 @@
             % else). The seventh argument may give the name of a label
             % that can be changed (because it is not mentioned in C code
             % and has no associated layout structure, being mentioned only
-            % in pragma_c_fail_to components).
+            % in foreign_proc_fail_to components).
             %
             % The stack_slot_ref argument says whether the contents of the
             % pragma C code can refer to stack slots. User-written
@@ -506,7 +506,8 @@
     ;       ordinary_frame(
                 string,                 % Name of the predicate.
                 int,                    % Number of framevar slots.
-                maybe(pragma_c_struct)  % If yes, the frame should also contain
+                maybe(foreign_proc_struct)
+                                        % If yes, the frame should also contain
                                         % this struct (for use by a model_non
                                         % pragma C code).
             ).
@@ -541,10 +542,10 @@
     % Our implementation saves this information in a C struct.
     % Programmers must include the declaration of the fields of this
     % C struct in the `pragma c_code' declaration itself.
-    % A pragma_c_struct holds information about this C struct.
+    % A foreign_proc_struct holds information about this C struct.
     %
-:- type pragma_c_struct
-    --->    pragma_c_struct(
+:- type foreign_proc_struct
+    --->    foreign_proc_struct(
                 string,     % The name of the struct tag.
                 string,     % The field declarations, supplied by the user
                             % in the `pragma foreign_proc' % declaration.
@@ -552,12 +553,12 @@
                             % Where the field declarations originally appeared.
             ).
 
-    % A pragma_c_decl holds the information needed for the declaration
-    % of a local variable in a block of C code emitted for a pragma_c
+    % A foreign_proc_decl holds the information needed for the declaration
+    % of a local variable in a block of C code emitted for a foreign_proc_code
     % instruction.
     %
-:- type pragma_c_decl
-    --->    pragma_c_arg_decl(
+:- type foreign_proc_decl
+    --->    foreign_proc_arg_decl(
                 % This local variable corresponds to a procedure arg.
                 mer_type,   % The Mercury type of the argument.
                 string,     % The string which is used to describe the type
@@ -565,7 +566,7 @@
                 string      % The name of the local variable that will hold
                             % the value of that argument inside the C block.
             )
-        ;   pragma_c_struct_ptr_decl(
+        ;   foreign_proc_struct_ptr_decl(
                 % This local variable holds the address of the save struct.
                 string,     % The name of the C struct tag of the save struct;
                             % the type of the local variable will be a pointer
@@ -573,25 +574,28 @@
                 string      % The name of the local variable.
             ).
 
-    % A pragma_c_component holds one component of a pragma_c instruction.
+    % A foreign_proc_component holds one component of a foreign_proc_code
+    % instruction.
     %
-:- type pragma_c_component
-    --->    pragma_c_inputs(list(pragma_c_input))
-    ;       pragma_c_outputs(list(pragma_c_output))
-    ;       pragma_c_user_code(maybe(prog_context), string)
-    ;       pragma_c_raw_code(string, can_branch_away, c_code_live_lvals)
-    ;       pragma_c_fail_to(label)
-    ;       pragma_c_noop.
+:- type foreign_proc_component
+    --->    foreign_proc_inputs(list(foreign_proc_input))
+    ;       foreign_proc_outputs(list(foreign_proc_output))
+    ;       foreign_proc_user_code(maybe(prog_context), affects_liveness,
+                string)
+    ;       foreign_proc_raw_code(can_branch_away, affects_liveness,
+                c_code_live_lvals, string)
+    ;       foreign_proc_fail_to(label)
+    ;       foreign_proc_noop.
 
 :- type can_branch_away
     --->    can_branch_away
     ;       cannot_branch_away.
 
-    % A pragma_c_input represents the code that initializes one
-    % of the input variables for a pragma_c instruction.
+    % A foreign_proc_input represents the code that initializes one
+    % of the input variables for a foreign_proc_code instruction.
     %
-:- type pragma_c_input
-    --->    pragma_c_input(
+:- type foreign_proc_input
+    --->    foreign_proc_input(
                 % The name of the foreign language variable.
                 in_foreign_lang_var_name    :: string,
 
@@ -612,16 +616,16 @@
 
                 % If in_original_type is a foreign type, info about
                 % that foreign type.
-                in_maybe_foreign_type       :: maybe(pragma_c_foreign_type),
+                in_maybe_foreign_type       :: maybe(foreign_proc_type),
 
                 in_box_policy               :: box_policy
             ).
 
-    % A pragma_c_output represents the code that stores one of
-    % of the outputs for a pragma_c instruction.
+    % A foreign_proc_output represents the code that stores one of
+    % of the outputs for a foreign_proc_code instruction.
     %
-:- type pragma_c_output
-    --->    pragma_c_output(
+:- type foreign_proc_output
+    --->    foreign_proc_output(
                 % The place where the foreign_proc should put this output.
                 out_arg_dest                :: lval,
 
@@ -640,13 +644,13 @@
 
                 % If in_original_type is a foreign type, info about
                 % that foreign type.
-                out_maybe_foreign_type      :: maybe(pragma_c_foreign_type),
+                out_maybe_foreign_type      :: maybe(foreign_proc_type),
 
                 out_box_policy              :: box_policy
             ).
 
-:- type pragma_c_foreign_type
-    --->    pragma_c_foreign_type(
+:- type foreign_proc_type
+    --->    foreign_proc_type(
                 string,         % The C type name.
                 list(foreign_type_assertion)
                                 % The assertions on the foreign_type
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.301
diff -u -b -r1.301 llds_out.m
--- compiler/llds_out.m	27 Dec 2006 04:16:27 -0000	1.301
+++ compiler/llds_out.m	30 Dec 2006 07:02:47 -0000
@@ -138,7 +138,7 @@
     ;       decl_float_label(string)
     ;       decl_code_addr(code_addr)
     ;       decl_data_addr(data_addr)
-    ;       decl_pragma_c_struct(string)
+    ;       decl_foreign_proc_struct(string)
     ;       decl_c_global_var(c_global_var_ref)
     ;       decl_type_info_like_struct(int)
     ;       decl_typeclass_constraint_struct(int).
@@ -1875,15 +1875,16 @@
 output_instr_decls(_, llcall(Target, ContLabel, _, _, _, _), !DeclSet, !IO) :-
     output_code_addr_decls(Target, !DeclSet, !IO),
     output_code_addr_decls(ContLabel, !DeclSet, !IO).
-output_instr_decls(_, arbitrary_c_code(_, _), !DeclSet, !IO).
+output_instr_decls(_, arbitrary_c_code(_, _, _), !DeclSet, !IO).
 output_instr_decls(_, mkframe(FrameInfo, MaybeFailureContinuation),
         !DeclSet, !IO) :-
     (
         FrameInfo = ordinary_frame(_, _, yes(Struct)),
-        Struct = pragma_c_struct(StructName, StructFields,
+        Struct = foreign_proc_struct(StructName, StructFields,
             MaybeStructFieldsContext)
     ->
-        ( decl_set_is_member(decl_pragma_c_struct(StructName), !.DeclSet) ->
+        DeclId = decl_foreign_proc_struct(StructName),
+        ( decl_set_is_member(DeclId, !.DeclSet) ->
             Msg = "struct " ++ StructName ++ " has been declared already",
             unexpected(this_file, Msg)
         ;
@@ -1902,7 +1903,7 @@
             io.write_string(StructFields, !IO)
         ),
         io.write_string("\n};\n", !IO),
-        decl_set_insert(decl_pragma_c_struct(StructName), !DeclSet)
+        decl_set_insert(DeclId, !DeclSet)
     ;
         true
     ),
@@ -1946,7 +1947,7 @@
 output_instr_decls(_, incr_sp(_, _, _), !DeclSet, !IO).
 output_instr_decls(_, decr_sp(_), !DeclSet, !IO).
 output_instr_decls(_, decr_sp_and_return(_), !DeclSet, !IO).
-output_instr_decls(StackLayoutLabels, pragma_c(_, Comps, _, _,
+output_instr_decls(StackLayoutLabels, foreign_proc_code(_, Comps, _, _,
         MaybeLayoutLabel, MaybeOnlyLayoutLabel, _, _, _), !DeclSet, !IO) :-
     (
         MaybeLayoutLabel = yes(Label),
@@ -1962,7 +1963,7 @@
     ;
         MaybeOnlyLayoutLabel = no
     ),
-    list.foldl2(output_pragma_c_component_decls, Comps, !DeclSet, !IO).
+    list.foldl2(output_foreign_proc_component_decls, Comps, !DeclSet, !IO).
 output_instr_decls(_, init_sync_term(Lval, _), !DeclSet, !IO) :-
     output_lval_decls(Lval, !DeclSet, !IO).
 output_instr_decls(_, fork(Child), !DeclSet, !IO) :-
@@ -1971,17 +1972,23 @@
     output_lval_decls(Lval, !DeclSet, !IO),
     output_code_addr_decls(code_label(Label), !DeclSet, !IO).
 
-:- pred output_pragma_c_component_decls(pragma_c_component::in,
+:- pred output_foreign_proc_component_decls(foreign_proc_component::in,
     decl_set::in, decl_set::out, io::di, io::uo) is det.
 
-output_pragma_c_component_decls(pragma_c_inputs(Inputs), !DeclSet, !IO) :-
-    output_pragma_input_rval_decls(Inputs, !DeclSet, !IO).
-output_pragma_c_component_decls(pragma_c_outputs(Outputs), !DeclSet, !IO) :-
-    output_pragma_output_lval_decls(Outputs, !DeclSet, !IO).
-output_pragma_c_component_decls(pragma_c_raw_code(_, _, _), !DeclSet, !IO).
-output_pragma_c_component_decls(pragma_c_user_code(_, _), !DeclSet, !IO).
-output_pragma_c_component_decls(pragma_c_fail_to(_), !DeclSet, !IO).
-output_pragma_c_component_decls(pragma_c_noop, !DeclSet, !IO).
+output_foreign_proc_component_decls(Component, !DeclSet, !IO) :-
+    (
+        Component = foreign_proc_inputs(Inputs),
+        output_foreign_proc_input_rval_decls(Inputs, !DeclSet, !IO)
+    ;
+        Component = foreign_proc_outputs(Outputs),
+        output_foreign_proc_output_lval_decls(Outputs, !DeclSet, !IO)
+    ;
+        ( Component = foreign_proc_raw_code(_, _, _, _)
+        ; Component = foreign_proc_user_code(_, _, _)
+        ; Component = foreign_proc_fail_to(_)
+        ; Component = foreign_proc_noop
+        )
+    ).
 
 %-----------------------------------------------------------------------------%
 
@@ -2228,15 +2235,15 @@
     output_call(Target, ContLabel, CallerLabel, !IO),
     output_gc_livevals(LiveVals, !IO).
 
-output_instruction(arbitrary_c_code(C_Code_String, _), _, !IO) :-
+output_instruction(arbitrary_c_code(_, _, C_Code), _, !IO) :-
     io.write_string("\t", !IO),
-    io.write_string(C_Code_String, !IO).
+    io.write_string(C_Code, !IO).
 
 output_instruction(mkframe(FrameInfo, MaybeFailCont), _, !IO) :-
     (
         FrameInfo = ordinary_frame(Msg, Num, MaybeStruct),
         (
-            MaybeStruct = yes(pragma_c_struct(StructName, _, _)),
+            MaybeStruct = yes(foreign_proc_struct(StructName, _, _)),
             (
                 MaybeFailCont = yes(FailCont),
                 io.write_string("\tMR_mkpragmaframe(""", !IO),
@@ -2531,10 +2538,11 @@
     io.write_int(N, !IO),
     io.write_string(");\n", !IO).
 
-output_instruction(pragma_c(Decls, Components, _, _, _, _, _, _, _), _, !IO) :-
+output_instruction(foreign_proc_code(Decls, Components, _, _, _, _, _, _, _),
+        _, !IO) :-
     io.write_string("\t{\n", !IO),
-    output_pragma_decls(Decls, !IO),
-    list.foldl(output_pragma_c_component, Components, !IO),
+    output_foreign_proc_decls(Decls, !IO),
+    list.foldl(output_foreign_proc_component, Components, !IO),
     io.write_string("\t}\n", !IO).
 
 output_instruction(init_sync_term(Lval, N), _, !IO) :-
@@ -2562,14 +2570,15 @@
 % in runtime/mercury_wrapper.c. See the documentation there.
 max_leaf_stack_frame_size = 128.
 
-:- pred output_pragma_c_component(pragma_c_component::in, io::di, io::uo)
-    is det.
+:- pred output_foreign_proc_component(foreign_proc_component::in,
+    io::di, io::uo) is det.
 
-output_pragma_c_component(pragma_c_inputs(Inputs), !IO) :-
-    output_pragma_inputs(Inputs, !IO).
-output_pragma_c_component(pragma_c_outputs(Outputs), !IO) :-
-    output_pragma_outputs(Outputs, !IO).
-output_pragma_c_component(pragma_c_user_code(MaybeContext, C_Code), !IO) :-
+output_foreign_proc_component(foreign_proc_inputs(Inputs), !IO) :-
+    output_foreign_proc_inputs(Inputs, !IO).
+output_foreign_proc_component(foreign_proc_outputs(Outputs), !IO) :-
+    output_foreign_proc_outputs(Outputs, !IO).
+output_foreign_proc_component(foreign_proc_user_code(MaybeContext, _, C_Code),
+        !IO) :-
     ( C_Code = "" ->
         true
     ;
@@ -2589,75 +2598,78 @@
             io.write_string(";}\n", !IO)
         )
     ).
-output_pragma_c_component(pragma_c_raw_code(C_Code, _, _), !IO) :-
+output_foreign_proc_component(foreign_proc_raw_code(_, _, _, C_Code), !IO) :-
     io.write_string(C_Code, !IO).
-output_pragma_c_component(pragma_c_fail_to(Label), !IO) :-
-    io.write_string("if (!" ++ pragma_succ_ind_name ++ ") MR_GOTO_LAB(", !IO),
+output_foreign_proc_component(foreign_proc_fail_to(Label), !IO) :-
+    io.write_string(
+        "if (!" ++ foreign_proc_succ_ind_name ++ ") MR_GOTO_LAB(", !IO),
     output_label(Label, no, !IO),
     io.write_string(");\n", !IO).
-output_pragma_c_component(pragma_c_noop, !IO).
+output_foreign_proc_component(foreign_proc_noop, !IO).
 
     % Output the local variable declarations at the top of the
-    % pragma_foreign code for C.
+    % foreign_proc code for C.
     %
-:- pred output_pragma_decls(list(pragma_c_decl)::in, io::di, io::uo) is det.
+:- pred output_foreign_proc_decls(list(foreign_proc_decl)::in, io::di, io::uo)
+    is det.
 
-output_pragma_decls([], !IO).
-output_pragma_decls([Decl | Decls], !IO) :-
+output_foreign_proc_decls([], !IO).
+output_foreign_proc_decls([Decl | Decls], !IO) :-
     (
         % Apart from special cases, the local variables are MR_Words
-        Decl = pragma_c_arg_decl(_Type, TypeString, VarName),
+        Decl = foreign_proc_arg_decl(_Type, TypeString, VarName),
         io.write_string("\t", !IO),
         io.write_string(TypeString, !IO),
         io.write_string("\t", !IO),
         io.write_string(VarName, !IO),
         io.write_string(";\n", !IO)
     ;
-        Decl = pragma_c_struct_ptr_decl(StructTag, VarName),
+        Decl = foreign_proc_struct_ptr_decl(StructTag, VarName),
         io.write_string("\tstruct ", !IO),
         io.write_string(StructTag, !IO),
         io.write_string("\t*", !IO),
         io.write_string(VarName, !IO),
         io.write_string(";\n", !IO)
     ),
-    output_pragma_decls(Decls, !IO).
+    output_foreign_proc_decls(Decls, !IO).
 
     % Output declarations for any rvals used to initialize the inputs.
     %
-:- pred output_pragma_input_rval_decls(list(pragma_c_input)::in,
+:- pred output_foreign_proc_input_rval_decls(list(foreign_proc_input)::in,
     decl_set::in, decl_set::out, io::di, io::uo) is det.
 
-output_pragma_input_rval_decls([], !DeclSet, !IO).
-output_pragma_input_rval_decls([Input | Inputs], !DeclSet, !IO) :-
-    Input = pragma_c_input(_VarName, _VarType, _IsDummy, _OrigType, Rval,
+output_foreign_proc_input_rval_decls([], !DeclSet, !IO).
+output_foreign_proc_input_rval_decls([Input | Inputs], !DeclSet, !IO) :-
+    Input = foreign_proc_input(_VarName, _VarType, _IsDummy, _OrigType, Rval,
         _, _),
     output_rval_decls_format(Rval, "", "\t", 0, _N, !DeclSet, !IO),
-    output_pragma_input_rval_decls(Inputs, !DeclSet, !IO).
+    output_foreign_proc_input_rval_decls(Inputs, !DeclSet, !IO).
 
-    % Output the input variable assignments at the top of the
-    % pragma foreign_code code for C.
+    % Output the input variable assignments at the top of the foreign code
+    % for C.
     %
-:- pred output_pragma_inputs(list(pragma_c_input)::in, io::di, io::uo) is det.
+:- pred output_foreign_proc_inputs(list(foreign_proc_input)::in,
+    io::di, io::uo) is det.
 
-output_pragma_inputs([], !IO).
-output_pragma_inputs([Input | Inputs], !IO) :-
-    Input = pragma_c_input(_VarName, _VarType, IsDummy, _OrigType, _Rval,
+output_foreign_proc_inputs([], !IO).
+output_foreign_proc_inputs([Input | Inputs], !IO) :-
+    Input = foreign_proc_input(_VarName, _VarType, IsDummy, _OrigType, _Rval,
         _MaybeForeignTypeInfo, _BoxPolicy),
     (
         IsDummy = yes
     ;
         IsDummy = no,
-        output_pragma_input(Input, !IO)
+        output_foreign_proc_input(Input, !IO)
     ),
-    output_pragma_inputs(Inputs, !IO).
+    output_foreign_proc_inputs(Inputs, !IO).
 
-    % Output an input variable assignment at the top of the
-    % pragma foreign_code code for C.
+    % Output an input variable assignment at the top of the foreign code for C.
     %
-:- pred output_pragma_input(pragma_c_input::in, io::di, io::uo) is det.
+:- pred output_foreign_proc_input(foreign_proc_input::in, io::di, io::uo)
+    is det.
 
-output_pragma_input(Input, !IO) :-
-    Input = pragma_c_input(VarName, _VarType, _IsDummy, OrigType, Rval,
+output_foreign_proc_input(Input, !IO) :-
+    Input = foreign_proc_input(VarName, _VarType, _IsDummy, OrigType, Rval,
         MaybeForeignTypeInfo, BoxPolicy),
     io.write_string("\t", !IO),
     (
@@ -2669,15 +2681,18 @@
         BoxPolicy = native_if_possible,
         (
             MaybeForeignTypeInfo = yes(ForeignTypeInfo),
-            ForeignTypeInfo = pragma_c_foreign_type(ForeignType, Assertions),
+            ForeignTypeInfo = foreign_proc_type(ForeignType, Assertions),
             % For foreign types for which c_type_is_word_sized_int_or_ptr
             % succeeds, the code in the else branch is not only correct,
             % it also generates faster code than would be generated by
             % the then branch, because MR_MAYBE_UNBOX_FOREIGN_TYPE
             % invokes memcpy when given a word-sized type.
             (
-                ( c_type_is_word_sized_int_or_ptr(ForeignType)
-                ; list.member(foreign_type_can_pass_as_mercury_type, Assertions)
+                (
+                    c_type_is_word_sized_int_or_ptr(ForeignType)
+                ;
+                    list.member(foreign_type_can_pass_as_mercury_type,
+                        Assertions)
                 )
             ->
                 % Note that for this cast to be correct the foreign
@@ -2713,40 +2728,42 @@
 
     % Output declarations for any lvals used for the outputs.
     %
-:- pred output_pragma_output_lval_decls(list(pragma_c_output)::in,
+:- pred output_foreign_proc_output_lval_decls(list(foreign_proc_output)::in,
     decl_set::in, decl_set::out, io::di, io::uo) is det.
 
-output_pragma_output_lval_decls([], !DeclSet, !IO).
-output_pragma_output_lval_decls([O | Outputs], !DeclSet, !IO) :-
-    O = pragma_c_output(Lval, _VarType, _IsDummy, _OrigType, _VarName, _, _),
+output_foreign_proc_output_lval_decls([], !DeclSet, !IO).
+output_foreign_proc_output_lval_decls([O | Outputs], !DeclSet, !IO) :-
+    O = foreign_proc_output(Lval, _VarType, _IsDummy, _OrigType, _VarName,
+        _, _),
     output_lval_decls_format(Lval, "\t", "\t", 0, _N, !DeclSet, !IO),
-    output_pragma_output_lval_decls(Outputs, !DeclSet, !IO).
+    output_foreign_proc_output_lval_decls(Outputs, !DeclSet, !IO).
 
-    % Output the output variable assignments at the bottom of the
-    % pragma foreign code for C.
+    % Output the output variable assignments at the bottom of the foreign code
+    % for C.
     %
-:- pred output_pragma_outputs(list(pragma_c_output)::in, io::di, io::uo)
-    is det.
+:- pred output_foreign_proc_outputs(list(foreign_proc_output)::in,
+    io::di, io::uo) is det.
 
-output_pragma_outputs([], !IO).
-output_pragma_outputs([Output | Outputs], !IO) :-
-    Output = pragma_c_output(_Lval, _VarType, IsDummy, _OrigType, _VarName,
+output_foreign_proc_outputs([], !IO).
+output_foreign_proc_outputs([Output | Outputs], !IO) :-
+    Output = foreign_proc_output(_Lval, _VarType, IsDummy, _OrigType, _VarName,
         _MaybeForeignType, _BoxPolicy),
     (
         IsDummy = yes
     ;
         IsDummy = no,
-        output_pragma_output(Output, !IO)
+        output_foreign_proc_output(Output, !IO)
     ),
-    output_pragma_outputs(Outputs, !IO).
+    output_foreign_proc_outputs(Outputs, !IO).
 
-    % Output a output variable assignment at the bottom of the
-    % pragma foreign code for C.
+    % Output a output variable assignment at the bottom of the foreign code
+    % for C.
     %
-:- pred output_pragma_output(pragma_c_output::in, io::di, io::uo) is det.
+:- pred output_foreign_proc_output(foreign_proc_output::in, io::di, io::uo)
+    is det.
 
-output_pragma_output(Output, !IO) :-
-    Output = pragma_c_output(Lval, _VarType, _IsDummy, OrigType, VarName,
+output_foreign_proc_output(Output, !IO) :-
+    Output = foreign_proc_output(Lval, _VarType, _IsDummy, OrigType, VarName,
         MaybeForeignType, BoxPolicy),
     io.write_string("\t", !IO),
     (
@@ -2758,7 +2775,7 @@
         BoxPolicy = native_if_possible,
         (
             MaybeForeignType = yes(ForeignTypeInfo),
-            ForeignTypeInfo = pragma_c_foreign_type(ForeignType, Assertions),
+            ForeignTypeInfo = foreign_proc_type(ForeignType, Assertions),
             ( list.member(foreign_type_can_pass_as_mercury_type, Assertions) ->
                 output_lval_as_word(Lval, !IO),
                 io.write_string(" = ", !IO),
@@ -3211,8 +3228,8 @@
     unexpected(this_file, "output_decl_id: code_addr unexpected").
 output_decl_id(decl_float_label(_Label), !IO) :-
     unexpected(this_file, "output_decl_id: float_label unexpected").
-output_decl_id(decl_pragma_c_struct(_Name), !IO) :-
-    unexpected(this_file, "output_decl_id: pragma_c_struct unexpected").
+output_decl_id(decl_foreign_proc_struct(_Name), !IO) :-
+    unexpected(this_file, "output_decl_id: foreign_proc_struct unexpected").
 output_decl_id(decl_c_global_var(_), !IO) :-
     unexpected(this_file, "output_decl_id: c_global_var unexpected").
 output_decl_id(decl_type_info_like_struct(_Name), !IO) :-
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.310
diff -u -b -r1.310 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	27 Dec 2006 04:16:28 -0000	1.310
+++ compiler/mercury_to_mercury.m	30 Dec 2006 06:51:51 -0000
@@ -3300,13 +3300,13 @@
         mercury_format_foreign_code_string(Later, !U),
         add_string("), ", !U),
         (
-            Treat = share,
+            Treat = shared_code_share,
             add_string("shared_code(", !U)
         ;
-            Treat = duplicate,
+            Treat = shared_code_duplicate,
             add_string("duplicated_code(", !U)
         ;
-            Treat = automatic,
+            Treat = shared_code_automatic,
             add_string("common_code(", !U)
         ),
         mercury_format_foreign_code_string(Shared, !U),
Index: compiler/middle_rec.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/middle_rec.m,v
retrieving revision 1.126
diff -u -b -r1.126 middle_rec.m
--- compiler/middle_rec.m	1 Dec 2006 15:04:07 -0000	1.126
+++ compiler/middle_rec.m	30 Dec 2006 07:02:59 -0000
@@ -499,7 +499,7 @@
 find_used_registers_instr(goto(_), !Used).
 find_used_registers_instr(computed_goto(Rval, _), !Used) :-
     find_used_registers_rval(Rval, !Used).
-find_used_registers_instr(arbitrary_c_code(_, _), !Used).
+find_used_registers_instr(arbitrary_c_code(_, _, _), !Used).
 find_used_registers_instr(if_val(Rval, _), !Used) :-
     find_used_registers_rval(Rval, !Used).
 find_used_registers_instr(save_maxfr(Lval), !Used) :-
@@ -528,8 +528,8 @@
 find_used_registers_instr(incr_sp(_, _, _), !Used).
 find_used_registers_instr(decr_sp(_), !Used).
 find_used_registers_instr(decr_sp_and_return(_), !Used).
-find_used_registers_instr(pragma_c(_, Components, _, _, _, _, _, _, _),
-        !Used) :-
+find_used_registers_instr(foreign_proc_code(_, Components,
+        _, _, _, _, _, _, _), !Used) :-
     find_used_registers_components(Components, !Used).
 find_used_registers_instr(init_sync_term(Lval, _), !Used) :-
     find_used_registers_lval(Lval, !Used).
@@ -538,7 +538,7 @@
     find_used_registers_lval(Lval, !Used).
 
 :- pred find_used_registers_components(
-    list(pragma_c_component)::in,
+    list(foreign_proc_component)::in,
     set(int)::in, set(int)::out) is det.
 
 find_used_registers_components([], !Used).
@@ -546,17 +546,17 @@
     find_used_registers_component(Comp, !Used),
     find_used_registers_components(Comps, !Used).
 
-:- pred find_used_registers_component(pragma_c_component::in,
+:- pred find_used_registers_component(foreign_proc_component::in,
     set(int)::in, set(int)::out) is det.
 
-find_used_registers_component(pragma_c_inputs(In), !Used) :-
-    insert_pragma_c_input_registers(In, !Used).
-find_used_registers_component(pragma_c_outputs(Out), !Used) :-
-    insert_pragma_c_output_registers(Out, !Used).
-find_used_registers_component(pragma_c_user_code(_, _), !Used).
-find_used_registers_component(pragma_c_raw_code(_, _, _), !Used).
-find_used_registers_component(pragma_c_fail_to(_), !Used).
-find_used_registers_component(pragma_c_noop, !Used).
+find_used_registers_component(foreign_proc_inputs(In), !Used) :-
+    insert_foreign_proc_input_registers(In, !Used).
+find_used_registers_component(foreign_proc_outputs(Out), !Used) :-
+    insert_foreign_proc_output_registers(Out, !Used).
+find_used_registers_component(foreign_proc_user_code(_, _, _), !Used).
+find_used_registers_component(foreign_proc_raw_code(_, _, _, _), !Used).
+find_used_registers_component(foreign_proc_fail_to(_), !Used).
+find_used_registers_component(foreign_proc_noop, !Used).
 
 :- pred find_used_registers_lvals(list(lval)::in,
     set(int)::in, set(int)::out) is det.
@@ -632,23 +632,23 @@
     ),
     find_used_registers_maybe_rvals(MaybeRvals, !Used).
 
-:- pred insert_pragma_c_input_registers(list(pragma_c_input)::in,
+:- pred insert_foreign_proc_input_registers(list(foreign_proc_input)::in,
     set(int)::in, set(int)::out) is det.
 
-insert_pragma_c_input_registers([], !Used).
-insert_pragma_c_input_registers([Input | Inputs], !Used) :-
-    Input = pragma_c_input(_, _, _, _, Rval, _, _),
+insert_foreign_proc_input_registers([], !Used).
+insert_foreign_proc_input_registers([Input | Inputs], !Used) :-
+    Input = foreign_proc_input(_, _, _, _, Rval, _, _),
     find_used_registers_rval(Rval, !Used),
-    insert_pragma_c_input_registers(Inputs, !Used).
+    insert_foreign_proc_input_registers(Inputs, !Used).
 
-:- pred insert_pragma_c_output_registers(list(pragma_c_output)::in,
+:- pred insert_foreign_proc_output_registers(list(foreign_proc_output)::in,
     set(int)::in, set(int)::out) is det.
 
-insert_pragma_c_output_registers([], !Used).
-insert_pragma_c_output_registers([Output | Outputs], !Used) :-
-    Output = pragma_c_output(Lval, _, _, _, _, _, _),
+insert_foreign_proc_output_registers([], !Used).
+insert_foreign_proc_output_registers([Output | Outputs], !Used) :-
+    Output = foreign_proc_output(Lval, _, _, _, _, _, _),
     find_used_registers_lval(Lval, !Used),
-    insert_pragma_c_output_registers(Outputs, !Used).
+    insert_foreign_proc_output_registers(Outputs, !Used).
 
 %---------------------------------------------------------------------------%
 
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.186
diff -u -b -r1.186 opt_debug.m
--- compiler/opt_debug.m	22 Dec 2006 05:37:50 -0000	1.186
+++ compiler/opt_debug.m	30 Dec 2006 07:35:35 -0000
@@ -677,7 +677,7 @@
         (
             FrameInfo = ordinary_frame(Name, Size, MaybePragma),
             (
-                MaybePragma = yes(pragma_c_struct(StructName, Fields, _)),
+                MaybePragma = yes(foreign_proc_struct(StructName, Fields, _)),
                 P_str = "yes(" ++ StructName ++ ", " ++ Fields ++ ")"
             ;
                 MaybePragma = no,
@@ -706,8 +706,9 @@
         Str = "computed_goto " ++ dump_rval(yes(ProcLabel), Rval) ++ ":"
             ++ dump_labels(yes(ProcLabel), Labels)
     ;
-        Instr = arbitrary_c_code(Code, _),
-        Str = "arbitrary_c_code(" ++ Code ++ ")"
+        Instr = arbitrary_c_code(AL, _, Code),
+        Str = "arbitrary_c_code(" ++ dump_affects_liveness(AL) ++ "\n" ++
+            Code ++ ")"
     ;
         Instr = if_val(Rval, CodeAddr),
         Str = "if (" ++ dump_rval(yes(ProcLabel), Rval) ++ ") goto "
@@ -787,9 +788,10 @@
         Str = "join(" ++ dump_lval(yes(ProcLabel), Lval) ++ ", "
             ++ dump_label(yes(ProcLabel), Label) ++ ")"
     ;
-        Instr = pragma_c(Decls, Comps, MCM, MFNL, MFL, MFOL, MNF, SSR, MD),
+        Instr = foreign_proc_code(Decls, Comps, MCM, MFNL, MFL, MFOL, MNF,
+            SSR, MD),
         MaybeProcLabel = yes(ProcLabel),
-        Str = "pragma_c(\n"
+        Str = "foreign_proc_code(\n"
             ++ "declarations:\n" ++ dump_decls(Decls)
             ++ "components:\n" ++ dump_components(MaybeProcLabel, Comps)
             ++ dump_may_call_mercury(MCM) ++ "\n"
@@ -823,39 +825,48 @@
 dump_may_use_atomic(may_use_atomic_alloc) = "may_use_atomic_alloc".
 dump_may_use_atomic(may_not_use_atomic_alloc) = "may_not_use_atomic_alloc".
 
-:- func dump_decls(list(pragma_c_decl)) = string.
+:- func dump_decls(list(foreign_proc_decl)) = string.
 
 dump_decls([]) = "".
 dump_decls([Decl | Decls]) =
     dump_decl(Decl) ++ dump_decls(Decls).
 
-:- func dump_decl(pragma_c_decl) = string.
+:- func dump_decl(foreign_proc_decl) = string.
 
-dump_decl(pragma_c_arg_decl(_MerType, TypeStr, VarName)) =
+dump_decl(foreign_proc_arg_decl(_MerType, TypeStr, VarName)) =
     "decl " ++ TypeStr ++ " " ++ VarName ++ "\n".
-dump_decl(pragma_c_struct_ptr_decl(StructTag, VarName)) =
+dump_decl(foreign_proc_struct_ptr_decl(StructTag, VarName)) =
     "decl struct" ++ StructTag ++ " " ++ VarName ++ "\n".
 
-:- func dump_components(maybe(proc_label), list(pragma_c_component)) = string.
+:- func dump_components(maybe(proc_label), list(foreign_proc_component))
+    = string.
 
 dump_components(_, []) = "".
 dump_components(MaybeProcLabel, [Comp | Comps]) =
     dump_component(MaybeProcLabel, Comp) ++
         dump_components(MaybeProcLabel, Comps).
 
-:- func dump_component(maybe(proc_label), pragma_c_component) = string.
+:- func dump_component(maybe(proc_label), foreign_proc_component) = string.
 
-dump_component(MaybeProcLabel, pragma_c_inputs(Inputs)) =
+dump_component(MaybeProcLabel, foreign_proc_inputs(Inputs)) =
     dump_input_components(MaybeProcLabel, Inputs).
-dump_component(MaybeProcLabel, pragma_c_outputs(Outputs)) =
+dump_component(MaybeProcLabel, foreign_proc_outputs(Outputs)) =
     dump_output_components(MaybeProcLabel, Outputs).
-dump_component(_, pragma_c_user_code(_, Code)) = Code ++ "\n".
-dump_component(_, pragma_c_raw_code(Code, _, _)) = Code ++ "\n".
-dump_component(MaybeProcLabel, pragma_c_fail_to(Label)) =
+dump_component(_, foreign_proc_user_code(_, AL, Code)) =
+    dump_affects_liveness(AL) ++ "\n" ++ Code ++ "\n".
+dump_component(_, foreign_proc_raw_code(_, AL, _, Code)) =
+    dump_affects_liveness(AL) ++ "\n" ++ Code ++ "\n".
+dump_component(MaybeProcLabel, foreign_proc_fail_to(Label)) =
     "fail to " ++ dump_label(MaybeProcLabel, Label) ++ "\n".
-dump_component(_, pragma_c_noop) = "".
+dump_component(_, foreign_proc_noop) = "".
+
+:- func dump_affects_liveness(affects_liveness) = string.
+
+dump_affects_liveness(affects_liveness) = "affects_liveness".
+dump_affects_liveness(doesnt_affect_liveness) = "doesnt_affect_liveness".
+dump_affects_liveness(default_affects_liveness) = "default_affects_liveness".
 
-:- func dump_input_components(maybe(proc_label), list(pragma_c_input))
+:- func dump_input_components(maybe(proc_label), list(foreign_proc_input))
     = string.
 
 dump_input_components(_, []) = "".
@@ -863,7 +874,7 @@
     dump_input_component(MaybeProcLabel, Input) ++ "\n" ++
     dump_input_components(MaybeProcLabel, Inputs).
 
-:- func dump_output_components(maybe(proc_label), list(pragma_c_output))
+:- func dump_output_components(maybe(proc_label), list(foreign_proc_output))
     = string.
 
 dump_output_components(_, []) = "".
@@ -871,17 +882,17 @@
     dump_output_component(MaybeProcLabel, Input) ++ "\n" ++
     dump_output_components(MaybeProcLabel, Inputs).
 
-:- func dump_input_component(maybe(proc_label), pragma_c_input) = string.
+:- func dump_input_component(maybe(proc_label), foreign_proc_input) = string.
 
 dump_input_component(MaybeProcLabel,
-        pragma_c_input(Var, _, Dummy, _, Rval, _, _)) =
+        foreign_proc_input(Var, _, Dummy, _, Rval, _, _)) =
     Var ++ dump_maybe_dummy(Dummy) ++ " := " ++
         dump_rval(MaybeProcLabel, Rval).
 
-:- func dump_output_component(maybe(proc_label), pragma_c_output) = string.
+:- func dump_output_component(maybe(proc_label), foreign_proc_output) = string.
 
 dump_output_component(MaybeProcLabel,
-        pragma_c_output(Lval, _, Dummy, _, Var, _, _)) =
+        foreign_proc_output(Lval, _, Dummy, _, Var, _, _)) =
     dump_lval(MaybeProcLabel, Lval) ++ " := " ++ Var ++
         dump_maybe_dummy(Dummy).
 
Index: compiler/opt_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/opt_util.m,v
retrieving revision 1.158
diff -u -b -r1.158 opt_util.m
--- compiler/opt_util.m	1 Dec 2006 15:04:12 -0000	1.158
+++ compiler/opt_util.m	30 Dec 2006 07:29:41 -0000
@@ -68,7 +68,7 @@
     % the virtual machine registers that point to the nondet stack
     % (curfr and maxfr) and the fixed slots in nondet stack frames.
     %
-:- pred touches_nondet_ctrl(list(instruction)::in, bool::out) is det.
+:- func touches_nondet_ctrl(list(instruction)) = bool.
 
     % Find the instructions up to and including the next one that
     % cannot fall through.
@@ -179,18 +179,18 @@
 
     % Check whether an instruction can possibly branch away.
     %
-:- pred can_instr_branch_away(instr::in, bool::out) is det.
+:- func can_instr_branch_away(instr) = bool.
 
     % Check whether an instruction can possibly fall through
     % to the next instruction without using its label.
     %
-:- pred can_instr_fall_through(instr::in, bool::out) is det.
+:- func can_instr_fall_through(instr) = bool.
 
     % Check whether a code_addr, when the target of a goto, represents either
     % a call or a proceed/succeed; if so, it is the end of an extended basic
     % block and needs a livevals in front of it.
     %
-:- pred livevals_addr(code_addr::in, bool::out) is det.
+:- func livevals_addr(code_addr) = bool.
 
     % Determine all the labels and code addresses which are referenced
     % by an instruction. The code addresses that are labels are returned
@@ -291,8 +291,8 @@
 :- pred replace_labels_instruction_list(list(instruction)::in,
     map(label, label)::in, bool::in, bool::in, list(instruction)::out) is det.
 
-:- pred replace_labels_comps(list(pragma_c_component)::in,
-    map(label, label)::in, list(pragma_c_component)::out) is det.
+:- pred replace_labels_comps(list(foreign_proc_component)::in,
+    map(label, label)::in, list(foreign_proc_component)::out) is det.
 
 :- pred replace_labels_code_addr(code_addr::in, map(label, label)::in,
     code_addr::out) is det.
@@ -415,7 +415,7 @@
     ->
         fail
     ;
-        can_instr_branch_away(Uinstr, CanBranchAway),
+        CanBranchAway = can_instr_branch_away(Uinstr),
         (
             CanBranchAway = no,
             next_assign_to_redoip(Instrs, AllowedBases, [Instr | RevSkip],
@@ -430,7 +430,7 @@
 find_no_fallthrough([Instr0 | Instrs0], Instrs) :-
     (
         Instr0 = Uinstr0 - _,
-        can_instr_fall_through(Uinstr0, no)
+        can_instr_fall_through(Uinstr0) = no
     ->
         Instrs = [Instr0]
     ;
@@ -603,8 +603,8 @@
         After = Instrs0
     ;
         (
-            can_instr_branch_away(Uinstr0, no),
-            touches_nondet_ctrl_instr(Uinstr0, no)
+            can_instr_branch_away(Uinstr0) = no,
+            touches_nondet_ctrl_instr(Uinstr0) = no
         ;
             Uinstr0 = if_val(_, CodeAddr),
             ( CodeAddr = do_fail ; CodeAddr = do_redo )
@@ -772,7 +772,7 @@
     ;
         InstrRefers = no,
         Instr = Uinstr - _,
-        can_instr_fall_through(Uinstr, CanFallThrough),
+        CanFallThrough = can_instr_fall_through(Uinstr),
         (
             CanFallThrough = yes,
             Refers = block_refers_to_stack(Instrs)
@@ -787,7 +787,7 @@
         ( Uinstr = comment(_)
         ; Uinstr = livevals(_)
         ; Uinstr = label(_)
-        ; Uinstr = arbitrary_c_code(_, _)
+        ; Uinstr = arbitrary_c_code(_, _, _)
         ; Uinstr = discard_ticket
         ; Uinstr = prune_ticket
         ),
@@ -859,8 +859,8 @@
         Uinstr = decr_sp_and_return(_),
         Refers = yes
     ;
-        Uinstr = pragma_c(_, Components, _, _, _, _, _, _, _),
-        Refers = bool.or_list(list.map(pragma_c_component_refers_stackvars,
+        Uinstr = foreign_proc_code(_, Components, _, _, _, _, _, _, _),
+        Refers = bool.or_list(list.map(foreign_proc_component_refers_stackvars,
             Components))
     ;
         Uinstr = init_sync_term(Lval, _),
@@ -873,30 +873,30 @@
         Refers = lval_refers_stackvars(Lval)
     ).
 
-:- func pragma_c_component_refers_stackvars(pragma_c_component) = bool.
+:- func foreign_proc_component_refers_stackvars(foreign_proc_component) = bool.
 
-pragma_c_component_refers_stackvars(Component) = Refers :-
+foreign_proc_component_refers_stackvars(Component) = Refers :-
     (
-        Component = pragma_c_inputs(Inputs),
-        bool.or_list(list.map(pragma_c_input_refers_stackvars, Inputs),
+        Component = foreign_proc_inputs(Inputs),
+        bool.or_list(list.map(foreign_proc_input_refers_stackvars, Inputs),
             Refers)
     ;
-        Component = pragma_c_outputs(Outputs),
-        bool.or_list(list.map(pragma_c_output_refers_stackvars, Outputs),
+        Component = foreign_proc_outputs(Outputs),
+        bool.or_list(list.map(foreign_proc_output_refers_stackvars, Outputs),
             Refers)
     ;
-        ( Component = pragma_c_user_code(_, _)
-        ; Component = pragma_c_raw_code(_, _, _)
-        ; Component = pragma_c_fail_to(_)
-        ; Component = pragma_c_noop
+        ( Component = foreign_proc_user_code(_, _, _)
+        ; Component = foreign_proc_raw_code(_, _, _, _)
+        ; Component = foreign_proc_fail_to(_)
+        ; Component = foreign_proc_noop
         ),
         Refers = no
     ).
 
-:- func pragma_c_input_refers_stackvars(pragma_c_input) = bool.
+:- func foreign_proc_input_refers_stackvars(foreign_proc_input) = bool.
 
-pragma_c_input_refers_stackvars(Input) = Refers :-
-    Input = pragma_c_input(_Name, _Type, IsDummy, _OrigType, Rval,
+foreign_proc_input_refers_stackvars(Input) = Refers :-
+    Input = foreign_proc_input(_Name, _Type, IsDummy, _OrigType, Rval,
         _MaybeForeign, _BoxPolicy),
     (
         IsDummy = yes,
@@ -906,10 +906,10 @@
         Refers = rval_refers_stackvars(Rval)
     ).
 
-:- func pragma_c_output_refers_stackvars(pragma_c_output) = bool.
+:- func foreign_proc_output_refers_stackvars(foreign_proc_output) = bool.
 
-pragma_c_output_refers_stackvars(Input) = Refers :-
-    Input = pragma_c_output(Lval, _Type, IsDummy, _OrigType, _Name,
+foreign_proc_output_refers_stackvars(Input) = Refers :-
+    Input = foreign_proc_output(Lval, _Type, IsDummy, _OrigType, _Name,
         _MaybeForeign, _BoxPolicy),
     (
         IsDummy = yes,
@@ -980,50 +980,48 @@
     Rval1 = Rval2,
     Taken = yes.
 
-can_instr_branch_away(comment(_), no).
-can_instr_branch_away(livevals(_), no).
-can_instr_branch_away(block(_, _, _), yes).
-can_instr_branch_away(assign(_, _), no).
-can_instr_branch_away(llcall(_, _, _, _, _, _), yes).
-can_instr_branch_away(mkframe(_, _), no).
-can_instr_branch_away(label(_), no).
-can_instr_branch_away(goto(_), yes).
-can_instr_branch_away(computed_goto(_, _), yes).
-can_instr_branch_away(arbitrary_c_code(_, _), no).
-can_instr_branch_away(if_val(_, _), yes).
-can_instr_branch_away(save_maxfr(_), no).
-can_instr_branch_away(restore_maxfr(_), no).
-can_instr_branch_away(incr_hp(_, _, _, _, _, _), no).
-can_instr_branch_away(mark_hp(_), no).
-can_instr_branch_away(restore_hp(_), no).
-can_instr_branch_away(free_heap(_), no).
-can_instr_branch_away(store_ticket(_), no).
-can_instr_branch_away(reset_ticket(_, _), no).
-can_instr_branch_away(discard_ticket, no).
-can_instr_branch_away(prune_ticket, no).
-can_instr_branch_away(mark_ticket_stack(_), no).
-can_instr_branch_away(prune_tickets_to(_), no).
-can_instr_branch_away(incr_sp(_, _, _), no).
-can_instr_branch_away(decr_sp(_), no).
-can_instr_branch_away(decr_sp_and_return(_), yes).
-can_instr_branch_away(init_sync_term(_, _), no).
-can_instr_branch_away(fork(_), no).
-can_instr_branch_away(join_and_continue(_, _), yes).
-can_instr_branch_away(pragma_c(_, Comps, _, _, _, _, _, _, _), BranchAway) :-
-    can_components_branch_away(Comps, BranchAway).
-
-:- pred can_components_branch_away(list(pragma_c_component)::in,
-    bool::out) is det.
-
-can_components_branch_away([], no).
-can_components_branch_away([Component | Components], BranchAway) :-
-    can_component_branch_away(Component, BranchAway1),
+can_instr_branch_away(comment(_)) = no.
+can_instr_branch_away(livevals(_)) = no.
+can_instr_branch_away(block(_, _, _)) = yes.
+can_instr_branch_away(assign(_, _)) = no.
+can_instr_branch_away(llcall(_, _, _, _, _, _)) = yes.
+can_instr_branch_away(mkframe(_, _)) = no.
+can_instr_branch_away(label(_)) = no.
+can_instr_branch_away(goto(_)) = yes.
+can_instr_branch_away(computed_goto(_, _)) = yes.
+can_instr_branch_away(arbitrary_c_code(_, _, _)) = no.
+can_instr_branch_away(if_val(_, _)) = yes.
+can_instr_branch_away(save_maxfr(_)) = no.
+can_instr_branch_away(restore_maxfr(_)) = no.
+can_instr_branch_away(incr_hp(_, _, _, _, _, _)) = no.
+can_instr_branch_away(mark_hp(_)) = no.
+can_instr_branch_away(restore_hp(_)) = no.
+can_instr_branch_away(free_heap(_)) = no.
+can_instr_branch_away(store_ticket(_)) = no.
+can_instr_branch_away(reset_ticket(_, _)) = no.
+can_instr_branch_away(discard_ticket) = no.
+can_instr_branch_away(prune_ticket) = no.
+can_instr_branch_away(mark_ticket_stack(_)) = no.
+can_instr_branch_away(prune_tickets_to(_)) = no.
+can_instr_branch_away(incr_sp(_, _, _)) = no.
+can_instr_branch_away(decr_sp(_)) = no.
+can_instr_branch_away(decr_sp_and_return(_)) = yes.
+can_instr_branch_away(init_sync_term(_, _)) = no.
+can_instr_branch_away(fork(_)) = no.
+can_instr_branch_away(join_and_continue(_, _)) = yes.
+can_instr_branch_away(foreign_proc_code(_, Comps, _, _, _, _, _, _, _)) =
+    can_components_branch_away(Comps).
+
+:- func can_components_branch_away(list(foreign_proc_component)) = bool.
+
+can_components_branch_away([]) = no.
+can_components_branch_away([Component | Components]) = !:BranchAway :-
+    !:BranchAway = can_component_branch_away(Component),
     (
-        BranchAway1 = yes,
-        BranchAway = yes
+        !.BranchAway = yes
     ;
-        BranchAway1 = no,
-        can_components_branch_away(Components, BranchAway)
+        !.BranchAway = no,
+        !:BranchAway = can_components_branch_away(Components)
     ).
 
     % The input and output components get expanded to straight line code.
@@ -1038,12 +1036,12 @@
     % but we are careful to preserve a declarative interface, and that
     % is incompatible with branching away.)
     %
-:- pred can_component_branch_away(pragma_c_component::in, bool::out) is det.
+:- func can_component_branch_away(foreign_proc_component) = bool.
 
-can_component_branch_away(pragma_c_inputs(_), no).
-can_component_branch_away(pragma_c_outputs(_), no).
-can_component_branch_away(pragma_c_raw_code(_, CanBranchAway, _),
-        CanBranchAwayBool) :-
+can_component_branch_away(foreign_proc_inputs(_)) = no.
+can_component_branch_away(foreign_proc_outputs(_)) = no.
+can_component_branch_away(foreign_proc_raw_code(CanBranchAway, _, _, _))
+        = CanBranchAwayBool :-
     (
         CanBranchAway = can_branch_away,
         CanBranchAwayBool = yes
@@ -1051,41 +1049,41 @@
         CanBranchAway = cannot_branch_away,
         CanBranchAwayBool = no
     ).
-can_component_branch_away(pragma_c_user_code(_, _), no).
-can_component_branch_away(pragma_c_fail_to(_), yes).
-can_component_branch_away(pragma_c_noop, no).
-
-can_instr_fall_through(comment(_), yes).
-can_instr_fall_through(livevals(_), yes).
-can_instr_fall_through(block(_, _, Instrs), FallThrough) :-
+can_component_branch_away(foreign_proc_user_code(_, _, _)) = no.
+can_component_branch_away(foreign_proc_fail_to(_)) = yes.
+can_component_branch_away(foreign_proc_noop) = no.
+
+can_instr_fall_through(comment(_)) = yes.
+can_instr_fall_through(livevals(_)) = yes.
+can_instr_fall_through(block(_, _, Instrs)) = FallThrough :-
     can_block_fall_through(Instrs, FallThrough).
-can_instr_fall_through(assign(_, _), yes).
-can_instr_fall_through(llcall(_, _, _, _, _, _), no).
-can_instr_fall_through(mkframe(_, _), yes).
-can_instr_fall_through(label(_), yes).
-can_instr_fall_through(goto(_), no).
-can_instr_fall_through(computed_goto(_, _), no).
-can_instr_fall_through(arbitrary_c_code(_, _), yes).
-can_instr_fall_through(if_val(_, _), yes).
-can_instr_fall_through(save_maxfr(_), yes).
-can_instr_fall_through(restore_maxfr(_), yes).
-can_instr_fall_through(incr_hp(_, _, _, _, _, _), yes).
-can_instr_fall_through(mark_hp(_), yes).
-can_instr_fall_through(restore_hp(_), yes).
-can_instr_fall_through(free_heap(_), yes).
-can_instr_fall_through(store_ticket(_), yes).
-can_instr_fall_through(reset_ticket(_, _), yes).
-can_instr_fall_through(discard_ticket, yes).
-can_instr_fall_through(prune_ticket, yes).
-can_instr_fall_through(mark_ticket_stack(_), yes).
-can_instr_fall_through(prune_tickets_to(_), yes).
-can_instr_fall_through(incr_sp(_, _, _), yes).
-can_instr_fall_through(decr_sp(_), yes).
-can_instr_fall_through(decr_sp_and_return(_), no).
-can_instr_fall_through(init_sync_term(_, _), yes).
-can_instr_fall_through(fork(_), yes).
-can_instr_fall_through(join_and_continue(_, _), no).
-can_instr_fall_through(pragma_c(_, _, _, _, _, _, _, _, _), yes).
+can_instr_fall_through(assign(_, _)) = yes.
+can_instr_fall_through(llcall(_, _, _, _, _, _)) = no.
+can_instr_fall_through(mkframe(_, _)) = yes.
+can_instr_fall_through(label(_)) = yes.
+can_instr_fall_through(goto(_)) = no.
+can_instr_fall_through(computed_goto(_, _)) = no.
+can_instr_fall_through(arbitrary_c_code(_, _, _)) = yes.
+can_instr_fall_through(if_val(_, _)) = yes.
+can_instr_fall_through(save_maxfr(_)) = yes.
+can_instr_fall_through(restore_maxfr(_)) = yes.
+can_instr_fall_through(incr_hp(_, _, _, _, _, _)) = yes.
+can_instr_fall_through(mark_hp(_)) = yes.
+can_instr_fall_through(restore_hp(_)) = yes.
+can_instr_fall_through(free_heap(_)) = yes.
+can_instr_fall_through(store_ticket(_)) = yes.
+can_instr_fall_through(reset_ticket(_, _)) = yes.
+can_instr_fall_through(discard_ticket) = yes.
+can_instr_fall_through(prune_ticket) = yes.
+can_instr_fall_through(mark_ticket_stack(_)) = yes.
+can_instr_fall_through(prune_tickets_to(_)) = yes.
+can_instr_fall_through(incr_sp(_, _, _)) = yes.
+can_instr_fall_through(decr_sp(_)) = yes.
+can_instr_fall_through(decr_sp_and_return(_)) = no.
+can_instr_fall_through(init_sync_term(_, _)) = yes.
+can_instr_fall_through(fork(_)) = yes.
+can_instr_fall_through(join_and_continue(_, _)) = no.
+can_instr_fall_through(foreign_proc_code(_, _, _, _, _, _, _, _, _)) = yes.
 
     % Check whether an instruction sequence can possibly fall through
     % to the next instruction without using its label.
@@ -1094,7 +1092,7 @@
 
 can_block_fall_through([], yes).
 can_block_fall_through([Instr - _ | Instrs], FallThrough) :-
-    ( can_instr_fall_through(Instr, no) ->
+    ( can_instr_fall_through(Instr) = no ->
         FallThrough = no
     ;
         can_block_fall_through(Instrs, FallThrough)
@@ -1111,7 +1109,7 @@
 can_use_livevals(label(_), no).
 can_use_livevals(goto(_), yes).
 can_use_livevals(computed_goto(_, _), no).
-can_use_livevals(arbitrary_c_code(_, _), no).
+can_use_livevals(arbitrary_c_code(_, _, _), no).
 can_use_livevals(if_val(_, _), yes).
 can_use_livevals(save_maxfr(_), no).
 can_use_livevals(restore_maxfr(_), no).
@@ -1131,7 +1129,7 @@
 can_use_livevals(init_sync_term(_, _), no).
 can_use_livevals(fork(_), no).
 can_use_livevals(join_and_continue(_, _), no).
-can_use_livevals(pragma_c(_, _, _, _, _, _, _, _, _), no).
+can_use_livevals(foreign_proc_code(_, _, _, _, _, _, _, _, _), no).
 
 instr_labels(Instr, Labels, CodeAddrs) :-
     instr_labels_2(Instr, Labels0, CodeAddrs1),
@@ -1174,7 +1172,7 @@
 instr_labels_2(label(_), [], []).
 instr_labels_2(goto(Addr), [], [Addr]).
 instr_labels_2(computed_goto(_, Labels), Labels, []).
-instr_labels_2(arbitrary_c_code(_, _), [], []).
+instr_labels_2(arbitrary_c_code(_, _, _), [], []).
 instr_labels_2(if_val(_, Addr), [], [Addr]).
 instr_labels_2(save_maxfr(_), [], []).
 instr_labels_2(restore_maxfr(_), [], []).
@@ -1199,9 +1197,9 @@
 instr_labels_2(init_sync_term(_, _), [], []).
 instr_labels_2(fork(Child), [Child], []).
 instr_labels_2(join_and_continue(_, Label), [Label], []).
-instr_labels_2(pragma_c(_, _, _, MaybeFixLabel, MaybeLayoutLabel,
+instr_labels_2(foreign_proc_code(_, _, _, MaybeFixLabel, MaybeLayoutLabel,
         MaybeOnlyLayoutLabel, MaybeSubLabel, _, _), Labels, []) :-
-    pragma_c_labels(MaybeFixLabel, MaybeLayoutLabel,
+    foreign_proc_labels(MaybeFixLabel, MaybeLayoutLabel,
         MaybeOnlyLayoutLabel, MaybeSubLabel, Labels).
 
 possible_targets(comment(_), [], []).
@@ -1228,7 +1226,7 @@
         CodeAddrs = [CodeAddr]
     ).
 possible_targets(computed_goto(_, Labels), Labels, []).
-possible_targets(arbitrary_c_code(_, _), [], []).
+possible_targets(arbitrary_c_code(_, _, _), [], []).
 possible_targets(if_val(_, CodeAddr), Labels, CodeAddrs) :-
     ( CodeAddr = code_label(Label) ->
         Labels = [Label],
@@ -1257,15 +1255,15 @@
 possible_targets(init_sync_term(_, _), [], []).
 possible_targets(fork(_Child), [], []).
 possible_targets(join_and_continue(_, L), [L], []).
-possible_targets(pragma_c(_, _, _, MaybeFixedLabel, MaybeLayoutLabel,
+possible_targets(foreign_proc_code(_, _, _, MaybeFixedLabel, MaybeLayoutLabel,
         _, MaybeSubLabel, _, _), Labels, []) :-
-    pragma_c_labels(MaybeFixedLabel, MaybeLayoutLabel,
+    foreign_proc_labels(MaybeFixedLabel, MaybeLayoutLabel,
         no, MaybeSubLabel, Labels).
 
-:- pred pragma_c_labels(maybe(label)::in, maybe(label)::in, maybe(label)::in,
-    maybe(label)::in, list(label)::out) is det.
+:- pred foreign_proc_labels(maybe(label)::in, maybe(label)::in,
+    maybe(label)::in, maybe(label)::in, list(label)::out) is det.
 
-pragma_c_labels(MaybeFixedLabel, MaybeLayoutLabel,
+foreign_proc_labels(MaybeFixedLabel, MaybeLayoutLabel,
         MaybeOnlyLayoutLabel, MaybeSubLabel, !:Labels) :-
     !:Labels = [],
     (
@@ -1308,7 +1306,7 @@
 instr_rvals_and_lvals(label(_), [], []).
 instr_rvals_and_lvals(goto(_), [], []).
 instr_rvals_and_lvals(computed_goto(Rval, _), [Rval], []).
-instr_rvals_and_lvals(arbitrary_c_code(_, _), [], []).
+instr_rvals_and_lvals(arbitrary_c_code(_, _, _), [], []).
 instr_rvals_and_lvals(if_val(Rval, _), [Rval], []).
 instr_rvals_and_lvals(save_maxfr(Lval), [], [Lval]).
 instr_rvals_and_lvals(restore_maxfr(Lval), [], [Lval]).
@@ -1328,62 +1326,63 @@
 instr_rvals_and_lvals(init_sync_term(Lval, _), [], [Lval]).
 instr_rvals_and_lvals(fork(_), [], []).
 instr_rvals_and_lvals(join_and_continue(Lval, _), [], [Lval]).
-instr_rvals_and_lvals(pragma_c(_, Cs, _, _, _, _, _, _, _),
+instr_rvals_and_lvals(foreign_proc_code(_, Cs, _, _, _, _, _, _, _),
         Rvals, Lvals) :-
-    pragma_c_components_get_rvals_and_lvals(Cs, Rvals, Lvals).
+    foreign_proc_components_get_rvals_and_lvals(Cs, Rvals, Lvals).
 
-    % Extract the rvals and lvals from the pragma_c_components.
+    % Extract the rvals and lvals from the foreign_proc_components.
     %
-:- pred pragma_c_components_get_rvals_and_lvals(list(pragma_c_component)::in,
+:- pred foreign_proc_components_get_rvals_and_lvals(
+    list(foreign_proc_component)::in,
     list(rval)::out, list(lval)::out) is det.
 
-pragma_c_components_get_rvals_and_lvals([], [], []).
-pragma_c_components_get_rvals_and_lvals([Comp | Comps], !:Rvals, !:Lvals) :-
-    pragma_c_components_get_rvals_and_lvals(Comps, !:Rvals, !:Lvals),
-    pragma_c_component_get_rvals_and_lvals(Comp, !Rvals, !Lvals).
+foreign_proc_components_get_rvals_and_lvals([], [], []).
+foreign_proc_components_get_rvals_and_lvals([Comp | Comps], !:Rvals, !:Lvals) :-
+    foreign_proc_components_get_rvals_and_lvals(Comps, !:Rvals, !:Lvals),
+    foreign_proc_component_get_rvals_and_lvals(Comp, !Rvals, !Lvals).
 
-    % Extract the rvals and lvals from the pragma_c_component
+    % Extract the rvals and lvals from the foreign_proc_component
     % and add them to the list.
     %
-:- pred pragma_c_component_get_rvals_and_lvals(pragma_c_component::in,
+:- pred foreign_proc_component_get_rvals_and_lvals(foreign_proc_component::in,
     list(rval)::in, list(rval)::out, list(lval)::in, list(lval)::out) is det.
 
-pragma_c_component_get_rvals_and_lvals(pragma_c_inputs(Inputs),
+foreign_proc_component_get_rvals_and_lvals(foreign_proc_inputs(Inputs),
         !Rvals, !Lvals) :-
-    pragma_c_inputs_get_rvals(Inputs, NewRvals),
+    NewRvals = foreign_proc_inputs_get_rvals(Inputs),
     list.append(NewRvals, !Rvals).
-pragma_c_component_get_rvals_and_lvals(pragma_c_outputs(Outputs),
+foreign_proc_component_get_rvals_and_lvals(foreign_proc_outputs(Outputs),
         !Rvals, !Lvals) :-
-    pragma_c_outputs_get_lvals(Outputs, NewLvals),
+    NewLvals = foreign_proc_outputs_get_lvals(Outputs),
     list.append(NewLvals, !Lvals).
-pragma_c_component_get_rvals_and_lvals(pragma_c_user_code(_, _),
+foreign_proc_component_get_rvals_and_lvals(foreign_proc_user_code(_, _, _),
         !Rvals, !Lvals).
-pragma_c_component_get_rvals_and_lvals(pragma_c_raw_code(_, _, _),
+foreign_proc_component_get_rvals_and_lvals(foreign_proc_raw_code(_, _, _, _),
         !Rvals, !Lvals).
-pragma_c_component_get_rvals_and_lvals(pragma_c_fail_to(_),
+foreign_proc_component_get_rvals_and_lvals(foreign_proc_fail_to(_),
         !Rvals, !Lvals).
-pragma_c_component_get_rvals_and_lvals(pragma_c_noop,
+foreign_proc_component_get_rvals_and_lvals(foreign_proc_noop,
         !Rvals, !Lvals).
 
-    % Extract the rvals from the pragma_c_input.
+    % Extract the rvals from the foreign_proc_input.
     %
-:- pred pragma_c_inputs_get_rvals(list(pragma_c_input)::in, list(rval)::out)
-    is det.
+:- func foreign_proc_inputs_get_rvals(list(foreign_proc_input)) = list(rval).
 
-pragma_c_inputs_get_rvals([], []).
-pragma_c_inputs_get_rvals([I | Inputs], [R | Rvals]) :-
-    I = pragma_c_input(_Name, _VarType, _IsDummy, _OrigType, R, _, _),
-    pragma_c_inputs_get_rvals(Inputs, Rvals).
+foreign_proc_inputs_get_rvals([]) = [].
+foreign_proc_inputs_get_rvals([Input | Inputs]) = [Rval | Rvals] :-
+    Input = foreign_proc_input(_Name, _VarType, _IsDummy, _OrigType, Rval,
+        _, _),
+    Rvals = foreign_proc_inputs_get_rvals(Inputs).
 
-    % Extract the lvals from the pragma_c_output.
+    % Extract the lvals from the foreign_proc_output.
     %
-:- pred pragma_c_outputs_get_lvals(list(pragma_c_output)::in, list(lval)::out)
-    is det.
+:- func foreign_proc_outputs_get_lvals(list(foreign_proc_output)) = list(lval).
 
-pragma_c_outputs_get_lvals([], []).
-pragma_c_outputs_get_lvals([O | Outputs], [L | Lvals]) :-
-    O = pragma_c_output(L, _VarType, _IsDummy, _OrigType, _Name, _, _),
-    pragma_c_outputs_get_lvals(Outputs, Lvals).
+foreign_proc_outputs_get_lvals([]) = [].
+foreign_proc_outputs_get_lvals([Output | Outputs]) = [Lval | Lvals] :-
+    Output = foreign_proc_output(Lval, _VarType, _IsDummy, _OrigType,
+        _Name, _, _),
+    Lvals = foreign_proc_outputs_get_lvals(Outputs).
 
     % Determine all the rvals and lvals referenced by a list of instructions.
     %
@@ -1404,7 +1403,7 @@
     list.append(Labels0, Labels1, Labels),
     list.append(CodeAddrs0, CodeAddrs1, CodeAddrs).
 
-livevals_addr(code_label(Label), Result) :-
+livevals_addr(code_label(Label)) = Result :-
     (
         Label = internal_label(_, _),
         Result = no
@@ -1412,16 +1411,16 @@
         Label = entry_label(_, _),
         Result = yes
     ).
-livevals_addr(code_imported_proc(_), yes).
-livevals_addr(code_succip, yes).
-livevals_addr(do_succeed(_), yes).
-livevals_addr(do_redo, no).
-livevals_addr(do_fail, no).
-livevals_addr(do_trace_redo_fail_shallow, no).
-livevals_addr(do_trace_redo_fail_deep, no).
-livevals_addr(do_call_closure(_), yes).
-livevals_addr(do_call_class_method(_), yes).
-livevals_addr(do_not_reached, no).
+livevals_addr(code_imported_proc(_)) = yes.
+livevals_addr(code_succip) = yes.
+livevals_addr(do_succeed(_)) = yes.
+livevals_addr(do_redo) = no.
+livevals_addr(do_fail) = no.
+livevals_addr(do_trace_redo_fail_shallow) = no.
+livevals_addr(do_trace_redo_fail_deep) = no.
+livevals_addr(do_call_closure(_)) = yes.
+livevals_addr(do_call_class_method(_)) = yes.
+livevals_addr(do_not_reached) = no.
 
 count_temps_instr_list([], !R, !F).
 count_temps_instr_list([Uinstr - _Comment | Instrs], !R, !F) :-
@@ -1442,7 +1441,7 @@
     count_temps_rval(Rval, !R, !F).
 count_temps_instr(if_val(Rval, _), !R, !F) :-
     count_temps_rval(Rval, !R, !F).
-count_temps_instr(arbitrary_c_code(_, _), !R, !F).
+count_temps_instr(arbitrary_c_code(_, _, _), !R, !F).
 count_temps_instr(save_maxfr(Lval), !R, !F) :-
     count_temps_lval(Lval, !R, !F).
 count_temps_instr(restore_maxfr(Lval), !R, !F) :-
@@ -1474,7 +1473,7 @@
 count_temps_instr(fork(_), !R, !F).
 count_temps_instr(join_and_continue(Lval, _), !R, !F) :-
     count_temps_lval(Lval, !R, !F).
-count_temps_instr(pragma_c(_, _, _, _, _, _, _, _, _), !R, !F).
+count_temps_instr(foreign_proc_code(_, _, _, _, _, _, _, _, _), !R, !F).
 
 :- pred count_temps_lval(lval::in, int::in, int::out, int::in, int::out)
     is det.
@@ -1535,19 +1534,19 @@
     ),
     has_both_incr_decr_sp_2(Instrs, !HasIncr, !HasDecr).
 
-touches_nondet_ctrl([], no).
-touches_nondet_ctrl([Uinstr - _ | Instrs], !:Touch) :-
-    touches_nondet_ctrl_instr(Uinstr, !:Touch),
+touches_nondet_ctrl([]) = no.
+touches_nondet_ctrl([Uinstr - _ | Instrs]) = !:Touch :-
+    !:Touch = touches_nondet_ctrl_instr(Uinstr),
     (
         !.Touch = yes
     ;
         !.Touch = no,
-        touches_nondet_ctrl(Instrs, !:Touch)
+        !:Touch = touches_nondet_ctrl(Instrs)
     ).
 
-:- pred touches_nondet_ctrl_instr(instr::in, bool::out) is det.
+:- func touches_nondet_ctrl_instr(instr) = bool.
 
-touches_nondet_ctrl_instr(Uinstr, Touch) :-
+touches_nondet_ctrl_instr(Uinstr) = Touch :-
     (
         ( Uinstr = comment(_)
         ; Uinstr = livevals(_)
@@ -1570,7 +1569,7 @@
         ; Uinstr = computed_goto(_, _)
         ; Uinstr = llcall(_, _, _, _, _, _) % This is a safe approximation.
         ; Uinstr = if_val(_, _)
-        ; Uinstr = arbitrary_c_code(_, _)
+        ; Uinstr = arbitrary_c_code(_, _, _)
         ; Uinstr = save_maxfr(_)
         ; Uinstr = restore_maxfr(_)
         ; Uinstr = init_sync_term(_, _)     % This is a safe approximation.
@@ -1584,83 +1583,82 @@
         unexpected(this_file, "touches_nondet_ctrl_instr: block")
     ;
         Uinstr = assign(Lval, Rval),
-        touches_nondet_ctrl_lval(Lval, TouchLval),
-        touches_nondet_ctrl_rval(Rval, TouchRval),
+        TouchLval = touches_nondet_ctrl_lval(Lval),
+        TouchRval = touches_nondet_ctrl_rval(Rval),
         bool.or(TouchLval, TouchRval, Touch)
     ;
         Uinstr = incr_hp(Lval, _, _, Rval, _, _),
-        touches_nondet_ctrl_lval(Lval, TouchLval),
-        touches_nondet_ctrl_rval(Rval, TouchRval),
+        TouchLval = touches_nondet_ctrl_lval(Lval),
+        TouchRval = touches_nondet_ctrl_rval(Rval),
         bool.or(TouchLval, TouchRval, Touch)
     ;
         Uinstr = mark_hp(Lval),
-        touches_nondet_ctrl_lval(Lval, Touch)
+        Touch = touches_nondet_ctrl_lval(Lval)
     ;
         Uinstr = restore_hp(Rval),
-        touches_nondet_ctrl_rval(Rval, Touch)
+        Touch = touches_nondet_ctrl_rval(Rval)
     ;
-        Uinstr = pragma_c(_, Components, _, _, _, _, _, _, _),
-        touches_nondet_ctrl_components(Components, Touch)
+        Uinstr = foreign_proc_code(_, Components, _, _, _, _, _, _, _),
+        Touch = touches_nondet_ctrl_components(Components)
     ).
 
-:- pred touches_nondet_ctrl_lval(lval::in, bool::out) is det.
+:- func touches_nondet_ctrl_lval(lval) = bool.
 
-touches_nondet_ctrl_lval(reg(_, _), no).
-touches_nondet_ctrl_lval(stackvar(_), no).
-touches_nondet_ctrl_lval(parent_stackvar(_), no).
-touches_nondet_ctrl_lval(framevar(_), no).
-touches_nondet_ctrl_lval(succip, no).
-touches_nondet_ctrl_lval(maxfr, yes).
-touches_nondet_ctrl_lval(curfr, yes).
-touches_nondet_ctrl_lval(succfr_slot(_), yes).
-touches_nondet_ctrl_lval(prevfr_slot(_), yes).
-touches_nondet_ctrl_lval(redofr_slot(_), yes).
-touches_nondet_ctrl_lval(redoip_slot(_), yes).
-touches_nondet_ctrl_lval(succip_slot(_), yes).
-touches_nondet_ctrl_lval(hp, no).
-touches_nondet_ctrl_lval(sp, no).
-touches_nondet_ctrl_lval(parent_sp, no).
-touches_nondet_ctrl_lval(field(_, Rval1, Rval2), Touch) :-
-    touches_nondet_ctrl_rval(Rval1, Touch1),
-    touches_nondet_ctrl_rval(Rval2, Touch2),
+touches_nondet_ctrl_lval(reg(_, _)) = no.
+touches_nondet_ctrl_lval(stackvar(_)) = no.
+touches_nondet_ctrl_lval(parent_stackvar(_)) = no.
+touches_nondet_ctrl_lval(framevar(_)) = no.
+touches_nondet_ctrl_lval(succip) = no.
+touches_nondet_ctrl_lval(maxfr) = yes.
+touches_nondet_ctrl_lval(curfr) = yes.
+touches_nondet_ctrl_lval(succfr_slot(_)) = yes.
+touches_nondet_ctrl_lval(prevfr_slot(_)) = yes.
+touches_nondet_ctrl_lval(redofr_slot(_)) = yes.
+touches_nondet_ctrl_lval(redoip_slot(_)) = yes.
+touches_nondet_ctrl_lval(succip_slot(_)) = yes.
+touches_nondet_ctrl_lval(hp) = no.
+touches_nondet_ctrl_lval(sp) = no.
+touches_nondet_ctrl_lval(parent_sp) = no.
+touches_nondet_ctrl_lval(field(_, Rval1, Rval2)) = Touch :-
+    Touch1 = touches_nondet_ctrl_rval(Rval1),
+    Touch2 = touches_nondet_ctrl_rval(Rval2),
     bool.or(Touch1, Touch2, Touch).
-touches_nondet_ctrl_lval(lvar(_), no).
-touches_nondet_ctrl_lval(temp(_, _), no).
-touches_nondet_ctrl_lval(mem_ref(Rval), Touch) :-
-    touches_nondet_ctrl_rval(Rval, Touch).
-touches_nondet_ctrl_lval(global_var_ref(_), no).
-
-:- pred touches_nondet_ctrl_rval(rval::in, bool::out) is det.
-
-touches_nondet_ctrl_rval(lval(Lval), Touch) :-
-    touches_nondet_ctrl_lval(Lval, Touch).
-touches_nondet_ctrl_rval(var(_), no).
-touches_nondet_ctrl_rval(mkword(_, Rval), Touch) :-
-    touches_nondet_ctrl_rval(Rval, Touch).
-touches_nondet_ctrl_rval(const(_), no).
-touches_nondet_ctrl_rval(unop(_, Rval), Touch) :-
-    touches_nondet_ctrl_rval(Rval, Touch).
-touches_nondet_ctrl_rval(binop(_, Rval1, Rval2), Touch) :-
-    touches_nondet_ctrl_rval(Rval1, Touch1),
-    touches_nondet_ctrl_rval(Rval2, Touch2),
+touches_nondet_ctrl_lval(lvar(_)) = no.
+touches_nondet_ctrl_lval(temp(_, _)) = no.
+touches_nondet_ctrl_lval(mem_ref(Rval)) =
+    touches_nondet_ctrl_rval(Rval).
+touches_nondet_ctrl_lval(global_var_ref(_)) = no.
+
+:- func touches_nondet_ctrl_rval(rval) = bool.
+
+touches_nondet_ctrl_rval(lval(Lval)) =
+    touches_nondet_ctrl_lval(Lval).
+touches_nondet_ctrl_rval(var(_)) = no.
+touches_nondet_ctrl_rval(mkword(_, Rval)) =
+    touches_nondet_ctrl_rval(Rval).
+touches_nondet_ctrl_rval(const(_)) = no.
+touches_nondet_ctrl_rval(unop(_, Rval)) =
+    touches_nondet_ctrl_rval(Rval).
+touches_nondet_ctrl_rval(binop(_, Rval1, Rval2)) = Touch :-
+    Touch1 = touches_nondet_ctrl_rval(Rval1),
+    Touch2 = touches_nondet_ctrl_rval(Rval2),
     bool.or(Touch1, Touch2, Touch).
-touches_nondet_ctrl_rval(mem_addr(MemRef), Touch) :-
-    touches_nondet_ctrl_mem_ref(MemRef, Touch).
+touches_nondet_ctrl_rval(mem_addr(MemRef)) =
+    touches_nondet_ctrl_mem_ref(MemRef).
 
-:- pred touches_nondet_ctrl_mem_ref(mem_ref::in, bool::out) is det.
+:- func touches_nondet_ctrl_mem_ref(mem_ref) = bool.
 
-touches_nondet_ctrl_mem_ref(stackvar_ref(_), no).
-touches_nondet_ctrl_mem_ref(framevar_ref(_), no).
-touches_nondet_ctrl_mem_ref(heap_ref(Rval, _, _), Touch) :-
-    touches_nondet_ctrl_rval(Rval, Touch).
-
-:- pred touches_nondet_ctrl_components(list(pragma_c_component)::in,
-    bool::out) is det.
-
-touches_nondet_ctrl_components([], no).
-touches_nondet_ctrl_components([C | Cs], Touch) :-
-    touches_nondet_ctrl_component(C, Touch1),
-    touches_nondet_ctrl_components(Cs, Touch2),
+touches_nondet_ctrl_mem_ref(stackvar_ref(_)) = no.
+touches_nondet_ctrl_mem_ref(framevar_ref(_)) = no.
+touches_nondet_ctrl_mem_ref(heap_ref(Rval, _, _)) =
+    touches_nondet_ctrl_rval(Rval).
+
+:- func touches_nondet_ctrl_components(list(foreign_proc_component)) = bool.
+
+touches_nondet_ctrl_components([]) = no.
+touches_nondet_ctrl_components([Comp | Comps]) = Touch :-
+    Touch1 = touches_nondet_ctrl_component(Comp),
+    Touch2 = touches_nondet_ctrl_components(Comps),
     bool.or(Touch1, Touch2, Touch).
 
     % The inputs and outputs components get emitted as simple straight-line
@@ -1669,15 +1667,14 @@
     % until we have prohibited the use of ordinary pragma C codes for model_non
     % procedures, some user code will need to ignore this restriction.
     %
-:- pred touches_nondet_ctrl_component(pragma_c_component::in, bool::out)
-    is det.
+:- func touches_nondet_ctrl_component(foreign_proc_component) = bool.
 
-touches_nondet_ctrl_component(pragma_c_inputs(_), no).
-touches_nondet_ctrl_component(pragma_c_outputs(_), no).
-touches_nondet_ctrl_component(pragma_c_raw_code(_, _, _), no).
-touches_nondet_ctrl_component(pragma_c_user_code(_, _), yes).
-touches_nondet_ctrl_component(pragma_c_fail_to(_), no).
-touches_nondet_ctrl_component(pragma_c_noop, no).
+touches_nondet_ctrl_component(foreign_proc_inputs(_)) = no.
+touches_nondet_ctrl_component(foreign_proc_outputs(_)) = no.
+touches_nondet_ctrl_component(foreign_proc_raw_code(_, _, _, _)) = no.
+touches_nondet_ctrl_component(foreign_proc_user_code(_, _, _)) = yes.
+touches_nondet_ctrl_component(foreign_proc_fail_to(_)) = no.
+touches_nondet_ctrl_component(foreign_proc_noop) = no.
 
 %-----------------------------------------------------------------------------%
 
@@ -1763,7 +1760,7 @@
         Instr = Instr0,
         ( Uinstr0 = assign(Lval, _) ->
             set.delete(Livevals0, Lval, Livevals)
-        ; can_instr_fall_through(Uinstr0, no) ->
+        ; can_instr_fall_through(Uinstr0) = no ->
             set.init(Livevals)
         ;
             Livevals = Livevals0
@@ -1852,8 +1849,8 @@
         Rval = Rval0
     ),
     replace_labels_label_list(Labels0, ReplMap, Labels).
-replace_labels_instr(arbitrary_c_code(Code, Lvals), _, _,
-        arbitrary_c_code(Code, Lvals)).
+replace_labels_instr(arbitrary_c_code(Lvals, AffectsLiveness, Code), _, _,
+        arbitrary_c_code(Lvals, AffectsLiveness, Code)).
 replace_labels_instr(if_val(Rval0, Target0), ReplMap, ReplData,
         if_val(Rval, Target)) :-
     (
@@ -1967,9 +1964,9 @@
         Replmap, _, join_and_continue(Lval, Label)) :-
     replace_labels_label(Label0, Replmap, Label),
     replace_labels_lval(Lval0, Replmap, Lval).
-replace_labels_instr(pragma_c(A, Comps0, C, MaybeFix, MaybeLayout,
+replace_labels_instr(foreign_proc_code(A, Comps0, C, MaybeFix, MaybeLayout,
         MaybeOnlyLayout, MaybeSub0, H, I), ReplMap, _,
-        pragma_c(A, Comps, C, MaybeFix, MaybeLayout, MaybeOnlyLayout,
+        foreign_proc_code(A, Comps, C, MaybeFix, MaybeLayout, MaybeOnlyLayout,
             MaybeSub, H, I)) :-
     (
         MaybeFix = no
@@ -2014,19 +2011,19 @@
     replace_labels_comp(Comp0, ReplMap, Comp),
     replace_labels_comps(Comps0, ReplMap, Comps).
 
-:- pred replace_labels_comp(pragma_c_component::in,
-    map(label, label)::in, pragma_c_component::out) is det.
+:- pred replace_labels_comp(foreign_proc_component::in,
+    map(label, label)::in, foreign_proc_component::out) is det.
 
-replace_labels_comp(pragma_c_inputs(A), _, pragma_c_inputs(A)).
-replace_labels_comp(pragma_c_outputs(A), _, pragma_c_outputs(A)).
-replace_labels_comp(pragma_c_user_code(A, B), _,
-        pragma_c_user_code(A, B)).
-replace_labels_comp(pragma_c_raw_code(A, B, C), _,
-        pragma_c_raw_code(A, B, C)).
-replace_labels_comp(pragma_c_fail_to(Label0), ReplMap,
-        pragma_c_fail_to(Label)) :-
+replace_labels_comp(foreign_proc_inputs(A), _, foreign_proc_inputs(A)).
+replace_labels_comp(foreign_proc_outputs(A), _, foreign_proc_outputs(A)).
+replace_labels_comp(foreign_proc_user_code(A, B, C), _,
+        foreign_proc_user_code(A, B, C)).
+replace_labels_comp(foreign_proc_raw_code(A, B, C, D), _,
+        foreign_proc_raw_code(A, B, C, D)).
+replace_labels_comp(foreign_proc_fail_to(Label0), ReplMap,
+        foreign_proc_fail_to(Label)) :-
     replace_labels_label(Label0, ReplMap, Label).
-replace_labels_comp(pragma_c_noop, _, pragma_c_noop).
+replace_labels_comp(foreign_proc_noop, _, foreign_proc_noop).
 
 :- pred replace_labels_lval(lval::in, map(label, label)::in, lval::out) is det.
 
Index: compiler/peephole.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/peephole.m,v
retrieving revision 1.96
diff -u -b -r1.96 peephole.m
--- compiler/peephole.m	1 Dec 2006 15:04:14 -0000	1.96
+++ compiler/peephole.m	30 Dec 2006 07:33:29 -0000
@@ -263,7 +263,7 @@
         ),
         opt_util.next_assign_to_redoip(Instrs0, AllowedBases, [], Redoip2,
             Skipped, Rest),
-        opt_util.touches_nondet_ctrl(Skipped, no)
+        opt_util.touches_nondet_ctrl(Skipped) = no
     ->
         Instrs1 = Skipped ++ Rest,
         Instrs = [mkframe(NondetFrameInfo, yes(Redoip2)) - Comment | Instrs1]
@@ -356,7 +356,7 @@
     (
         opt_util.next_assign_to_redoip(Instrs0, [Base], [], Redoip2,
             Skipped, Rest),
-        opt_util.touches_nondet_ctrl(Skipped, no)
+        opt_util.touches_nondet_ctrl(Skipped) = no
     ->
         Instrs1 = Skipped ++ Rest,
         Instrs = [assign(redoip_slot(lval(Base)),
@@ -365,7 +365,7 @@
         Base = curfr,
         Redoip = const(llconst_code_addr(do_fail)),
         opt_util.straight_alternative(Instrs0, Between, After),
-        opt_util.touches_nondet_ctrl(Between, no),
+        opt_util.touches_nondet_ctrl(Between) = no,
         string.sub_string_search(Comment, "curfr==maxfr", _)
     ->
         list.condense([Between,
Index: compiler/pragma_c_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pragma_c_gen.m,v
retrieving revision 1.99
diff -u -b -r1.99 pragma_c_gen.m
--- compiler/pragma_c_gen.m	1 Dec 2006 15:04:15 -0000	1.99
+++ compiler/pragma_c_gen.m	30 Dec 2006 06:36:27 -0000
@@ -9,13 +9,13 @@
 % File: pragma_c_gen.m
 % Main authors: dgj, conway, zs.
 %
-% The code in this module generates code for pragma_c_code goals.
+% The code in this module generates code for call_foreign_proc goals.
 %
 % The schemes we use to generate code for model_det and model_semi
-% pragma_c_codes are quite similar, so we handle them together.
+% call_foreign_proc goals are quite similar, so we handle them together.
 % The code that does this is reasonably simple.
 %
-% The scheme for model_non pragma_c_codes is substantially different,
+% The scheme for model_non call_foreign_procs is substantially different,
 % so we handle them separately.
 %
 %---------------------------------------------------------------------------%
@@ -36,19 +36,19 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred generate_pragma_c_code(code_model::in,
+:- pred generate_foreign_proc_code(code_model::in,
     pragma_foreign_proc_attributes::in, pred_id::in, proc_id::in,
     list(foreign_arg)::in, list(foreign_arg)::in,
     maybe(trace_expr(trace_runtime))::in, pragma_foreign_code_impl::in,
     hlds_goal_info::in, code_tree::out,
     code_info::in, code_info::out) is det.
 
-:- func struct_name(module_name, string, int, proc_id) = string.
+:- func foreign_proc_struct_name(module_name, string, int, proc_id) = string.
 
     % The name of the variable model_semi foreign_procs in C assign to
     % to indicate success or failure. Exported for llds_out.m.
     %
-:- func pragma_succ_ind_name = string.
+:- func foreign_proc_succ_ind_name = string.
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
@@ -87,9 +87,10 @@
 
 %---------------------------------------------------------------------------%
 
-% The code we generate for an ordinary (model_det or model_semi) pragma_c_code
-% must be able to fit into the middle of a procedure, since such
-% pragma_c_codes can be inlined. This code is of the following form:
+% The code we generate for an ordinary (model_det or model_semi)
+% call_foreign_proc goal must be able to fit into the middle of a procedure,
+% since such call_foreign_proc goals can be inlined. This code is of the
+% following form:
 %
 %   <save live variables onto the stack> /* see note (1) below */
 %   {
@@ -108,7 +109,7 @@
 %       #undef MR_PROC_LABEL /* see note (5) below */
 %   }
 %
-% In the case of a semidet pragma c_code, the above is followed by
+% In the case of a semidet foreign_proc, the above is followed by
 %
 %   goto skip_label;
 %   fail_label:
@@ -119,17 +120,17 @@
 %
 %   if (!r1) MR_GOTO_LABEL(fail_label);
 %
-% In the case of a pragma c_code with determinism failure, the above
+% In the case of a foreign_proc with determinism failure, the above
 % is followed by
 %
 %    <code to fail>
 %
 % and the <check of r1> is empty.
 %
-% The code we generate for nondet pragma_c_code assumes that this code is
-% the only thing between the procedure prolog and epilog; such pragma_c_codes
-% therefore cannot be inlined. The code of the procedure is of one of the
-% following two forms:
+% The code we generate for nondet call_foreign_proc goals assumes that this
+% code is the only thing between the procedure prolog and epilog; such
+% call_foreign_proc goals therefore cannot be inlined. The code of the
+% procedure is of one of the following two forms:
 %
 % form 1 (duplicated common code):
 % <proc entry label and comments>
@@ -289,18 +290,18 @@
 % The procedure prolog creates a nondet stack frame that includes space for
 % a struct that is saved across calls. Since the position of this struct in
 % the nondet stack frame is not known until the procedure prolog is created,
-% which is *after* the call to generate_pragma_c_code, the prolog will #define
-% MR_ORDINARY_SLOTS as the number of ordinary slots in the nondet frame.
-% From the size of the fixed portion of the nondet stack frame, from
+% which is *after* the call to generate_foreign_proc_code, the prolog will
+% #define MR_ORDINARY_SLOTS as the number of ordinary slots in the nondet
+% frame. From the size of the fixed portion of the nondet stack frame, from
 % MR_ORDINARY_SLOTS and from the size of the save struct itself, one can
 % calculate the address of the save struct itself. The epilog will #undef
 % MR_ORDINARY_SLOTS. It need not do anything else, since all the normal epilog
 % stuff has been done in the code above.
 %
-% Unlike with ordinary pragma C codes, with nondet C codes there are never
+% Unlike with ordinary foreign_procs, with nondet foreign_procs there are never
 % any live variables to save at the start, except for the input variables,
 % and saving these is a job for the included C code. Also unlike ordinary
-% pragma C codes, nondet C codes are never followed by any other code,
+% foreign_procs, nondet C codes are never followed by any other code,
 % so the exprn_info component of the code generator state need not be
 % kept up to date.
 %
@@ -330,7 +331,7 @@
 %   needs restoring.
 %
 %   When calling nondet code, maxfr may be changed. This is why we must call
-%   MR_restore_registers() from the code we generate for nondet pragma C codes
+%   MR_restore_registers() from the code we generate for nondet foreign_procs
 %   even if we are not using conservative gc.
 %
 % 4 These labels and the code following them can be optimized away by the C
@@ -343,65 +344,68 @@
 %   standard library that allocates memory manually can use MR_PROC_LABEL as
 %   the procname argument to incr_hp_msg(), for memory profiling. Hard-coding
 %   the procname argument in the C code would be wrong, since it wouldn't
-%   handle the case where the original pragma c_code procedure gets inlined
-%   and optimized away. Of course we also need to #undef it afterwards.
+%   handle the case where the original foreign_proc gets inlined and optimized
+%   away. Of course we also need to #undef it afterwards.
 
 %---------------------------------------------------------------------------%
 
-generate_pragma_c_code(CodeModel, Attributes, PredId, ProcId, Args, ExtraArgs,
-        MaybeTraceRuntimeCond, PragmaImpl, GoalInfo, Code, !CI) :-
+generate_foreign_proc_code(CodeModel, Attributes, PredId, ProcId,
+        Args, ExtraArgs, MaybeTraceRuntimeCond, PragmaImpl, GoalInfo, Code,
+        !CI) :-
     (
         PragmaImpl = fc_impl_ordinary(C_Code, Context),
         (
             MaybeTraceRuntimeCond = no,
             CanOptAwayUnnamedArgs = yes,
-            ordinary_pragma_c_code(CodeModel, Attributes, PredId, ProcId,
-                Args, ExtraArgs, C_Code, Context, GoalInfo,
+            generate_ordinary_foreign_proc_code(CodeModel, Attributes,
+                PredId, ProcId, Args, ExtraArgs, C_Code, Context, GoalInfo,
                 CanOptAwayUnnamedArgs, Code, !CI)
         ;
             MaybeTraceRuntimeCond = yes(TraceRuntimeCond),
             expect(unify(Args, []), this_file,
-                "generate_pragma_c_code: args runtime cond"),
+                "generate_foreign_proc_code: args runtime cond"),
             expect(unify(ExtraArgs, []), this_file,
-                "generate_pragma_c_code: extra args runtime cond"),
+                "generate_foreign_proc_code: extra args runtime cond"),
             expect(unify(CodeModel, model_semi), this_file,
-                "generate_pragma_c_code: non-semi runtime cond"),
-            trace_runtime_cond_pragma_c_code(TraceRuntimeCond, Code, !CI)
+                "generate_foreign_proc_code: non-semi runtime cond"),
+            generate_trace_runtime_cond_foreign_proc_code(TraceRuntimeCond,
+                Code, !CI)
         )
     ;
         PragmaImpl = fc_impl_model_non(Fields, FieldsContext,
             First, FirstContext, Later, LaterContext,
             Treat, Shared, SharedContext),
         expect(unify(ExtraArgs, []), this_file,
-            "generate_pragma_c_code: extra args nondet"),
+            "generate_foreign_proc_code: extra args nondet"),
         require(unify(MaybeTraceRuntimeCond, no),
-            "generate_pragma_c_code: runtime cond nondet"),
+            "generate_foreign_proc_code: runtime cond nondet"),
         CanOptAwayUnnamedArgs = yes,
-        nondet_pragma_c_code(CodeModel, Attributes, PredId, ProcId,
-            Args, Fields, FieldsContext,
+        generate_nondet_foreign_proc_code(CodeModel, Attributes,
+            PredId, ProcId, Args, Fields, FieldsContext,
             First, FirstContext, Later, LaterContext,
             Treat, Shared, SharedContext, CanOptAwayUnnamedArgs, Code, !CI)
     ;
         PragmaImpl = fc_impl_import(Name, HandleReturn, Vars, Context),
         expect(unify(ExtraArgs, []), this_file,
-            "generate_pragma_c_code: extra args import"),
+            "generate_foreign_proc_code: extra args import"),
         require(unify(MaybeTraceRuntimeCond, no),
-            "generate_pragma_c_code: runtime cond import"),
+            "generate_foreign_proc_code: runtime cond import"),
         C_Code = HandleReturn ++ " " ++ Name ++ "(" ++ Vars ++ ");",
 
         % The imported function was generated with all arguments present.
         CanOptAwayUnnamedArgs = no,
-        ordinary_pragma_c_code(CodeModel, Attributes, PredId, ProcId,
-            Args, ExtraArgs, C_Code, Context, GoalInfo,
+        generate_ordinary_foreign_proc_code(CodeModel, Attributes,
+            PredId, ProcId, Args, ExtraArgs, C_Code, Context, GoalInfo,
             CanOptAwayUnnamedArgs, Code, !CI)
     ).
 
 %---------------------------------------------------------------------------%
 
-:- pred trace_runtime_cond_pragma_c_code(trace_expr(trace_runtime)::in,
-    code_tree::out, code_info::in, code_info::out) is det.
+:- pred generate_trace_runtime_cond_foreign_proc_code(
+    trace_expr(trace_runtime)::in, code_tree::out,
+    code_info::in, code_info::out) is det.
 
-trace_runtime_cond_pragma_c_code(RuntimeExpr, Code, !CI) :-
+generate_trace_runtime_cond_foreign_proc_code(RuntimeExpr, Code, !CI) :-
     generate_runtime_cond_code(RuntimeExpr, CondRval, !CI),
     code_info.get_next_label(SuccessLabel, !CI),
     code_info.generate_failure(FailCode, !CI),
@@ -443,14 +447,15 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred ordinary_pragma_c_code(code_model::in,
+:- pred generate_ordinary_foreign_proc_code(code_model::in,
     pragma_foreign_proc_attributes::in, pred_id::in, proc_id::in,
     list(foreign_arg)::in, list(foreign_arg)::in, string::in,
     maybe(prog_context)::in, hlds_goal_info::in, bool::in, code_tree::out,
     code_info::in, code_info::out) is det.
 
-ordinary_pragma_c_code(CodeModel, Attributes, PredId, ProcId, Args, ExtraArgs,
-        C_Code, Context, GoalInfo, CanOptAwayUnnamedArgs, Code, !CI) :-
+generate_ordinary_foreign_proc_code(CodeModel, Attributes, PredId, ProcId,
+        Args, ExtraArgs, C_Code, Context, GoalInfo, CanOptAwayUnnamedArgs,
+        Code, !CI) :-
     % Extract the attributes.
     MayCallMercury = get_may_call_mercury(Attributes),
     ThreadSafe = get_thread_safe(Attributes),
@@ -461,8 +466,8 @@
         ThreadSafe = proc_thread_safe
     ;
         ThreadSafe = proc_maybe_thread_safe,
-        unexpected(this_file,
-            "ordinary_pragma_c_code: maybe_thread_safe encountered.")
+        unexpected(this_file, "generate_ordinary_foreign_proc_code: " ++
+            "maybe_thread_safe encountered.")
     ;
         ThreadSafe = proc_not_thread_safe
     ),
@@ -472,8 +477,8 @@
     code_info.get_module_info(!.CI, ModuleInfo),
     make_extra_c_arg_list(ExtraArgs, ModuleInfo, ArgInfos, ExtraCArgs),
     list.append(OrigCArgs, ExtraCArgs, CArgs),
-    pragma_select_in_args(CArgs, InCArgs),
-    pragma_select_out_args(CArgs, OutCArgs),
+    foreign_proc_select_in_args(CArgs, InCArgs),
+    foreign_proc_select_out_args(CArgs, OutCArgs),
 
     goal_info_get_post_deaths(GoalInfo, PostDeaths),
     set.init(DeadVars0),
@@ -499,17 +504,17 @@
     % Generate the values of input variables.
     % (NB we need to be careful that the rvals generated here
     % remain valid below.)
-    get_pragma_input_vars(InCArgs, InputDescs, CanOptAwayUnnamedArgs,
+    get_foreign_proc_input_vars(InCArgs, InputDescs, CanOptAwayUnnamedArgs,
         InputVarsCode, !CI),
 
     % We cannot kill the forward dead input arguments until we have
     % finished generating the code producing the input variables.
-    % (The forward dead variables will be dead after the pragma_c_code,
+    % (The forward dead variables will be dead after the call_foreign_proc,
     % but are live during its input phase.)
     code_info.make_vars_forward_dead(DeadVars, !CI),
 
     % Generate <declaration of one local variable for each arg>.
-    make_pragma_decls(CArgs, ModuleInfo, CanOptAwayUnnamedArgs, Decls),
+    make_foreign_proc_decls(CArgs, ModuleInfo, CanOptAwayUnnamedArgs, Decls),
 
     % Generate #define MR_PROC_LABEL <procedure label> /* see note (5) */
     % and #undef MR_PROC_LABEL.
@@ -519,26 +524,27 @@
         ProcLabelHashDefine, ProcLabelHashUndef),
 
     % <assignment of input values from registers to local vars>
-    InputComp = pragma_c_inputs(InputDescs),
+    InputComp = foreign_proc_inputs(InputDescs),
 
     % MR_save_registers(); /* see notes (1) and (2) above */
     (
         MayCallMercury = proc_will_not_call_mercury,
-        SaveRegsComp = pragma_c_raw_code("", cannot_branch_away,
-            live_lvals_info(set.init))
+        SaveRegsComp = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), "")
     ;
         MayCallMercury = proc_may_call_mercury,
-        SaveRegsComp = pragma_c_raw_code("\tMR_save_registers();\n",
-            cannot_branch_away, live_lvals_info(set.init))
+        SaveRegsComp = foreign_proc_raw_code(cannot_branch_away,
+            affects_liveness, live_lvals_info(set.init),
+            "\tMR_save_registers();\n")
     ),
 
     % Code fragments to obtain and release the global lock.
     (
         ThreadSafe = proc_thread_safe,
-        ObtainLock = pragma_c_raw_code("", cannot_branch_away,
-            live_lvals_info(set.init)),
-        ReleaseLock = pragma_c_raw_code("", cannot_branch_away,
-            live_lvals_info(set.init))
+        ObtainLock = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), ""),
+        ReleaseLock = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), "")
     ;
         ThreadSafe = proc_not_thread_safe,
         module_info_pred_info(ModuleInfo, PredId, PredInfo),
@@ -546,45 +552,46 @@
         c_util.quote_string(Name, MangledName),
         ObtainLockStr = "\tMR_OBTAIN_GLOBAL_LOCK("""
             ++ MangledName ++ """);\n",
-        ObtainLock = pragma_c_raw_code(ObtainLockStr, cannot_branch_away,
-            live_lvals_info(set.init)),
+        ObtainLock = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), ObtainLockStr),
         ReleaseLockStr = "\tMR_RELEASE_GLOBAL_LOCK("""
             ++ MangledName ++ """);\n",
-        ReleaseLock = pragma_c_raw_code(ReleaseLockStr, cannot_branch_away,
-            live_lvals_info(set.init))
+        ReleaseLock = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), ReleaseLockStr)
     ),
 
     % <The C code itself>
-    C_Code_Comp = pragma_c_user_code(Context, C_Code),
+    C_Code_Comp = foreign_proc_user_code(Context, default_affects_liveness,
+        C_Code),
 
     % <for semidet code, check of SUCCESS_INDICATOR>
     goal_info_get_determinism(GoalInfo, Detism),
     ( CodeModel = model_semi ->
         ( Detism = detism_failure ->
-            CheckSuccess_Comp = pragma_c_noop,
+            CheckSuccess_Comp = foreign_proc_noop,
             MaybeFailLabel = no
         ;
             code_info.get_next_label(FailLabel, !CI),
-            CheckSuccess_Comp = pragma_c_fail_to(FailLabel),
+            CheckSuccess_Comp = foreign_proc_fail_to(FailLabel),
             MaybeFailLabel = yes(FailLabel)
         ),
-        DefSuccessComp = pragma_c_raw_code(
-            "\tMR_bool " ++ pragma_succ_ind_name ++ ";\n" ++
+        DefSuccessComp = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init),
+            "\tMR_bool " ++ foreign_proc_succ_ind_name ++ ";\n" ++
             "#undef SUCCESS_INDICATOR\n" ++
             "#define SUCCESS_INDICATOR " ++
-                pragma_succ_ind_name ++ "\n",
-            cannot_branch_away, live_lvals_info(set.init)),
-        UndefSuccessComp = pragma_c_raw_code(
+                foreign_proc_succ_ind_name ++ "\n"),
+        UndefSuccessComp = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init),
             "#undef SUCCESS_INDICATOR\n" ++
-            "#define SUCCESS_INDICATOR MR_r1\n",
-            cannot_branch_away, live_lvals_info(set.init))
+            "#define SUCCESS_INDICATOR MR_r1\n")
     ;
-        CheckSuccess_Comp = pragma_c_noop,
+        CheckSuccess_Comp = foreign_proc_noop,
         MaybeFailLabel = no,
-        DefSuccessComp = pragma_c_raw_code("", cannot_branch_away,
-            live_lvals_info(set.init)),
-        UndefSuccessComp = pragma_c_raw_code("", cannot_branch_away,
-            live_lvals_info(set.init))
+        DefSuccessComp = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), ""),
+        UndefSuccessComp = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), "")
     ),
 
     % #ifndef MR_CONSERVATIVE_GC
@@ -592,14 +599,13 @@
     % #endif
     (
         MayCallMercury = proc_will_not_call_mercury,
-        RestoreRegsComp = pragma_c_noop
+        RestoreRegsComp = foreign_proc_noop
     ;
         MayCallMercury = proc_may_call_mercury,
-        RestoreRegsComp = pragma_c_raw_code(
+        RestoreRegsComp = foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init),
             "#ifndef MR_CONSERVATIVE_GC\n\t" ++
-                "MR_restore_registers();\n#endif\n",
-            cannot_branch_away, live_lvals_info(set.init)
-        )
+                "MR_restore_registers();\n#endif\n")
     ),
 
     % The C code may have called Mercury code which clobbered the regs,
@@ -619,12 +625,12 @@
     ),
 
     % <assignment of the output values from local variables to registers>
-    pragma_acquire_regs(OutCArgs, Regs, !CI),
-    place_pragma_output_args_in_regs(OutCArgs, Regs, CanOptAwayUnnamedArgs,
-        OutputDescs, !CI),
-    OutputComp = pragma_c_outputs(OutputDescs),
+    foreign_proc_acquire_regs(OutCArgs, Regs, !CI),
+    place_foreign_proc_output_args_in_regs(OutCArgs, Regs,
+        CanOptAwayUnnamedArgs, OutputDescs, !CI),
+    OutputComp = foreign_proc_outputs(OutputDescs),
 
-    % Join all the components of the pragma_c together.
+    % Join all the components of the foreign_proc_code together.
     Components = [ProcLabelHashDefine, DefSuccessComp, InputComp,
         SaveRegsComp, ObtainLock, C_Code_Comp, ReleaseLock,
         CheckSuccess_Comp, RestoreRegsComp,
@@ -643,9 +649,9 @@
         RefersToLLDSSTack = no
     ),
     PragmaCCode = node([
-        pragma_c(Decls, Components, MayCallMercury, no, no, no,
+        foreign_proc_code(Decls, Components, MayCallMercury, no, no, no,
             MaybeFailLabel, RefersToLLDSSTack, MaybeDupl)
-            - "Pragma C inclusion"
+            - "foreign_proc inclusion"
     ]),
     %
     % For semidet code, we need to insert the failure handling code here:
@@ -680,16 +686,17 @@
     Code = tree_list([SaveVarsCode, InputVarsCode, PragmaCCode, FailureCode]).
 
 :- pred make_proc_label_hash_define(module_info::in, pred_id::in, proc_id::in,
-    pragma_c_component::out, pragma_c_component::out) is det.
+    foreign_proc_component::out, foreign_proc_component::out) is det.
 
 make_proc_label_hash_define(ModuleInfo, PredId, ProcId,
         ProcLabelHashDef, ProcLabelHashUndef) :-
-    ProcLabelHashDef = pragma_c_raw_code(string.append_list([
-        "#define\tMR_PROC_LABEL\t",
-        make_proc_label_string(ModuleInfo, PredId, ProcId), "\n"]),
-        cannot_branch_away, live_lvals_info(set.init)),
-    ProcLabelHashUndef = pragma_c_raw_code("#undef\tMR_PROC_LABEL\n",
-        cannot_branch_away, live_lvals_info(set.init)).
+    ProcLabelHashDef = foreign_proc_raw_code(cannot_branch_away,
+        doesnt_affect_liveness, live_lvals_info(set.init),
+        "#define\tMR_PROC_LABEL\t" ++
+            make_proc_label_string(ModuleInfo, PredId, ProcId) ++ "\n"),
+    ProcLabelHashUndef = foreign_proc_raw_code(cannot_branch_away,
+        doesnt_affect_liveness, live_lvals_info(set.init),
+        "#undef\tMR_PROC_LABEL\n").
 
 :- func make_proc_label_string(module_info, pred_id, proc_id) = string.
 
@@ -705,21 +712,22 @@
 
 %-----------------------------------------------------------------------------%
 
-:- pred nondet_pragma_c_code(code_model::in,
+:- pred generate_nondet_foreign_proc_code(code_model::in,
     pragma_foreign_proc_attributes::in, pred_id::in, proc_id::in,
     list(foreign_arg)::in,
     string::in, maybe(prog_context)::in,
     string::in, maybe(prog_context)::in,
-    string::in, maybe(prog_context)::in, pragma_shared_code_treatment::in,
+    string::in, maybe(prog_context)::in,
+    foreign_proc_shared_code_treatment::in,
     string::in, maybe(prog_context)::in, bool::in, code_tree::out,
     code_info::in, code_info::out) is det.
 
-nondet_pragma_c_code(CodeModel, Attributes, PredId, ProcId,
+generate_nondet_foreign_proc_code(CodeModel, Attributes, PredId, ProcId,
         Args, _Fields, _FieldsContext,
         First, FirstContext, Later, LaterContext, Treat, Shared, SharedContext,
         CanOptAwayUnnamedArgs, Code, !CI) :-
     expect(unify(CodeModel, model_non), this_file,
-        "inappropriate code model for nondet pragma C code"),
+        "inappropriate code model for nondet foreign_proc"),
     % Extract the may_call_mercury attribute.
     MayCallMercury = get_may_call_mercury(Attributes),
 
@@ -738,10 +746,11 @@
     % Get a list of input and output arguments.
     ArgInfos = code_info.get_pred_proc_arginfo(!.CI, PredId, ProcId),
     make_c_arg_list(Args, ArgInfos, CArgs),
-    pragma_select_in_args(CArgs, InCArgs),
-    pragma_select_out_args(CArgs, OutCArgs),
-    make_pragma_decls(CArgs, ModuleInfo, CanOptAwayUnnamedArgs, Decls),
-    make_pragma_decls(OutCArgs, ModuleInfo, CanOptAwayUnnamedArgs, OutDecls),
+    foreign_proc_select_in_args(CArgs, InCArgs),
+    foreign_proc_select_out_args(CArgs, OutCArgs),
+    make_foreign_proc_decls(CArgs, ModuleInfo, CanOptAwayUnnamedArgs, Decls),
+    make_foreign_proc_decls(OutCArgs, ModuleInfo, CanOptAwayUnnamedArgs,
+        OutDecls),
 
     input_descs_from_arg_info(!.CI, InCArgs, CanOptAwayUnnamedArgs,
         InputDescs),
@@ -752,8 +761,8 @@
     ModuleName = pred_info_module(PredInfo),
     PredName = pred_info_name(PredInfo),
     Arity = pred_info_orig_arity(PredInfo),
-    StructName = struct_name(ModuleName, PredName, Arity, ProcId),
-    SaveStructDecl = pragma_c_struct_ptr_decl(StructName, "LOCALS"),
+    StructName = foreign_proc_struct_name(ModuleName, PredName, Arity, ProcId),
+    SaveStructDecl = foreign_proc_struct_ptr_decl(StructName, "LOCALS"),
     string.format("\tLOCALS = (struct %s *) ((char *)
         (MR_curfr + 1 - MR_ORDINARY_SLOTS - MR_NONDET_FIXED_SIZE)
         - sizeof(struct %s));\n",
@@ -788,16 +797,16 @@
         FirstContext = no,
         term.context_init(ActualFirstContext)
     ),
-    maybe_generate_pragma_event_code(nondet_pragma_first, ActualFirstContext,
-        FirstTraceCode, !CI),
+    maybe_generate_foreign_proc_event_code(nondet_foreign_proc_first,
+        ActualFirstContext, FirstTraceCode, !CI),
     (
         LaterContext = yes(ActualLaterContext)
     ;
         LaterContext = no,
         term.context_init(ActualLaterContext)
     ),
-    maybe_generate_pragma_event_code(nondet_pragma_later, ActualLaterContext,
-        LaterTraceCode, !CI),
+    maybe_generate_foreign_proc_event_code(nondet_foreign_proc_later,
+        ActualLaterContext, LaterTraceCode, !CI),
 
     FirstDisjunctCode = tree_list([SaveHeapCode, SaveTicketCode,
          FirstTraceCode]),
@@ -858,9 +867,9 @@
         % how many C statements it has and thus how big its object code
         % is likely to be.
         (
-            Treat = duplicate
+            Treat = shared_code_duplicate
         ;
-            Treat = automatic,
+            Treat = shared_code_automatic,
             \+ pred_info_requested_no_inlining(PredInfo),
             CountSemis = (pred(Char::in, Count0::in, Count::out) is det :-
                 ( Char = (;) ->
@@ -875,81 +884,93 @@
     ->
         CallDecls = [SaveStructDecl | Decls],
         CallComponents = [
-            pragma_c_inputs(InputDescs),
-            pragma_c_raw_code(InitSaveStruct, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(SaveRegs, cannot_branch_away,
-                no_live_lvals_info),
+            foreign_proc_inputs(InputDescs),
+            foreign_proc_raw_code(cannot_branch_away,
+                doesnt_affect_liveness, no_live_lvals_info, InitSaveStruct),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SaveRegs),
             ProcLabelDefine,
-            pragma_c_raw_code(CallDef1, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(CallDef2, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(CallDef3, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_user_code(FirstContext, First),
-            pragma_c_user_code(SharedContext, Shared),
-            pragma_c_raw_code(CallSuccessLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(Succeed, can_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(CallLastSuccessLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(SucceedDiscard, can_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(Undef1, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef2, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef3, cannot_branch_away, no_live_lvals_info),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallDef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallDef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallDef3),
+            foreign_proc_user_code(FirstContext, default_affects_liveness,
+                First),
+            foreign_proc_user_code(SharedContext, default_affects_liveness,
+                Shared),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallSuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Succeed),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallLastSuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SucceedDiscard),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef3),
             ProcLabelUndef
         ],
         CallBlockCode = node([
-            pragma_c(CallDecls, CallComponents,
+            foreign_proc_code(CallDecls, CallComponents,
                 MayCallMercury, no, no, no, no, yes, no)
-                - "Call and shared pragma C inclusion"
+                - "Call and shared foreign_proc inclusion"
         ]),
 
         RetryDecls = [SaveStructDecl | OutDecls],
         RetryComponents = [
-            pragma_c_raw_code(InitSaveStruct, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(SaveRegs, cannot_branch_away,
-                no_live_lvals_info),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, InitSaveStruct),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SaveRegs),
             ProcLabelDefine,
-            pragma_c_raw_code(RetryDef1, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RetryDef2, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RetryDef3, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_user_code(LaterContext, Later),
-            pragma_c_user_code(SharedContext, Shared),
-            pragma_c_raw_code(RetrySuccessLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(Succeed, can_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(RetryLastSuccessLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(SucceedDiscard, can_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(Undef1, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef2, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef3, cannot_branch_away, no_live_lvals_info),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetryDef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetryDef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetryDef3),
+            foreign_proc_user_code(LaterContext, default_affects_liveness,
+                Later),
+            foreign_proc_user_code(SharedContext, default_affects_liveness,
+                Shared),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetrySuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Succeed),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetryLastSuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SucceedDiscard),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef3),
             ProcLabelUndef
         ],
         RetryBlockCode = node([
-            pragma_c(RetryDecls, RetryComponents,
+            foreign_proc_code(RetryDecls, RetryComponents,
                 MayCallMercury, no, no, no, no, yes, no)
-                - "Retry and shared pragma C inclusion"
+                - "Retry and shared foreign_proc inclusion"
         ]),
 
         Code = tree_list([ModFrameCode, FirstDisjunctCode, CallBlockCode,
@@ -979,121 +1000,136 @@
 
         CallDecls = [SaveStructDecl | Decls],
         CallComponents = [
-            pragma_c_inputs(InputDescs),
-            pragma_c_raw_code(InitSaveStruct, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(SaveRegs, cannot_branch_away,
-                no_live_lvals_info),
+            foreign_proc_inputs(InputDescs),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, InitSaveStruct),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SaveRegs),
             ProcLabelDefine,
-            pragma_c_raw_code(CallDef1, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(CallDef2, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(CallDef3, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_user_code(FirstContext, First),
-            pragma_c_raw_code(GotoSharedLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(CallSuccessLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(Succeed, can_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(CallLastSuccessLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(SucceedDiscard, can_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(Undef1, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef2, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef3, cannot_branch_away, no_live_lvals_info),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallDef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallDef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallDef3),
+            foreign_proc_user_code(FirstContext, default_affects_liveness,
+                First),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, GotoSharedLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallSuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Succeed),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, CallLastSuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SucceedDiscard),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef3),
             ProcLabelUndef
         ],
         CallBlockCode = node([
-            pragma_c(CallDecls, CallComponents, MayCallMercury,
+            foreign_proc_code(CallDecls, CallComponents, MayCallMercury,
                 yes(SharedLabel), no, no, no, yes, no)
-                - "Call pragma C inclusion"
+                - "Call foreign_proc inclusion"
         ]),
 
         RetryDecls = [SaveStructDecl | OutDecls],
         RetryComponents = [
-            pragma_c_raw_code(InitSaveStruct, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(SaveRegs, cannot_branch_away,
-                no_live_lvals_info),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, InitSaveStruct),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SaveRegs),
             ProcLabelDefine,
-            pragma_c_raw_code(RetryDef1, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RetryDef2, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RetryDef3, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_user_code(LaterContext, Later),
-            pragma_c_raw_code(GotoSharedLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RetrySuccessLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(Succeed, can_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(RetryLastSuccessLabel, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(SucceedDiscard, can_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(Undef1, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef2, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef3, cannot_branch_away, no_live_lvals_info),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetryDef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetryDef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetryDef3),
+            foreign_proc_user_code(LaterContext, default_affects_liveness,
+                Later),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, GotoSharedLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetrySuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Succeed),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RetryLastSuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SucceedDiscard),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef3),
             ProcLabelUndef
         ],
         RetryBlockCode = node([
-            pragma_c(RetryDecls, RetryComponents, MayCallMercury,
+            foreign_proc_code(RetryDecls, RetryComponents, MayCallMercury,
                 yes(SharedLabel), no, no, no, yes, no)
-                - "Retry pragma C inclusion"
+                - "Retry foreign_proc inclusion"
         ]),
 
         SharedDecls = [SaveStructDecl | OutDecls],
         SharedComponents = [
-            pragma_c_raw_code(InitSaveStruct, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(SaveRegs, cannot_branch_away,
-                no_live_lvals_info),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, InitSaveStruct),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SaveRegs),
             ProcLabelDefine,
-            pragma_c_raw_code(SharedDef1, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(SharedDef2, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(SharedDef3, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_user_code(SharedContext, Shared),
-            pragma_c_raw_code(SharedSuccessLabel,
-                cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(Succeed, can_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(SharedLastSuccessLabel,
-                cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(RestoreRegs, can_branch_away,
-                no_live_lvals_info),
-            pragma_c_outputs(OutputDescs),
-            pragma_c_raw_code(SucceedDiscard, cannot_branch_away,
-                no_live_lvals_info),
-            pragma_c_raw_code(Undef1, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef2, cannot_branch_away, no_live_lvals_info),
-            pragma_c_raw_code(Undef3, cannot_branch_away, no_live_lvals_info),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SharedDef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SharedDef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SharedDef3),
+            foreign_proc_user_code(SharedContext, default_affects_liveness,
+                Shared),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SharedSuccessLabel),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Succeed),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SharedLastSuccessLabel),
+            foreign_proc_raw_code(can_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, RestoreRegs),
+            foreign_proc_outputs(OutputDescs),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, SucceedDiscard),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef1),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef2),
+            foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+                no_live_lvals_info, Undef3),
             ProcLabelUndef
         ],
         SharedBlockCode = node([
-            pragma_c(SharedDecls, SharedComponents,
+            foreign_proc_code(SharedDecls, SharedComponents,
                 MayCallMercury, no, no, no, no, yes, no)
-                - "Shared pragma C inclusion"
+                - "Shared foreign_proc inclusion"
         ]),
 
         Code = tree_list([ModFrameCode, FirstDisjunctCode, CallBlockCode,
@@ -1131,9 +1167,9 @@
     CArg = c_arg(Var, MaybeName, Type, BoxPolicy, ArgInfo),
     make_c_arg_list(ArgTail, ArgInfoTail, CArgTail).
 make_c_arg_list([], [_ | _], _) :-
-    unexpected(this_file, "pragma_c_gen.make_c_arg_list length mismatch").
+    unexpected(this_file, "make_c_arg_list length mismatch").
 make_c_arg_list([_ | _], [], _) :-
-    unexpected(this_file, "pragma_c_gen.make_c_arg_list length mismatch").
+    unexpected(this_file, "make_c_arg_list length mismatch").
 
 %---------------------------------------------------------------------------%
 
@@ -1182,14 +1218,14 @@
 
 %---------------------------------------------------------------------------%
 
-    % pragma_select_out_args returns the list of variables which are outputs
+    % foreign_proc_select_out_args returns the list of variables which are outputs
     % for a procedure.
     %
-:- pred pragma_select_out_args(list(c_arg)::in, list(c_arg)::out) is det.
+:- pred foreign_proc_select_out_args(list(c_arg)::in, list(c_arg)::out) is det.
 
-pragma_select_out_args([], []).
-pragma_select_out_args([Arg | Rest], Out) :-
-    pragma_select_out_args(Rest, OutTail),
+foreign_proc_select_out_args([], []).
+foreign_proc_select_out_args([Arg | Rest], Out) :-
+    foreign_proc_select_out_args(Rest, OutTail),
     Arg = c_arg(_, _, _, _, ArgInfo),
     ArgInfo = arg_info(_Loc, Mode),
     ( Mode = top_out ->
@@ -1198,14 +1234,14 @@
         Out = OutTail
     ).
 
-    % Pragma_select_in_args returns the list of variables
+    % foreign_proc_select_in_args returns the list of variables
     % which are inputs for a procedure.
     %
-:- pred pragma_select_in_args(list(c_arg)::in, list(c_arg)::out) is det.
+:- pred foreign_proc_select_in_args(list(c_arg)::in, list(c_arg)::out) is det.
 
-pragma_select_in_args([], []).
-pragma_select_in_args([Arg | Rest], In) :-
-    pragma_select_in_args(Rest, InTail),
+foreign_proc_select_in_args([], []).
+foreign_proc_select_in_args([Arg | Rest], In) :-
+    foreign_proc_select_in_args(Rest, InTail),
     Arg = c_arg(_, _, _, _, ArgInfo),
     ArgInfo = arg_info(_Loc, Mode),
     ( Mode = top_in ->
@@ -1224,7 +1260,7 @@
     % aren't, we replace their name with UnnamedArgN.
     %
     % Singleton vars should be ignored when generating the declarations for
-    % pragma_c arguments because:
+    % call_foreign_proc arguments because:
     %
     %   - they should not appear in the C code
     %   - they could clash with the system name space
@@ -1251,16 +1287,17 @@
 
 %---------------------------------------------------------------------------%
 
-    % make_pragma_decls returns the list of pragma_decls for the pragma_c
-    % data structure in the LLDS. It is essentially a list of pairs of type and
-    % variable name, so that declarations of the form "Type Name;" can be made.
+    % make_foreign_proc_decls returns the list of foreign_proc_decls for the
+    % foreign_proc_code instruction in the LLDS. It is essentially a list of
+    % pairs of type and variable name, so that declarations of the form
+    % "Type Name;" can be made.
     %
-:- pred make_pragma_decls(list(c_arg)::in, module_info::in, bool::in,
-    list(pragma_c_decl)::out) is det.
+:- pred make_foreign_proc_decls(list(c_arg)::in, module_info::in, bool::in,
+    list(foreign_proc_decl)::out) is det.
 
-make_pragma_decls([], _, _, []).
-make_pragma_decls([Arg | Args], Module, CanOptAwayUnnamedArgs, Decls) :-
-    make_pragma_decls(Args, Module, CanOptAwayUnnamedArgs, DeclsTail),
+make_foreign_proc_decls([], _, _, []).
+make_foreign_proc_decls([Arg | Args], Module, CanOptAwayUnnamedArgs, Decls) :-
+    make_foreign_proc_decls(Args, Module, CanOptAwayUnnamedArgs, DeclsTail),
     Arg = c_arg(Var, MaybeArgName, OrigType, BoxPolicy, _ArgInfo),
     MaybeName = var_should_be_passed(CanOptAwayUnnamedArgs, Var, MaybeArgName),
     (
@@ -1272,7 +1309,7 @@
             BoxPolicy = always_boxed,
             OrigTypeString = "MR_Word"
         ),
-        Decl = pragma_c_arg_decl(OrigType, OrigTypeString, Name),
+        Decl = foreign_proc_arg_decl(OrigType, OrigTypeString, Name),
         Decls = [Decl | DeclsTail]
     ;
         MaybeName = no,
@@ -1296,15 +1333,17 @@
 
 %---------------------------------------------------------------------------%
 
-    % get_pragma_input_vars returns a list of pragma_c_inputs for the pragma_c
-    % data structure in the LLDS. It is essentially a list of the input
-    % variables, and the corresponding rvals assigned to those (C) variables.
+    % get_foreign_proc_input_vars returns a list of foreign_proc_inputs
+    % for the foreign_proc_code instruction in the LLDS. It is essentially
+    % a list of the input variables, and the corresponding rvals assigned
+    % to those (C) variables.
     %
-:- pred get_pragma_input_vars(list(c_arg)::in, list(pragma_c_input)::out,
-    bool::in, code_tree::out, code_info::in, code_info::out) is det.
+:- pred get_foreign_proc_input_vars(list(c_arg)::in,
+    list(foreign_proc_input)::out, bool::in, code_tree::out,
+    code_info::in, code_info::out) is det.
 
-get_pragma_input_vars([], [], _, empty, !CI).
-get_pragma_input_vars([Arg | Args], Inputs, CanOptAwayUnnamedArgs, Code,
+get_foreign_proc_input_vars([], [], _, empty, !CI).
+get_foreign_proc_input_vars([Arg | Args], Inputs, CanOptAwayUnnamedArgs, Code,
         !CI) :-
     Arg = c_arg(Var, MaybeArgName, OrigType, BoxPolicy, _ArgInfo),
     MaybeName = var_should_be_passed(CanOptAwayUnnamedArgs, Var, MaybeArgName),
@@ -1319,20 +1358,21 @@
         ;
             IsDummy = no
         ),
-        Input = pragma_c_input(Name, VarType, IsDummy, OrigType, Rval,
+        Input = foreign_proc_input(Name, VarType, IsDummy, OrigType, Rval,
             MaybeForeign, BoxPolicy),
-        get_pragma_input_vars(Args, Inputs1, CanOptAwayUnnamedArgs, RestCode,
-            !CI),
+        get_foreign_proc_input_vars(Args, Inputs1, CanOptAwayUnnamedArgs,
+            RestCode, !CI),
         Inputs = [Input | Inputs1],
         Code = tree(FirstCode, RestCode)
     ;
         MaybeName = no,
         % Just ignore the argument.
-        get_pragma_input_vars(Args, Inputs, CanOptAwayUnnamedArgs, Code, !CI)
+        get_foreign_proc_input_vars(Args, Inputs, CanOptAwayUnnamedArgs, Code,
+            !CI)
     ).
 
 :- func get_maybe_foreign_type_info(code_info, mer_type) =
-    maybe(pragma_c_foreign_type).
+    maybe(foreign_proc_type).
 
 get_maybe_foreign_type_info(CI, Type) = MaybeForeignTypeInfo :-
     code_info.get_module_info(CI, Module),
@@ -1347,7 +1387,7 @@
         (
             MaybeC = yes(Data),
             Data = foreign_type_lang_data(c_type(Name), _, Assertions),
-            MaybeForeignTypeInfo = yes(pragma_c_foreign_type(Name, Assertions))
+            MaybeForeignTypeInfo = yes(foreign_proc_type(Name, Assertions))
         ;
             MaybeC = no,
             % This is ensured by check_foreign_type in make_hlds.
@@ -1360,32 +1400,32 @@
 
 %---------------------------------------------------------------------------%
 
-    % pragma_acquire_regs acquires a list of registers in which to place each
-    % of the given arguments.
+    % foreign_proc_acquire_regs acquires a list of registers in which to place
+    % each of the given arguments.
     %
-:- pred pragma_acquire_regs(list(c_arg)::in, list(lval)::out,
+:- pred foreign_proc_acquire_regs(list(c_arg)::in, list(lval)::out,
     code_info::in, code_info::out) is det.
 
-pragma_acquire_regs([], [], !CI).
-pragma_acquire_regs([Arg | Args], [Reg | Regs], !CI) :-
+foreign_proc_acquire_regs([], [], !CI).
+foreign_proc_acquire_regs([Arg | Args], [Reg | Regs], !CI) :-
     Arg = c_arg(Var, _, _, _, _),
     code_info.acquire_reg_for_var(Var, Reg, !CI),
-    pragma_acquire_regs(Args, Regs, !CI).
+    foreign_proc_acquire_regs(Args, Regs, !CI).
 
 %---------------------------------------------------------------------------%
 
-    % place_pragma_output_args_in_regs returns a list of pragma_c_outputs,
-    % which are pairs of names of output registers and (C) variables which
-    % hold the output value.
+    % place_foreign_proc_output_args_in_regs returns a list of
+    % foreign_proc_outputs, which are pairs of names of output registers
+    % and (C) variables which hold the output value.
     %
-:- pred place_pragma_output_args_in_regs(list(c_arg)::in, list(lval)::in,
-    bool::in, list(pragma_c_output)::out, code_info::in, code_info::out)
+:- pred place_foreign_proc_output_args_in_regs(list(c_arg)::in, list(lval)::in,
+    bool::in, list(foreign_proc_output)::out, code_info::in, code_info::out)
     is det.
 
-place_pragma_output_args_in_regs([], [], _, [], !CI).
-place_pragma_output_args_in_regs([Arg | Args], [Reg | Regs],
+place_foreign_proc_output_args_in_regs([], [], _, [], !CI).
+place_foreign_proc_output_args_in_regs([Arg | Args], [Reg | Regs],
         CanOptAwayUnnamedArgs, Outputs, !CI) :-
-    place_pragma_output_args_in_regs(Args, Regs, CanOptAwayUnnamedArgs,
+    place_foreign_proc_output_args_in_regs(Args, Regs, CanOptAwayUnnamedArgs,
         OutputsTail, !CI),
     Arg = c_arg(Var, MaybeArgName, OrigType, BoxPolicy, _ArgInfo),
     code_info.release_reg(Reg, !CI),
@@ -1403,8 +1443,8 @@
             ;
                 IsDummy = no
             ),
-            PragmaCOutput = pragma_c_output(Reg, VarType, IsDummy, OrigType,
-                Name, MaybeForeign, BoxPolicy),
+            PragmaCOutput = foreign_proc_output(Reg, VarType, IsDummy,
+                OrigType, Name, MaybeForeign, BoxPolicy),
             Outputs = [PragmaCOutput | OutputsTail]
         ;
             MaybeName = no,
@@ -1413,18 +1453,20 @@
     ;
         Outputs = OutputsTail
     ).
-place_pragma_output_args_in_regs([_ | _], [], _, _, !CI) :-
-    unexpected(this_file, "place_pragma_output_args_in_regs: length mismatch").
-place_pragma_output_args_in_regs([], [_ | _], _, _, !CI) :-
-    unexpected(this_file, "place_pragma_output_args_in_regs: length mismatch").
+place_foreign_proc_output_args_in_regs([_ | _], [], _, _, !CI) :-
+    unexpected(this_file,
+        "place_foreign_proc_output_args_in_regs: length mismatch").
+place_foreign_proc_output_args_in_regs([], [_ | _], _, _, !CI) :-
+    unexpected(this_file,
+        "place_foreign_proc_output_args_in_regs: length mismatch").
 
 %---------------------------------------------------------------------------%
 
-    % input_descs_from_arg_info returns a list of pragma_c_inputs, which
+    % input_descs_from_arg_info returns a list of foreign_proc_inputs, which
     % are pairs of rvals and (C) variables which receive the input value.
     %
 :- pred input_descs_from_arg_info(code_info::in, list(c_arg)::in,
-    bool::in, list(pragma_c_input)::out) is det.
+    bool::in, list(foreign_proc_input)::out) is det.
 
 input_descs_from_arg_info(_, [], _, []).
 input_descs_from_arg_info(CI, [Arg | Args], CanOptAwayUnnamedArgs, Inputs) :-
@@ -1443,7 +1485,7 @@
         ;
             IsDummy = no
         ),
-        Input = pragma_c_input(Name, VarType, IsDummy, OrigType, lval(Reg),
+        Input = foreign_proc_input(Name, VarType, IsDummy, OrigType, lval(Reg),
             MaybeForeign, BoxPolicy),
         Inputs = [Input | InputsTail]
     ;
@@ -1453,12 +1495,12 @@
 
 %---------------------------------------------------------------------------%
 
-    % output_descs_from_arg_info returns a list of pragma_c_outputs, which
+    % output_descs_from_arg_info returns a list of foreign_proc_outputs, which
     % are pairs of names of output registers and (C) variables which hold the
     % output value.
     %
 :- pred output_descs_from_arg_info(code_info::in, list(c_arg)::in,
-    bool::in, list(pragma_c_output)::out) is det.
+    bool::in, list(foreign_proc_output)::out) is det.
 
 output_descs_from_arg_info(_, [], _, []).
 output_descs_from_arg_info(CI, [Arg | Args], CanOptAwayUnnamedArgs, Outputs) :-
@@ -1477,7 +1519,7 @@
         ;
             IsDummy = no
         ),
-        Output = pragma_c_output(Reg, VarType, IsDummy, OrigType, Name,
+        Output = foreign_proc_output(Reg, VarType, IsDummy, OrigType, Name,
             MaybeForeign, BoxPolicy),
         Outputs = [Output | OutputsTail]
     ;
@@ -1487,12 +1529,12 @@
 
 %---------------------------------------------------------------------------%
 
-pragma_c_gen.struct_name(ModuleName, PredName, Arity, ProcId) =
+foreign_proc_struct_name(ModuleName, PredName, Arity, ProcId) =
     "mercury_save__" ++ sym_name_mangle(ModuleName) ++ "__" ++
         name_mangle(PredName) ++ "__" ++ int_to_string(Arity) ++ "_" ++
         int_to_string(proc_id_to_int(ProcId)).
 
-pragma_succ_ind_name = "MercurySuccessIndicator".
+foreign_proc_succ_ind_name = "MercurySuccessIndicator".
 
 %---------------------------------------------------------------------------%
 
Index: compiler/proc_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/proc_gen.m,v
retrieving revision 1.13
diff -u -b -r1.13 proc_gen.m
--- compiler/proc_gen.m	3 Jan 2007 05:17:06 -0000	1.13
+++ compiler/proc_gen.m	3 Jan 2007 05:17:29 -0000
@@ -904,19 +904,19 @@
             PragmaCode = fc_impl_model_non(Fields, FieldsContext,
                 _, _, _, _, _, _, _)
         ->
-            StructName = pragma_c_gen.struct_name(ModuleName, PredName, Arity,
+            StructName = foreign_proc_struct_name(ModuleName, PredName, Arity,
                 ProcId),
-            Struct = pragma_c_struct(StructName, Fields, FieldsContext),
+            Struct = foreign_proc_struct(StructName, Fields, FieldsContext),
             string.format("#define\tMR_ORDINARY_SLOTS\t%d\n",
                 [i(TotalSlots)], DefineStr),
-            DefineComponents = [pragma_c_raw_code(DefineStr,
-                cannot_branch_away, live_lvals_info(set.init))],
+            DefineComponents = [foreign_proc_raw_code(cannot_branch_away,
+                doesnt_affect_liveness, live_lvals_info(set.init), DefineStr)],
             NondetFrameInfo = ordinary_frame(PushMsg, TotalSlots, yes(Struct)),
             AllocCode = node([
                 mkframe(NondetFrameInfo, yes(OutsideResumeAddress))
                     - "Allocate stack frame",
-                pragma_c([], DefineComponents, proc_will_not_call_mercury,
-                    no, no, no, no, no, no) - ""
+                foreign_proc_code([], DefineComponents,
+                    proc_will_not_call_mercury, no, no, no, no, no, no) - ""
             ]),
             NondetPragma = yes
         ;
@@ -1003,10 +1003,10 @@
     (
         NondetPragma = yes,
         UndefStr = "#undef\tMR_ORDINARY_SLOTS\n",
-        UndefComponents = [pragma_c_raw_code(UndefStr, cannot_branch_away,
-            live_lvals_info(set.init))],
+        UndefComponents = [foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), UndefStr)],
         UndefCode = node([
-            pragma_c([], UndefComponents, proc_will_not_call_mercury,
+            foreign_proc_code([], UndefComponents, proc_will_not_call_mercury,
                 no, no, no, no, no, no) - ""
         ]),
         RestoreDeallocCode = empty, % always empty for nondet code
@@ -1260,20 +1260,20 @@
         ], BytecodeCall),
 
     BytecodeInstructionsComponents = [
-        pragma_c_raw_code("\t{\n", cannot_branch_away,
-            live_lvals_info(set.init)),
-        pragma_c_raw_code(CallStruct, cannot_branch_away,
-            live_lvals_info(set.init)),
-        pragma_c_raw_code(BytecodeCall, cannot_branch_away,
-            no_live_lvals_info),
-        pragma_c_raw_code("\t}\n", cannot_branch_away,
-            live_lvals_info(set.init))
+        foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+            live_lvals_info(set.init), "\t{\n"),
+        foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+            live_lvals_info(set.init), CallStruct),
+        foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+            no_live_lvals_info, BytecodeCall),
+        foreign_proc_raw_code(cannot_branch_away, doesnt_affect_liveness,
+            live_lvals_info(set.init), "\t}\n")
     ],
 
     BytecodeInstructions = [
         label(EntryLabel) - "Procedure entry point",
-        pragma_c([], BytecodeInstructionsComponents, proc_may_call_mercury,
-            no, no, no, no, no, no) - "Entry stub"
+        foreign_proc_code([], BytecodeInstructionsComponents,
+            proc_may_call_mercury, no, no, no, no, no, no) - "Entry stub"
     ].
 
 %---------------------------------------------------------------------------%
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.183
diff -u -b -r1.183 prog_data.m
--- compiler/prog_data.m	27 Dec 2006 04:16:29 -0000	1.183
+++ compiler/prog_data.m	30 Dec 2006 06:52:48 -0000
@@ -560,7 +560,7 @@
                     % into the procedure.  This code may not access the input
                     % variables.
 
-                pragma_shared_code_treatment,
+                foreign_proc_shared_code_treatment,
                     % How should the shared code be treated during code
                     % generation.
 
@@ -581,10 +581,10 @@
     % The use of this type is explained in the comment at the top of
     % pragma_c_gen.m.
     %
-:- type pragma_shared_code_treatment
-    --->    duplicate
-    ;       share
-    ;       automatic.
+:- type foreign_proc_shared_code_treatment
+    --->    shared_code_duplicate
+    ;       shared_code_share
+    ;       shared_code_automatic.
 
 :- type foreign_import_module_info_list  == list(foreign_import_module_info).
                     % in reverse order
@@ -686,6 +686,8 @@
 :- func default_attributes(foreign_language) = pragma_foreign_proc_attributes.
 :- func get_may_call_mercury(pragma_foreign_proc_attributes) =
     proc_may_call_mercury.
+:- func get_affects_liveness(pragma_foreign_proc_attributes) =
+    affects_liveness.
 :- func get_thread_safe(pragma_foreign_proc_attributes) = proc_thread_safe.
 :- func get_purity(pragma_foreign_proc_attributes) = purity.
 :- func get_terminates(pragma_foreign_proc_attributes) = proc_terminates.
@@ -711,6 +713,10 @@
     pragma_foreign_proc_attributes::in,
     pragma_foreign_proc_attributes::out) is det.
 
+:- pred set_affects_liveness(affects_liveness::in,
+    pragma_foreign_proc_attributes::in,
+    pragma_foreign_proc_attributes::out) is det.
+
 :- pred set_thread_safe(proc_thread_safe::in,
     pragma_foreign_proc_attributes::in,
     pragma_foreign_proc_attributes::out) is det.
@@ -816,6 +822,11 @@
     --->    native_if_possible
     ;       always_boxed.
 
+:- type affects_liveness
+    --->    affects_liveness
+    ;       doesnt_affect_liveness
+    ;       default_affects_liveness.
+
     % This type specifies the termination property of a procedure
     % defined using pragma c_code or pragma foreign_proc.
     %
@@ -1669,6 +1680,7 @@
                 attr_may_modify_trail           :: proc_may_modify_trail,
                 attr_may_call_mm_tabled         :: may_call_mm_tabled,
                 attr_box_policy                 :: box_policy,
+                attr_affects_liveness           :: affects_liveness,
                 attr_extra_attributes ::
                     list(pragma_foreign_proc_extra_attribute)
             ).
@@ -1678,7 +1690,7 @@
         proc_not_tabled_for_io, purity_impure, depends_on_mercury_calls,
         no_user_annotated_sharing, default_exception_behaviour,
         no, no, proc_may_modify_trail, default_calls_mm_tabled,
-        native_if_possible, []).
+        native_if_possible, default_affects_liveness, []).
 
 get_may_call_mercury(Attrs) = Attrs ^ attr_may_call_mercury.
 get_thread_safe(Attrs) = Attrs ^ attr_thread_safe.
@@ -1693,6 +1705,7 @@
 get_may_modify_trail(Attrs) = Attrs ^ attr_may_modify_trail.
 get_may_call_mm_tabled(Attrs) = Attrs ^ attr_may_call_mm_tabled.
 get_box_policy(Attrs) = Attrs ^ attr_box_policy.
+get_affects_liveness(Attrs) = Attrs ^ attr_affects_liveness.
 get_extra_attributes(Attrs) = Attrs ^ attr_extra_attributes.
 
 set_may_call_mercury(MayCallMercury, Attrs0, Attrs) :-
@@ -1721,6 +1734,8 @@
     Attrs = Attrs0 ^ attr_may_call_mm_tabled := MayCallMM_Tabled.
 set_box_policy(BoxPolicyStr, Attrs0, Attrs) :-
     Attrs = Attrs0 ^ attr_box_policy := BoxPolicyStr.
+set_affects_liveness(AffectsLiveness, Attrs0, Attrs) :-
+    Attrs = Attrs0 ^ attr_affects_liveness := AffectsLiveness.
 
 attributes_to_strings(Attrs) = StringList :-
     % We ignore Lang because it isn't an attribute that you can put
@@ -1729,7 +1744,7 @@
     Attrs = attributes(_Lang, MayCallMercury, ThreadSafe, TabledForIO,
         Purity, Terminates, _UserSharing, Exceptions, _LegacyBehaviour,
         OrdinaryDespiteDetism, MayModifyTrail, MayCallMM_Tabled,
-        BoxPolicy, ExtraAttributes),
+        BoxPolicy, AffectsLiveness, ExtraAttributes),
     (
         MayCallMercury = proc_may_call_mercury,
         MayCallMercuryStr = "may_call_mercury"
@@ -1818,10 +1833,20 @@
         BoxPolicy = always_boxed,
         BoxPolicyStr = ["always_boxed"]
     ),
+    (
+        AffectsLiveness = affects_liveness,
+        AffectsLivenessStr = ["affects_liveness"]
+    ;
+        AffectsLiveness = doesnt_affect_liveness,
+        AffectsLivenessStr = ["doesnt_affect_liveness"]
+    ;
+        AffectsLiveness = default_affects_liveness,
+        AffectsLivenessStr = []
+    ),
     StringList = [MayCallMercuryStr, ThreadSafeStr, TabledForIOStr |
         PurityStrList] ++ TerminatesStrList ++ ExceptionsStrList ++
         OrdinaryDespiteDetismStrList ++ MayModifyTrailStrList ++
-        MayCallMM_TabledStrList ++ BoxPolicyStr ++
+        MayCallMM_TabledStrList ++ BoxPolicyStr ++ AffectsLivenessStr ++
         list.map(extra_attribute_to_string, ExtraAttributes).
 
 add_extra_attribute(NewAttribute, Attributes0,
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.118
diff -u -b -r1.118 prog_io_pragma.m
--- compiler/prog_io_pragma.m	19 Dec 2006 03:28:57 -0000	1.118
+++ compiler/prog_io_pragma.m	30 Dec 2006 07:41:28 -0000
@@ -1363,7 +1363,7 @@
     ->
         Shared = SharedPrime,
         SharedContext = SharedContextPrime,
-        Treatment = share,
+        Treatment = shared_code_share,
         SharedErrs = []
     ;
         parse_pragma_keyword("duplicated_code", SharedTerm,
@@ -1371,7 +1371,7 @@
     ->
         Shared = SharedPrime,
         SharedContext = SharedContextPrime,
-        Treatment = duplicate,
+        Treatment = shared_code_duplicate,
         SharedErrs = []
     ;
         parse_pragma_keyword("common_code", SharedTerm,
@@ -1379,12 +1379,12 @@
     ->
         Shared = SharedPrime,
         SharedContext = SharedContextPrime,
-        Treatment = automatic,
+        Treatment = shared_code_automatic,
         SharedErrs = []
     ;
         Shared = "",                                    % Dummy
         SharedContext = term.context_init,              % Dummy
-        Treatment = automatic,                          % Dummy
+        Treatment = shared_code_automatic,              % Dummy
         SharedMsg = "-- invalid seventh argument, "
             ++ "expecting `common_code(<code>)'",
         SharedErrs = [(InvalidDeclStr ++ SharedMsg) - SharedTerm]
@@ -1494,7 +1494,8 @@
     ;       coll_ordinary_despite_detism
     ;       coll_may_modify_trail(proc_may_modify_trail)
     ;       coll_may_call_mm_tabled(may_call_mm_tabled)
-    ;       coll_box_policy(box_policy).
+    ;       coll_box_policy(box_policy)
+    ;       coll_affects_liveness(affects_liveness).
 
 :- pred parse_pragma_foreign_proc_attributes_term(foreign_language::in,
     string::in, varset::in, term::in,
@@ -1539,7 +1540,9 @@
             coll_may_modify_trail(proc_will_not_modify_trail),
         coll_may_call_mercury(proc_will_not_call_mercury) -
             coll_may_call_mm_tabled(may_call_mm_tabled),
-        coll_box_policy(native_if_possible) - coll_box_policy(always_boxed)
+        coll_box_policy(native_if_possible) - coll_box_policy(always_boxed),
+        coll_affects_liveness(affects_liveness) -
+            coll_affects_liveness(doesnt_affect_liveness)
     ],
     (
         parse_pragma_foreign_proc_attributes_term0(Varset, Term, AttrList)
@@ -1578,6 +1581,8 @@
     set_purity(Pure, !Attrs).
 process_attribute(coll_terminates(Terminates), !Attrs) :-
     set_terminates(Terminates, !Attrs).
+process_attribute(coll_user_annotated_sharing(UserSharing), !Attrs) :-
+    set_user_annotated_sharing(UserSharing, !Attrs).
 process_attribute(coll_will_not_throw_exception, !Attrs) :-
     set_may_throw_exception(proc_will_not_throw_exception, !Attrs).
 process_attribute(coll_max_stack_size(Size), !Attrs) :-
@@ -1592,8 +1597,8 @@
     set_may_call_mm_tabled(MayCallTabled, !Attrs).
 process_attribute(coll_box_policy(BoxPolicy), !Attrs) :-
     set_box_policy(BoxPolicy, !Attrs).
-process_attribute(coll_user_annotated_sharing(UserSharing), !Attrs) :-
-    set_user_annotated_sharing(UserSharing, !Attrs).
+process_attribute(coll_affects_liveness(AffectsLiveness), !Attrs) :-
+    set_affects_liveness(AffectsLiveness, !Attrs).
 
     % Check whether all the required attributes have been set for
     % a particular language
@@ -1668,6 +1673,8 @@
         Flag = coll_may_call_mm_tabled(CallsTabled)
     ; parse_box_policy(Term, BoxPolicy) ->
         Flag = coll_box_policy(BoxPolicy)
+    ; parse_affects_liveness(Term, AffectsLiveness) ->
+        Flag = coll_affects_liveness(AffectsLiveness)
     ;
         fail
     ).
@@ -1715,6 +1722,18 @@
 parse_box_policy(term.functor(term.atom("always_boxed"), [], _),
     always_boxed).
 
+:- pred parse_affects_liveness(term::in, affects_liveness::out) is semidet.
+
+parse_affects_liveness(Term, AffectsLiveness) :-
+    Term = term.functor(term.atom(Functor), [], _),
+    (
+        Functor = "affects_liveness",
+        AffectsLiveness = affects_liveness
+    ;
+        Functor = "doesnt_affect_liveness",
+        AffectsLiveness = doesnt_affect_liveness
+    ).
+
 :- pred parse_tabled_for_io(term::in, proc_tabled_for_io::out) is semidet.
 
 parse_tabled_for_io(term.functor(term.atom(Str), [], _), TabledForIo) :-
Index: compiler/reassign.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/reassign.m,v
retrieving revision 1.21
diff -u -b -r1.21 reassign.m
--- compiler/reassign.m	1 Nov 2006 02:31:10 -0000	1.21
+++ compiler/reassign.m	30 Dec 2006 07:13:38 -0000
@@ -203,7 +203,7 @@
         !:KnownContentsMap = map.init,
         !:DepLvalMap = map.init
     ;
-        Uinstr0 = arbitrary_c_code(_, _),
+        Uinstr0 = arbitrary_c_code(_, _, _),
         !:RevInstrs = [Instr0 | !.RevInstrs],
         % The C code may clobber any lval.
         !:KnownContentsMap = map.init,
@@ -285,7 +285,7 @@
         !:KnownContentsMap = map.init,
         !:DepLvalMap = map.init
     ;
-        Uinstr0 = pragma_c(_, _, _, _, _, _, _, _, _),
+        Uinstr0 = foreign_proc_code(_, _, _, _, _, _, _, _, _),
         !:RevInstrs = [Instr0 | !.RevInstrs],
         % The C code may clobber any lval.
         !:KnownContentsMap = map.init,
Index: compiler/trace_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_gen.m,v
retrieving revision 1.11
diff -u -b -r1.11 trace_gen.m
--- compiler/trace_gen.m	3 Jan 2007 05:17:07 -0000	1.11
+++ compiler/trace_gen.m	3 Jan 2007 05:17:29 -0000
@@ -30,17 +30,17 @@
 % However, some of these labels may be fallen into from other places,
 % and thus optimization may redirect references from labels to one of these
 % labels. This cannot happen in the opposite direction, due to the reference
-% to each event's label from the event's pragma C code instruction.
+% to each event's label from the event's foreign_proc_code instruction.
 % (This prevents labelopt from removing the label.)
 %
 % We classify events into three kinds: external events (call, exit, fail),
-% internal events (switch, disj, ite_then, ite_else), and nondet pragma C
+% internal events (switch, disj, ite_then, ite_else), and nondet foreign_proc
 % events (first, later). Code_gen.m, which calls this module to generate
 % all external events, checks whether tracing is required before calling us;
-% the predicates handing internal and nondet pragma C events must check this
-% themselves. The predicates generating internal events need the goal
+% the predicates handing internal and nondet foreign_proc events must check
+% this themselves. The predicates generating internal events need the goal
 % following the event as a parameter. For the first and later arms of
-% nondet pragma C code, there is no such hlds_goal, which is why these events
+% nondet foreign_proc, there is no such hlds_goal, which is why these events
 % need a bit of special treatment.
 %
 %-----------------------------------------------------------------------------%
@@ -83,9 +83,9 @@
     --->    neg_success
     ;       neg_failure.
 
-:- type nondet_pragma_trace_port
-    --->    nondet_pragma_first
-    ;       nondet_pragma_later.
+:- type nondet_foreign_proc_trace_port
+    --->    nondet_foreign_proc_first
+    ;       nondet_foreign_proc_later.
 
 :- type trace_info.
 
@@ -191,10 +191,11 @@
     code_info::in, code_info::out) is det.
 
     % If we are doing execution tracing, generate code for a nondet
-    % pragma C code trace event.
+    % foreign_proc trace event.
     %
-:- pred maybe_generate_pragma_event_code(nondet_pragma_trace_port::in,
-    prog_context::in, code_tree::out, code_info::in, code_info::out) is det.
+:- pred maybe_generate_foreign_proc_event_code(
+    nondet_foreign_proc_trace_port::in, prog_context::in, code_tree::out,
+    code_info::in, code_info::out) is det.
 
     % Generate code for a user-defined trace event.
     %
@@ -279,7 +280,7 @@
     ;       port_info_user(
                 goal_path       % The path of the goal.
             )
-    ;       port_info_nondet_pragma.
+    ;       port_info_nondet_foreign_proc.
 
 trace_fail_vars(ModuleInfo, ProcInfo, FailVars) :-
     proc_info_get_headvars(ProcInfo, HeadVars),
@@ -622,11 +623,11 @@
         MaybeFromFullSlot = no,
         TraceStmt1 = FillSlotsUptoTrail
     ),
+    TraceComponents1 = [foreign_proc_raw_code(cannot_branch_away,
+        doesnt_affect_liveness, live_lvals_info(set.init), TraceStmt1)],
     TraceCode1 = node([
-        pragma_c([], [pragma_c_raw_code(TraceStmt1, cannot_branch_away,
-            live_lvals_info(set.init))], proc_will_not_call_mercury,
-            no, no, MaybeLayoutLabel, no, yes, no)
-            - ""
+        foreign_proc_code([], TraceComponents1, proc_will_not_call_mercury,
+            no, no, MaybeLayoutLabel, no, yes, no) - ""
     ]),
     (
         MaybeMaxfrLval = yes(MaxfrLval),
@@ -641,10 +642,11 @@
         MaybeCallTableLval = yes(CallTableLval),
         stackref_to_string(CallTableLval, CallTableLvalStr),
         TraceStmt3 = "\t\t" ++ CallTableLvalStr ++ " = 0;\n",
+        TraceComponents3 = [foreign_proc_raw_code(cannot_branch_away,
+            doesnt_affect_liveness, live_lvals_info(set.init), TraceStmt3)],
         TraceCode3 = node([
-            pragma_c([], [pragma_c_raw_code(TraceStmt3, cannot_branch_away,
-                live_lvals_info(set.init))],
-                proc_will_not_call_mercury, no, no, no, no, yes, no) - ""
+            foreign_proc_code([], TraceComponents3, proc_will_not_call_mercury,
+                no, no, no, no, yes, no) - ""
         ])
     ;
         MaybeCallTableLval = no,
@@ -669,7 +671,8 @@
         ),
         ResetStmt = MacroStr ++ "(" ++ CallDepthStr ++ ");\n",
         TraceCode = node([
-            arbitrary_c_code(ResetStmt, live_lvals_info(set.init)) - ""
+            arbitrary_c_code(doesnt_affect_liveness, live_lvals_info(set.init),
+                ResetStmt) - ""
         ])
     ;
         MaybeTraceInfo = no,
@@ -768,11 +771,11 @@
         Code = empty
     ).
 
-maybe_generate_pragma_event_code(PragmaPort, Context, Code, !CI) :-
+maybe_generate_foreign_proc_event_code(PragmaPort, Context, Code, !CI) :-
     code_info.get_maybe_trace_info(!.CI, MaybeTraceInfo),
     (
         MaybeTraceInfo = yes(TraceInfo),
-        Port = convert_nondet_pragma_port_type(PragmaPort),
+        Port = convert_nondet_foreign_proc_port_type(PragmaPort),
         code_info.get_module_info(!.CI, ModuleInfo),
         code_info.get_pred_info(!.CI, PredInfo),
         code_info.get_proc_info(!.CI, ProcInfo),
@@ -780,8 +783,8 @@
             TraceInfo ^ trace_level,
             TraceInfo ^ trace_suppress_items, Port) = yes
     ->
-        generate_event_code(Port, port_info_nondet_pragma, yes(TraceInfo),
-            Context, no, no, _, _, Code, !CI)
+        generate_event_code(Port, port_info_nondet_foreign_proc,
+            yes(TraceInfo), Context, no, no, _, _, Code, !CI)
     ;
         Code = empty
     ).
@@ -841,15 +844,15 @@
         PortInfo = port_info_user(Path),
         LiveVars = LiveVars0
     ;
-        PortInfo = port_info_nondet_pragma,
+        PortInfo = port_info_nondet_foreign_proc,
         LiveVars = [],
-        ( Port = port_nondet_pragma_first ->
+        ( Port = port_nondet_foreign_proc_first ->
             Path = [first]
-        ; Port = port_nondet_pragma_later ->
+        ; Port = port_nondet_foreign_proc_later ->
             Path = [later]
         ;
             unexpected(this_file,
-                "generate_event_code: bad nondet pragma port")
+                "generate_event_code: bad nondet foreign_proc port")
         )
     ),
     VarTypes = code_info.get_var_types(!.CI),
@@ -916,20 +919,19 @@
     ;
         true
     ),
+    TraceComponents = [foreign_proc_raw_code(cannot_branch_away,
+        doesnt_affect_liveness, live_lvals_info(LiveLvalSet), TraceStmt)],
     TraceCode =
         node([
             label(Label)
                 - "A label to hang trace liveness on",
-                % Referring to the label from the pragma_c
-                % prevents the label from being renamed
-                % or optimized away.
-                % The label is before the trace code
-                % because sometimes this pair is preceded
-                % by another label, and this way we can
+                % Referring to the label from the foreign_proc_code
+                % prevents the label from being renamed or optimized away.
+                % The label is before the trace code because sometimes this
+                % pair is preceded by another label, and this way we can
                 % eliminate this other label.
-            pragma_c([], [pragma_c_raw_code(TraceStmt, cannot_branch_away,
-                live_lvals_info(LiveLvalSet))],
-                proc_may_call_mercury, no, no, yes(Label), no, yes, no) - ""
+            foreign_proc_code([], TraceComponents, proc_may_call_mercury,
+                no, no, yes(Label), no, yes, no) - ""
         ]),
     Code = tree(ProduceCode, TraceCode).
 
@@ -1066,12 +1068,13 @@
 convert_external_port_type(external_port_exit) = port_exit.
 convert_external_port_type(external_port_fail) = port_fail.
 
-:- func convert_nondet_pragma_port_type(nondet_pragma_trace_port) = trace_port.
+:- func convert_nondet_foreign_proc_port_type(nondet_foreign_proc_trace_port)
+    = trace_port.
 
-convert_nondet_pragma_port_type(nondet_pragma_first) =
-    port_nondet_pragma_first.
-convert_nondet_pragma_port_type(nondet_pragma_later) =
-    port_nondet_pragma_later. 
+convert_nondet_foreign_proc_port_type(nondet_foreign_proc_first) =
+    port_nondet_foreign_proc_first.
+convert_nondet_foreign_proc_port_type(nondet_foreign_proc_later) =
+    port_nondet_foreign_proc_later. 
 
 %-----------------------------------------------------------------------------%
 
Index: compiler/trace_params.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trace_params.m,v
retrieving revision 1.39
diff -u -b -r1.39 trace_params.m
--- compiler/trace_params.m	5 Dec 2006 03:51:00 -0000	1.39
+++ compiler/trace_params.m	30 Dec 2006 06:45:25 -0000
@@ -460,10 +460,12 @@
 convert_port_name("swtc") = port_switch.
 convert_port_name("switch") = port_switch.
 convert_port_name("disj") = port_disj.
-convert_port_name("frst") = port_nondet_pragma_first.
-convert_port_name("nondet_pragma_first") = port_nondet_pragma_first.
-convert_port_name("latr") = port_nondet_pragma_first.
-convert_port_name("nondet_pragma_later") = port_nondet_pragma_later.
+convert_port_name("frst") = port_nondet_foreign_proc_first.
+convert_port_name("nondet_foreign_proc_first") =
+    port_nondet_foreign_proc_first.
+convert_port_name("latr") = port_nondet_foreign_proc_later.
+convert_port_name("nondet_foreign_proc_later") =
+    port_nondet_foreign_proc_later.
 convert_port_name("user") = port_user.
 
 :- func convert_port_class_name(string) = list(trace_port) is semidet.
@@ -545,8 +547,8 @@
 trace_port_category(port_neg_failure)         = port_cat_context.
 trace_port_category(port_switch)              = port_cat_internal.
 trace_port_category(port_disj)                = port_cat_internal.
-trace_port_category(port_nondet_pragma_first) = port_cat_internal.
-trace_port_category(port_nondet_pragma_later) = port_cat_internal.
+trace_port_category(port_nondet_foreign_proc_first) = port_cat_internal.
+trace_port_category(port_nondet_foreign_proc_later) = port_cat_internal.
 trace_port_category(port_user)                = port_cat_user.
 
 :- func trace_level_port_categories(trace_level) = list(port_category).
@@ -613,6 +615,6 @@
 port_number(port_neg_failure) = 11.
 port_number(port_disj) = 12.
 port_number(port_switch) = 13.
-port_number(port_nondet_pragma_first) = 14.
-port_number(port_nondet_pragma_later) = 15.
+port_number(port_nondet_foreign_proc_first) = 14.
+port_number(port_nondet_foreign_proc_later) = 15.
 port_number(port_user) = 16.
Index: compiler/use_local_vars.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/use_local_vars.m,v
retrieving revision 1.30
diff -u -b -r1.30 use_local_vars.m
--- compiler/use_local_vars.m	27 Dec 2006 03:22:27 -0000	1.30
+++ compiler/use_local_vars.m	30 Dec 2006 07:37:27 -0000
@@ -105,7 +105,7 @@
     create_basic_blocks(Instrs0, Comments0, ProcLabel, !C, NewLabels,
         LabelSeq, BlockMap0),
     flatten_basic_blocks(LabelSeq, BlockMap0, TentativeInstrs),
-    livemap.build(TentativeInstrs, MaybeLiveMap),
+    build_livemap(TentativeInstrs, MaybeLiveMap),
     extend_basic_blocks(LabelSeq, EBBLabelSeq, BlockMap0, EBBBlockMap0,
         NewLabels),
     list.foldl(use_local_vars_block(MaybeLiveMap, NumRealRRegs,
@@ -536,9 +536,9 @@
     ;
         Uinstr0 = join_and_continue(_, _)
     ;
-        Uinstr0 = arbitrary_c_code(_, _)
+        Uinstr0 = arbitrary_c_code(_, _, _)
     ;
-        Uinstr0 = pragma_c(_, _, _, _, _, _, _, _, _)
+        Uinstr0 = foreign_proc_code(_, _, _, _, _, _, _, _, _)
     ).
 
 %-----------------------------------------------------------------------------%
Index: compiler/wrap_blocks.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/wrap_blocks.m,v
retrieving revision 1.14
diff -u -b -r1.14 wrap_blocks.m
--- compiler/wrap_blocks.m	31 Jul 2006 08:32:11 -0000	1.14
+++ compiler/wrap_blocks.m	30 Dec 2006 07:34:14 -0000
@@ -82,7 +82,7 @@
             list.reverse(RevSofar, BlockInstrs),
             wrap_instrs(Instrs0, 0, 0, [], Instrs1),
             Instrs = [block(R1, F1, BlockInstrs) - "", Instr0 | Instrs1]
-        ; opt_util.can_instr_fall_through(Uinstr0, no) ->
+        ; opt_util.can_instr_fall_through(Uinstr0) = no ->
             list.reverse([Instr0 | RevSofar], BlockInstrs),
             wrap_instrs(Instrs0, 0, 0, [], Instrs1),
             Instrs = [block(R1, F1, BlockInstrs) - "" | Instrs1]
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/stream/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
Index: mdbcomp/prim_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/prim_data.m,v
retrieving revision 1.17
diff -u -b -r1.17 prim_data.m
--- mdbcomp/prim_data.m	21 Dec 2006 11:11:34 -0000	1.17
+++ mdbcomp/prim_data.m	30 Dec 2006 06:38:08 -0000
@@ -46,8 +46,8 @@
     ;       port_neg_failure
     ;       port_disj
     ;       port_switch
-    ;       port_nondet_pragma_first
-    ;       port_nondet_pragma_later
+    ;       port_nondet_foreign_proc_first
+    ;       port_nondet_foreign_proc_later
     ;       port_user.
 
 % was in compiler/prog_data.m
Index: mdbcomp/trace_counts.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/trace_counts.m,v
retrieving revision 1.17
diff -u -b -r1.17 trace_counts.m
--- mdbcomp/trace_counts.m	1 Dec 2006 15:04:38 -0000	1.17
+++ mdbcomp/trace_counts.m	30 Dec 2006 06:38:46 -0000
@@ -699,8 +699,8 @@
 string_to_trace_port("NEGF", port_neg_failure).
 string_to_trace_port("DISJ", port_disj).
 string_to_trace_port("SWTC", port_switch).
-string_to_trace_port("FRST", port_nondet_pragma_first).
-string_to_trace_port("LATR", port_nondet_pragma_later).
+string_to_trace_port("FRST", port_nondet_foreign_proc_first).
+string_to_trace_port("LATR", port_nondet_foreign_proc_later).
 string_to_trace_port("USER", port_user).
 
 :- func string_to_goal_path(string) = goal_path is semidet.
@@ -731,8 +731,8 @@
     port_and_path(port_neg_failure, GoalPath).
 make_path_port(GoalPath, port_disj) = path_only(GoalPath).
 make_path_port(GoalPath, port_switch) = path_only(GoalPath).
-make_path_port(GoalPath, port_nondet_pragma_first) = path_only(GoalPath).
-make_path_port(GoalPath, port_nondet_pragma_later) = path_only(GoalPath).
+make_path_port(GoalPath, port_nondet_foreign_proc_first) = path_only(GoalPath).
+make_path_port(GoalPath, port_nondet_foreign_proc_later) = path_only(GoalPath).
 make_path_port(_GoalPath, port_user) = port_only(port_call).
 
 %-----------------------------------------------------------------------------%
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_trace_base.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trace_base.h,v
retrieving revision 1.57
diff -u -b -r1.57 mercury_trace_base.h
--- runtime/mercury_trace_base.h	29 Nov 2006 05:18:27 -0000	1.57
+++ runtime/mercury_trace_base.h	30 Dec 2006 06:48:57 -0000
@@ -44,8 +44,8 @@
 	MR_PORT_NEG_FAILURE,	/* negated goal succeeded; negation fails */
 	MR_PORT_DISJ,
 	MR_PORT_SWITCH,
-	MR_PORT_PRAGMA_FIRST,
-	MR_PORT_PRAGMA_LATER,
+	MR_PORT_FOREIGN_PROC_FIRST,
+	MR_PORT_FOREIGN_PROC_LATER,
 	MR_PORT_USER,
 	MR_PORT_NONE
 } MR_TracePort;
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.108
diff -u -b -r1.108 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	3 Jan 2007 05:17:20 -0000	1.108
+++ trace/mercury_trace_declarative.c	3 Jan 2007 05:17:43 -0000
@@ -727,8 +727,8 @@
             trace = MR_trace_decl_neg_failure(event_info, trace);
             break;
 
-        case MR_PORT_PRAGMA_FIRST:
-        case MR_PORT_PRAGMA_LATER:
+        case MR_PORT_FOREIGN_PROC_FIRST:
+        case MR_PORT_FOREIGN_PROC_LATER:
             MR_fatal_error("MR_trace_construct_node: "
                 "foreign language code is not handled (yet)");
 
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list