summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStuart Hastings <stuart@apple.com>2009-07-15 17:27:11 +0000
committerStuart Hastings <stuart@apple.com>2009-07-15 17:27:11 +0000
commit2286f8dc4cec0625f7d7a14e2570926cf8599646 (patch)
tree2443581013659cf94139995c03b6883ff4ab43db /tools
parent7fe3dd5b7ea9ef7d3cfd6d26dfdd7ddf49718339 (diff)
downloadllvm-2286f8dc4cec0625f7d7a14e2570926cf8599646.tar.gz
llvm-2286f8dc4cec0625f7d7a14e2570926cf8599646.tar.bz2
llvm-2286f8dc4cec0625f7d7a14e2570926cf8599646.tar.xz
Revert 75762, 75763, 75766..75769, 75772..75775, 75778, 75780, 75782 to repair broken LLVM-GCC build.
Will revert 75770 in the llvm-gcc trunk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llc/llc.cpp23
-rw-r--r--tools/lto/LTOCodeGenerator.cpp8
-rw-r--r--tools/lto/LTOModule.cpp6
3 files changed, 16 insertions, 21 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 346e54706d..9acfcd2900 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -128,8 +128,7 @@ GetFileNameRoot(const std::string &InputFilename) {
return outputFilename;
}
-static formatted_raw_ostream *GetOutputStream(const char *TargetName,
- const char *ProgName) {
+static formatted_raw_ostream *GetOutputStream(const char *ProgName) {
if (OutputFilename != "") {
if (OutputFilename == "-")
return &fouts();
@@ -170,10 +169,10 @@ static formatted_raw_ostream *GetOutputStream(const char *TargetName,
bool Binary = false;
switch (FileType) {
case TargetMachine::AssemblyFile:
- if (TargetName[0] == 'c') {
- if (TargetName[1] == 0)
+ if (MArch->Name[0] == 'c') {
+ if (MArch->Name[1] == 0)
OutputFilename += ".cbe.c";
- else if (TargetName[1] == 'p' && TargetName[2] == 'p')
+ else if (MArch->Name[1] == 'p' && MArch->Name[2] == 'p')
OutputFilename += ".cpp";
else
OutputFilename += ".s";
@@ -249,13 +248,10 @@ int main(int argc, char **argv) {
// Allocate target machine. First, check whether the user has
// explicitly specified an architecture to compile for.
- const Target *TheTarget;
- if (MArch) {
- TheTarget = &MArch->TheTarget;
- } else {
+ if (MArch == 0) {
std::string Err;
- TheTarget = TargetRegistry::getClosestStaticTargetForModule(mod, Err);
- if (TheTarget == 0) {
+ MArch = TargetMachineRegistry::getClosestStaticTargetForModule(mod, Err);
+ if (MArch == 0) {
errs() << argv[0] << ": error auto-selecting target for module '"
<< Err << "'. Please use the -march option to explicitly "
<< "pick a target.\n";
@@ -273,13 +269,12 @@ int main(int argc, char **argv) {
FeaturesStr = Features.getString();
}
- std::auto_ptr<TargetMachine>
- target(TheTarget->createTargetMachine(mod, FeaturesStr));
+ std::auto_ptr<TargetMachine> target(MArch->CtorFn(mod, FeaturesStr));
assert(target.get() && "Could not allocate target machine!");
TargetMachine &Target = *target.get();
// Figure out where we are going to send the output...
- formatted_raw_ostream *Out = GetOutputStream(TheTarget->getName(), argv[0]);
+ formatted_raw_ostream *Out = GetOutputStream(argv[0]);
if (Out == 0) return 1;
CodeGenOpt::Level OLvl = CodeGenOpt::Default;
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index cb6c4ae6f5..b4c4e7767b 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -328,9 +328,9 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg)
if ( _target == NULL ) {
// create target machine from info for merged modules
Module* mergedModule = _linker.getModule();
- const Target *march =
- TargetRegistry::getClosestStaticTargetForModule(*mergedModule,
- errMsg);
+ const TargetMachineRegistry::entry* march =
+ TargetMachineRegistry::getClosestStaticTargetForModule(
+ *mergedModule, errMsg);
if ( march == NULL )
return true;
@@ -351,7 +351,7 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg)
// construct LTModule, hand over ownership of module and target
std::string FeatureStr =
getFeatureString(_linker.getModule()->getTargetTriple().c_str());
- _target = march->createTargetMachine(*mergedModule, FeatureStr.c_str());
+ _target = march->CtorFn(*mergedModule, FeatureStr.c_str());
}
return false;
}
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index be6543c8f7..38ee1cc7a2 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -147,15 +147,15 @@ LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer,
if ( !m )
return NULL;
// find machine architecture for this module
- const Target* march =
- TargetRegistry::getClosestStaticTargetForModule(*m, errMsg);
+ const TargetMachineRegistry::entry* march =
+ TargetMachineRegistry::getClosestStaticTargetForModule(*m, errMsg);
if ( march == NULL )
return NULL;
// construct LTModule, hand over ownership of module and target
std::string FeatureStr = getFeatureString(m->getTargetTriple().c_str());
- TargetMachine* target = march->createTargetMachine(*m, FeatureStr);
+ TargetMachine* target = march->CtorFn(*m, FeatureStr);
return new LTOModule(m.take(), target);
}