_codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
_nativeObjectFile(NULL), _gccPath(NULL), _assemblerPath(NULL)
{
- InitializeAllTargets();
- InitializeAllAsmPrinters();
-
+ InitializeAllTargets();
+ InitializeAllAsmPrinters();
}
LTOCodeGenerator::~LTOCodeGenerator()
bool LTOCodeGenerator::generateAssemblyCode(formatted_raw_ostream& out,
std::string& errMsg)
{
- if ( this->determineTarget(errMsg) )
+ if ( this->determineTarget(errMsg) )
return true;
// mark which symbols can not be internalized
codeGenPasses->run(*it);
codeGenPasses->doFinalization();
+
+ out.flush();
+
return false; // success
}
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegistry.h"
+#include "llvm/Target/TargetSelect.h"
using namespace llvm;
/// subtarget. It would be better if we could encode this information into the
/// IR. See <rdar://5972456>.
std::string getFeatureString(const char *TargetTriple) {
+ InitializeAllTargets();
+
SubtargetFeatures Features;
if (strncmp(TargetTriple, "powerpc-apple-", 14) == 0) {
LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer,
std::string& errMsg)
{
+ InitializeAllTargets();
+
// parse bitcode buffer
OwningPtr<Module> m(ParseBitcodeFile(buffer, getGlobalContext(), &errMsg));
if ( !m )
-// Find exeternal symbols referenced by VALUE. This is a recursive function.
+// Find external symbols referenced by VALUE. This is a recursive function.
void LTOModule::findExternalRefs(Value* value, Mangler &mangler) {
if (GlobalValue* gv = dyn_cast<GlobalValue>(value)) {
it != _undefines.end(); ++it) {
// if this symbol also has a definition, then don't make an undefine
// because it is a tentative definition
- if ( _defines.count(it->getKey())) {
+ if ( _defines.count(it->getKey()) == 0 ) {
NameAndAttributes info = it->getValue();
_symbols.push_back(info);
}