[llvm-commits] [gcc-plugin] r79627 - in /gcc-plugin/trunk: Makefile llvm-backend.cpp
Duncan Sands
baldrick at free.fr
Fri Aug 21 06:08:13 PDT 2009
Author: baldrick
Date: Fri Aug 21 08:08:13 2009
New Revision: 79627
URL: http://llvm.org/viewvc/llvm-project?rev=79627&view=rev
Log:
Export version and help information for the plugin. This can be
accessed via "gcc --help -v -fplugin=./llvm.so". Currently the
version number is the subversion revision, and there is no help.
Modified:
gcc-plugin/trunk/Makefile
gcc-plugin/trunk/llvm-backend.cpp
Modified: gcc-plugin/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/Makefile?rev=79627&r1=79626&r2=79627&view=diff
==============================================================================
--- gcc-plugin/trunk/Makefile (original)
+++ gcc-plugin/trunk/Makefile Fri Aug 21 08:08:13 2009
@@ -2,6 +2,8 @@
GCCOBJECT_DIR=/home/duncan/tmp/gcc.fsf.master-objects
#GCCPLUGIN_DIR:=$(shell $(GCC) -print-file-name=plugin)
+REVISION:=$(shell svnversion -n .)
+
TARGET_TRIPLE:=$(shell $(GCCOBJECT_DIR)/gcc/xgcc -v 2>&1 | grep "^Target:" | sed -e "s/^Target: *//")
ARCH_DIR:=$(shell TARGET_TRIPLE=$(TARGET_TRIPLE) GCCSOURCE_DIR=$(GCCSOURCE_DIR) $(SHELL) ./get_arch_dir)
@@ -11,7 +13,8 @@
PLUGIN_OBJECT_FILES=$(C_SOURCE_FILES:.c=.o) $(CPP_SOURCE_FILES:.cpp=.o)
CFLAGS+=-Werror -fPIC -g -O2
-CFLAGS+=-DIN_GCC -DTARGET_NAME=\"$(TARGET_TRIPLE)\" -I$(ARCH_DIR)
+CFLAGS+=-DIN_GCC -DREVISION=\"$(REVISION)\" \
+ -DTARGET_NAME=\"$(TARGET_TRIPLE)\" -I$(ARCH_DIR)
CFLAGS+=-I${GCCOBJECT_DIR}/gcc -I${GCCOBJECT_DIR}/gcc/include \
-I${GCCSOURCE_DIR}/gcc -I${GCCSOURCE_DIR}/include \
-I${GCCSOURCE_DIR}/libcpp/include -I${GCCSOURCE_DIR}/libdecnumber \
Modified: gcc-plugin/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=79627&r1=79626&r2=79627&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Fri Aug 21 08:08:13 2009
@@ -1981,6 +1981,14 @@
}
};
+/// llvm_plugin_info - Information about this plugin. Users can access this
+/// using "gcc --help -v".
+static struct plugin_info llvm_plugin_info = {
+ REVISION, // version
+ // TODO provide something useful here
+ NULL // help
+};
+
/// plugin_init - The initialization routine called by GCC. Defined in
/// gcc-plugin.h.
int plugin_init (struct plugin_name_args *plugin_info,
@@ -2022,6 +2030,9 @@
}
}
+ // Provide our version and help information.
+ register_callback (plugin_name, PLUGIN_INFO, NULL, &llvm_plugin_info);
+
// Replace rtl expansion with gimple to LLVM conversion.
pass_info.pass = &pass_emit_llvm.pass;
pass_info.reference_pass_name = "expand";
More information about the llvm-commits
mailing list