diff options
Diffstat (limited to 'llvm/lib/Target/Sparc')
20 files changed, 90 insertions, 15 deletions
diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp index 25034177da4..6af9836e29b 100644 --- a/llvm/lib/Target/Sparc/EmitAssembly.cpp +++ b/llvm/lib/Target/Sparc/EmitAssembly.cpp @@ -33,6 +33,8 @@ #include "SparcInternals.h" #include <string> +namespace llvm { + namespace { Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); @@ -877,12 +879,13 @@ SparcFunctionAsmPrinter::emitFunction(const Function &F) } // End anonymous namespace +namespace llvm { + Pass *UltraSparc::getFunctionAsmPrinterPass(std::ostream &Out) { return new SparcFunctionAsmPrinter(Out, *this); } - - +} // End llvm namespace //===----------------------------------------------------------------------===// @@ -954,3 +957,5 @@ void SparcModuleAsmPrinter::emitGlobals(const Module &M) { Pass *UltraSparc::getModuleAsmPrinterPass(std::ostream &Out) { return new SparcModuleAsmPrinter(Out, *this); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/EmitBytecodeToAssembly.cpp b/llvm/lib/Target/Sparc/EmitBytecodeToAssembly.cpp index 2c45021f007..a603e94b819 100644 --- a/llvm/lib/Target/Sparc/EmitBytecodeToAssembly.cpp +++ b/llvm/lib/Target/Sparc/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/llvm/lib/Target/Sparc/MappingInfo.cpp b/llvm/lib/Target/Sparc/MappingInfo.cpp index db03f13b976..2afde6bdf59 100644 --- a/llvm/lib/Target/Sparc/MappingInfo.cpp +++ b/llvm/lib/Target/Sparc/MappingInfo.cpp @@ -49,6 +49,8 @@ #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "Support/StringExtras.h" +namespace llvm { + namespace { class MappingInfoAsmPrinter : public FunctionPass { std::ostream &Out; @@ -293,3 +295,5 @@ bool MappingInfoAsmPrinter::doFinalization (Module &M) { return false; } +} // End llvm namespace + diff --git a/llvm/lib/Target/Sparc/MappingInfo.h b/llvm/lib/Target/Sparc/MappingInfo.h index f86e2b42b7a..6af116a6da2 100644 --- a/llvm/lib/Target/Sparc/MappingInfo.h +++ b/llvm/lib/Target/Sparc/MappingInfo.h @@ -18,6 +18,9 @@ #include <iosfwd> #include <vector> #include <string> + +namespace llvm { + class Pass; Pass *getMappingInfoAsmPrinterPass(std::ostream &out); @@ -41,4 +44,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/PeepholeOpts.cpp b/llvm/lib/Target/Sparc/PeepholeOpts.cpp index 83081b71203..9713a02d95e 100644 --- a/llvm/lib/Target/Sparc/PeepholeOpts.cpp +++ b/llvm/lib/Target/Sparc/PeepholeOpts.cpp @@ -20,6 +20,8 @@ #include "llvm/BasicBlock.h" #include "llvm/Pass.h" +namespace llvm { + //************************* Internal Functions *****************************/ static inline void @@ -163,3 +165,5 @@ bool PeepholeOpts::runOnBasicBlock(BasicBlock &BB) { FunctionPass* createPeepholeOptsPass(const TargetMachine &TM) { return new PeepholeOpts(TM); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/PreSelection.cpp b/llvm/lib/Target/Sparc/PreSelection.cpp index 9078dc13b1e..205ecd3145c 100644 --- a/llvm/lib/Target/Sparc/PreSelection.cpp +++ b/llvm/lib/Target/Sparc/PreSelection.cpp @@ -29,6 +29,8 @@ #include "llvm/Transforms/Scalar.h" #include <algorithm> +namespace llvm { + namespace { //===--------------------------------------------------------------------===// @@ -71,6 +73,7 @@ namespace { "Specialize LLVM code for a target machine" createPreselectionPass); #endif + } // end anonymous namespace @@ -236,7 +239,6 @@ void PreSelection::visitCallInst(CallInst &I) { visitOperands(I, (/*firstOp=*/ I.getCalledFunction()? 1 : 0)); } - //===----------------------------------------------------------------------===// // createPreSelectionPass - Public entrypoint for pre-selection pass // and this file as a whole... @@ -244,3 +246,5 @@ void PreSelection::visitCallInst(CallInst &I) { FunctionPass* createPreSelectionPass(const TargetMachine &TM) { return new PreSelection(TM); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp b/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp index ff7bd7d0269..555b6b14fe7 100644 --- a/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp +++ b/llvm/lib/Target/Sparc/PrologEpilogCodeInserter.cpp @@ -27,6 +27,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Intrinsics.h" +namespace llvm { + namespace { struct InsertPrologEpilogCode : public MachineFunctionPass { const char *getPassName() const { return "Sparc Prolog/Epilog Inserter"; } @@ -177,3 +179,5 @@ void InsertPrologEpilogCode::InsertEpilogCode(MachineFunction &MF) FunctionPass *UltraSparc::getPrologEpilogInsertionPass() { return new InsertPrologEpilogCode(); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/Sparc.burg.in b/llvm/lib/Target/Sparc/Sparc.burg.in index a5bc98fa899..38dc2439ce8 100644 --- a/llvm/lib/Target/Sparc/Sparc.burg.in +++ b/llvm/lib/Target/Sparc/Sparc.burg.in @@ -11,7 +11,7 @@ Xinclude <cstdio> Xinclude <llvm/CodeGen/InstrForest.h> -typedef InstrTreeNode* NODEPTR_TYPE; +typedef llvm::InstrTreeNode* NODEPTR_TYPE; Xdefine OP_LABEL(p) ((p)->opLabel) Xdefine LEFT_CHILD(p) ((p)->LeftChild) Xdefine RIGHT_CHILD(p) ((p)->RightChild) diff --git a/llvm/lib/Target/Sparc/Sparc.cpp b/llvm/lib/Target/Sparc/Sparc.cpp index d20fc758d0d..73f2fd81395 100644 --- a/llvm/lib/Target/Sparc/Sparc.cpp +++ b/llvm/lib/Target/Sparc/Sparc.cpp @@ -27,6 +27,8 @@ #include "llvm/Target/TargetMachineImpls.h" #include "Support/CommandLine.h" +namespace llvm { + static const unsigned ImplicitRegUseList[] = { 0 }; /* not used yet */ // Build the MachineInstruction Description Array... const TargetInstrDescriptor SparcMachineInstrDesc[] = { @@ -267,3 +269,5 @@ bool UltraSparc::addPassesToJITCompile(FunctionPassManager &PM) { return false; // success! } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp index d92e3be9ca2..11b0c7beab5 100644 --- a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp @@ -23,6 +23,8 @@ #include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +namespace llvm { + static const uint32_t MAXLO = (1 << 10) - 1; // set bits set by %lo(*) static const uint32_t MAXSIMM = (1 << 12) - 1; // set bits in simm13 field of OR @@ -792,3 +794,5 @@ UltraSparcInstrInfo::CreateZeroExtensionInstructions( CreateBitExtensionInstructions(/*signExtend*/ false, target, F, srcVal, destVal, numLowBits, mvec, mcfi); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp index b377658b9c8..21e884be8e1 100644 --- a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp +++ b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp @@ -32,6 +32,8 @@ #include <algorithm> #include <cmath> +namespace llvm { + static inline void Add3OperandInstr(unsigned Opcode, InstructionNode* Node, std::vector<MachineInstr*>& mvec) { mvec.push_back(BuildMI(Opcode, 3).addReg(Node->leftChild()->getValue()) @@ -1390,12 +1392,12 @@ AllUsesAreBranches(const Instruction* setccI) // instead of a regular call. If not that kind of intrinsic, do nothing. // Returns true if code was generated, otherwise false. // -bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr, +bool CodeGenIntrinsic(Intrinsic::ID iid, CallInst &callInstr, TargetMachine &target, std::vector<MachineInstr*>& mvec) { switch (iid) { - case LLVMIntrinsic::va_start: { + case Intrinsic::va_start: { // Get the address of the first incoming vararg argument on the stack bool ignore; Function* func = cast<Function>(callInstr.getParent()->getParent()); @@ -1409,10 +1411,10 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr, return true; } - case LLVMIntrinsic::va_end: + case Intrinsic::va_end: return true; // no-op on Sparc - case LLVMIntrinsic::va_copy: + case Intrinsic::va_copy: // Simple copy of current va_list (arg1) to new va_list (result) mvec.push_back(BuildMI(V9::ORr, 3). addMReg(target.getRegInfo().getZeroRegNum()). @@ -1420,8 +1422,8 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr, addRegDef(&callInstr)); return true; - case LLVMIntrinsic::sigsetjmp: - case LLVMIntrinsic::setjmp: { + case Intrinsic::sigsetjmp: + case Intrinsic::setjmp: { // act as if we return 0 unsigned g0 = target.getRegInfo().getZeroRegNum(); mvec.push_back(BuildMI(V9::ORr,3).addMReg(g0).addMReg(g0) @@ -1429,8 +1431,8 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr, return true; } - case LLVMIntrinsic::siglongjmp: - case LLVMIntrinsic::longjmp: { + case Intrinsic::siglongjmp: + case Intrinsic::longjmp: { // call abort() Module* M = callInstr.getParent()->getParent()->getParent(); const FunctionType *voidvoidFuncTy = @@ -2474,8 +2476,8 @@ GetInstructionsByRule(InstructionNode* subtreeRoot, // sequence (e.g., va_start). Indirect calls cannot be special. // bool specialIntrinsic = false; - LLVMIntrinsic::ID iid; - if (calledFunc && (iid=(LLVMIntrinsic::ID)calledFunc->getIntrinsicID())) + Intrinsic::ID iid; + if (calledFunc && (iid=(Intrinsic::ID)calledFunc->getIntrinsicID())) specialIntrinsic = CodeGenIntrinsic(iid, *callInstr, target, mvec); // If not, generate the normal call sequence for the function. @@ -2929,3 +2931,5 @@ GetInstructionsByRule(InstructionNode* subtreeRoot, } } } + +} diff --git a/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h b/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h index d49863c1c84..b69c5c2b6e4 100644 --- a/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h +++ b/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h @@ -17,6 +17,8 @@ #include "llvm/DerivedTypes.h" #include "SparcInternals.h" +namespace llvm { + // Choose load instruction opcode based on type of value inline MachineOpCode ChooseLoadInstruction(const Type *DestTy) @@ -220,4 +222,6 @@ convertOpcodeFromRegToImm(unsigned Opcode) { } } +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/SparcInternals.h b/llvm/lib/Target/Sparc/SparcInternals.h index 4d0a48e4d5d..5e5f155e399 100644 --- a/llvm/lib/Target/Sparc/SparcInternals.h +++ b/llvm/lib/Target/Sparc/SparcInternals.h @@ -25,6 +25,8 @@ #include "SparcRegClassInfo.h" #include "Config/sys/types.h" +namespace llvm { + class LiveRange; class UltraSparc; class Pass; @@ -693,4 +695,6 @@ public: Pass* getBytecodeAsmPrinterPass(std::ostream &Out); }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp index d6de5f9c0df..564e59cd70e 100644 --- a/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcRegClassInfo.cpp @@ -17,6 +17,8 @@ #include "../../CodeGen/RegAlloc/RegAllocCommon.h" // FIXME! #include "../../CodeGen/RegAlloc/IGNode.h" // FIXME! +namespace llvm { + //----------------------------------------------------------------------------- // Int Register Class - method for coloring a node in the interference graph. // @@ -390,3 +392,5 @@ int SparcFloatRegClass::findFloatColor(const LiveRange *LR, return -1; } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/SparcRegClassInfo.h b/llvm/lib/Target/Sparc/SparcRegClassInfo.h index 321ce60ab0f..cc492e77c72 100644 --- a/llvm/lib/Target/Sparc/SparcRegClassInfo.h +++ b/llvm/lib/Target/Sparc/SparcRegClassInfo.h @@ -16,6 +16,8 @@ #include "llvm/Target/TargetRegInfo.h" +namespace llvm { + //----------------------------------------------------------------------------- // Integer Register Class //----------------------------------------------------------------------------- @@ -217,4 +219,6 @@ struct SparcSpecialRegClass : public TargetRegClassInfo { const char * const getRegName(unsigned reg) const; }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/SparcRegInfo.cpp b/llvm/lib/Target/Sparc/SparcRegInfo.cpp index 84dc92e246d..5edbbe06470 100644 --- a/llvm/lib/Target/Sparc/SparcRegInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcRegInfo.cpp @@ -27,6 +27,8 @@ #include "llvm/Function.h" #include "llvm/DerivedTypes.h" +namespace llvm { + enum { BadRegClass = ~0 }; @@ -967,3 +969,5 @@ void UltraSparcRegInfo::printReg(const LiveRange *LR) const { std::cerr << "+" << getUnifiedRegName(uRegName+1); std::cerr << "]\n"; } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp b/llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp index d60d9151c1c..c50dca55e78 100644 --- a/llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp +++ b/llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp @@ -38,6 +38,8 @@ #include "SparcV9CodeEmitter.h" #include "Config/alloca.h" +namespace llvm { + namespace { Statistic<> OverwrittenCalls("call-ovwr", "Number of over-written calls"); Statistic<> UnmodifiedCalls("call-skip", "Number of unmodified calls"); @@ -443,7 +445,6 @@ uint64_t JITResolver::emitStubForFunction(Function *F) { return (intptr_t)MCE.finishFunctionStub(*F)+4; /* 1 instr past the restore */ } - SparcV9CodeEmitter::SparcV9CodeEmitter(TargetMachine &tm, MachineCodeEmitter &M): TM(tm), MCE(M) { @@ -809,4 +810,6 @@ void* SparcV9CodeEmitter::getGlobalAddress(GlobalValue *V, MachineInstr &MI, } } +} // End llvm namespace + #include "SparcV9CodeEmitter.inc" diff --git a/llvm/lib/Target/Sparc/SparcV9CodeEmitter.h b/llvm/lib/Target/Sparc/SparcV9CodeEmitter.h index 7e19c44ce03..d21345ec041 100644 --- a/llvm/lib/Target/Sparc/SparcV9CodeEmitter.h +++ b/llvm/lib/Target/Sparc/SparcV9CodeEmitter.h @@ -19,6 +19,8 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Target/TargetMachine.h" +namespace llvm { + class GlobalValue; class MachineInstr; class MachineOperand; @@ -81,4 +83,6 @@ private: }; +} // End llvm namespace + #endif diff --git a/llvm/lib/Target/Sparc/StackSlots.cpp b/llvm/lib/Target/Sparc/StackSlots.cpp index 551dd92b495..5fd0ba19271 100644 --- a/llvm/lib/Target/Sparc/StackSlots.cpp +++ b/llvm/lib/Target/Sparc/StackSlots.cpp @@ -20,6 +20,8 @@ #include "llvm/CodeGen/MachineFunctionInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" +namespace llvm { + namespace { class StackSlots : public MachineFunctionPass { const TargetMachine &Target; @@ -48,3 +50,5 @@ namespace { Pass *createStackSlotsPass(const TargetMachine &Target) { return new StackSlots(Target); } + +} // End llvm namespace diff --git a/llvm/lib/Target/Sparc/UltraSparcSchedInfo.cpp b/llvm/lib/Target/Sparc/UltraSparcSchedInfo.cpp index fd03ad69d67..7d8ea05066c 100644 --- a/llvm/lib/Target/Sparc/UltraSparcSchedInfo.cpp +++ b/llvm/lib/Target/Sparc/UltraSparcSchedInfo.cpp @@ -13,6 +13,8 @@ #include "SparcInternals.h" +using namespace llvm; + /*--------------------------------------------------------------------------- Scheduling guidelines for SPARC IIi: |