[llvm-commits] [llvm] r74711 - in /llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base: PIC16Base.td PluginMain.cpp
Sanjiv Gupta
sanjiv.gupta at microchip.com
Thu Jul 2 10:35:54 PDT 2009
Author: sgupta
Date: Thu Jul 2 12:35:38 2009
New Revision: 74711
URL: http://llvm.org/viewvc/llvm-project?rev=74711&view=rev
Log:
Fixed handling of -c option.wq
Modified:
llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td
llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td?rev=74711&r1=74710&r2=74711&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td (original)
+++ llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td Thu Jul 2 12:35:38 2009
@@ -13,6 +13,8 @@
(help "Enable Debugging")),
(switch_option "S",
(help "Stop after compilation, do not assemble")),
+ (switch_option "c",
+ (help "Stop after assemble, do not link")),
(parameter_option "I",
(help "Add a directory to include path")),
(parameter_option "pre-RA-sched",
@@ -43,7 +45,7 @@
(in_language "llvm-bitcode"),
(out_language "llvm-bitcode"),
(output_suffix "bc"),
- (cmd_line "llvm-ld -f -link-as-library $INFILE -o $OUTFILE"),
+ (cmd_line "llvm-ld -link-as-library $INFILE -o $OUTFILE"),
(actions (case
(switch_on "g"), (append_cmd "-disable-opt"),
(not_empty "Wo,"), (unpack_values "Wo,")))
@@ -75,8 +77,9 @@
(in_language "assembler"),
(out_language "object-code"),
(output_suffix "o"),
- (cmd_line "gpasm -I $CALL(GetStdAsmHeadersDir) $INFILE -o $OUTFILE"),
+ (cmd_line "gpasm -r decimal -p p16F1937 -I $CALL(GetStdAsmHeadersDir) -C -c $INFILE -o $OUTFILE"),
(actions (case
+ (switch_on "c"), (stop_compilation),
(not_empty "Wa,"), (unpack_values "Wa,")))
]>;
@@ -84,7 +87,7 @@
(in_language "object-code"),
(out_language "executable"),
(output_suffix "out"),
- (cmd_line "mplink /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) $INFILE -o $OUTFILE"),
+ (cmd_line "mplink.exe /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) 16f1937.lkr intrinsics.lib std.lib $INFILE -o $OUTFILE"),
(actions (case
(not_empty "Wl,"), (unpack_values "Wl,"))),
(join)
@@ -109,7 +112,9 @@
Edge<"root", "clang_cc">,
Edge<"clang_cc", "llvm_ld_lto">,
Edge<"llvm_ld_lto", "llc">,
- OptionalEdge<"clang_cc", "llvm_ld", (case (switch_on "S"), (inc_weight))>,
+ OptionalEdge<"clang_cc", "llvm_ld", (case
+ (switch_on "S"), (inc_weight),
+ (switch_on "c"), (inc_weight))>,
Edge<"llvm_ld", "llc">,
Edge<"llc", "gpasm">,
Edge<"gpasm", "mplink">
Modified: llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp?rev=74711&r1=74710&r2=74711&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp (original)
+++ llvm/trunk/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp Thu Jul 2 12:35:38 2009
@@ -1,5 +1,9 @@
#include "AutoGenerated.inc"
+
#include "llvm/System/Path.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
namespace llvmc {
extern char *ProgramName;
@@ -11,19 +15,23 @@
}
namespace hooks {
+// Get the dir where c16 executables reside.
std::string GetBinDir (void) {
// Construct a Path object from the program name.
- llvm::sys::Path ProgramFullName(llvmc::ProgramName,
- strlen(llvmc::ProgramName));
+ void *P = (void*) (intptr_t) GetBinDir;
+ sys::Path ProgramFullPath
+ = sys::Path::GetMainExecutable(llvmc::ProgramName, P);
// Get the dir name for the program. It's last component should be 'bin'.
- std::string BinDir = ProgramFullName.getDirname();
+ std::string BinDir = ProgramFullPath.getDirname();
+ // llvm::errs() << "BinDir: " << BinDir << '\n';
return BinDir + GetDirSeparator();
}
+// Get the Top-level Installation dir for c16.
std::string GetInstallDir (void) {
- llvm::sys::Path BinDirPath = llvm::sys::Path(GetBinDir());
+ sys::Path BinDirPath = sys::Path(GetBinDir());
// Go one more level up to get the install dir.
std::string InstallDir = BinDirPath.getDirname();
@@ -31,17 +39,22 @@
return InstallDir + GetDirSeparator();
}
+// Get the dir where the c16 header files reside.
std::string GetStdHeadersDir (void) {
return GetInstallDir() + "include";
}
+// Get the dir where the assembler header files reside.
std::string GetStdAsmHeadersDir (void) {
return GetInstallDir() + "inc";
}
+
+// Get the dir where the linker scripts reside.
std::string GetStdLinkerScriptsDir (void) {
return GetInstallDir() + "lkr";
}
+// Get the dir where startup code, intrinsics and lib reside.
std::string GetStdLibsDir (void) {
return GetInstallDir() + "lib";
}
More information about the llvm-commits
mailing list