[dragonegg] r178338 - Add support for using the integrated assembler.
Peter Collingbourne
peter at pcc.me.uk
Fri Mar 29 02:14:51 PDT 2013
Author: pcc
Date: Fri Mar 29 04:14:50 2013
New Revision: 178338
URL: http://llvm.org/viewvc/llvm-project?rev=178338&view=rev
Log:
Add support for using the integrated assembler.
Added:
dragonegg/trunk/integrated-as.specs
Modified:
dragonegg/trunk/README
dragonegg/trunk/TODO
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/README
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/README?rev=178338&r1=178337&r2=178338&view=diff
==============================================================================
--- dragonegg/trunk/README (original)
+++ dragonegg/trunk/README Fri Mar 29 04:14:50 2013
@@ -85,6 +85,9 @@ If you renamed dragonegg.so to something
work with -c too but it's not clear how. If you plan to read the IR then you
probably want to use the -fverbose-asm flag as well (see below).
+-specs=/path/to/integrated-as.specs
+ Use the LLVM integrated assembler rather than the system assembler.
+
-fverbose-asm
Annotate the target assembler with helpful comments. Turns on the generation
of helpful names (the same as in GCC tree dumps) in the LLVM IR.
Modified: dragonegg/trunk/TODO
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/TODO?rev=178338&r1=178337&r2=178338&view=diff
==============================================================================
--- dragonegg/trunk/TODO (original)
+++ dragonegg/trunk/TODO Fri Mar 29 04:14:50 2013
@@ -78,10 +78,6 @@ The GCC builtin lowering outputs helpful
20081109_0.c:3:35: warning: attempt to free a non-heap object âbarâ,
see maybe_emit_free_warning), but we don't. Improve this somehow.
-Work out how to write object files directly. Currently this can't be
-done because gcc insists on running the assembler on compiler output
-when using -c.
-
Make LTO transparent. One part of this working out how to write bitcode when
using -c, which runs into trouble because gcc insists on running the assembler
on compiler output. Another part is looking into the possibility of encoding
Added: dragonegg/trunk/integrated-as.specs
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/integrated-as.specs?rev=178338&view=auto
==============================================================================
--- dragonegg/trunk/integrated-as.specs (added)
+++ dragonegg/trunk/integrated-as.specs Fri Mar 29 04:14:50 2013
@@ -0,0 +1,2 @@
+*invoke_as:
+%{!fwpa:%{!S:-fplugin-arg-dragonegg-emit-obj %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}}}
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=178338&r1=178337&r2=178338&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Fri Mar 29 04:14:50 2013
@@ -127,6 +127,7 @@ static bool DebugPassArguments;
static bool DebugPassStructure;
static bool EnableGCCOptimizations;
static bool EmitIR;
+static bool EmitObj;
static bool SaveGCCOutput;
static int LLVMCodeGenOptimizeArg = -1;
static int LLVMIROptimizeArg = -1;
@@ -293,6 +294,7 @@ Declare(LLVM_TARGET_NAME, TargetInfo);
Declare(LLVM_TARGET_NAME, Target);
Declare(LLVM_TARGET_NAME, TargetMC);
Declare(LLVM_TARGET_NAME, AsmPrinter);
+Declare(LLVM_TARGET_NAME, AsmParser);
#undef Declare
#undef Declare2
}
@@ -306,6 +308,7 @@ static void ConfigureLLVM(void) {
DoInit(LLVM_TARGET_NAME, Target);
DoInit(LLVM_TARGET_NAME, TargetMC);
DoInit(LLVM_TARGET_NAME, AsmPrinter);
+ DoInit(LLVM_TARGET_NAME, AsmParser);
#undef DoInit
#undef DoInit2
@@ -664,11 +667,13 @@ static void createPerFunctionOptimizatio
bool DisableVerify = true;
#endif
- // Normal mode, emit a .s file by running the code generator.
+ // Normal mode, emit a .s or .o file by running the code generator.
// Note, this also adds codegenerator level optimization passes.
- InitializeOutputStreams(false);
- if (TheTarget->addPassesToEmitFile(*PM, FormattedOutStream,
- TargetMachine::CGFT_AssemblyFile,
+ InitializeOutputStreams(EmitObj);
+ TargetMachine::CodeGenFileType CGFT = TargetMachine::CGFT_AssemblyFile;
+ if (EmitObj)
+ CGFT = TargetMachine::CGFT_ObjectFile;
+ if (TheTarget->addPassesToEmitFile(*PM, FormattedOutStream, CGFT,
DisableVerify))
llvm_unreachable("Error interfacing to target machine!");
}
@@ -745,11 +750,13 @@ static void createPerModuleOptimizationP
bool DisableVerify = true;
#endif
- // Normal mode, emit a .s file by running the code generator.
+ // Normal mode, emit a .s or .o file by running the code generator.
// Note, this also adds codegenerator level optimization passes.
- InitializeOutputStreams(false);
- if (TheTarget->addPassesToEmitFile(*PM, FormattedOutStream,
- TargetMachine::CGFT_AssemblyFile,
+ InitializeOutputStreams(EmitObj);
+ TargetMachine::CodeGenFileType CGFT = TargetMachine::CGFT_AssemblyFile;
+ if (EmitObj)
+ CGFT = TargetMachine::CGFT_ObjectFile;
+ if (TheTarget->addPassesToEmitFile(*PM, FormattedOutStream, CGFT,
DisableVerify))
llvm_unreachable("Error interfacing to target machine!");
}
@@ -2029,6 +2036,7 @@ static FlagDescriptor PluginFlags[] = {
{ "debug-pass-structure", &DebugPassStructure },
{ "debug-pass-arguments", &DebugPassArguments },
{ "enable-gcc-optzns", &EnableGCCOptimizations }, { "emit-ir", &EmitIR },
+ { "emit-obj", &EmitObj },
{ "save-gcc-output", &SaveGCCOutput }, { NULL, NULL } // Terminator.
};
More information about the llvm-commits
mailing list