aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-29 21:12:46 +0000
committerChris Lattner <sabre@nondot.org>2002-10-29 21:12:46 +0000
commit6334205cb5c626d2b35e42dd4c710b857bf0a126 (patch)
tree0330b254c66da59d0f34ff8c686a93053c66d3f1
parent083ee69349df5bc6fc26da25acf0ba8628789589 (diff)
Allow TargetMachine to refuse static code gen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4415 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetMachine.h9
-rw-r--r--lib/Target/SparcV9/SparcV9Internals.h2
-rw-r--r--lib/Target/SparcV9/SparcV9TargetMachine.cpp3
-rw-r--r--tools/llc/llc.cpp12
4 files changed, 17 insertions, 9 deletions
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h
index 16bb97f000..860d67eeae 100644
--- a/include/llvm/Target/TargetMachine.h
+++ b/include/llvm/Target/TargetMachine.h
@@ -51,7 +51,7 @@ protected:
ShortAl, ByteAl) { }
public:
virtual ~TargetMachine() {}
-
+
//
// Interfaces to the major aspects of target machine information:
// -- Instruction opcode and operand information
@@ -74,9 +74,12 @@ public:
/// addPassesToEmitAssembly - Add passes to the specified pass manager to get
/// assembly langage code emited. Typically this will involve several steps
- /// of code generation.
+ /// of code generation. This method should return true if code generation is
+ /// not supported.
///
- virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) = 0;
+ virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) {
+ return true;
+ }
/// addPassesToJITCompile - Add passes to the specified pass manager to
/// implement a fast dynamic compiler for this target. Return true if this is
diff --git a/lib/Target/SparcV9/SparcV9Internals.h b/lib/Target/SparcV9/SparcV9Internals.h
index 9be6b7fe58..e31f375dc6 100644
--- a/lib/Target/SparcV9/SparcV9Internals.h
+++ b/lib/Target/SparcV9/SparcV9Internals.h
@@ -718,7 +718,7 @@ public:
virtual const MachineCacheInfo &getCacheInfo() const { return cacheInfo; }
virtual const MachineOptInfo &getOptInfo() const { return optInfo; }
- virtual void addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
+ virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
// getPrologEpilogCodeInserter - Inserts prolog/epilog code.
virtual Pass* getPrologEpilogInsertionPass();
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index 80724694d2..e8f9c9ee72 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -141,7 +141,7 @@ UltraSparc::UltraSparc()
// addPassesToEmitAssembly - This method controls the entire code generation
// process for the ultra sparc.
//
-void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
+bool UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
{
// Construct and initialize the MachineFunction object for this fn.
PM.add(createMachineCodeConstructionPass(*this));
@@ -189,4 +189,5 @@ void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
// Emit bytecode to the assembly file into its special section next
PM.add(getEmitBytecodeToAsmPass(Out));
PM.add(getFunctionInfo(Out));
+ return false;
}
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 8fb31241a2..9a30854a6a 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -281,10 +281,14 @@ main(int argc, char **argv)
}
}
- Target.addPassesToEmitAssembly(Passes, *Out);
-
- // Run our queue of passes all at once now, efficiently.
- Passes.run(*M.get());
+ // Ask the target to add backend passes as neccesary
+ if (Target.addPassesToEmitAssembly(Passes, *Out)) {
+ cerr << argv[0] << ": target '" << Target.TargetName
+ << " does not support static compilation!\n";
+ } else {
+ // Run our queue of passes all at once now, efficiently.
+ Passes.run(*M.get());
+ }
// Delete the ostream if it's not a stdout stream
if (Out != &std::cout) delete Out;