mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-03 14:31:10 +00:00
bitcodify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36838 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0f4ed87c9c
commit
68d4922adf
@ -24,7 +24,7 @@ else
|
|||||||
BUILD_ARCHIVE = 1
|
BUILD_ARCHIVE = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bcreader bcwriter
|
LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bcreader bcwriter bitreader bitwriter
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
include $(LEVEL)/Makefile.common
|
||||||
|
|
||||||
|
@ -17,12 +17,14 @@
|
|||||||
#include "llvm/Linker.h"
|
#include "llvm/Linker.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
|
#include "llvm/Bitcode/ReaderWriter.h"
|
||||||
#include "llvm/Bytecode/Reader.h"
|
#include "llvm/Bytecode/Reader.h"
|
||||||
#include "llvm/Bytecode/Writer.h"
|
#include "llvm/Bytecode/Writer.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
#include "llvm/Support/FileUtilities.h"
|
||||||
#include "llvm/Support/SystemUtils.h"
|
#include "llvm/Support/SystemUtils.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/System/Program.h"
|
#include "llvm/System/Program.h"
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
#include "llvm/Analysis/Passes.h"
|
#include "llvm/Analysis/Passes.h"
|
||||||
@ -51,7 +53,7 @@ llvm::LinkTimeOptimizer *createLLVMOptimizer()
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool Bitcode = false;
|
||||||
|
|
||||||
/// If symbol is not used then make it internal and let optimizer takes
|
/// If symbol is not used then make it internal and let optimizer takes
|
||||||
/// care of it.
|
/// care of it.
|
||||||
@ -119,7 +121,14 @@ LTO::getModule(const std::string &InputFilename)
|
|||||||
NameToModuleMap::iterator pos = allModules.find(InputFilename.c_str());
|
NameToModuleMap::iterator pos = allModules.find(InputFilename.c_str());
|
||||||
if (pos != allModules.end())
|
if (pos != allModules.end())
|
||||||
m = allModules[InputFilename.c_str()];
|
m = allModules[InputFilename.c_str()];
|
||||||
else {
|
else if (Bitcode) {
|
||||||
|
if (MemoryBuffer *Buffer
|
||||||
|
= MemoryBuffer::getFile(&InputFilename[0], InputFilename.size())) {
|
||||||
|
m = ParseBitcodeFile(Buffer);
|
||||||
|
delete Buffer;
|
||||||
|
}
|
||||||
|
allModules[InputFilename.c_str()] = m;
|
||||||
|
} else {
|
||||||
m = ParseBytecodeFile(InputFilename);
|
m = ParseBytecodeFile(InputFilename);
|
||||||
allModules[InputFilename.c_str()] = m;
|
allModules[InputFilename.c_str()] = m;
|
||||||
}
|
}
|
||||||
@ -376,8 +385,12 @@ LTO::optimizeModules(const std::string &OutputFilename,
|
|||||||
std::string tempFileName(FinalOutputPath.c_str());
|
std::string tempFileName(FinalOutputPath.c_str());
|
||||||
tempFileName += "0.bc";
|
tempFileName += "0.bc";
|
||||||
std::ofstream Out(tempFileName.c_str(), io_mode);
|
std::ofstream Out(tempFileName.c_str(), io_mode);
|
||||||
OStream L(Out);
|
if (Bitcode) {
|
||||||
WriteBytecodeToFile(bigOne, L);
|
WriteBitcodeToFile(bigOne, Out);
|
||||||
|
} else {
|
||||||
|
OStream L(Out);
|
||||||
|
WriteBytecodeToFile(bigOne, L);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip leading underscore because it was added to match names
|
// Strip leading underscore because it was added to match names
|
||||||
@ -430,8 +443,12 @@ LTO::optimizeModules(const std::string &OutputFilename,
|
|||||||
std::string tempFileName(FinalOutputPath.c_str());
|
std::string tempFileName(FinalOutputPath.c_str());
|
||||||
tempFileName += "1.bc";
|
tempFileName += "1.bc";
|
||||||
std::ofstream Out(tempFileName.c_str(), io_mode);
|
std::ofstream Out(tempFileName.c_str(), io_mode);
|
||||||
OStream L(Out);
|
if (Bitcode) {
|
||||||
WriteBytecodeToFile(bigOne, L);
|
WriteBitcodeToFile(bigOne, Out);
|
||||||
|
} else {
|
||||||
|
OStream L(Out);
|
||||||
|
WriteBytecodeToFile(bigOne, L);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
targetTriple = bigOne->getTargetTriple();
|
targetTriple = bigOne->getTargetTriple();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user