aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ravi <jjravi@ncsu.edu>2020-08-29 07:06:28 +0000
committerJohn Ravi <jjravi@ncsu.edu>2020-08-29 07:06:28 +0000
commit9eebf96f8710cb03aac7e3572bf2a7e5a603c9ec (patch)
treee2e44225ea00ca1a8e45fa37d56195d04e3d2218
parentc184dfeffa20684beeff39e6b3a85f805e0d2da3 (diff)
downloadgcc-9eebf96f8710cb03aac7e3572bf2a7e5a603c9ec.zip
gcc-9eebf96f8710cb03aac7e3572bf2a7e5a603c9ec.tar.gz
gcc-9eebf96f8710cb03aac7e3572bf2a7e5a603c9ec.tar.bz2
1. renamed libcody lto functions to invoke functions
2. invoke (send to libcody) all the lto trans commands at once
-rw-r--r--gcc/lto-wrapper.c71
-rw-r--r--gcc/mapper-resolver.cc6
-rw-r--r--gcc/mapper.h2
3 files changed, 34 insertions, 45 deletions
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 60ed319..516c621 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -1919,6 +1919,8 @@ cont:
}
auto *mapper = get_mapper (main_source_loc);
+ mapper->Cork();
+
/* Execute the LTRANS stage for each input file (or prepare a
makefile to invoke this in parallel). */
for (i = 0; i < nr; ++i)
@@ -1962,55 +1964,42 @@ cont:
}
else
{
- //fprintf(stderr, "\tRAVI PRINT: %s ", new_argv[0]);
- mapper->Cork();
-
// TODO: better way to figure out the number of arguments?
for (j = 1; new_argv[j] != NULL; ++j);
fprintf(stderr, "argc: %d\n", j);
- //std::vector<const char*> v_new_argv(new_argv, new_argv + j);
- //mapper->LTOCompile(v_new_argv);
- mapper->LTOCompile(new_argv, j);
- const char **arg_it = new_argv + 1;
-
- while(*arg_it != NULL)
- {
- //fprintf(stderr, "\tRAVI PRINT: %s\n", *arg_it);
- fprintf(stderr, " \'%s\' ", *arg_it);
- //mapper->LTOCompile(*arg_it);
- arg_it++;
- }
- ////fprintf(stderr, "\n");
- auto response = mapper->Uncork();
- auto r_iter = response.begin ();
-
- while(r_iter != response.end()) {
- Cody::Packet const &p = *r_iter;
-
- if(p.GetCode() == Cody::Client::PC_LTO_COMPILED) {
- if(strcmp(p.GetString().c_str(), "success") == 0) {
- // fprintf(stderr, "\tlto compilation succeeded\n");
- }
- else {
- fprintf(stderr, "\tlto compilation failure message: %s\n", p.GetString().c_str());
- }
- }
- else {
- fprintf(stderr, "\tlto compilation unknown failure\n");
- }
-
- ++r_iter;
- }
-
- //fprintf(stderr, "\tRAVI PRINT: %s\n", new_argv[0]);
- //fork_execute (new_argv[0], CONST_CAST (char **, new_argv),
- // true);
- maybe_unlink (input_name);
+ mapper->InvokeSubProcess(new_argv, j);
+
+ // TODO: unlink input file somewhere
+ // maybe_unlink (input_name);
}
output_names[i] = output_name;
}
+
+ auto response = mapper->Uncork();
+ auto r_iter = response.begin ();
+
+ while(r_iter != response.end()) {
+ Cody::Packet const &p = *r_iter;
+
+ if(p.GetCode() == Cody::Client::PC_INVOKED) {
+ if(strcmp(p.GetString().c_str(), "success") == 0) {
+ fprintf(stderr, "\tlto compilation succeeded\n");
+ }
+ else {
+ fprintf(stderr, "\tlto compilation failure message: %s\n", p.GetString().c_str());
+ }
+ }
+ else {
+ fprintf(stderr, "\tlto compilation unknown failure\n");
+ }
+
+ ++r_iter;
+ }
+
+ fprintf(stderr, "\n");
+
if (parallel)
{
struct pex_obj *pex;
diff --git a/gcc/mapper-resolver.cc b/gcc/mapper-resolver.cc
index 35de17d..d8e1b57 100644
--- a/gcc/mapper-resolver.cc
+++ b/gcc/mapper-resolver.cc
@@ -244,14 +244,14 @@ module_resolver::IncludeTranslateRequest (Cody::Server *s,
return 0;
}
-int module_resolver::LTOCompileRequest (Cody::Server *s, std::vector<std::string> &args) {
+int module_resolver::InvokeSubProcessRequest (Cody::Server *s, std::vector<std::string> &args) {
char **new_argv = (char **)malloc((args.size()) * sizeof(char *));
new_argv[args.size()-1] = NULL;
int i = 0;
for (std::vector<std::string>::iterator arg = args.begin() ; arg != args.end(); ++arg, ++i) {
- // ignore "LTO-COMPILE"
+ // ignore "INVOKE"
if(i == 0) continue;
//new_argv[i++] = (char *)malloc(args[i].length() * sizeof(char));
@@ -265,7 +265,7 @@ int module_resolver::LTOCompileRequest (Cody::Server *s, std::vector<std::string
fork_execute (new_argv[0], new_argv, true);
// TODO: send back a compile status response
- s->LTOResponse("success");
+ s->InvokedResponse("success");
return 0;
}
diff --git a/gcc/mapper.h b/gcc/mapper.h
index 306ee5c..49118d1 100644
--- a/gcc/mapper.h
+++ b/gcc/mapper.h
@@ -78,7 +78,7 @@ public:
virtual int IncludeTranslateRequest (Cody::Server *s, std::string &include)
override;
- virtual int LTOCompileRequest (Cody::Server *s, std::vector<std::string> &args)
+ virtual int InvokeSubProcessRequest (Cody::Server *s, std::vector<std::string> &args)
override;
private: