[llvm-commits] [dragonegg] r91116 - /dragonegg/trunk/llvm-backend.cpp
Duncan Sands
baldrick at free.fr
Fri Dec 11 04:48:44 PST 2009
Author: baldrick
Date: Fri Dec 11 06:48:44 2009
New Revision: 91116
URL: http://llvm.org/viewvc/llvm-project?rev=91116&view=rev
Log:
Support for file-scope asm. With this, dragonegg can mostly
build llvm. Unfortunately the built llvm doesn't actually
work properly, causing the build to die at
llvm[2]: Building Debug Bytecode Archive libprofile_rt.bca (internalize)
llvm-ld: llvm/include/llvm/PassSupport.h:109: llvm::Pass* llvm::PassInfo::createPass() const: Assertion `(!isAnalysisGroup() || NormalCtor) && "No default implementation found for analysis group!"' failed.
Modified:
dragonegg/trunk/llvm-backend.cpp
Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=91116&r1=91115&r2=91116&view=diff
==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Fri Dec 11 06:48:44 2009
@@ -417,7 +417,7 @@
IdentString += version_string;
IdentString += " LLVM: ";
IdentString += REVISION;
- IdentString += '"';
+ IdentString += "\"\n";
TheModule->setModuleInlineAsm(IdentString);
}
#endif
@@ -1796,6 +1796,14 @@
emit_alias(alias->decl, alias->thunk.alias);
}
+/// emit_file_scope_asm - Emit the specified string as a file-scope inline
+/// asm block.
+static void emit_file_scope_asm(tree string) {
+ if (TREE_CODE(string) == ADDR_EXPR)
+ string = TREE_OPERAND(string, 0);
+ TheModule->appendModuleInlineAsm(TREE_STRING_POINTER (string));
+}
+
/// emit_functions - Turn all functions in the compilation unit into LLVM IR.
static void emit_functions(cgraph_node_set set) {
LazilyInitializeModule();
@@ -1820,6 +1828,13 @@
emit_same_body_alias(alias, node);
}
}
+
+ // Emit any file-scope asms.
+ for (struct cgraph_asm_node *can = cgraph_asm_nodes; can; can = can->next)
+ emit_file_scope_asm(can->asm_str);
+
+ // Remove the asms so gcc doesn't waste time outputting them.
+ cgraph_asm_nodes = NULL;
}
/// pass_emit_functions - IPA pass that turns gimple functions into LLVM IR.
More information about the llvm-commits
mailing list