mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
Executables will be at InstallDir/bin directory. Std header files will be at InstallDir/include, libs will be at InstallDir/lib. Define hooks for these and use them in the options for various tools.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74611 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
75657ab707
commit
81d0c2abc8
@ -10,7 +10,7 @@ include "llvm/CompilerDriver/Common.td"
|
||||
|
||||
def OptionList : OptionList<[
|
||||
(switch_option "g",
|
||||
(help "Disable optimizations")),
|
||||
(help "Enable Debugging")),
|
||||
(switch_option "S",
|
||||
(help "Stop after compilation, do not assemble")),
|
||||
(parameter_option "I",
|
||||
@ -33,7 +33,7 @@ def clang_cc : Tool<[
|
||||
(in_language "c"),
|
||||
(out_language "llvm-bitcode"),
|
||||
(output_suffix "bc"),
|
||||
(cmd_line "clang-cc $INFILE -o $OUTFILE"),
|
||||
(cmd_line "$CALL(GetBinDir)clang-cc -I $CALL(GetStdHeadersDir) -triple=pic16- -emit-llvm-bc $INFILE -o $OUTFILE"),
|
||||
(actions (case
|
||||
(not_empty "I"), (forward "I"))),
|
||||
(sink)
|
||||
@ -43,7 +43,7 @@ def llvm_ld : Tool<[
|
||||
(in_language "llvm-bitcode"),
|
||||
(out_language "llvm-bitcode"),
|
||||
(output_suffix "bc"),
|
||||
(cmd_line "llvm-ld $INFILE -o $OUTFILE"),
|
||||
(cmd_line "llvm-ld -f -link-as-library $INFILE -o $OUTFILE"),
|
||||
(actions (case
|
||||
(switch_on "g"), (append_cmd "-disable-opt"),
|
||||
(not_empty "Wo,"), (unpack_values "Wo,")))
|
||||
@ -53,7 +53,7 @@ def llvm_ld_lto : Tool<[
|
||||
(in_language "llvm-bitcode"),
|
||||
(out_language "llvm-bitcode"),
|
||||
(output_suffix "bc"),
|
||||
(cmd_line "llvm-ld $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,"))),
|
||||
@ -64,27 +64,27 @@ def llc : Tool<[
|
||||
(in_language "llvm-bitcode"),
|
||||
(out_language "assembler"),
|
||||
(output_suffix "s"),
|
||||
(cmd_line "llc -f $INFILE -o $OUTFILE"),
|
||||
(cmd_line "llc -march=pic16 -f $INFILE -o $OUTFILE"),
|
||||
(actions (case
|
||||
(switch_on "S"), (stop_compilation),
|
||||
(not_empty "Wllc,"), (unpack_values "Wllc,"),
|
||||
(not_empty "pre-RA-sched"), (forward "pre-RA-sched")))
|
||||
]>;
|
||||
|
||||
def native_as : Tool<[
|
||||
def gpasm : Tool<[
|
||||
(in_language "assembler"),
|
||||
(out_language "object-code"),
|
||||
(output_suffix "o"),
|
||||
(cmd_line "native-as $INFILE -o $OUTFILE"),
|
||||
(cmd_line "gpasm -I $CALL(GetStdAsmHeadersDir) $INFILE -o $OUTFILE"),
|
||||
(actions (case
|
||||
(not_empty "Wa,"), (unpack_values "Wa,")))
|
||||
]>;
|
||||
|
||||
def native_ld : Tool<[
|
||||
def mplink : Tool<[
|
||||
(in_language "object-code"),
|
||||
(out_language "executable"),
|
||||
(output_suffix "out"),
|
||||
(cmd_line "native-ld $INFILE -o $OUTFILE"),
|
||||
(cmd_line "mplink /k $CALL(GetStdLinkerScriptsDir) /l $CALL(GetStdLibsDir) $INFILE -o $OUTFILE"),
|
||||
(actions (case
|
||||
(not_empty "Wl,"), (unpack_values "Wl,"))),
|
||||
(join)
|
||||
@ -111,6 +111,6 @@ def CompilationGraph : CompilationGraph<[
|
||||
Edge<"llvm_ld_lto", "llc">,
|
||||
OptionalEdge<"clang_cc", "llvm_ld", (case (switch_on "S"), (inc_weight))>,
|
||||
Edge<"llvm_ld", "llc">,
|
||||
Edge<"llc", "native_as">,
|
||||
Edge<"native_as", "native_ld">
|
||||
Edge<"llc", "gpasm">,
|
||||
Edge<"gpasm", "mplink">
|
||||
]>;
|
||||
|
@ -1 +1,48 @@
|
||||
#include "AutoGenerated.inc"
|
||||
#include "llvm/System/Path.h"
|
||||
|
||||
namespace llvmc {
|
||||
extern char *ProgramName;
|
||||
}
|
||||
|
||||
// Returns the platform specific directory separator via #ifdefs.
|
||||
static std::string GetDirSeparator(void) {
|
||||
return "/";
|
||||
}
|
||||
|
||||
namespace hooks {
|
||||
std::string GetBinDir (void) {
|
||||
// Construct a Path object from the program name.
|
||||
llvm::sys::Path ProgramFullName(llvmc::ProgramName,
|
||||
strlen(llvmc::ProgramName));
|
||||
|
||||
// Get the dir name for the program. It's last component should be 'bin'.
|
||||
std::string BinDir = ProgramFullName.getDirname();
|
||||
|
||||
return BinDir + GetDirSeparator();
|
||||
}
|
||||
|
||||
std::string GetInstallDir (void) {
|
||||
llvm::sys::Path BinDirPath = llvm::sys::Path(GetBinDir());
|
||||
|
||||
// Go one more level up to get the install dir.
|
||||
std::string InstallDir = BinDirPath.getDirname();
|
||||
|
||||
return InstallDir + GetDirSeparator();
|
||||
}
|
||||
|
||||
std::string GetStdHeadersDir (void) {
|
||||
return GetInstallDir() + "include";
|
||||
}
|
||||
|
||||
std::string GetStdAsmHeadersDir (void) {
|
||||
return GetInstallDir() + "inc";
|
||||
}
|
||||
std::string GetStdLinkerScriptsDir (void) {
|
||||
return GetInstallDir() + "lkr";
|
||||
}
|
||||
|
||||
std::string GetStdLibsDir (void) {
|
||||
return GetInstallDir() + "lib";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user