PIPS
one_thread_kernel.c
Go to the documentation of this file.
1 /*
2 
3  $Id: one_thread_kernel.c 23059 2016-02-27 07:27:33Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6  Copyright 2012 Silkan
7 
8  This file is part of PIPS.
9 
10  PIPS is free software: you can redistribute it and/or modify it
11  under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  any later version.
14 
15  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
16  WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  FITNESS FOR A PARTICULAR PURPOSE.
18 
19  See the GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
23 
24 */
25 #ifdef HAVE_CONFIG_H
26 #include "pips_config.h"
27 #endif
28 
29 #include <stdio.h>
30 #include <ctype.h>
31 
32 #include "genC.h"
33 #include "linear.h"
34 #include "ri.h"
35 #include "effects.h"
36 
37 #include "resources.h"
38 
39 #include "misc.h"
40 #include "ri-util.h"
41 #include "effects-util.h"
42 #include "control.h"
43 #include "pipsdbm.h"
44 #include "text-util.h"
45 #include "properties.h"
46 
49  pips_user_error("Module statement is not a block\n");
50  }
53  (void *) 4));
54  /* Loop range is created */
58  entity label_entity = entity_empty_label();
60  make_loop(loop_idx,
61  rg,
63  label_entity,
65  NIL));
66 
71  loop_inst,
72  NIL,
73  NULL,
75 }
76 
77 bool one_thread_parallelize(string mod_name) {
79  mod_name,
80  true);
81 
83 
84  /* Set the current module entity required to have many things
85  working in PIPS: */
87 
88  debug_on("ONE_THREAD_PARALLELIZE_DEBUG_LEVEL");
89  pips_assert("Statement should be OK at entry...",
91 
94 
95  DB_PUT_MEMORY_RESOURCE(DBR_CODE, mod_name, (char*) module_statement);
96 
97  debug_off();
98 
101 
102  return true;
103 }
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
Definition: ri.c:1301
basic make_basic(enum basic_utype tag, void *val)
Definition: ri.c:155
bool statement_consistent_p(statement p)
Definition: ri.c:2195
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
Definition: ri.c:2222
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
synchronization make_synchronization_none(void)
Definition: ri.c:2424
execution make_execution_parallel(void)
Definition: ri.c:844
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
static statement module_statement
Definition: alias_check.c:125
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
#define debug_on(env)
Definition: misc-local.h:157
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define debug_off()
Definition: misc-local.h:160
#define pips_user_error
Definition: misc-local.h:147
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
static statement enclose_in_a_parallel_loop(statement module_statement)
bool one_thread_parallelize(string mod_name)
one_thread_kernel.c
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
#define statement_block_p(stat)
#define STATEMENT_NUMBER_UNDEFINED
default values
#define empty_comments
Empty comments (i.e.
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
entity entity_empty_label(void)
Definition: entity.c:1105
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
entity make_new_scalar_variable(entity, basic)
Definition: variable.c:741
@ is_basic_int
Definition: ri.h:571
@ is_instruction_loop
Definition: ri.h:1471