diff options
Diffstat (limited to 'lib/Target')
78 files changed, 371 insertions, 72 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 258c287878..bac088abf7 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -31,6 +31,8 @@ #include <algorithm> #include <sstream> +namespace llvm { + namespace { class CWriter : public Pass, public InstVisitor<CWriter> { std::ostream &Out; @@ -161,7 +163,6 @@ namespace { void printIndexingExpression(Value *Ptr, User::op_iterator I, User::op_iterator E); }; -} // Pass the Type* and the variable name and this prints out the variable // declaration. @@ -339,7 +340,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) { // compiler agreeing on the conversion process (which is pretty likely since we // only deal in IEEE FP). // -static bool isFPCSafeToPrint(const ConstantFP *CFP) { +bool isFPCSafeToPrint(const ConstantFP *CFP) { #if HAVE_PRINTF_A char Buffer[100]; sprintf(Buffer, "%a", CFP->getValue()); @@ -563,7 +564,7 @@ bool CWriter::nameAllUsedStructureTypes(Module &M) { // generateCompilerSpecificCode - This is where we add conditional compilation // directives to cater to specific compilers as need be. // -static void generateCompilerSpecificCode(std::ostream& Out) { +void generateCompilerSpecificCode(std::ostream& Out) { // Alloca is hard to get, and we don't want to include stdlib.h here... Out << "/* get a declaration for alloca */\n" << "#ifdef sun\n" @@ -1058,7 +1059,7 @@ void CWriter::visitUnwindInst(UnwindInst &I) { emittedInvoke = true; } -static bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) { +bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) { // If PHI nodes need copies, we need the copy code... if (isa<PHINode>(To->front()) || From->getNext() != To) // Not directly successor, need goto @@ -1195,10 +1196,10 @@ void CWriter::visitCastInst(CastInst &I) { void CWriter::visitCallInst(CallInst &I) { // Handle intrinsic function calls first... if (Function *F = I.getCalledFunction()) - if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) { + if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) { switch (ID) { default: assert(0 && "Unknown LLVM intrinsic!"); - case LLVMIntrinsic::va_start: + case Intrinsic::va_start: Out << "0; "; Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", "; @@ -1212,28 +1213,28 @@ void CWriter::visitCallInst(CallInst &I) { writeOperand(&I.getParent()->getParent()->aback()); Out << ")"; return; - case LLVMIntrinsic::va_end: + case Intrinsic::va_end: Out << "va_end(*(va_list*)&"; writeOperand(I.getOperand(1)); Out << ")"; return; - case LLVMIntrinsic::va_copy: + case Intrinsic::va_copy: Out << "0;"; Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", "; Out << "*(va_list*)&"; writeOperand(I.getOperand(1)); Out << ")"; return; - case LLVMIntrinsic::setjmp: - case LLVMIntrinsic::sigsetjmp: + case Intrinsic::setjmp: + case Intrinsic::sigsetjmp: // This intrinsic should never exist in the program, but until we get // setjmp/longjmp transformations going on, we should codegen it to // something reasonable. This will allow code that never calls longjmp // to work. Out << "0"; return; - case LLVMIntrinsic::longjmp: - case LLVMIntrinsic::siglongjmp: + case Intrinsic::longjmp: + case Intrinsic::siglongjmp: // Longjmp is not implemented, and never will be. It would cause an // exception throw. Out << "abort()"; @@ -1385,9 +1386,12 @@ void CWriter::visitVAArgInst(VAArgInst &I) { Out << ");\n va_end(Tmp); }"; } +} //===----------------------------------------------------------------------===// // External Interface declaration //===----------------------------------------------------------------------===// Pass *createWriteToCPass(std::ostream &o) { return new CWriter(o); } + +} // End llvm namespace diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 258c287878..bac088abf7 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -31,6 +31,8 @@ #include <algorithm> #include <sstream> +namespace llvm { + namespace { class CWriter : public Pass, public InstVisitor<CWriter> { std::ostream &Out; @@ -161,7 +163,6 @@ namespace { void printIndexingExpression(Value *Ptr, User::op_iterator I, User::op_iterator E); }; -} // Pass the Type* and the variable name and this prints out the variable // declaration. @@ -339,7 +340,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) { // compiler agreeing on the conversion process (which is pretty likely since we // only deal in IEEE FP). // -static bool isFPCSafeToPrint(const ConstantFP *CFP) { +bool isFPCSafeToPrint(const ConstantFP *CFP) { #if HAVE_PRINTF_A char Buffer[100]; sprintf(Buffer, "%a", CFP->getValue()); @@ -563,7 +564,7 @@ bool CWriter::nameAllUsedStructureTypes(Module &M) { // generateCompilerSpecificCode - This is where we add conditional compilation // directives to cater to specific compilers as need be. // -static void generateCompilerSpecificCode(std::ostream& Out) { +void generateCompilerSpecificCode(std::ostream& Out) { // Alloca is hard to get, and we don't want to include stdlib.h here... Out << "/* get a declaration for alloca */\n" << "#ifdef sun\n" @@ -1058,7 +1059,7 @@ void CWriter::visitUnwindInst(UnwindInst &I) { emittedInvoke = true; } -static bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) { +bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) { // If PHI nodes need copies, we need the copy code... if (isa<PHINode>(To->front()) || From->getNext() != To) // Not directly successor, need goto @@ -1195,10 +1196,10 @@ void CWriter::visitCastInst(CastInst &I) { void CWriter::visitCallInst(CallInst &I) { // Handle intrinsic function calls first... if (Function *F = I.getCalledFunction()) - if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) { + if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) { switch (ID) { default: assert(0 && "Unknown LLVM intrinsic!"); - case LLVMIntrinsic::va_start: + case Intrinsic::va_start: Out << "0; "; Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", "; @@ -1212,28 +1213,28 @@ void CWriter::visitCallInst(CallInst &I) { writeOperand(&I.getParent()->getParent()->aback()); Out << ")"; return; - case LLVMIntrinsic::va_end: + case Intrinsic::va_end: Out << "va_end(*(va_list*)&"; writeOperand(I.getOperand(1)); Out << ")"; return; - case LLVMIntrinsic::va_copy: + case Intrinsic::va_copy: Out << "0;"; Out << "va_copy(*(va_list*)&" << Mang->getValueName(&I) << ", "; Out << "*(va_list*)&"; writeOperand(I.getOperand(1)); Out << ")"; return; - case LLVMIntrinsic::setjmp: - case LLVMIntrinsic::sigsetjmp: + case Intrinsic::setjmp: + case Intrinsic::sigsetjmp: // This intrinsic should never exist in the program, but until we get // setjmp/longjmp transformations going on, we should codegen it to // something reasonable. This will allow code that never calls longjmp // to work. Out << "0"; return; - case LLVMIntrinsic::longjmp: - case LLVMIntrinsic::siglongjmp: + case Intrinsic::longjmp: + case Intrinsic::siglongjmp: // Longjmp is not implemented, and never will be. It would cause an // exception throw. Out << "abort()"; @@ -1385,9 +1386,12 @@ void CWriter::visitVAArgInst(VAArgInst &I) { Out << ");\n va_end(Tmp); }"; } +} //===----------------------------------------------------------------------===// // External Interface declaration //===----------------------------------------------------------------------===// Pass *createWriteToCPass(std::ostream &o) { return new CWriter(o); } + +} // End llvm namespace diff --git a/lib/Target/MRegisterInfo.cpp b/lib/Target/MRegisterInfo.cpp index 6f35815263..7c1028bc32 100644 --- a/lib/Target/MRegisterInfo.cpp +++ b/lib/Target/MRegisterInfo.cpp @@ -13,6 +13,8 @@ #include "llvm/Target/MRegisterInfo.h" +namespace llvm { + MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR, regclass_iterator RCB, regclass_iterator RCE, int CFSO, int CFDO) @@ -41,3 +43,5 @@ MRegisterInfo::MRegisterInfo(const MRegisterDesc *D, unsigned NR, MRegisterInfo::~MRegisterInfo() { delete[] PhysRegClasses; } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp b/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp index 2c45021f00..a603e94b81 100644 --- a/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp +++ b/lib/Target/SparcV9/EmitBytecodeToAssembly.cpp @@ -18,6 +18,8 @@ #include "llvm/Bytecode/Writer.h" #include <iostream> +namespace llvm { + using std::ostream; namespace { @@ -113,3 +115,5 @@ namespace { Pass *UltraSparc::getBytecodeAsmPrinterPass(std::ostream &Out) { return new SparcBytecodeWriter(Out); } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp index a50439de7f..4e2bf47876 100644 --- a/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp +++ b/lib/Target/SparcV9/InstrSched/InstrScheduling.cpp @@ -22,6 +22,8 @@ #include "Support/CommandLine.h" #include <algorithm> +namespace llvm { + SchedDebugLevel_t SchedDebugLevel; static cl::opt<bool> EnableFillingDelaySlots("sched-fill-delay-slots", @@ -1518,3 +1520,6 @@ bool InstructionSchedulingWithSSA::runOnFunction(Function &F) FunctionPass *createInstructionSchedulingWithSSAPass(const TargetMachine &tgt) { return new InstructionSchedulingWithSSA(tgt); } + +} // End llvm namespace + diff --git a/lib/Target/SparcV9/InstrSched/SchedGraph.cpp b/lib/Target/SparcV9/InstrSched/SchedGraph.cpp index e7cd47881a..3a8088043b 100644 --- a/lib/Target/SparcV9/InstrSched/SchedGraph.cpp +++ b/lib/Target/SparcV9/InstrSched/SchedGraph.cpp @@ -23,6 +23,8 @@ #include "llvm/Target/TargetRegInfo.h" #include "Support/STLExtras.h" +namespace llvm { + //*********************** Internal Data Structures *************************/ // The following two types need to be classes, not typedefs, so we can use @@ -737,3 +739,5 @@ void SchedGraphNode::print(std::ostream &os) const { os << std::string(16, ' ') << *outEdges[i]; } } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/InstrSched/SchedGraph.h b/lib/Target/SparcV9/InstrSched/SchedGraph.h index 50cc0520e6..5aee9b25f6 100644 --- a/lib/Target/SparcV9/InstrSched/SchedGraph.h +++ b/lib/Target/SparcV9/InstrSched/SchedGraph.h @@ -25,6 +25,8 @@ #include "Support/hash_map" #include "Support/GraphTraits.h" +namespace llvm { + class RegToRefVecMap; class ValueToDefVecMap; class RefVec; @@ -317,4 +319,6 @@ template <> struct GraphTraits<const SchedGraph*> { } }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp b/lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp index b75e3397cb..d96c201c8a 100644 --- a/lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp +++ b/lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/SchedGraphCommon.h" #include "Support/STLExtras.h" +namespace llvm { + class SchedGraphCommon; // @@ -175,3 +177,4 @@ void SchedGraphCommon::eraseIncidentEdges(SchedGraphNodeCommon* node, this->eraseOutgoingEdges(node, addDummyEdges); } +} // End llvm namespace diff --git a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp index 1644d5ecbc..7e05d1417f 100644 --- a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp +++ b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp @@ -23,6 +23,8 @@ #include "llvm/Support/CFG.h" #include "Support/PostOrderIterator.h" +namespace llvm { + std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd) { return os << "Delay for node " << nd->node->getNodeId() << " = " << (long)nd->delay << "\n"; @@ -278,3 +280,4 @@ SchedPriorities::instructionHasLastUse(FunctionLiveVarInfo &LVI, return lastUseMap[MI] = hasLastUse; } +} // End llvm namespace diff --git a/lib/Target/SparcV9/InstrSched/SchedPriorities.h b/lib/Target/SparcV9/InstrSched/SchedPriorities.h index de321f9fcb..7470467806 100644 --- a/lib/Target/SparcV9/InstrSched/SchedPriorities.h +++ b/lib/Target/SparcV9/InstrSched/SchedPriorities.h @@ -26,6 +26,8 @@ #include "Support/hash_set" #include <list> +namespace llvm { + class Function; class MachineInstr; class SchedulingManager; @@ -214,4 +216,6 @@ inline void SchedPriorities::updateTime(cycles_t c) { std::ostr |