Added NOP final stage to pinpoint plugin
This commit is contained in:
parent
ecfeed59ee
commit
3b49742f87
@ -10,3 +10,4 @@ target_include_directories(spslr_pinpoint PRIVATE ${GCC_PLUGIN_PATH}/include ${C
|
||||
|
||||
add_subdirectory(stage0)
|
||||
add_subdirectory(stage1)
|
||||
add_subdirectory(final)
|
||||
|
||||
2
pinpoint/final/CMakeLists.txt
Normal file
2
pinpoint/final/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
target_sources(spslr_pinpoint PRIVATE on_finish_unit.cpp)
|
||||
target_include_directories(spslr_pinpoint PRIVATE .)
|
||||
3
pinpoint/final/final.h
Normal file
3
pinpoint/final/final.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void on_finish_unit(void* plugin_data, void* user_data);
|
||||
15
pinpoint/final/on_finish_unit.cpp
Normal file
15
pinpoint/final/on_finish_unit.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include <iostream>
|
||||
#include <final.h>
|
||||
|
||||
#include <safe-input.h>
|
||||
|
||||
void on_finish_unit(void* plugin_data, void* user_data) {
|
||||
/*
|
||||
TODO
|
||||
The result lbasename(...) is not unique (e.g., "file.c" and "sub/file.c")
|
||||
Calculate UID for compilation unit -> hash(main_input_filename)
|
||||
Add UID symbol to CU -> __spslr_cu_<uid>
|
||||
Then dump accumulated data for finalizer
|
||||
*/
|
||||
std::cout << "Finishing unit \"" << lbasename(main_input_filename) << "\"" << std::endl;
|
||||
}
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include <stage0.h>
|
||||
#include <stage1.h>
|
||||
#include <final.h>
|
||||
|
||||
int plugin_is_GPL_compatible;
|
||||
|
||||
@ -37,5 +38,9 @@ int plugin_init(struct plugin_name_args* plugin_info, struct plugin_gcc_version*
|
||||
asm_offset_pass_info.pos_op = PASS_POS_INSERT_AFTER;
|
||||
register_callback(plugin_info->base_name, PLUGIN_PASS_MANAGER_SETUP, nullptr, &asm_offset_pass_info);
|
||||
|
||||
// Final stage -> dump accumulated information
|
||||
|
||||
register_callback(plugin_info->base_name, PLUGIN_FINISH_UNIT, on_finish_unit, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
#include <iostream> // TODO
|
||||
#include <stage0.h>
|
||||
|
||||
#include <pinpoint_error.h>
|
||||
#include <safe-input.h>
|
||||
|
||||
static std::list<DataPin> pins;
|
||||
|
||||
@ -73,11 +71,7 @@ static void on_static_var(tree var) {
|
||||
pinpoint_fatal("on_static_var failed to get symbol of static variable");
|
||||
|
||||
pin.symbol = std::string{ symbol };
|
||||
|
||||
pins.emplace_back(std::move(pin));
|
||||
|
||||
// TODO
|
||||
std::cout << "Pinned: \"" << symbol << "\" (" << lbasename(main_input_filename) << ")" << std::endl;
|
||||
}
|
||||
|
||||
void on_finish_decl(void* plugin_data, void* user_data) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user