From 8ca0eebe4ef4fe810dba5ce91306031272f139cf Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 21 Aug 2003 22:29:52 +0000 Subject: Initial checkin of ModuleMaker project git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8036 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/ModuleMaker.cpp | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 examples/ModuleMaker/ModuleMaker.cpp (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp new file mode 100644 index 0000000000..1d06c2d0dd --- /dev/null +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -0,0 +1,52 @@ +//===- ModuleMaker.cpp - Example project which creates modules --*- C++ -*-===// +// +// This programs is a simple example that creates an LLVM module "from scratch", +// emitting it as a bytecode file to standard out. This is just to show how +// LLVM projects work and to demonstrate some of the LLVM APIs. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Module.h" +#include "llvm/DerivedTypes.h" +#include "llvm/Constants.h" +#include "llvm/Instructions.h" +#include "llvm/Bytecode/Writer.h" + +int main() { + // Create the "module" or "program" or "translation unit" to hold the + // function + Module *M = new Module("test"); + + // Create the main function: first create the type 'int ()' + FunctionType *FT = FunctionType::get(Type::IntTy, std::vector(), + /*not vararg*/false); + + // By passing a module as the last parameter to the Function constructor, + // it automatically gets appended to the Module. + Function *F = new Function(FT, Function::ExternalLinkage, "main", M); + + // Add a basic block to the function... again, it automatically inserts + // because of the last argument. + BasicBlock *BB = new BasicBlock("EntryBlock", F); + + // Get pointers to the constant integers... + Value *Two = ConstantSInt::get(Type::IntTy, 2); + Value *Three = ConstantSInt::get(Type::IntTy, 3); + + // Create the add instruction... does not insert... + Instruction *Add = BinaryOperator::create(Instruction::Add, Two, Three, + "addresult"); + + // explicitly insert it into the basic block... + BB->getInstList().push_back(Add); + + // Create the return instruction and add it to the basic block + BB->getInstList().push_back(new ReturnInst(Add)); + + // Output the bytecode file to stdout + WriteBytecodeToFile(M, std::cout); + + // Delete the module and all of its contents. + delete M; + return 0; +} -- cgit v1.2.3-70-g09d2 From d0fde30ce850b78371fd1386338350591f9ff494 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Tue, 11 Nov 2003 22:41:34 +0000 Subject: Put all LLVM code into the llvm namespace, as per bug 109. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8 --- autoconf/configure.ac | 1 + examples/ModuleMaker/ModuleMaker.cpp | 2 + .../ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp | 2 + include/Support/Annotation.h | 4 ++ include/Support/BitSetVector.h | 3 ++ include/Support/Casting.h | 4 ++ include/Support/CommandLine.h | 3 ++ include/Support/DOTGraphTraits.h | 4 ++ include/Support/Debug.h | 4 ++ include/Support/DepthFirstIterator.h | 3 ++ include/Support/DynamicLinker.h | 4 ++ include/Support/EquivalenceClasses.h | 4 ++ include/Support/FileUtilities.h | 4 ++ include/Support/GraphTraits.h | 4 ++ include/Support/GraphWriter.h | 4 ++ include/Support/LeakDetector.h | 5 ++ include/Support/MallocAllocator.h | 3 ++ include/Support/MathExtras.h | 4 ++ include/Support/PostOrderIterator.h | 4 ++ include/Support/SCCIterator.h | 4 ++ include/Support/STLExtras.h | 4 ++ include/Support/SetOperations.h | 4 ++ include/Support/Signals.h | 5 +- include/Support/Statistic.h | 4 ++ include/Support/StringExtras.h | 4 ++ include/Support/SystemUtils.h | 5 ++ include/Support/Timer.h | 4 ++ include/Support/Tree.h | 3 ++ include/Support/TypeInfo.h | 4 ++ include/Support/VectorExtras.h | 4 ++ include/Support/ilist | 6 ++- include/llvm/ADT/BitSetVector.h | 3 ++ include/llvm/ADT/DepthFirstIterator.h | 3 ++ include/llvm/ADT/EquivalenceClasses.h | 4 ++ include/llvm/ADT/GraphTraits.h | 4 ++ include/llvm/ADT/PostOrderIterator.h | 4 ++ include/llvm/ADT/SCCIterator.h | 4 ++ include/llvm/ADT/STLExtras.h | 4 ++ include/llvm/ADT/SetOperations.h | 4 ++ include/llvm/ADT/Statistic.h | 4 ++ include/llvm/ADT/StringExtras.h | 4 ++ include/llvm/ADT/Tree.h | 3 ++ include/llvm/ADT/VectorExtras.h | 4 ++ include/llvm/ADT/ilist | 6 ++- include/llvm/AbstractTypeUser.h | 4 ++ include/llvm/Analysis/AliasAnalysis.h | 5 ++ include/llvm/Analysis/AliasSetTracker.h | 5 ++ include/llvm/Analysis/CallGraph.h | 5 ++ include/llvm/Analysis/ConstantsScanner.h | 5 ++ include/llvm/Analysis/DSGraph.h | 5 ++ include/llvm/Analysis/DSGraphTraits.h | 4 ++ include/llvm/Analysis/DSNode.h | 4 ++ include/llvm/Analysis/DSSupport.h | 12 ++++- include/llvm/Analysis/DataStructure.h | 4 ++ include/llvm/Analysis/DataStructure/DSGraph.h | 5 ++ .../llvm/Analysis/DataStructure/DSGraphTraits.h | 4 ++ include/llvm/Analysis/DataStructure/DSNode.h | 4 ++ include/llvm/Analysis/DataStructure/DSSupport.h | 12 ++++- .../llvm/Analysis/DataStructure/DataStructure.h | 4 ++ include/llvm/Analysis/DependenceGraph.h | 4 ++ include/llvm/Analysis/Dominators.h | 4 ++ include/llvm/Analysis/Expressions.h | 4 ++ include/llvm/Analysis/FindUnsafePointerTypes.h | 4 ++ include/llvm/Analysis/FindUsedTypes.h | 5 ++ include/llvm/Analysis/IPModRef.h | 4 ++ include/llvm/Analysis/InductionVariable.h | 5 ++ include/llvm/Analysis/InstForest.h | 4 ++ include/llvm/Analysis/Interval.h | 4 ++ include/llvm/Analysis/IntervalIterator.h | 4 ++ include/llvm/Analysis/IntervalPartition.h | 4 ++ include/llvm/Analysis/LoadValueNumbering.h | 4 ++ include/llvm/Analysis/LoopInfo.h | 4 ++ include/llvm/Analysis/MemoryDepAnalysis.h | 4 ++ include/llvm/Analysis/PgmDependenceGraph.h | 5 +- include/llvm/Analysis/PostDominators.h | 4 ++ include/llvm/Analysis/SlotCalculator.h | 5 ++ include/llvm/Analysis/ValueNumbering.h | 5 ++ include/llvm/Analysis/Verifier.h | 4 ++ include/llvm/Argument.h | 4 ++ include/llvm/Assembly/AsmAnnotationWriter.h | 5 ++ include/llvm/Assembly/CWriter.h | 5 ++ include/llvm/Assembly/CachedWriter.h | 4 ++ include/llvm/Assembly/Parser.h | 4 ++ include/llvm/Assembly/PrintModulePass.h | 4 ++ include/llvm/Assembly/Writer.h | 5 ++ include/llvm/BasicBlock.h | 4 ++ include/llvm/Bytecode/Format.h | 5 ++ include/llvm/Bytecode/Primitives.h | 4 ++ include/llvm/Bytecode/Reader.h | 4 ++ include/llvm/Bytecode/WriteBytecodePass.h | 4 ++ include/llvm/Bytecode/Writer.h | 4 ++ include/llvm/CallGraphSCCPass.h | 4 ++ include/llvm/CodeGen/FunctionLiveVarInfo.h | 4 ++ include/llvm/CodeGen/InstrForest.h | 11 ++++ include/llvm/CodeGen/InstrScheduling.h | 4 ++ include/llvm/CodeGen/InstrSelection.h | 4 ++ include/llvm/CodeGen/InstrSelectionSupport.h | 5 ++ include/llvm/CodeGen/LiveVariables.h | 4 ++ include/llvm/CodeGen/MachineBasicBlock.h | 4 ++ include/llvm/CodeGen/MachineCodeEmitter.h | 5 ++ include/llvm/CodeGen/MachineCodeForInstruction.h | 4 ++ include/llvm/CodeGen/MachineConstantPool.h | 5 ++ include/llvm/CodeGen/MachineFrameInfo.h | 9 ++++ include/llvm/CodeGen/MachineFunction.h | 4 ++ include/llvm/CodeGen/MachineFunctionInfo.h | 5 ++ include/llvm/CodeGen/MachineFunctionPass.h | 4 ++ include/llvm/CodeGen/MachineInstr.h | 4 ++ include/llvm/CodeGen/MachineInstrAnnot.h | 3 ++ include/llvm/CodeGen/MachineInstrBuilder.h | 4 ++ include/llvm/CodeGen/Passes.h | 4 ++ include/llvm/CodeGen/SSARegMap.h | 4 ++ include/llvm/CodeGen/SchedGraphCommon.h | 4 ++ include/llvm/CodeGen/SelectionDAG.h | 5 ++ include/llvm/CodeGen/ValueSet.h | 5 ++ include/llvm/CodeGen/ValueTypes.h | 5 +- include/llvm/Constant.h | 4 ++ include/llvm/ConstantHandling.h | 6 +++ include/llvm/Constants.h | 4 ++ include/llvm/DerivedTypes.h | 4 ++ include/llvm/ExecutionEngine/ExecutionEngine.h | 5 ++ include/llvm/ExecutionEngine/GenericValue.h | 4 ++ include/llvm/Function.h | 6 ++- include/llvm/GlobalValue.h | 5 ++ include/llvm/GlobalVariable.h | 4 ++ include/llvm/InstrTypes.h | 4 ++ include/llvm/Instruction.def | 2 +- include/llvm/Instruction.h | 4 ++ include/llvm/Intrinsics.h | 11 ++-- include/llvm/Linker.h | 5 ++ include/llvm/Module.h | 5 ++ include/llvm/ModuleProvider.h | 4 ++ include/llvm/Pass.h | 5 ++ include/llvm/PassAnalysisSupport.h | 4 ++ include/llvm/PassManager.h | 4 ++ include/llvm/PassSupport.h | 5 ++ include/llvm/SlotCalculator.h | 5 ++ include/llvm/Support/Annotation.h | 4 ++ include/llvm/Support/CFG.h | 4 ++ include/llvm/Support/CallSite.h | 4 ++ include/llvm/Support/Casting.h | 4 ++ include/llvm/Support/CommandLine.h | 3 ++ include/llvm/Support/ConstantRange.h | 5 ++ include/llvm/Support/DOTGraphTraits.h | 4 ++ include/llvm/Support/Debug.h | 4 ++ include/llvm/Support/DynamicLinker.h | 4 ++ include/llvm/Support/FileUtilities.h | 4 ++ include/llvm/Support/GraphWriter.h | 4 ++ include/llvm/Support/InstIterator.h | 4 ++ include/llvm/Support/InstVisitor.h | 5 +- include/llvm/Support/LeakDetector.h | 5 ++ include/llvm/Support/Linker.h | 5 ++ include/llvm/Support/MallocAllocator.h | 3 ++ include/llvm/Support/Mangler.h | 9 ++++ include/llvm/Support/MathExtras.h | 4 ++ include/llvm/Support/PassNameParser.h | 4 ++ include/llvm/Support/SystemUtils.h | 5 ++ include/llvm/Support/Timer.h | 4 ++ include/llvm/Support/ToolRunner.h | 4 ++ include/llvm/Support/TypeInfo.h | 4 ++ include/llvm/Support/ValueHolder.h | 4 ++ include/llvm/SymbolTable.h | 4 ++ include/llvm/SymbolTableListTraits.h | 4 ++ include/llvm/System/Signals.h | 5 +- include/llvm/Target/MRegisterInfo.h | 4 ++ include/llvm/Target/TargetCacheInfo.h | 4 ++ include/llvm/Target/TargetData.h | 5 ++ include/llvm/Target/TargetFrameInfo.h | 4 ++ include/llvm/Target/TargetInstrInfo.h | 4 ++ include/llvm/Target/TargetMachine.h | 4 ++ include/llvm/Target/TargetMachineImpls.h | 4 ++ include/llvm/Target/TargetRegInfo.h | 4 ++ include/llvm/Target/TargetSchedInfo.h | 14 +++-- include/llvm/Transforms/IPO.h | 4 ++ include/llvm/Transforms/Instrumentation.h | 4 ++ include/llvm/Transforms/MutateStructTypes.h | 4 ++ include/llvm/Transforms/Scalar.h | 4 ++ include/llvm/Transforms/Utils/BasicBlockUtils.h | 5 +- include/llvm/Transforms/Utils/Cloning.h | 5 ++ include/llvm/Transforms/Utils/DemoteRegToStack.h | 4 ++ include/llvm/Transforms/Utils/Linker.h | 5 ++ include/llvm/Transforms/Utils/Local.h | 5 ++ include/llvm/Transforms/Utils/PromoteMemToReg.h | 7 ++- .../llvm/Transforms/Utils/UnifyFunctionExitNodes.h | 4 ++ include/llvm/Type.def | 2 +- include/llvm/Type.h | 4 ++ include/llvm/Use.h | 9 +++- include/llvm/User.h | 4 ++ include/llvm/Value.h | 4 ++ include/llvm/iMemory.h | 5 ++ include/llvm/iOperators.h | 4 ++ include/llvm/iOther.h | 4 ++ include/llvm/iPHINode.h | 5 ++ include/llvm/iTerminators.h | 4 ++ lib/Analysis/AliasAnalysis.cpp | 4 ++ lib/Analysis/AliasAnalysisCounter.cpp | 4 ++ lib/Analysis/AliasAnalysisEvaluator.cpp | 4 ++ lib/Analysis/AliasSetTracker.cpp | 5 +- lib/Analysis/BasicAliasAnalysis.cpp | 6 +-- lib/Analysis/CFGPrinter.cpp | 7 +-- lib/Analysis/ConstantRange.cpp | 4 ++ lib/Analysis/DataStructure/BottomUpClosure.cpp | 3 ++ lib/Analysis/DataStructure/DSCallSiteIterator.h | 4 ++ lib/Analysis/DataStructure/DataStructure.cpp | 7 ++- lib/Analysis/DataStructure/DataStructureAA.cpp | 4 ++ lib/Analysis/DataStructure/DataStructureOpt.cpp | 5 +- lib/Analysis/DataStructure/DataStructureStats.cpp | 4 ++ lib/Analysis/DataStructure/GraphChecker.cpp | 4 ++ lib/Analysis/DataStructure/IPModRef.cpp | 4 ++ lib/Analysis/DataStructure/Local.cpp | 8 ++- lib/Analysis/DataStructure/MemoryDepAnalysis.cpp | 5 +- lib/Analysis/DataStructure/Parallelize.cpp | 4 ++ lib/Analysis/DataStructure/PgmDependenceGraph.cpp | 3 ++ lib/Analysis/DataStructure/Printer.cpp | 5 +- lib/Analysis/DataStructure/Steensgaard.cpp | 5 +- lib/Analysis/DataStructure/TopDownClosure.cpp | 3 ++ lib/Analysis/Expressions.cpp | 4 ++ lib/Analysis/IPA/CallGraph.cpp | 4 ++ lib/Analysis/IPA/CallGraphSCCPass.cpp | 4 ++ lib/Analysis/IPA/DependenceGraph.cpp | 3 ++ lib/Analysis/IPA/FindUnsafePointerTypes.cpp | 4 ++ lib/Analysis/IPA/FindUsedTypes.cpp | 4 ++ lib/Analysis/IPA/IPModRef.cpp | 4 ++ lib/Analysis/IPA/MemoryDepAnalysis.cpp | 5 +- lib/Analysis/IPA/PgmDependenceGraph.cpp | 3 ++ lib/Analysis/IPA/PrintSCC.cpp | 4 ++ lib/Analysis/InductionVariable.cpp | 4 ++ lib/Analysis/InstCount.cpp | 4 ++ lib/Analysis/Interval.cpp | 2 + lib/Analysis/IntervalPartition.cpp | 4 ++ lib/Analysis/LiveVar/BBLiveVar.cpp | 5 +- lib/Analysis/LiveVar/BBLiveVar.h | 5 ++ lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp | 4 ++ lib/Analysis/LiveVar/ValueSet.cpp | 3 ++ lib/Analysis/LoadValueNumbering.cpp | 6 ++- lib/Analysis/LoopInfo.cpp | 4 ++ lib/Analysis/PostDominators.cpp | 4 ++ lib/Analysis/PrintSCC.cpp | 4 ++ lib/Analysis/ValueNumbering.cpp | 7 ++- lib/Archive/ArchiveReader.cpp | 5 +- lib/AsmParser/Lexer.l | 5 ++ lib/AsmParser/Parser.cpp | 4 ++ lib/AsmParser/ParserInternals.h | 14 +++-- lib/AsmParser/llvmAsmParser.y | 61 ++++++++++++---------- lib/Bytecode/Archive/ArchiveReader.cpp | 5 +- lib/Bytecode/Reader/ArchiveReader.cpp | 5 +- lib/Bytecode/Reader/ConstantReader.cpp | 4 ++ lib/Bytecode/Reader/InstructionReader.cpp | 6 ++- lib/Bytecode/Reader/Reader.cpp | 4 ++ lib/Bytecode/Reader/ReaderInternals.h | 4 ++ lib/Bytecode/Reader/ReaderWrappers.cpp | 7 ++- lib/Bytecode/Writer/ConstantWriter.cpp | 4 ++ lib/Bytecode/Writer/InstructionWriter.cpp | 4 ++ lib/Bytecode/Writer/SlotCalculator.cpp | 4 ++ lib/Bytecode/Writer/SlotCalculator.h | 5 ++ lib/Bytecode/Writer/Writer.cpp | 4 ++ lib/Bytecode/Writer/WriterInternals.h | 3 ++ lib/CodeGen/InstrSched/InstrScheduling.cpp | 5 ++ lib/CodeGen/InstrSched/SchedGraph.cpp | 4 ++ lib/CodeGen/InstrSched/SchedGraph.h | 4 ++ lib/CodeGen/InstrSched/SchedGraphCommon.cpp | 3 ++ lib/CodeGen/InstrSched/SchedPriorities.cpp | 3 ++ lib/CodeGen/InstrSched/SchedPriorities.h | 4 ++ lib/CodeGen/InstrSelection/InstrForest.cpp | 4 ++ lib/CodeGen/InstrSelection/InstrSelection.cpp | 8 ++- .../InstrSelection/InstrSelectionSupport.cpp | 3 ++ lib/CodeGen/LiveVariables.cpp | 4 ++ lib/CodeGen/MachineCodeEmitter.cpp | 24 +++++---- lib/CodeGen/MachineCodeForInstruction.cpp | 4 ++ lib/CodeGen/MachineFunction.cpp | 4 ++ lib/CodeGen/MachineInstr.cpp | 8 ++- lib/CodeGen/MachineInstrAnnot.cpp | 3 ++ lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp | 3 ++ lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h | 3 ++ lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp | 4 ++ lib/CodeGen/PHIElimination.cpp | 5 ++ lib/CodeGen/Passes.cpp | 4 ++ lib/CodeGen/PrologEpilogInserter.cpp | 5 ++ lib/CodeGen/RegAlloc/AllocInfo.h | 4 ++ lib/CodeGen/RegAlloc/IGNode.cpp | 4 ++ lib/CodeGen/RegAlloc/IGNode.h | 5 ++ lib/CodeGen/RegAlloc/InterferenceGraph.cpp | 4 ++ lib/CodeGen/RegAlloc/InterferenceGraph.h | 5 ++ lib/CodeGen/RegAlloc/LiveRange.h | 4 ++ lib/CodeGen/RegAlloc/LiveRangeInfo.cpp | 4 ++ lib/CodeGen/RegAlloc/LiveRangeInfo.h | 4 ++ lib/CodeGen/RegAlloc/PhyRegAlloc.cpp | 4 ++ lib/CodeGen/RegAlloc/PhyRegAlloc.h | 4 ++ lib/CodeGen/RegAlloc/RegAllocCommon.h | 4 ++ lib/CodeGen/RegAlloc/RegClass.cpp | 4 +- lib/CodeGen/RegAlloc/RegClass.h | 5 ++ lib/CodeGen/RegAllocLocal.cpp | 5 +- lib/CodeGen/RegAllocSimple.cpp | 4 ++ lib/CodeGen/SelectionDAG/DAGBuilder.cpp | 4 ++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 4 ++ lib/ExecutionEngine/ExecutionEngine.cpp | 3 ++ lib/ExecutionEngine/Interpreter/Execution.cpp | 6 ++- .../Interpreter/ExternalFunctions.cpp | 4 ++ lib/ExecutionEngine/Interpreter/Interpreter.cpp | 4 ++ lib/ExecutionEngine/Interpreter/Interpreter.h | 4 ++ lib/ExecutionEngine/JIT/Intercept.cpp | 4 ++ lib/ExecutionEngine/JIT/JIT.cpp | 4 ++ lib/ExecutionEngine/JIT/JIT.h | 4 ++ lib/ExecutionEngine/JIT/JITEmitter.cpp | 4 ++ lib/ExecutionEngine/JIT/VM.cpp | 4 ++ lib/ExecutionEngine/JIT/VM.h | 4 ++ lib/Linker/LinkArchives.cpp | 4 ++ lib/Linker/LinkModules.cpp | 3 ++ lib/Support/Annotation.cpp | 4 ++ lib/Support/CommandLine.cpp | 4 ++ lib/Support/ConstantRange.cpp | 4 ++ lib/Support/Debug.cpp | 4 ++ lib/Support/DynamicLinker.cpp | 4 ++ lib/Support/FileUtilities.cpp | 5 ++ lib/Support/LeakDetector.cpp | 4 ++ lib/Support/Mangler.cpp | 3 ++ lib/Support/PluginLoader.cpp | 4 ++ lib/Support/Signals.cpp | 4 ++ lib/Support/Statistic.cpp | 6 ++- lib/Support/SystemUtils.cpp | 3 ++ lib/Support/Timer.cpp | 7 ++- lib/Support/ToolRunner.cpp | 4 ++ lib/Support/ValueHolder.cpp | 4 ++ lib/Target/CBackend/CBackend.cpp | 28 +++++----- lib/Target/CBackend/Writer.cpp | 28 +++++----- lib/Target/MRegisterInfo.cpp | 4 ++ lib/Target/SparcV9/EmitBytecodeToAssembly.cpp | 4 ++ lib/Target/SparcV9/InstrSched/InstrScheduling.cpp | 5 ++ lib/Target/SparcV9/InstrSched/SchedGraph.cpp | 4 ++ lib/Target/SparcV9/InstrSched/SchedGraph.h | 4 ++ lib/Target/SparcV9/InstrSched/SchedGraphCommon.cpp | 3 ++ lib/Target/SparcV9/InstrSched/SchedPriorities.cpp | 3 ++ lib/Target/SparcV9/InstrSched/SchedPriorities.h | 4 ++ lib/Target/SparcV9/InstrSelection/InstrForest.cpp | 4 ++ .../SparcV9/InstrSelection/InstrSelection.cpp | 8 ++- .../InstrSelection/InstrSelectionSupport.cpp | 3 ++ lib/Target/SparcV9/LiveVar/BBLiveVar.cpp | 5 +- lib/Target/SparcV9/LiveVar/BBLiveVar.h | 5 ++ lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp | 4 ++ lib/Target/SparcV9/LiveVar/ValueSet.cpp | 3 ++ lib/Target/SparcV9/MachineCodeForInstruction.h | 4 ++ lib/Target/SparcV9/MachineFunctionInfo.h | 5 ++ lib/Target/SparcV9/MachineInstrAnnot.h | 3 ++ lib/Target/SparcV9/MappingInfo.cpp | 4 ++ lib/Target/SparcV9/MappingInfo.h | 5 ++ .../SparcV9/ModuloScheduling/ModuloSchedGraph.cpp | 3 ++ .../SparcV9/ModuloScheduling/ModuloSchedGraph.h | 3 ++ .../SparcV9/ModuloScheduling/ModuloScheduling.cpp | 4 ++ lib/Target/SparcV9/RegAlloc/AllocInfo.h | 4 ++ lib/Target/SparcV9/RegAlloc/IGNode.cpp | 4 ++ lib/Target/SparcV9/RegAlloc/IGNode.h | 5 ++ lib/Target/SparcV9/RegAlloc/InterferenceGraph.cpp | 4 ++ lib/Target/SparcV9/RegAlloc/InterferenceGraph.h | 5 ++ lib/Target/SparcV9/RegAlloc/LiveRange.h | 4 ++ lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp | 4 ++ lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h | 4 ++ lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp | 4 ++ lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h | 4 ++ lib/Target/SparcV9/RegAlloc/RegAllocCommon.h | 4 ++ lib/Target/SparcV9/RegAlloc/RegClass.cpp | 4 +- lib/Target/SparcV9/RegAlloc/RegClass.h | 5 ++ lib/Target/SparcV9/SparcV9.burg.in | 2 +- lib/Target/SparcV9/SparcV9AsmPrinter.cpp | 9 +++- lib/Target/SparcV9/SparcV9CodeEmitter.cpp | 5 +- lib/Target/SparcV9/SparcV9CodeEmitter.h | 4 ++ lib/Target/SparcV9/SparcV9InstrInfo.cpp | 4 ++ lib/Target/SparcV9/SparcV9InstrSelection.cpp | 24 +++++---- lib/Target/SparcV9/SparcV9InstrSelectionSupport.h | 4 ++ lib/Target/SparcV9/SparcV9Internals.h | 4 ++ lib/Target/SparcV9/SparcV9PeepholeOpts.cpp | 4 ++ lib/Target/SparcV9/SparcV9PreSelection.cpp | 6 ++- lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp | 4 ++ lib/Target/SparcV9/SparcV9RegClassInfo.cpp | 4 ++ lib/Target/SparcV9/SparcV9RegClassInfo.h | 4 ++ lib/Target/SparcV9/SparcV9RegInfo.cpp | 4 ++ lib/Target/SparcV9/SparcV9SchedInfo.cpp | 2 + lib/Target/SparcV9/SparcV9StackSlots.cpp | 4 ++ lib/Target/SparcV9/SparcV9TargetMachine.cpp | 4 ++ lib/Target/TargetData.cpp | 5 +- lib/Target/TargetInstrInfo.cpp | 4 ++ lib/Target/TargetMachine.cpp | 4 ++ lib/Target/TargetSchedInfo.cpp | 4 ++ lib/Target/X86/FloatingPoint.cpp | 6 ++- lib/Target/X86/InstSelectPattern.cpp | 5 +- lib/Target/X86/InstSelectSimple.cpp | 25 +++++---- lib/Target/X86/PeepholeOptimizer.cpp | 4 ++ lib/Target/X86/Printer.cpp | 4 ++ lib/Target/X86/X86.h | 5 ++ lib/Target/X86/X86AsmPrinter.cpp | 4 ++ lib/Target/X86/X86CodeEmitter.cpp | 4 ++ lib/Target/X86/X86FloatingPoint.cpp | 6 ++- lib/Target/X86/X86ISelPattern.cpp | 5 +- lib/Target/X86/X86ISelSimple.cpp | 25 +++++---- lib/Target/X86/X86InstrBuilder.h | 4 ++ lib/Target/X86/X86InstrInfo.cpp | 2 + lib/Target/X86/X86InstrInfo.h | 4 ++ lib/Target/X86/X86PeepholeOpt.cpp | 4 ++ lib/Target/X86/X86RegisterInfo.cpp | 8 +++ lib/Target/X86/X86RegisterInfo.h | 6 ++- lib/Target/X86/X86TargetMachine.cpp | 4 ++ lib/Target/X86/X86TargetMachine.h | 4 ++ lib/Transforms/ExprTypeConvert.cpp | 4 ++ lib/Transforms/Hello/Hello.cpp | 4 ++ lib/Transforms/IPO/ConstantMerge.cpp | 5 +- lib/Transforms/IPO/DeadArgumentElimination.cpp | 5 ++ lib/Transforms/IPO/DeadTypeElimination.cpp | 5 +- lib/Transforms/IPO/ExtractFunction.cpp | 4 ++ lib/Transforms/IPO/FunctionResolution.cpp | 4 ++ lib/Transforms/IPO/GlobalDCE.cpp | 4 ++ lib/Transforms/IPO/IPConstantPropagation.cpp | 4 ++ lib/Transforms/IPO/InlineSimple.cpp | 4 ++ lib/Transforms/IPO/Inliner.cpp | 4 ++ lib/Transforms/IPO/Inliner.h | 4 ++ lib/Transforms/IPO/Internalize.cpp | 4 ++ lib/Transforms/IPO/LowerSetJmp.cpp | 4 ++ lib/Transforms/IPO/MutateStructTypes.cpp | 2 + lib/Transforms/IPO/Parallelize.cpp | 4 ++ lib/Transforms/IPO/PruneEH.cpp | 4 ++ lib/Transforms/IPO/RaiseAllocations.cpp | 4 ++ lib/Transforms/IPO/SimpleStructMutation.cpp | 4 ++ lib/Transforms/Instrumentation/BlockProfiling.cpp | 4 ++ lib/Transforms/Instrumentation/EmitFunctions.cpp | 4 ++ .../Instrumentation/ProfilePaths/CombineBranch.cpp | 6 ++- .../Instrumentation/ProfilePaths/EdgeCode.cpp | 3 ++ .../Instrumentation/ProfilePaths/Graph.cpp | 4 +- .../Instrumentation/ProfilePaths/Graph.h | 12 ++++- .../ProfilePaths/GraphAuxiliary.cpp | 4 ++ .../Instrumentation/ProfilePaths/InstLoops.cpp | 4 ++ .../Instrumentation/ProfilePaths/ProfilePaths.cpp | 4 ++ .../Instrumentation/ProfilePaths/RetracePath.cpp | 4 ++ lib/Transforms/Instrumentation/TraceValues.cpp | 4 ++ lib/Transforms/LevelRaise.cpp | 7 ++- lib/Transforms/Scalar/ADCE.cpp | 4 ++ lib/Transforms/Scalar/ConstantProp.cpp | 4 ++ lib/Transforms/Scalar/CorrelatedExprs.cpp | 4 ++ lib/Transforms/Scalar/DCE.cpp | 5 +- lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp | 16 +++--- lib/Transforms/Scalar/GCSE.cpp | 5 +- lib/Transforms/Scalar/IndVarSimplify.cpp | 4 ++ lib/Transforms/Scalar/InstructionCombining.cpp | 4 ++ lib/Transforms/Scalar/LICM.cpp | 4 ++ lib/Transforms/Scalar/PRE.cpp | 6 ++- lib/Transforms/Scalar/PiNodeInsertion.cpp | 4 ++ lib/Transforms/Scalar/Reassociate.cpp | 5 ++ lib/Transforms/Scalar/SCCP.cpp | 5 +- lib/Transforms/Scalar/ScalarReplAggregates.cpp | 5 ++ lib/Transforms/Scalar/SimplifyCFG.cpp | 5 ++ lib/Transforms/Scalar/SymbolStripping.cpp | 4 ++ lib/Transforms/Scalar/TailDuplication.cpp | 5 ++ lib/Transforms/Scalar/TailRecursionElimination.cpp | 4 ++ lib/Transforms/TransformInternals.cpp | 4 ++ lib/Transforms/TransformInternals.h | 4 ++ lib/Transforms/Utils/BasicBlockUtils.cpp | 4 ++ lib/Transforms/Utils/BreakCriticalEdges.cpp | 4 ++ lib/Transforms/Utils/CloneFunction.cpp | 4 ++ lib/Transforms/Utils/CloneModule.cpp | 4 ++ lib/Transforms/Utils/CloneTrace.cpp | 4 ++ lib/Transforms/Utils/DemoteRegToStack.cpp | 4 ++ lib/Transforms/Utils/InlineFunction.cpp | 4 ++ lib/Transforms/Utils/Linker.cpp | 3 ++ lib/Transforms/Utils/Local.cpp | 4 ++ lib/Transforms/Utils/LoopSimplify.cpp | 5 +- lib/Transforms/Utils/LowerAllocations.cpp | 4 ++ lib/Transforms/Utils/LowerInvoke.cpp | 5 ++ lib/Transforms/Utils/LowerSwitch.cpp | 4 ++ lib/Transforms/Utils/Mem2Reg.cpp | 4 ++ lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 4 ++ lib/Transforms/Utils/SimplifyCFG.cpp | 4 ++ lib/Transforms/Utils/UnifyFunctionExitNodes.cpp | 4 ++ lib/Transforms/Utils/ValueMapper.cpp | 3 ++ lib/Transforms/Utils/ValueMapper.h | 5 ++ lib/VMCore/AsmWriter.cpp | 4 ++ lib/VMCore/BasicBlock.cpp | 6 ++- lib/VMCore/ConstantFold.cpp | 4 ++ lib/VMCore/ConstantFold.h | 6 +++ lib/VMCore/ConstantFolding.h | 6 +++ lib/VMCore/ConstantRange.cpp | 4 ++ lib/VMCore/Constants.cpp | 4 ++ lib/VMCore/Dominators.cpp | 4 ++ lib/VMCore/Function.cpp | 50 ++++++++++-------- lib/VMCore/InstrTypes.cpp | 4 ++ lib/VMCore/Instruction.cpp | 4 ++ lib/VMCore/LeakDetector.cpp | 4 ++ lib/VMCore/Linker.cpp | 3 ++ lib/VMCore/Mangler.cpp | 3 ++ lib/VMCore/Module.cpp | 4 ++ lib/VMCore/ModuleProvider.cpp | 4 ++ lib/VMCore/Pass.cpp | 4 ++ lib/VMCore/PassManagerT.h | 5 ++ lib/VMCore/SlotCalculator.cpp | 4 ++ lib/VMCore/SymbolTable.cpp | 4 ++ lib/VMCore/SymbolTableListTraitsImpl.h | 4 ++ lib/VMCore/Type.cpp | 3 ++ lib/VMCore/Value.cpp | 4 ++ lib/VMCore/Verifier.cpp | 60 +++++++++++---------- lib/VMCore/iBranch.cpp | 4 ++ lib/VMCore/iCall.cpp | 7 +++ lib/VMCore/iMemory.cpp | 2 + lib/VMCore/iOperators.cpp | 4 ++ lib/VMCore/iSwitch.cpp | 4 ++ .../ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp | 2 + .../ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp | 2 + tools/analyze/AnalysisWrappers.cpp | 2 + tools/analyze/GraphPrinters.cpp | 4 ++ tools/analyze/PrintSCC.cpp | 4 ++ tools/analyze/analyze.cpp | 1 + tools/bugpoint/BugDriver.cpp | 6 +++ tools/bugpoint/BugDriver.h | 4 ++ tools/bugpoint/CodeGeneratorBug.cpp | 4 ++ tools/bugpoint/CrashDebugger.cpp | 4 ++ tools/bugpoint/ExecutionDriver.cpp | 6 +++ tools/bugpoint/ExtractFunction.cpp | 11 ++++ tools/bugpoint/ListReducer.h | 4 ++ tools/bugpoint/Miscompilation.cpp | 4 ++ tools/bugpoint/OptimizerDriver.cpp | 4 ++ tools/bugpoint/TestPasses.cpp | 2 + tools/bugpoint/ToolRunner.cpp | 4 ++ tools/bugpoint/ToolRunner.h | 4 ++ tools/bugpoint/bugpoint.cpp | 2 + tools/extract/extract.cpp | 2 + tools/gccas/gccas.cpp | 2 + tools/gccld/GenerateCode.cpp | 5 ++ tools/gccld/Linker.cpp | 4 ++ tools/gccld/gccld.cpp | 5 ++ tools/gccld/gccld.h | 3 ++ tools/llc/llc.cpp | 2 + tools/lli/lli.cpp | 2 + tools/llvm-ar/llvm-ar.cpp | 6 ++- tools/llvm-as/llvm-as.cpp | 2 + tools/llvm-dis/llvm-dis.cpp | 10 ++-- tools/llvm-extract/llvm-extract.cpp | 2 + tools/llvm-link/llvm-link.cpp | 2 + tools/llvm-nm/llvm-nm.cpp | 2 + tools/llvm-prof/ProfileInfo.cpp | 2 + tools/llvm-prof/ProfileInfo.h | 5 ++ tools/llvm-prof/llvm-prof.cpp | 2 + tools/opt/AnalysisWrappers.cpp | 2 + tools/opt/GraphPrinters.cpp | 4 ++ tools/opt/PrintSCC.cpp | 4 ++ tools/opt/opt.cpp | 1 + utils/TableGen/CodeEmitterGen.cpp | 6 +++ utils/TableGen/CodeEmitterGen.h | 4 ++ utils/TableGen/CodeGenTarget.cpp | 4 ++ utils/TableGen/CodeGenTarget.h | 5 ++ utils/TableGen/CodeGenWrappers.cpp | 4 ++ utils/TableGen/CodeGenWrappers.h | 5 ++ utils/TableGen/FileLexer.l | 11 +++- utils/TableGen/FileParser.y | 27 ++++++---- utils/TableGen/InstrInfoEmitter.cpp | 6 +++ utils/TableGen/InstrInfoEmitter.h | 5 ++ utils/TableGen/InstrSelectorEmitter.cpp | 7 ++- utils/TableGen/InstrSelectorEmitter.h | 4 ++ utils/TableGen/Record.cpp | 4 ++ utils/TableGen/Record.h | 4 ++ utils/TableGen/RegisterInfoEmitter.cpp | 7 +++ utils/TableGen/RegisterInfoEmitter.h | 4 ++ utils/TableGen/TableGen.cpp | 10 ++++ utils/TableGen/TableGenBackend.cpp | 9 +++- utils/TableGen/TableGenBackend.h | 9 ++++ 558 files changed, 2496 insertions(+), 266 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 1ae8c1cdd8..212a460ddb 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -16,6 +16,7 @@ dnl ************************************************************************** dnl * Initialize dnl ************************************************************************** AC_INIT([[[LLVM]]],[[[1.0]]],[llvmbugs@cs.uiuc.edu]) +dnl AC_CONFIG_SRC_DIR(lib/VMCore/Pass.cpp) dnl Place all of the extra autoconf files into the config subdirectory AC_CONFIG_AUX_DIR([autoconf]) diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 1d06c2d0dd..a1b68449f3 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -12,6 +12,8 @@ #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" +using namespace llvm; + int main() { // Create the "module" or "program" or "translation unit" to hold the // function diff --git a/examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp index 1d06c2d0dd..a1b68449f3 100644 --- a/examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp @@ -12,6 +12,8 @@ #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" +using namespace llvm; + int main() { // Create the "module" or "program" or "translation unit" to hold the // function diff --git a/include/Support/Annotation.h b/include/Support/Annotation.h index 075ffc297a..cee7ab7d89 100644 --- a/include/Support/Annotation.h +++ b/include/Support/Annotation.h @@ -25,6 +25,8 @@ #include #include +namespace llvm { + class AnnotationID; class Annotation; class Annotable; @@ -217,4 +219,6 @@ inline Annotation *Annotable::getOrCreateAnnotation(AnnotationID ID) const { return A; } +} // End namespace llvm + #endif diff --git a/include/Support/BitSetVector.h b/include/Support/BitSetVector.h index 08bafa1580..72f55b38c4 100644 --- a/include/Support/BitSetVector.h +++ b/include/Support/BitSetVector.h @@ -30,6 +30,8 @@ #include #include +namespace llvm { + class BitSetVector { enum { BITSET_WORDSIZE = sizeof(long)*8 }; @@ -266,4 +268,5 @@ inline bool Disjoint(const BitSetVector& set1, return true; } +} // End llvm namespace #endif diff --git a/include/Support/Casting.h b/include/Support/Casting.h index 065919c179..4b070c18d8 100644 --- a/include/Support/Casting.h +++ b/include/Support/Casting.h @@ -15,6 +15,8 @@ #ifndef SUPPORT_CASTING_H #define SUPPORT_CASTING_H +namespace llvm { + //===----------------------------------------------------------------------===// // isa Support Templates //===----------------------------------------------------------------------===// @@ -293,4 +295,6 @@ void main() { #endif +} // End llvm namespace + #endif diff --git a/include/Support/CommandLine.h b/include/Support/CommandLine.h index 01f55a81d4..df40d80070 100644 --- a/include/Support/CommandLine.h +++ b/include/Support/CommandLine.h @@ -27,6 +27,7 @@ #include #include "boost/type_traits/object_traits.hpp" +namespace llvm { /// cl Namespace - This namespace contains all of the command line option /// processing machinery. It is intentionally a short name to make qualified /// usage concise. @@ -1022,4 +1023,6 @@ struct aliasopt { } // End namespace cl +} // End namespace llvm + #endif diff --git a/include/Support/DOTGraphTraits.h b/include/Support/DOTGraphTraits.h index 002a78ec4f..63837b7ddf 100644 --- a/include/Support/DOTGraphTraits.h +++ b/include/Support/DOTGraphTraits.h @@ -19,6 +19,8 @@ #include +namespace llvm { + /// DefaultDOTGraphTraits - This class provides the default implementations of /// all of the DOTGraphTraits methods. If a specialization does not need to /// override all methods here it should inherit so that it can get the default @@ -96,4 +98,6 @@ struct DefaultDOTGraphTraits { template class DOTGraphTraits : public DefaultDOTGraphTraits {}; +} // End llvm namespace + #endif diff --git a/include/Support/Debug.h b/include/Support/Debug.h index 8cba05771f..66a208811a 100644 --- a/include/Support/Debug.h +++ b/include/Support/Debug.h @@ -26,6 +26,8 @@ #ifndef SUPPORT_DEBUG_H #define SUPPORT_DEBUG_H +namespace llvm { + // DebugFlag - This boolean is set to true if the '-debug' command line option // is specified. This should probably not be referenced directly, instead, use // the DEBUG macro below. @@ -57,4 +59,6 @@ bool isCurrentDebugType(const char *Type); do { if (DebugFlag && isCurrentDebugType(DEBUG_TYPE)) { X; } } while (0) #endif +} // End llvm namespace + #endif diff --git a/include/Support/DepthFirstIterator.h b/include/Support/DepthFirstIterator.h index bb7673c83d..c465f4e549 100644 --- a/include/Support/DepthFirstIterator.h +++ b/include/Support/DepthFirstIterator.h @@ -38,6 +38,8 @@ #include #include +namespace llvm { + // df_iterator_storage - A private class which is used to figure out where to // store the visited set. template // Non-external set @@ -223,5 +225,6 @@ idf_ext_iterator idf_ext_end(T G, SetTy &S) { return idf_ext_iterator::end(G, S); } +} // End llvm namespace #endif diff --git a/include/Support/DynamicLinker.h b/include/Support/DynamicLinker.h index 8f02708268..fec9a45296 100644 --- a/include/Support/DynamicLinker.h +++ b/include/Support/DynamicLinker.h @@ -18,6 +18,8 @@ #include +namespace llvm { + /// LinkDynamicObject - Load the named file as a dynamic library /// and link it with the currently running process. Returns false /// on success, true if there is an error (and sets ErrorMessage @@ -33,4 +35,6 @@ bool LinkDynamicObject (const char *filename, std::string *ErrorMessage); void *GetAddressOfSymbol (const char *symbolName); void *GetAddressOfSymbol (const std::string &symbolName); +} // End llvm namespace + #endif // SUPPORT_DYNAMICLINKER_H diff --git a/include/Support/EquivalenceClasses.h b/include/Support/EquivalenceClasses.h index 01e8c5ef82..46e626b69b 100644 --- a/include/Support/EquivalenceClasses.h +++ b/include/Support/EquivalenceClasses.h @@ -20,6 +20,8 @@ #include #include +namespace llvm { + template class EquivalenceClasses { // Maps each element to the element that is the leader of its @@ -89,4 +91,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/Support/FileUtilities.h b/include/Support/FileUtilities.h index 0dfa625362..c276ec7aaa 100644 --- a/include/Support/FileUtilities.h +++ b/include/Support/FileUtilities.h @@ -17,6 +17,8 @@ #include +namespace llvm { + /// CheckMagic - Returns true IFF the file named FN begins with Magic. FN must /// name a readable file. /// @@ -95,4 +97,6 @@ bool MakeFileExecutable (const std::string & Filename); /// bool MakeFileReadable (const std::string & Filename); +} // End llvm namespace + #endif diff --git a/include/Support/GraphTraits.h b/include/Support/GraphTraits.h index 305f71e280..4ff74176a7 100644 --- a/include/Support/GraphTraits.h +++ b/include/Support/GraphTraits.h @@ -18,6 +18,8 @@ #ifndef SUPPORT_GRAPHTRAITS_H #define SUPPORT_GRAPHTRAITS_H +namespace llvm { + // GraphTraits - This class should be specialized by different graph types... // which is why the default version is empty. // @@ -76,4 +78,6 @@ struct Inverse { inline Inverse(GraphType &G) : Graph(G) {} }; +} // End llvm namespace + #endif diff --git a/include/Support/GraphWriter.h b/include/Support/GraphWriter.h index 2cb8fcc985..7e5aa80645 100644 --- a/include/Support/GraphWriter.h +++ b/include/Support/GraphWriter.h @@ -28,6 +28,8 @@ #include #include +namespace llvm { + namespace DOT { // Private functions... inline std::string EscapeString(const std::string &Label) { std::string Str(Label); @@ -206,4 +208,6 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G, return O; } +} // End llvm namespace + #endif diff --git a/include/Support/LeakDetector.h b/include/Support/LeakDetector.h index b39e0b5911..e2ce9c50be 100644 --- a/include/Support/LeakDetector.h +++ b/include/Support/LeakDetector.h @@ -23,6 +23,9 @@ #define SUPPORT_LEAKDETECTOR_H #include + +namespace llvm { + class Value; struct LeakDetector { @@ -83,4 +86,6 @@ private: static void checkForGarbageImpl(const std::string &Message); }; +} // End llvm namespace + #endif diff --git a/include/Support/MallocAllocator.h b/include/Support/MallocAllocator.h index 1ba25b0d65..766a67fa22 100644 --- a/include/Support/MallocAllocator.h +++ b/include/Support/MallocAllocator.h @@ -23,6 +23,8 @@ #include #include +namespace llvm { + template struct MallocAllocator { typedef size_t size_type; @@ -79,5 +81,6 @@ namespace std { }; } +} // End llvm namespace #endif diff --git a/include/Support/MathExtras.h b/include/Support/MathExtras.h index ec742324b0..74958fbc35 100644 --- a/include/Support/MathExtras.h +++ b/include/Support/MathExtras.h @@ -16,6 +16,8 @@ #include "Support/DataTypes.h" +namespace llvm { + inline unsigned log2(uint64_t C) { unsigned getPow; for (getPow = 0; C > 1; ++getPow) @@ -33,4 +35,6 @@ inline bool isPowerOf2(int64_t C, unsigned &getPow) { return false; } +} // End llvm namespace + #endif diff --git a/include/Support/PostOrderIterator.h b/include/Support/PostOrderIterator.h index 9309554f32..d66c4b84c4 100644 --- a/include/Support/PostOrderIterator.h +++ b/include/Support/PostOrderIterator.h @@ -21,6 +21,8 @@ #include #include +namespace llvm { + template > class po_iterator : public forward_iterator { typedef forward_iterator super; @@ -149,4 +151,6 @@ public: inline rpo_iterator end() { return Blocks.rend(); } }; +} // End llvm namespace + #endif diff --git a/include/Support/SCCIterator.h b/include/Support/SCCIterator.h index cf137cd473..f21c7d162e 100644 --- a/include/Support/SCCIterator.h +++ b/include/Support/SCCIterator.h @@ -26,6 +26,8 @@ #include #include +namespace llvm { + //===----------------------------------------------------------------------===// /// /// scc_iterator - Enumerate the SCCs of a directed graph, in @@ -197,4 +199,6 @@ scc_iterator scc_end(T G) { return scc_iterator::end(G); } +} // End llvm namespace + #endif diff --git a/include/Support/STLExtras.h b/include/Support/STLExtras.h index 28c46e3d99..06a15734a7 100644 --- a/include/Support/STLExtras.h +++ b/include/Support/STLExtras.h @@ -21,6 +21,8 @@ #include "Support/iterator" #include "boost/type_traits/transform_traits.hpp" +namespace llvm { + //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===// @@ -278,4 +280,6 @@ inline tier tie(T1& f, T2& s) { return tier(f, s); } +} // End llvm namespace + #endif diff --git a/include/Support/SetOperations.h b/include/Support/SetOperations.h index dc6e0d6029..bb1e68e6b2 100644 --- a/include/Support/SetOperations.h +++ b/include/Support/SetOperations.h @@ -15,6 +15,8 @@ #ifndef SUPPORT_SETOPERATIONS_H #define SUPPORT_SETOPERATIONS_H +namespace llvm { + // set_union(A, B) - Compute A := A u B, return whether A changed. // template @@ -64,4 +66,6 @@ void set_subtract(S1Ty &S1, const S2Ty &S2) { S1.erase(*SI); } +} // End llvm namespace + #endif diff --git a/include/Support/Signals.h b/include/Support/Signals.h index ce12301a15..0cbf398798 100644 --- a/include/Support/Signals.h +++ b/include/Support/Signals.h @@ -17,10 +17,13 @@ #include +namespace llvm { + // RemoveFileOnSignal - This function registers signal handlers to ensure that // if a signal gets delivered that the named file is removed. // void RemoveFileOnSignal(const std::string &Filename); -#endif +} // End llvm namespace +#endif diff --git a/include/Support/Statistic.h b/include/Support/Statistic.h index d69809ff18..4e592d5832 100644 --- a/include/Support/Statistic.h +++ b/include/Support/Statistic.h @@ -26,6 +26,8 @@ #include +namespace llvm { + // StatisticBase - Nontemplated base class for Statistic<> class... class StatisticBase { const char *Name; @@ -78,4 +80,6 @@ public: const Statistic &operator-=(const DataType &V) { Value -= V; return *this; } }; +} // End llvm namespace + #endif diff --git a/include/Support/StringExtras.h b/include/Support/StringExtras.h index 2c50c1cd5b..2ebac81935 100644 --- a/include/Support/StringExtras.h +++ b/include/Support/StringExtras.h @@ -18,6 +18,8 @@ #include #include +namespace llvm { + static inline std::string utohexstr(uint64_t X) { char Buffer[40]; char *BufPtr = Buffer+39; @@ -95,4 +97,6 @@ static inline std::string ftostr(double V) { return Buffer; } +} // End llvm namespace + #endif diff --git a/include/Support/SystemUtils.h b/include/Support/SystemUtils.h index ccde86cce6..c874d9932c 100644 --- a/include/Support/SystemUtils.h +++ b/include/Support/SystemUtils.h @@ -17,6 +17,8 @@ #include +namespace llvm { + /// isExecutableFile - This function returns true if the filename specified /// exists and is executable. /// @@ -45,4 +47,7 @@ int RunProgramWithTimeout(const std::string &ProgramPath, const char **Args, /// wait for it to terminate. /// int ExecWait (const char * const argv[], const char * const envp[]); + +} // End llvm namespace + #endif diff --git a/include/Support/Timer.h b/include/Support/Timer.h index 57ef3f0d64..ac465bb95b 100644 --- a/include/Support/Timer.h +++ b/include/Support/Timer.h @@ -20,6 +20,8 @@ #include #include +namespace llvm { + class TimerGroup; /// Timer - This class is used to track the amount of time spent between @@ -157,4 +159,6 @@ private: } }; +} // End llvm namespace + #endif diff --git a/include/Support/Tree.h b/include/Support/Tree.h index e6454317a8..bc5495f25a 100644 --- a/include/Support/Tree.h +++ b/include/Support/Tree.h @@ -17,6 +17,8 @@ #include +namespace llvm { + template class Tree { std::vector Children; // This nodes children, if any @@ -55,5 +57,6 @@ public: inline const Payload &getTreeData() const { return Data; } }; +} // End llvm namespace #endif diff --git a/include/Support/TypeInfo.h b/include/Support/TypeInfo.h index aa2093a43d..5d9035076f 100644 --- a/include/Support/TypeInfo.h +++ b/include/Support/TypeInfo.h @@ -18,6 +18,8 @@ #include +namespace llvm { + struct TypeInfo { TypeInfo() { // needed for containers struct Nil {}; // Anonymous class distinct from all others... @@ -69,4 +71,6 @@ inline bool operator>=(const TypeInfo &lhs, const TypeInfo &rhs) { return !(lhs < rhs); } +} // End llvm namespace + #endif diff --git a/include/Support/VectorExtras.h b/include/Support/VectorExtras.h index 32778309d4..cf7cf5d2eb 100644 --- a/include/Support/VectorExtras.h +++ b/include/Support/VectorExtras.h @@ -17,6 +17,8 @@ #include +namespace llvm { + /// make_vector - Helper function which is useful for building temporary vectors /// to pass into type construction of CallInst ctors. This turns a null /// terminated list of pointers (or other value types) into a real live vector. @@ -33,4 +35,6 @@ inline std::vector make_vector(T A, ...) { return Result; } +} // End llvm namespace + #endif diff --git a/include/Support/ilist b/include/Support/ilist index 488a90ffde..7f4d2659d5 100644 --- a/include/Support/ilist +++ b/include/Support/ilist @@ -41,6 +41,8 @@ #include #include +namespace llvm { + template class iplist; template class ilist_iterator; @@ -522,10 +524,12 @@ struct ilist : public iplist { void resize(size_type newsize) { resize(newsize, NodeTy()); } }; +} // End llvm namespace + namespace std { // Ensure that swap uses the fast list swap... template - void swap(iplist &Left, iplist &Right) { + void swap(llvm::iplist &Left, llvm::iplist &Right) { Left.swap(Right); } } // End 'std' extensions... diff --git a/include/llvm/ADT/BitSetVector.h b/include/llvm/ADT/BitSetVector.h index 08bafa1580..72f55b38c4 100644 --- a/include/llvm/ADT/BitSetVector.h +++ b/include/llvm/ADT/BitSetVector.h @@ -30,6 +30,8 @@ #include #include +namespace llvm { + class BitSetVector { enum { BITSET_WORDSIZE = sizeof(long)*8 }; @@ -266,4 +268,5 @@ inline bool Disjoint(const BitSetVector& set1, return true; } +} // End llvm namespace #endif diff --git a/include/llvm/ADT/DepthFirstIterator.h b/include/llvm/ADT/DepthFirstIterator.h index bb7673c83d..c465f4e549 100644 --- a/include/llvm/ADT/DepthFirstIterator.h +++ b/include/llvm/ADT/DepthFirstIterator.h @@ -38,6 +38,8 @@ #include #include +namespace llvm { + // df_iterator_storage - A private class which is used to figure out where to // store the visited set. template // Non-external set @@ -223,5 +225,6 @@ idf_ext_iterator idf_ext_end(T G, SetTy &S) { return idf_ext_iterator::end(G, S); } +} // End llvm namespace #endif diff --git a/include/llvm/ADT/EquivalenceClasses.h b/include/llvm/ADT/EquivalenceClasses.h index 01e8c5ef82..46e626b69b 100644 --- a/include/llvm/ADT/EquivalenceClasses.h +++ b/include/llvm/ADT/EquivalenceClasses.h @@ -20,6 +20,8 @@ #include #include +namespace llvm { + template class EquivalenceClasses { // Maps each element to the element that is the leader of its @@ -89,4 +91,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/GraphTraits.h b/include/llvm/ADT/GraphTraits.h index 305f71e280..4ff74176a7 100644 --- a/include/llvm/ADT/GraphTraits.h +++ b/include/llvm/ADT/GraphTraits.h @@ -18,6 +18,8 @@ #ifndef SUPPORT_GRAPHTRAITS_H #define SUPPORT_GRAPHTRAITS_H +namespace llvm { + // GraphTraits - This class should be specialized by different graph types... // which is why the default version is empty. // @@ -76,4 +78,6 @@ struct Inverse { inline Inverse(GraphType &G) : Graph(G) {} }; +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/PostOrderIterator.h b/include/llvm/ADT/PostOrderIterator.h index 9309554f32..d66c4b84c4 100644 --- a/include/llvm/ADT/PostOrderIterator.h +++ b/include/llvm/ADT/PostOrderIterator.h @@ -21,6 +21,8 @@ #include #include +namespace llvm { + template > class po_iterator : public forward_iterator { typedef forward_iterator super; @@ -149,4 +151,6 @@ public: inline rpo_iterator end() { return Blocks.rend(); } }; +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/SCCIterator.h b/include/llvm/ADT/SCCIterator.h index cf137cd473..f21c7d162e 100644 --- a/include/llvm/ADT/SCCIterator.h +++ b/include/llvm/ADT/SCCIterator.h @@ -26,6 +26,8 @@ #include #include +namespace llvm { + //===----------------------------------------------------------------------===// /// /// scc_iterator - Enumerate the SCCs of a directed graph, in @@ -197,4 +199,6 @@ scc_iterator scc_end(T G) { return scc_iterator::end(G); } +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h index 28c46e3d99..06a15734a7 100644 --- a/include/llvm/ADT/STLExtras.h +++ b/include/llvm/ADT/STLExtras.h @@ -21,6 +21,8 @@ #include "Support/iterator" #include "boost/type_traits/transform_traits.hpp" +namespace llvm { + //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===// @@ -278,4 +280,6 @@ inline tier tie(T1& f, T2& s) { return tier(f, s); } +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/SetOperations.h b/include/llvm/ADT/SetOperations.h index dc6e0d6029..bb1e68e6b2 100644 --- a/include/llvm/ADT/SetOperations.h +++ b/include/llvm/ADT/SetOperations.h @@ -15,6 +15,8 @@ #ifndef SUPPORT_SETOPERATIONS_H #define SUPPORT_SETOPERATIONS_H +namespace llvm { + // set_union(A, B) - Compute A := A u B, return whether A changed. // template @@ -64,4 +66,6 @@ void set_subtract(S1Ty &S1, const S2Ty &S2) { S1.erase(*SI); } +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/Statistic.h b/include/llvm/ADT/Statistic.h index d69809ff18..4e592d5832 100644 --- a/include/llvm/ADT/Statistic.h +++ b/include/llvm/ADT/Statistic.h @@ -26,6 +26,8 @@ #include +namespace llvm { + // StatisticBase - Nontemplated base class for Statistic<> class... class StatisticBase { const char *Name; @@ -78,4 +80,6 @@ public: const Statistic &operator-=(const DataType &V) { Value -= V; return *this; } }; +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h index 2c50c1cd5b..2ebac81935 100644 --- a/include/llvm/ADT/StringExtras.h +++ b/include/llvm/ADT/StringExtras.h @@ -18,6 +18,8 @@ #include #include +namespace llvm { + static inline std::string utohexstr(uint64_t X) { char Buffer[40]; char *BufPtr = Buffer+39; @@ -95,4 +97,6 @@ static inline std::string ftostr(double V) { return Buffer; } +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/Tree.h b/include/llvm/ADT/Tree.h index e6454317a8..bc5495f25a 100644 --- a/include/llvm/ADT/Tree.h +++ b/include/llvm/ADT/Tree.h @@ -17,6 +17,8 @@ #include +namespace llvm { + template class Tree { std::vector Children; // This nodes children, if any @@ -55,5 +57,6 @@ public: inline const Payload &getTreeData() const { return Data; } }; +} // End llvm namespace #endif diff --git a/include/llvm/ADT/VectorExtras.h b/include/llvm/ADT/VectorExtras.h index 32778309d4..cf7cf5d2eb 100644 --- a/include/llvm/ADT/VectorExtras.h +++ b/include/llvm/ADT/VectorExtras.h @@ -17,6 +17,8 @@ #include +namespace llvm { + /// make_vector - Helper function which is useful for building temporary vectors /// to pass into type construction of CallInst ctors. This turns a null /// terminated list of pointers (or other value types) into a real live vector. @@ -33,4 +35,6 @@ inline std::vector make_vector(T A, ...) { return Result; } +} // End llvm namespace + #endif diff --git a/include/llvm/ADT/ilist b/include/llvm/ADT/ilist index 488a90ffde..7f4d2659d5 100644 --- a/include/llvm/ADT/ilist +++ b/include/llvm/ADT/ilist @@ -41,6 +41,8 @@ #include #include +namespace llvm { + template class iplist; template class ilist_iterator; @@ -522,10 +524,12 @@ struct ilist : public iplist { void resize(size_type newsize) { resize(newsize, NodeTy()); } }; +} // End llvm namespace + namespace std { // Ensure that swap uses the fast list swap... template - void swap(iplist &Left, iplist &Right) { + void swap(llvm::iplist &Left, llvm::iplist &Right) { Left.swap(Right); } } // End 'std' extensions... diff --git a/include/llvm/AbstractTypeUser.h b/include/llvm/AbstractTypeUser.h index 9e3edddbc2..8a18f5896c 100644 --- a/include/llvm/AbstractTypeUser.h +++ b/include/llvm/AbstractTypeUser.h @@ -37,6 +37,8 @@ // #include +namespace llvm { + class Type; class DerivedType; @@ -165,4 +167,6 @@ private: void dropRef(); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index 4ce3f4baf1..dc484f5df5 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -31,6 +31,9 @@ #define LLVM_ANALYSIS_ALIAS_ANALYSIS_H #include "llvm/Support/CallSite.h" + +namespace llvm { + class LoadInst; class StoreInst; class TargetData; @@ -156,4 +159,6 @@ public: const Value *Ptr, unsigned Size); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h index 72168b4756..fe57c28679 100644 --- a/include/llvm/Analysis/AliasSetTracker.h +++ b/include/llvm/Analysis/AliasSetTracker.h @@ -21,6 +21,9 @@ #include "Support/iterator" #include "Support/hash_map" #include "Support/ilist" + +namespace llvm { + class AliasAnalysis; class LoadInst; class StoreInst; @@ -283,4 +286,6 @@ inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) { return OS; } +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 3a51b05655..60649f9ed9 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -51,6 +51,9 @@ #include "Support/GraphTraits.h" #include "Support/STLExtras.h" #include "llvm/Pass.h" + +namespace llvm { + class Function; class Module; class CallGraphNode; @@ -288,4 +291,6 @@ template<> struct GraphTraits : static IncludeFile CALLGRAPH_INCLUDE_FILE((void*)&CallGraph::stub); +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/ConstantsScanner.h b/include/llvm/Analysis/ConstantsScanner.h index c7efd76cef..e1533c35bb 100644 --- a/include/llvm/Analysis/ConstantsScanner.h +++ b/include/llvm/Analysis/ConstantsScanner.h @@ -19,6 +19,9 @@ #include "llvm/Support/InstIterator.h" #include "llvm/Instruction.h" #include "Support/iterator" + +namespace llvm { + class Constant; class constant_iterator : public forward_iterator { @@ -86,4 +89,6 @@ inline constant_iterator constant_end(const Function *F) { return constant_iterator(F, true); } +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DSGraph.h b/include/llvm/Analysis/DSGraph.h index 399da007e2..b7fdb10af5 100644 --- a/include/llvm/Analysis/DSGraph.h +++ b/include/llvm/Analysis/DSGraph.h @@ -15,6 +15,9 @@ #define LLVM_ANALYSIS_DSGRAPH_H #include "llvm/Analysis/DSNode.h" + +namespace llvm { + class GlobalValue; //===----------------------------------------------------------------------===// @@ -332,4 +335,6 @@ public: void removeTriviallyDeadNodes(); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DSGraphTraits.h b/include/llvm/Analysis/DSGraphTraits.h index 086835cb92..ad2cc6fa8f 100644 --- a/include/llvm/Analysis/DSGraphTraits.h +++ b/include/llvm/Analysis/DSGraphTraits.h @@ -21,6 +21,8 @@ #include "Support/iterator" #include "Support/STLExtras.h" +namespace llvm { + template class DSNodeIterator : public forward_iterator { friend class DSNode; @@ -146,4 +148,6 @@ template <> struct GraphTraits { static ChildIteratorType child_end(const NodeType *N) { return N->end(); } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DSNode.h b/include/llvm/Analysis/DSNode.h index ba5328b2b8..f206c3e5ad 100644 --- a/include/llvm/Analysis/DSNode.h +++ b/include/llvm/Analysis/DSNode.h @@ -16,6 +16,8 @@ #include "llvm/Analysis/DSSupport.h" +namespace llvm { + template class DSNodeIterator; // Data structure graph traversal iterator class TargetData; @@ -382,4 +384,6 @@ inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) { *this = Node; } +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DSSupport.h b/include/llvm/Analysis/DSSupport.h index e5662ff0a4..4b571917ff 100644 --- a/include/llvm/Analysis/DSSupport.h +++ b/include/llvm/Analysis/DSSupport.h @@ -18,6 +18,8 @@ #include "Support/hash_set" #include "llvm/Support/CallSite.h" +namespace llvm { + class Function; class CallInst; class Value; @@ -122,10 +124,14 @@ private: DSNode *HandleForwarding() const; }; +} // End llvm namespace + namespace std { - inline void swap(DSNodeHandle &NH1, DSNodeHandle &NH2) { NH1.swap(NH2); } + inline void swap(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); } } +namespace llvm { + //===----------------------------------------------------------------------===// /// DSCallSite - Representation of a call site via its call instruction, /// the DSNode handle for the callee function (or function pointer), and @@ -287,7 +293,9 @@ public: } }; +} // End llvm namespace + namespace std { - inline void swap(DSCallSite &CS1, DSCallSite &CS2) { CS1.swap(CS2); } + inline void swap(llvm::DSCallSite &CS1, llvm::DSCallSite &CS2) { CS1.swap(CS2); } } #endif diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h index afea126c07..4d6e3a0476 100644 --- a/include/llvm/Analysis/DataStructure.h +++ b/include/llvm/Analysis/DataStructure.h @@ -18,6 +18,8 @@ #include "llvm/Target/TargetData.h" #include "Support/hash_set" +namespace llvm { + class Type; class Instruction; class DSGraph; @@ -184,4 +186,6 @@ private: const BUDataStructures::ActualCalleesTy &ActualCallees); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index 399da007e2..b7fdb10af5 100644 --- a/include/llvm/Analysis/DataStructure/DSGraph.h +++ b/include/llvm/Analysis/DataStructure/DSGraph.h @@ -15,6 +15,9 @@ #define LLVM_ANALYSIS_DSGRAPH_H #include "llvm/Analysis/DSNode.h" + +namespace llvm { + class GlobalValue; //===----------------------------------------------------------------------===// @@ -332,4 +335,6 @@ public: void removeTriviallyDeadNodes(); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DataStructure/DSGraphTraits.h b/include/llvm/Analysis/DataStructure/DSGraphTraits.h index 086835cb92..ad2cc6fa8f 100644 --- a/include/llvm/Analysis/DataStructure/DSGraphTraits.h +++ b/include/llvm/Analysis/DataStructure/DSGraphTraits.h @@ -21,6 +21,8 @@ #include "Support/iterator" #include "Support/STLExtras.h" +namespace llvm { + template class DSNodeIterator : public forward_iterator { friend class DSNode; @@ -146,4 +148,6 @@ template <> struct GraphTraits { static ChildIteratorType child_end(const NodeType *N) { return N->end(); } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h index ba5328b2b8..f206c3e5ad 100644 --- a/include/llvm/Analysis/DataStructure/DSNode.h +++ b/include/llvm/Analysis/DataStructure/DSNode.h @@ -16,6 +16,8 @@ #include "llvm/Analysis/DSSupport.h" +namespace llvm { + template class DSNodeIterator; // Data structure graph traversal iterator class TargetData; @@ -382,4 +384,6 @@ inline void DSNodeHandle::mergeWith(const DSNodeHandle &Node) { *this = Node; } +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h index e5662ff0a4..4b571917ff 100644 --- a/include/llvm/Analysis/DataStructure/DSSupport.h +++ b/include/llvm/Analysis/DataStructure/DSSupport.h @@ -18,6 +18,8 @@ #include "Support/hash_set" #include "llvm/Support/CallSite.h" +namespace llvm { + class Function; class CallInst; class Value; @@ -122,10 +124,14 @@ private: DSNode *HandleForwarding() const; }; +} // End llvm namespace + namespace std { - inline void swap(DSNodeHandle &NH1, DSNodeHandle &NH2) { NH1.swap(NH2); } + inline void swap(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); } } +namespace llvm { + //===----------------------------------------------------------------------===// /// DSCallSite - Representation of a call site via its call instruction, /// the DSNode handle for the callee function (or function pointer), and @@ -287,7 +293,9 @@ public: } }; +} // End llvm namespace + namespace std { - inline void swap(DSCallSite &CS1, DSCallSite &CS2) { CS1.swap(CS2); } + inline void swap(llvm::DSCallSite &CS1, llvm::DSCallSite &CS2) { CS1.swap(CS2); } } #endif diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index afea126c07..4d6e3a0476 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -18,6 +18,8 @@ #include "llvm/Target/TargetData.h" #include "Support/hash_set" +namespace llvm { + class Type; class Instruction; class DSGraph; @@ -184,4 +186,6 @@ private: const BUDataStructures::ActualCalleesTy &ActualCallees); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/DependenceGraph.h b/include/llvm/Analysis/DependenceGraph.h index b5af0b9e25..b4c7aa1fcc 100644 --- a/include/llvm/Analysis/DependenceGraph.h +++ b/include/llvm/Analysis/DependenceGraph.h @@ -30,6 +30,8 @@ #include #include +namespace llvm { + class Instruction; class Function; class Dependence; @@ -264,4 +266,6 @@ public: //===----------------------------------------------------------------------===// +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index b8ac9c3e11..5688d6e811 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -28,6 +28,8 @@ #include "llvm/Pass.h" #include +namespace llvm { + class Instruction; template struct GraphTraits; @@ -487,4 +489,6 @@ private: const DominatorTree::Node *Node); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/Expressions.h b/include/llvm/Analysis/Expressions.h index 29207618d1..77475ffa6c 100644 --- a/include/llvm/Analysis/Expressions.h +++ b/include/llvm/Analysis/Expressions.h @@ -17,6 +17,8 @@ #ifndef LLVM_ANALYSIS_EXPRESSIONS_H #define LLVM_ANALYSIS_EXPRESSIONS_H +namespace llvm { + class Type; class Value; class ConstantInt; @@ -56,4 +58,6 @@ struct ExprType { const Type *getExprType(const Type *Default) const; }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h index 8f1cdcf094..62077f37d5 100644 --- a/include/llvm/Analysis/FindUnsafePointerTypes.h +++ b/include/llvm/Analysis/FindUnsafePointerTypes.h @@ -27,6 +27,8 @@ #include "llvm/Pass.h" #include +namespace llvm { + class PointerType; struct FindUnsafePointerTypes : public Pass { @@ -55,4 +57,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index a246084dbb..69471791ab 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -16,6 +16,9 @@ #include "llvm/Pass.h" #include + +namespace llvm { + class Type; class FindUsedTypes : public Pass { @@ -59,4 +62,6 @@ public: static IncludeFile FIND_USED_TYPES_INCLUDE_FILE((void*)&FindUsedTypes::stub); +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/IPModRef.h b/include/llvm/Analysis/IPModRef.h index 84e55195e5..cf70d5835e 100644 --- a/include/llvm/Analysis/IPModRef.h +++ b/include/llvm/Analysis/IPModRef.h @@ -50,6 +50,8 @@ #include "Support/BitSetVector.h" #include "Support/hash_map" +namespace llvm { + class Module; class Function; class CallSite; @@ -239,4 +241,6 @@ public: //===----------------------------------------------------------------------===// +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/InductionVariable.h b/include/llvm/Analysis/InductionVariable.h index 26deb832f8..6c06a6c065 100644 --- a/include/llvm/Analysis/InductionVariable.h +++ b/include/llvm/Analysis/InductionVariable.h @@ -27,6 +27,9 @@ #define LLVM_ANALYSIS_INDUCTIONVARIABLE_H #include + +namespace llvm { + class Value; class PHINode; class Instruction; @@ -60,4 +63,6 @@ public: void print(std::ostream &OS) const; }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/InstForest.h b/include/llvm/Analysis/InstForest.h index a034c92d51..82fc46e1d1 100644 --- a/include/llvm/Analysis/InstForest.h +++ b/include/llvm/Analysis/InstForest.h @@ -25,6 +25,8 @@ #include "Support/Tree.h" #include +namespace llvm { + template class InstTreeNode; template class InstForest; @@ -288,5 +290,7 @@ InstTreeNode::InstTreeNode(InstForest &IF, Value *V, getTreeData().first.second = InstructionNode; } +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/Interval.h b/include/llvm/Analysis/Interval.h index 9839cf5dc0..0d5912305b 100644 --- a/include/llvm/Analysis/Interval.h +++ b/include/llvm/Analysis/Interval.h @@ -24,6 +24,8 @@ #include #include +namespace llvm { + class BasicBlock; //===----------------------------------------------------------------------===// @@ -146,4 +148,6 @@ template <> struct GraphTraits > { } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/IntervalIterator.h b/include/llvm/Analysis/IntervalIterator.h index 2d67ded196..091959f25f 100644 --- a/include/llvm/Analysis/IntervalIterator.h +++ b/include/llvm/Analysis/IntervalIterator.h @@ -40,6 +40,8 @@ #include #include +namespace llvm { + // getNodeHeader - Given a source graph node and the source graph, return the // BasicBlock that is the header node. This is the opposite of // getSourceGraphNode. @@ -253,4 +255,6 @@ inline interval_part_interval_iterator intervals_end(IntervalPartition &IP) { return interval_part_interval_iterator(); } +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index 45e282acdf..408ace2e7e 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -26,6 +26,8 @@ #include "llvm/Analysis/Interval.h" #include "llvm/Pass.h" +namespace llvm { + //===----------------------------------------------------------------------===// // // IntervalPartition - This class builds and holds an "interval partition" for @@ -102,4 +104,6 @@ private: void updatePredecessors(Interval *Int); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/LoadValueNumbering.h b/include/llvm/Analysis/LoadValueNumbering.h index 83aa5e99a6..6218133a51 100644 --- a/include/llvm/Analysis/LoadValueNumbering.h +++ b/include/llvm/Analysis/LoadValueNumbering.h @@ -21,6 +21,8 @@ #ifndef LLVM_ANALYSIS_LOAD_VALUE_NUMBERING_H #define LLVM_ANALYSIS_LOAD_VALUE_NUMBERING_H +namespace llvm { + class Pass; /// createLoadValueNumberingPass - Create and return a new pass that implements @@ -28,4 +30,6 @@ class Pass; /// Pass *createLoadValueNumberingPass(); +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 6a96834a15..1458b3bd5f 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -29,6 +29,8 @@ #include "Support/GraphTraits.h" #include +namespace llvm { + class DominatorSet; class LoopInfo; @@ -224,4 +226,6 @@ template <> struct GraphTraits { } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/MemoryDepAnalysis.h b/include/llvm/Analysis/MemoryDepAnalysis.h index 6ecc3c8250..10eb6566b6 100644 --- a/include/llvm/Analysis/MemoryDepAnalysis.h +++ b/include/llvm/Analysis/MemoryDepAnalysis.h @@ -24,6 +24,8 @@ #include "llvm/Pass.h" #include "Support/hash_map" +namespace llvm { + class ModRefTable; class DSGraph; class FunctionModRefInfo; @@ -96,4 +98,6 @@ public: void dump() const; }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/PgmDependenceGraph.h b/include/llvm/Analysis/PgmDependenceGraph.h index edb5119f00..70128740a8 100644 --- a/include/llvm/Analysis/PgmDependenceGraph.h +++ b/include/llvm/Analysis/PgmDependenceGraph.h @@ -46,6 +46,8 @@ #include "llvm/Pass.h" #include "Support/iterator" +namespace llvm { + class DSGraph; class DependenceGraph; class PgmDependenceGraph; @@ -304,7 +306,8 @@ public: void dump() const; }; - //===----------------------------------------------------------------------===// +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index b1a9b8ed16..c8eb439b41 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -16,6 +16,8 @@ #include "llvm/Analysis/Dominators.h" +namespace llvm { + /// PostDominatorSet Class - Concrete subclass of DominatorSetBase that is used /// to compute the post-dominator set. Because there can be multiple exit nodes @@ -117,4 +119,6 @@ private: static IncludeFile POST_DOMINATOR_INCLUDE_FILE((void*)&PostDominanceFrontier::stub); +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/SlotCalculator.h b/include/llvm/Analysis/SlotCalculator.h index 7e56de99dc..596f9324ed 100644 --- a/include/llvm/Analysis/SlotCalculator.h +++ b/include/llvm/Analysis/SlotCalculator.h @@ -22,6 +22,9 @@ #include #include + +namespace llvm { + class Value; class Module; class Function; @@ -92,4 +95,6 @@ protected: void processSymbolTableConstants(const SymbolTable *ST); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/ValueNumbering.h b/include/llvm/Analysis/ValueNumbering.h index ff4680d663..74b5c97ff2 100644 --- a/include/llvm/Analysis/ValueNumbering.h +++ b/include/llvm/Analysis/ValueNumbering.h @@ -21,6 +21,9 @@ #define LLVM_ANALYSIS_VALUE_NUMBERING_H #include + +namespace llvm { + class Value; struct ValueNumbering { @@ -34,4 +37,6 @@ struct ValueNumbering { virtual ~ValueNumbering(); // We want to be subclassed }; +} // End llvm namespace + #endif diff --git a/include/llvm/Analysis/Verifier.h b/include/llvm/Analysis/Verifier.h index 427015c6c6..51da3a5eae 100644 --- a/include/llvm/Analysis/Verifier.h +++ b/include/llvm/Analysis/Verifier.h @@ -21,6 +21,8 @@ #ifndef LLVM_ANALYSIS_VERIFIER_H #define LLVM_ANALYSIS_VERIFIER_H +namespace llvm { + class FunctionPass; class Module; class Function; @@ -40,4 +42,6 @@ bool verifyModule(const Module &M); // pass. bool verifyFunction(const Function &F); +} // End llvm namespace + #endif diff --git a/include/llvm/Argument.h b/include/llvm/Argument.h index 2d70f5314b..ab4ee1bf0e 100644 --- a/include/llvm/Argument.h +++ b/include/llvm/Argument.h @@ -17,6 +17,8 @@ #include "llvm/Value.h" +namespace llvm { + class Argument : public Value { // Defined in the Function.cpp file Function *Parent; @@ -56,4 +58,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Assembly/AsmAnnotationWriter.h b/include/llvm/Assembly/AsmAnnotationWriter.h index 192cb3de0b..3beda6df03 100644 --- a/include/llvm/Assembly/AsmAnnotationWriter.h +++ b/include/llvm/Assembly/AsmAnnotationWriter.h @@ -18,6 +18,9 @@ #define LLVM_ASSEMBLY_ASMANNOTATIONWRITER_H #include + +namespace llvm { + class Function; class BasicBlock; class Instruction; @@ -37,4 +40,6 @@ struct AssemblyAnnotationWriter { virtual void emitInstructionAnnot(const Instruction *I, std::ostream &OS) {} }; +} // End llvm namespace + #endif diff --git a/include/llvm/Assembly/CWriter.h b/include/llvm/Assembly/CWriter.h index cc7a358a9b..3029787ca4 100644 --- a/include/llvm/Assembly/CWriter.h +++ b/include/llvm/Assembly/CWriter.h @@ -16,7 +16,12 @@ #define LLVM_ASSEMBLY_CWRITER_H #include + +namespace llvm { + class Pass; Pass *createWriteToCPass(std::ostream &o); +} // End llvm namespace + #endif diff --git a/include/llvm/Assembly/CachedWriter.h b/include/llvm/Assembly/CachedWriter.h index dbddacde93..4acd3de4da 100644 --- a/include/llvm/Assembly/CachedWriter.h +++ b/include/llvm/Assembly/CachedWriter.h @@ -20,6 +20,8 @@ #include "llvm/Value.h" #include +namespace llvm { + class Module; class PointerType; class SlotCalculator; @@ -82,4 +84,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Assembly/Parser.h b/include/llvm/Assembly/Parser.h index 4f1863f071..dc1b17eb50 100644 --- a/include/llvm/Assembly/Parser.h +++ b/include/llvm/Assembly/Parser.h @@ -16,6 +16,8 @@ #include +namespace llvm { + class Module; class ParseException; @@ -70,4 +72,6 @@ private : ParseException &operator=(const ParseException &E); // objects by reference }; +} // End llvm namespace + #endif diff --git a/include/llvm/Assembly/PrintModulePass.h b/include/llvm/Assembly/PrintModulePass.h index e211e8bdae..28100805a7 100644 --- a/include/llvm/Assembly/PrintModulePass.h +++ b/include/llvm/Assembly/PrintModulePass.h @@ -21,6 +21,8 @@ #include "llvm/Pass.h" #include "llvm/Module.h" +namespace llvm { + class PrintModulePass : public Pass { std::ostream *Out; // ostream to print on bool DeleteStream; // Delete the ostream in our dtor? @@ -72,4 +74,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Assembly/Writer.h b/include/llvm/Assembly/Writer.h index 5798ae8ac7..9f89b3192f 100644 --- a/include/llvm/Assembly/Writer.h +++ b/include/llvm/Assembly/Writer.h @@ -24,6 +24,9 @@ #define LLVM_ASSEMBLY_WRITER_H #include + +namespace llvm { + class Type; class Module; class Value; @@ -43,4 +46,6 @@ std::ostream &WriteTypeSymbolic(std::ostream &, const Type *, const Module *M); std::ostream &WriteAsOperand(std::ostream &, const Value *, bool PrintTy = true, bool PrintName = true, const Module *Context = 0); +} // End llvm namespace + #endif diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h index 1a996bcf26..9f78bc7467 100644 --- a/include/llvm/BasicBlock.h +++ b/include/llvm/BasicBlock.h @@ -33,6 +33,8 @@ #include "llvm/SymbolTableListTraits.h" #include "Support/ilist" +namespace llvm { + class TerminatorInst; template class SuccIterator; // Successor Iterator template class PredIterator; @@ -171,4 +173,6 @@ public: BasicBlock *splitBasicBlock(iterator I, const std::string &BBName = ""); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Bytecode/Format.h b/include/llvm/Bytecode/Format.h index 79cf9f0527..380f4df0ab 100644 --- a/include/llvm/Bytecode/Format.h +++ b/include/llvm/Bytecode/Format.h @@ -15,6 +15,8 @@ #ifndef LLVM_BYTECODE_FORMAT_H #define LLVM_BYTECODE_FORMAT_H +namespace llvm { + class BytecodeFormat { // Throw the constants into a poorman's namespace... BytecodeFormat(); // do not implement public: @@ -38,4 +40,7 @@ public: BasicBlock = 0x31, // May contain many basic blocks }; }; + +} // End llvm namespace + #endif diff --git a/include/llvm/Bytecode/Primitives.h b/include/llvm/Bytecode/Primitives.h index d9b29c00e7..3973eceadb 100644 --- a/include/llvm/Bytecode/Primitives.h +++ b/include/llvm/Bytecode/Primitives.h @@ -23,6 +23,8 @@ #include #include +namespace llvm { + //===----------------------------------------------------------------------===// // Reading Primitives //===----------------------------------------------------------------------===// @@ -275,4 +277,6 @@ static inline void output_data(void *Ptr, void *End, if (Align) align32(Out); } +} // End llvm namespace + #endif diff --git a/include/llvm/Bytecode/Reader.h b/include/llvm/Bytecode/Reader.h index 0de71002a7..1e9fa32bd1 100644 --- a/include/llvm/Bytecode/Reader.h +++ b/include/llvm/Bytecode/Reader.h @@ -23,6 +23,8 @@ #include #include +namespace llvm { + /// getBytecodeModuleProvider - lazy function-at-a-time loading from a file /// ModuleProvider *getBytecodeModuleProvider(const std::string &Filename); @@ -53,4 +55,6 @@ bool ReadArchiveFile(const std::string &Filename, std::vector &Objects, std::string *ErrorStr = 0); +} // End llvm namespace + #endif diff --git a/include/llvm/Bytecode/WriteBytecodePass.h b/include/llvm/Bytecode/WriteBytecodePass.h index ba8bc71c4c..b8863e6b47 100644 --- a/include/llvm/Bytecode/WriteBytecodePass.h +++ b/include/llvm/Bytecode/WriteBytecodePass.h @@ -19,6 +19,8 @@ #include "llvm/Bytecode/Writer.h" #include +namespace llvm { + class WriteBytecodePass : public Pass { std::ostream *Out; // ostream to print on bool DeleteStream; @@ -38,4 +40,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Bytecode/Writer.h b/include/llvm/Bytecode/Writer.h index ba82f6ad19..9fadddb66b 100644 --- a/include/llvm/Bytecode/Writer.h +++ b/include/llvm/Bytecode/Writer.h @@ -26,7 +26,11 @@ #include +namespace llvm { + class Module; void WriteBytecodeToFile(const Module *C, std::ostream &Out); +} // End llvm namespace + #endif diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index bb97a277cc..86cdc29f57 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -23,6 +23,8 @@ #include "llvm/Pass.h" +namespace llvm { + class CallGraphNode; struct CallGraphSCCPass : public Pass { @@ -46,4 +48,6 @@ struct CallGraphSCCPass : public Pass { virtual void getAnalysisUsage(AnalysisUsage &Info) const; }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/FunctionLiveVarInfo.h b/include/llvm/CodeGen/FunctionLiveVarInfo.h index e79d58f7e4..23a9d93a6e 100644 --- a/include/llvm/CodeGen/FunctionLiveVarInfo.h +++ b/include/llvm/CodeGen/FunctionLiveVarInfo.h @@ -39,6 +39,8 @@ #include "llvm/Pass.h" #include "llvm/CodeGen/ValueSet.h" +namespace llvm { + class BBLiveVar; class MachineInstr; @@ -104,4 +106,6 @@ public: const BasicBlock *BB = 0); }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/InstrForest.h b/include/llvm/CodeGen/InstrForest.h index fc82d7c165..48266715bd 100644 --- a/include/llvm/CodeGen/InstrForest.h +++ b/include/llvm/CodeGen/InstrForest.h @@ -29,16 +29,24 @@ #include "llvm/Instruction.h" #include "Support/hash_map" +namespace llvm { + class Constant; class Function; class InstrTreeNode; class InstrForest; +} // End llvm namespace + +using namespace llvm; + //-------------------------------------------------------------------------- // OpLabel values for special-case nodes created for instruction selection. // All op-labels not defined here are identical to the instruction // opcode returned by Instruction::getOpcode() //-------------------------------------------------------------------------- +// + const int InvalidOp = -1; const int VRegListOp = 97; @@ -103,6 +111,7 @@ extern void printtree (InstrTreeNode*); extern int treecost (InstrTreeNode*, int, int); extern void printMatches (InstrTreeNode*); +namespace llvm { //------------------------------------------------------------------------ // class InstrTreeNode @@ -325,4 +334,6 @@ private: InstructionNode* buildTreeForInstruction(Instruction* instr); }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/InstrScheduling.h b/include/llvm/CodeGen/InstrScheduling.h index 40ce442f55..816aa7e806 100644 --- a/include/llvm/CodeGen/InstrScheduling.h +++ b/include/llvm/CodeGen/InstrScheduling.h @@ -15,6 +15,8 @@ #ifndef LLVM_CODEGEN_INSTR_SCHEDULING_H #define LLVM_CODEGEN_INSTR_SCHEDULING_H +namespace llvm { + class FunctionPass; class TargetMachine; @@ -30,4 +32,6 @@ class TargetMachine; FunctionPass *createInstructionSchedulingWithSSAPass(const TargetMachine &TM); +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/InstrSelection.h b/include/llvm/CodeGen/InstrSelection.h index 89e827d106..2f269ea2d5 100644 --- a/include/llvm/CodeGen/InstrSelection.h +++ b/include/llvm/CodeGen/InstrSelection.h @@ -16,6 +16,8 @@ #include "llvm/Instruction.h" +namespace llvm { + class Function; class InstrForest; class MachineInstr; @@ -102,4 +104,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/InstrSelectionSupport.h b/include/llvm/CodeGen/InstrSelectionSupport.h index 2ab23c756c..c1fba48615 100644 --- a/include/llvm/CodeGen/InstrSelectionSupport.h +++ b/include/llvm/CodeGen/InstrSelectionSupport.h @@ -17,6 +17,9 @@ #include "llvm/CodeGen/MachineInstr.h" #include "Support/DataTypes.h" + +namespace llvm { + class InstructionNode; class TargetMachine; class Instruction; @@ -44,4 +47,6 @@ MachineOperand::MachineOperandType ChooseRegOrImmed(int64_t intValue, unsigned& getMachineRegNum, int64_t& getImmedValue); +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index 8d1306e061..3a0d044c59 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -32,6 +32,8 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include +namespace llvm { + class MRegisterInfo; class LiveVariables : public MachineFunctionPass { @@ -207,4 +209,6 @@ public: void HandlePhysRegDef(unsigned Reg, MachineInstr *MI); }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index b3959e81a7..b8a0361f7f 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -15,6 +15,9 @@ #define LLVM_CODEGEN_MACHINEBASICBLOCK_H #include + +namespace llvm { + class BasicBlock; class MachineInstr; template struct ilist_traits; @@ -81,5 +84,6 @@ private: // Methods used to maintain doubly linked list of blocks... void setNext(MachineBasicBlock *N) { Next = N; } }; +} // End llvm namespace #endif diff --git a/include/llvm/CodeGen/MachineCodeEmitter.h b/include/llvm/CodeGen/MachineCodeEmitter.h index 4145851006..2d01f45d70 100644 --- a/include/llvm/CodeGen/MachineCodeEmitter.h +++ b/include/llvm/CodeGen/MachineCodeEmitter.h @@ -19,6 +19,9 @@ #include #include "Support/DataTypes.h" + +namespace llvm { + class MachineFunction; class MachineBasicBlock; class MachineConstantPool; @@ -105,4 +108,6 @@ struct MachineCodeEmitter { static MachineCodeEmitter *createFilePrinterEmitter(MachineCodeEmitter&); }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineCodeForInstruction.h b/include/llvm/CodeGen/MachineCodeForInstruction.h index d421f3e971..9a08de79af 100644 --- a/include/llvm/CodeGen/MachineCodeForInstruction.h +++ b/include/llvm/CodeGen/MachineCodeForInstruction.h @@ -28,6 +28,8 @@ #include "Support/Annotation.h" #include +namespace llvm { + class MachineInstr; class Instruction; class Value; @@ -96,4 +98,6 @@ public: CallArgsDescriptor* getCallArgsDescriptor() const { return callArgsDesc; } }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h index 441a43a9b9..edfd601faa 100644 --- a/include/llvm/CodeGen/MachineConstantPool.h +++ b/include/llvm/CodeGen/MachineConstantPool.h @@ -23,6 +23,9 @@ #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H #include + +namespace llvm { + class Constant; class MachineConstantPool { @@ -54,4 +57,6 @@ public: void dump() const; }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 48b91012e0..e48158e1b5 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -38,12 +38,19 @@ #ifndef LLVM_CODEGEN_MACHINEFRAMEINFO_H #define LLVM_CODEGEN_MACHINEFRAMEINFO_H +namespace llvm { + class TargetData; class TargetRegisterClass; class Type; class MachineFunction; + +} + #include +namespace llvm { + class MachineFrameInfo { // StackObject - Represent a single object allocated on the stack. @@ -220,4 +227,6 @@ public: void dump(const MachineFunction &MF) const; }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 7474a6e29a..60478cfe5a 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -22,6 +22,8 @@ #include "Support/Annotation.h" #include "Support/ilist" +namespace llvm { + class Function; class TargetMachine; class FunctionPass; @@ -141,4 +143,6 @@ public: MachineBasicBlock & back() { return BasicBlocks.back(); } }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineFunctionInfo.h b/include/llvm/CodeGen/MachineFunctionInfo.h index db73322278..fdf135b16b 100644 --- a/include/llvm/CodeGen/MachineFunctionInfo.h +++ b/include/llvm/CodeGen/MachineFunctionInfo.h @@ -17,6 +17,9 @@ #include "Support/HashExtras.h" #include "Support/hash_set" + +namespace llvm { + class MachineFunction; class Value; class Constant; @@ -112,4 +115,6 @@ private: int allocateOptionalArg(const Type* type); }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h index 6975b5e785..390dcb8562 100644 --- a/include/llvm/CodeGen/MachineFunctionPass.h +++ b/include/llvm/CodeGen/MachineFunctionPass.h @@ -22,6 +22,8 @@ #include "llvm/Pass.h" #include "llvm/CodeGen/MachineFunction.h" +namespace llvm { + struct MachineFunctionPass : public FunctionPass { /// runOnMachineFunction - This method must be overloaded to perform the @@ -37,4 +39,6 @@ struct MachineFunctionPass : public FunctionPass { } }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index fc886d97f5..2eb373f462 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -20,6 +20,8 @@ #include "Support/Annotation.h" #include "Support/iterator" +namespace llvm { + class Value; class Function; class MachineBasicBlock; @@ -715,4 +717,6 @@ std::ostream& operator<<(std::ostream &OS, const MachineInstr &MI); std::ostream& operator<<(std::ostream &OS, const MachineOperand &MO); void PrintMachineInstructions(const Function *F); +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/MachineInstrAnnot.h b/include/llvm/CodeGen/MachineInstrAnnot.h index 98dde590b8..19d93ab56a 100644 --- a/include/llvm/CodeGen/MachineInstrAnnot.h +++ b/include/llvm/CodeGen/MachineInstrAnnot.h @@ -17,6 +17,8 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetRegInfo.h" +namespace llvm { + class Value; class TmpInstruction; class CallInst; @@ -88,5 +90,6 @@ public: static CallArgsDescriptor *get(const MachineInstr* MI); }; +} // End llvm namespace #endif diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h index 14c7fe041f..67255214a2 100644 --- a/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/include/llvm/CodeGen/MachineInstrBuilder.h @@ -25,6 +25,8 @@ #include "llvm/CodeGen/MachineInstr.h" +namespace llvm { + class MachineInstrBuilder { MachineInstr *MI; public: @@ -162,4 +164,6 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock *BB, int Opcode, MOTy::Def); } +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h index 807257e2c5..11fcf29013 100644 --- a/include/llvm/CodeGen/Passes.h +++ b/include/llvm/CodeGen/Passes.h @@ -15,6 +15,8 @@ #ifndef LLVM_CODEGEN_PASSES_H #define LLVM_CODEGEN_PASSES_H +namespace llvm { + class FunctionPass; class PassInfo; class TargetMachine; @@ -52,4 +54,6 @@ FunctionPass *createPrologEpilogCodeInserter(); /// for the Sparc. FunctionPass *getRegisterAllocator(TargetMachine &T); +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/SSARegMap.h b/include/llvm/CodeGen/SSARegMap.h index 7f5d5f97e5..c31911c91b 100644 --- a/include/llvm/CodeGen/SSARegMap.h +++ b/include/llvm/CodeGen/SSARegMap.h @@ -19,6 +19,8 @@ #include "llvm/Target/MRegisterInfo.h" +namespace llvm { + class TargetRegisterClass; class SSARegMap { @@ -44,4 +46,6 @@ class SSARegMap { } }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/SchedGraphCommon.h b/include/llvm/CodeGen/SchedGraphCommon.h index 874e53d994..a422d9ae0d 100644 --- a/include/llvm/CodeGen/SchedGraphCommon.h +++ b/include/llvm/CodeGen/SchedGraphCommon.h @@ -18,6 +18,8 @@ #include "llvm/Value.h" #include +namespace llvm { + class SchedGraphEdge; class SchedGraphNode; @@ -217,4 +219,6 @@ public: ~SchedGraphCommon(); }; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index f132f7b0a2..4719bf9d21 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -27,6 +27,9 @@ #include #include #include + +namespace llvm { + class Value; class Type; class Instruction; @@ -362,4 +365,6 @@ typedef ReducedValue ReducedValue_Consta typedef ReducedValue ReducedValue_Constant_f32; typedef ReducedValue ReducedValue_Constant_f64; +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/ValueSet.h b/include/llvm/CodeGen/ValueSet.h index 149506550d..f4bc6e80d4 100644 --- a/include/llvm/CodeGen/ValueSet.h +++ b/include/llvm/CodeGen/ValueSet.h @@ -17,6 +17,9 @@ #define VALUE_SET_H #include + +namespace llvm { + class Value; // RAV - Used to print values in a form used by the register allocator. @@ -31,4 +34,6 @@ std::ostream &operator<<(std::ostream &out, RAV Val); typedef std::set ValueSet; void printSet(const ValueSet &S); +} // End llvm namespace + #endif diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h index dc85ee0d3c..b523b71a14 100644 --- a/include/llvm/CodeGen/ValueTypes.h +++ b/include/llvm/CodeGen/ValueTypes.h @@ -16,6 +16,8 @@ #ifndef LLVM_CODEGEN_VALUETYPES_H #define LLVM_CODEGEN_VALUETYPES_H +namespace llvm { + /// MVT namespace - This namespace defines the ValueType enum, which contains /// the various low-level value types. /// @@ -40,5 +42,6 @@ namespace MVT { // MVT = Machine Value Types }; }; -#endif +} // End llvm namespace +#endif diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h index ac4c82090d..fbed6ee0fb 100644 --- a/include/llvm/Constant.h +++ b/include/llvm/Constant.h @@ -16,6 +16,8 @@ #include "llvm/User.h" +namespace llvm { + class Constant : public User { protected: inline Constant(const Type *Ty) : User(Ty, Value::ConstantVal) {} @@ -91,4 +93,6 @@ public: // END WARNING!! }; +} // End llvm namespace + #endif diff --git a/include/llvm/ConstantHandling.h b/include/llvm/ConstantHandling.h index a27283c440..a0a01e5306 100644 --- a/include/llvm/ConstantHandling.h +++ b/include/llvm/ConstantHandling.h @@ -42,6 +42,9 @@ #include "llvm/Constants.h" #include "llvm/Type.h" + +namespace llvm { + class PointerType; //===----------------------------------------------------------------------===// @@ -244,4 +247,7 @@ Constant *ConstantFoldShiftInstruction(unsigned Opcode, const Constant *V1, const Constant *V2); Constant *ConstantFoldGetElementPtr(const Constant *C, const std::vector &IdxList); + +} // End llvm namespace + #endif diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 077c61c6d5..5d65b2f0c7 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -18,6 +18,8 @@ #include "llvm/Constant.h" #include "Support/DataTypes.h" +namespace llvm { + class ArrayType; class StructType; class PointerType; @@ -575,4 +577,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 8efe2695a1..8d23df10c0 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -21,6 +21,8 @@ #include "llvm/Type.h" #include +namespace llvm { + template class TypeMap; class FunctionValType; class ArrayValType; @@ -490,4 +492,6 @@ inline const Type* PATypeHolder::get() const { return *const_cast(this) = NewTy; } +} // End llvm namespace + #endif diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h index c2a0a3a7d2..5dd74b7cde 100644 --- a/include/llvm/ExecutionEngine/ExecutionEngine.h +++ b/include/llvm/ExecutionEngine/ExecutionEngine.h @@ -19,6 +19,9 @@ #include #include #include + +namespace llvm { + class Constant; class Function; union GenericValue; @@ -92,4 +95,6 @@ protected: GenericValue LoadValueFromMemory(GenericValue *Ptr, const Type *Ty); }; +} // End llvm namespace + #endif diff --git a/include/llvm/ExecutionEngine/GenericValue.h b/include/llvm/ExecutionEngine/GenericValue.h index b64eb79bbd..0446795d31 100644 --- a/include/llvm/ExecutionEngine/GenericValue.h +++ b/include/llvm/ExecutionEngine/GenericValue.h @@ -17,6 +17,8 @@ #include "Support/DataTypes.h" +namespace llvm { + typedef uint64_t PointerTy; union GenericValue { @@ -44,4 +46,6 @@ inline GenericValue PTOGV(void *P) { return GenericValue(P); } inline void* GVTOP(const GenericValue &GV) { return (void*)(intptr_t)GV.PointerVal; } + +} // End llvm namespace #endif diff --git a/include/llvm/Function.h b/include/llvm/Function.h index 3c44b3658f..4dd791ec21 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -22,6 +22,8 @@ #include "llvm/BasicBlock.h" #include "llvm/Argument.h" +namespace llvm { + class FunctionType; // Traits for intrusive list of instructions... @@ -95,7 +97,7 @@ public: virtual bool isExternal() const { return BasicBlocks.empty(); } /// getIntrinsicID - This method returns the ID number of the specified - /// function, or LLVMIntrinsic::not_intrinsic if the function is not an + /// function, or Intrinsic::not_intrinsic if the function is not an /// instrinsic, or if the pointer is null. This value is always defined to be /// zero to allow easy checking for whether a function is intrinsic or not. /// The particular intrinsic functions which correspond to this value are @@ -220,4 +222,6 @@ public: void dropAllReferences(); }; +} // End llvm namespace + #endif diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index f2349bc3cb..47a2189fa4 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -18,6 +18,9 @@ #define LLVM_GLOBALVALUE_H #include "llvm/User.h" + +namespace llvm { + class PointerType; class Module; @@ -71,4 +74,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index d1a9a293c6..03c4f39120 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -22,6 +22,8 @@ #include "llvm/GlobalValue.h" +namespace llvm { + class Module; class Constant; class PointerType; @@ -105,4 +107,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index e3d3d61adb..7938b483c7 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -18,6 +18,8 @@ #include "llvm/Instruction.h" +namespace llvm { + //===----------------------------------------------------------------------===// // TerminatorInst Class //===----------------------------------------------------------------------===// @@ -134,4 +136,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Instruction.def b/include/llvm/Instruction.def index e069e2ca7a..4208642d7f 100644 --- a/include/llvm/Instruction.def +++ b/include/llvm/Instruction.def @@ -15,7 +15,7 @@ // NOTE: NO INCLUDE GUARD DESIRED! -// Provide definitions of macros so that users of this file don't have to define +// Provide definitions of macros so that users of this file do not have to define // everything to use it... // #ifndef FIRST_TERM_INST diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index 264356ca91..cc9a8aec2b 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -17,6 +17,8 @@ #include "llvm/User.h" +namespace llvm { + class AssemblyAnnotationWriter; template struct ilist_traits; @@ -151,4 +153,6 @@ public: }; }; +} // End llvm namespace + #endif diff --git a/include/llvm/Intrinsics.h b/include/llvm/Intrinsics.h index 9d7c7bc994..8ecb6c42ee 100644 --- a/include/llvm/Intrinsics.h +++ b/include/llvm/Intrinsics.h @@ -16,11 +16,13 @@ #ifndef LLVM_INTRINSICS_H #define LLVM_INTRINSICS_H -/// LLVMIntrinsic Namespace - This namespace contains an enum with a value for +namespace llvm { + +/// Intrinsic Namespace - This namespace contains an enum with a value for /// every intrinsic/builtin function known by LLVM. These enum values are /// returned by Function::getIntrinsicID(). /// -namespace LLVMIntrinsic { +namespace Intrinsic { enum ID { not_intrinsic = 0, // Must be zero @@ -125,6 +127,9 @@ namespace LLVMIntrinsic { // second parameter, the possible values for which are // defined in the AlphaSfpToSq enumeration }; -} + +} // End Intrinsic namespace + +} // End llvm namespace #endif diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h index ac399034d4..9f4c8c25f6 100644 --- a/include/llvm/Linker.h +++ b/include/llvm/Linker.h @@ -15,6 +15,9 @@ #define LLVM_TRANSFORMATIONS_UTILS_LINKER_H #include + +namespace llvm { + class Module; // LinkModules - This function links two modules together, with the resulting @@ -24,5 +27,7 @@ class Module; // bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0); +} // End llvm namespace + #endif diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 19626aea03..b38269dde0 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -21,6 +21,9 @@ #include "llvm/Function.h" #include "llvm/GlobalVariable.h" + +namespace llvm { + class GlobalVariable; class GlobalValueRefMap; // Used by ConstantVals.cpp class ConstantPointerRef; @@ -213,4 +216,6 @@ inline std::ostream &operator<<(std::ostream &O, const Module &M) { return O; } +} // End llvm namespace + #endif diff --git a/include/llvm/ModuleProvider.h b/include/llvm/ModuleProvider.h index 8d4b1d23af..de9616fe2e 100644 --- a/include/llvm/ModuleProvider.h +++ b/include/llvm/ModuleProvider.h @@ -18,6 +18,8 @@ #ifndef MODULEPROVIDER_H #define MODULEPROVIDER_H +namespace llvm { + class Function; class Module; @@ -52,4 +54,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 0d0a6e6fbc..8a10ead35e 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -34,6 +34,9 @@ #include #include #include + +namespace llvm { + class Value; class BasicBlock; class Function; @@ -329,6 +332,8 @@ private: virtual void addToPassManager(PassManagerT *PM,AnalysisUsage &AU); }; +} // End llvm namespace + // Include support files that contain important APIs commonly used by Passes, // but that we want to separate out to make it easier to read the header files. // diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h index 61fb29fb81..f62465a8b8 100644 --- a/include/llvm/PassAnalysisSupport.h +++ b/include/llvm/PassAnalysisSupport.h @@ -19,6 +19,8 @@ #ifndef LLVM_PASS_ANALYSIS_SUPPORT_H #define LLVM_PASS_ANALYSIS_SUPPORT_H +namespace llvm { + // No need to include Pass.h, we are being included by it! //===----------------------------------------------------------------------===// @@ -133,4 +135,6 @@ AnalysisType *Pass::getAnalysisToUpdate() const { return dynamic_cast(Resolver->getAnalysisToUpdate(PI)); } +} // End llvm namespace + #endif diff --git a/include/llvm/PassManager.h b/include/llvm/PassManager.h index c47abdaef9..b1d369b925 100644 --- a/include/llvm/PassManager.h +++ b/include/llvm/PassManager.h @@ -17,6 +17,8 @@ #ifndef LLVM_PASSMANAGER_H #define LLVM_PASSMANAGER_H +namespace llvm { + class Pass; class Module; class ModuleProvider; @@ -72,4 +74,6 @@ public: bool run(Function &F); }; +} // End llvm namespace + #endif diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 226ee29357..d985bf121d 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -23,6 +23,8 @@ // No need to include Pass.h, we are being included by it! +namespace llvm { + class TargetMachine; //===--------------------------------------------------------------------------- @@ -395,4 +397,7 @@ struct PassRegistrationListener { struct IncludeFile { IncludeFile(void *); }; + +} // End llvm namespace + #endif diff --git a/include/llvm/SlotCalculator.h b/include/llvm/SlotCalculator.h index 7e56de99dc..596f9324ed 100644 --- a/include/llvm/SlotCalculator.h +++ b/include/llvm/SlotCalculator.h @@ -22,6 +22,9 @@ #include #include + +namespace llvm { + class Value; class Module; class Function; @@ -92,4 +95,6 @@ protected: void processSymbolTableConstants(const SymbolTable *ST); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Support/Annotation.h b/include/llvm/Support/Annotation.h index 075ffc297a..cee7ab7d89 100644 --- a/include/llvm/Support/Annotation.h +++ b/include/llvm/Support/Annotation.h @@ -25,6 +25,8 @@ #include #include +namespace llvm { + class AnnotationID; class Annotation; class Annotable; @@ -217,4 +219,6 @@ inline Annotation *Annotable::getOrCreateAnnotation(AnnotationID ID) const { return A; } +} // End namespace llvm + #endif diff --git a/include/llvm/Support/CFG.h b/include/llvm/Support/CFG.h index 26616dbb7a..bbe1701da1 100644 --- a/include/llvm/Support/CFG.h +++ b/include/llvm/Support/CFG.h @@ -20,6 +20,8 @@ #include "llvm/InstrTypes.h" #include "Support/iterator" +namespace llvm { + //===--------------------------------------------------------------------===// // BasicBlock pred_iterator definition //===--------------------------------------------------------------------===// @@ -264,4 +266,6 @@ template <> struct GraphTraits > : } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index 5e3fd3e662..8f7cf1a786 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -23,6 +23,8 @@ #include "llvm/Instruction.h" +namespace llvm { + class CallInst; class InvokeInst; @@ -100,4 +102,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Support/Casting.h b/include/llvm/Support/Casting.h index 065919c179..4b070c18d8 100644 --- a/include/llvm/Support/Casting.h +++ b/include/llvm/Support/Casting.h @@ -15,6 +15,8 @@ #ifndef SUPPORT_CASTING_H #define SUPPORT_CASTING_H +namespace llvm { + //===----------------------------------------------------------------------===// // isa Support Templates //===----------------------------------------------------------------------===// @@ -293,4 +295,6 @@ void main() { #endif +} // End llvm namespace + #endif diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 01f55a81d4..df40d80070 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -27,6 +27,7 @@ #include #include "boost/type_traits/object_traits.hpp" +namespace llvm { /// cl Namespace - This namespace contains all of the command line option /// processing machinery. It is intentionally a short name to make qualified /// usage concise. @@ -1022,4 +1023,6 @@ struct aliasopt { } // End namespace cl +} // End namespace llvm + #endif diff --git a/include/llvm/Support/ConstantRange.h b/include/llvm/Support/ConstantRange.h index c173549a37..d97b73e824 100644 --- a/include/llvm/Support/ConstantRange.h +++ b/include/llvm/Support/ConstantRange.h @@ -26,6 +26,9 @@ #include "Support/DataTypes.h" #include + +namespace llvm { + class ConstantIntegral; class Type; @@ -124,4 +127,6 @@ inline std::ostream &operator<<(std::ostream &OS, const ConstantRange &CR) { return OS; } +} // End llvm namespace + #endif diff --git a/include/llvm/Support/DOTGraphTraits.h b/include/llvm/Support/DOTGraphTraits.h index 002a78ec4f..63837b7ddf 100644 --- a/include/llvm/Support/DOTGraphTraits.h +++ b/include/llvm/Support/DOTGraphTraits.h @@ -19,6 +19,8 @@ #include +namespace llvm { + /// DefaultDOTGraphTraits - This class provides the default implementations of /// all of the DOTGraphTraits methods. If a specialization does not need to /// override all methods here it should inherit so that it can get the default @@ -96,4 +98,6 @@ struct DefaultDOTGraphTraits { template class DOTGraphTraits : public DefaultDOTGraphTraits {}; +} // End llvm namespace + #endif diff --git a/include/llvm/Support/Debug.h b/include/llvm/Support/Debug.h index 8cba05771f..66a208811a 100644 --- a/include/llvm/Support/Debug.h +++ b/include/llvm/Support/Debug.h @@ -26,6 +26,8 @@ #ifndef SUPPORT_DEBUG_H #define SUPPORT_DEBUG_H +namespace llvm { + // DebugFlag - This boolean is set to true if the '-debug' command line option // is specified. This should probably not be referenced directly, instead, use // the DEBUG macro below. @@ -57,4 +59,6 @@ bool isCurrentDebugType(const char *Type); do { if (DebugFlag && isCurrentDebugType(DEBUG_TYPE)) { X; } } while (0) #endif +} // End llvm namespace + #endif diff --git a/include/llvm/Support/DynamicLinker.h b/include/llvm/Support/DynamicLinker.h index 8f02708268..fec9a45296 100644 --- a/include/llvm/Support/DynamicLinker.h +++ b/include/llvm/Support/DynamicLinker.h @@ -18,6 +18,8 @@ #include +namespace llvm { + /// LinkDynamicObject - Load the named file as a dynamic library /// and link it with the currently running process. Returns false /// on success, true if there is an error (and sets ErrorMessage @@ -33,4 +35,6 @@ bool LinkDynamicObject (const char *filename, std::string *ErrorMessage); void *GetAddressOfSymbol (const char *symbolName); void *GetAddressOfSymbol (const std::string &symbolName); +} // End llvm namespace + #endif // SUPPORT_DYNAMICLINKER_H diff --git a/include/llvm/Support/FileUtilities.h b/include/llvm/Support/FileUtilities.h index 0dfa625362..c276ec7aaa 100644 --- a/include/llvm/Support/FileUtilities.h +++ b/include/llvm/Support/FileUtilities.h @@ -17,6 +17,8 @@ #include +namespace llvm { + /// CheckMagic - Returns true IFF the file named FN begins with Magic. FN must /// name a readable file. /// @@ -95,4 +97,6 @@ bool MakeFileExecutable (const std::string & Filename); /// bool MakeFileReadable (const std::string & Filename); +} // End llvm namespace + #endif diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index 2cb8fcc985..7e5aa80645 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -28,6 +28,8 @@ #include #include +namespace llvm { + namespace DOT { // Private functions... inline std::string EscapeString(const std::string &Label) { std::string Str(Label); @@ -206,4 +208,6 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G, return O; } +} // End llvm namespace + #endif diff --git a/include/llvm/Support/InstIterator.h b/include/llvm/Support/InstIterator.h index 4c2d185576..31c8b660d6 100644 --- a/include/llvm/Support/InstIterator.h +++ b/include/llvm/Support/InstIterator.h @@ -22,6 +22,8 @@ #include "llvm/BasicBlock.h" #include "llvm/Function.h" +namespace llvm { + // This class implements inst_begin() & inst_end() for // inst_iterator and const_inst_iterator's. // @@ -137,4 +139,6 @@ inline const_inst_iterator inst_end(const Function &F) { return const_inst_iterator(F, true); } +} // End llvm namespace + #endif diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h index de1bce96bb..9a34edb71f 100644 --- a/include/llvm/Support/InstVisitor.h +++ b/include/llvm/Support/InstVisitor.h @@ -52,6 +52,8 @@ #include "llvm/Instruction.h" +namespace llvm { + class Module; // We operate on opaque instruction classes, so forward declare all instruction @@ -64,7 +66,6 @@ class Module; class TerminatorInst; class BinaryOperator; class AllocationInst; - #define DELEGATE(CLASS_TO_VISIT) \ return ((SubClass*)this)->visit##CLASS_TO_VISIT((CLASS_TO_VISIT&)I) @@ -186,4 +187,6 @@ struct InstVisitor { #undef DELEGATE +} // End llvm namespace + #endif diff --git a/include/llvm/Support/LeakDetector.h b/include/llvm/Support/LeakDetector.h index b39e0b5911..e2ce9c50be 100644 --- a/include/llvm/Support/LeakDetector.h +++ b/include/llvm/Support/LeakDetector.h @@ -23,6 +23,9 @@ #define SUPPORT_LEAKDETECTOR_H #include + +namespace llvm { + class Value; struct LeakDetector { @@ -83,4 +86,6 @@ private: static void checkForGarbageImpl(const std::string &Message); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Support/Linker.h b/include/llvm/Support/Linker.h index ac399034d4..9f4c8c25f6 100644 --- a/include/llvm/Support/Linker.h +++ b/include/llvm/Support/Linker.h @@ -15,6 +15,9 @@ #define LLVM_TRANSFORMATIONS_UTILS_LINKER_H #include + +namespace llvm { + class Module; // LinkModules - This function links two modules together, with the resulting @@ -24,5 +27,7 @@ class Module; // bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0); +} // End llvm namespace + #endif diff --git a/include/llvm/Support/MallocAllocator.h b/include/llvm/Support/MallocAllocator.h index 1ba25b0d65..766a67fa22 100644 --- a/include/llvm/Support/MallocAllocator.h +++ b/include/llvm/Support/MallocAllocator.h @@ -23,6 +23,8 @@ #include #include +namespace llvm { + template struct MallocAllocator { typedef size_t size_type; @@ -79,5 +81,6 @@ namespace std { }; } +} // End llvm namespace #endif diff --git a/include/llvm/Support/Mangler.h b/include/llvm/Support/Mangler.h index 1f56ff319e..5b312f8ef4 100644 --- a/include/llvm/Support/Mangler.h +++ b/include/llvm/Support/Mangler.h @@ -14,12 +14,19 @@ #ifndef LLVM_SUPPORT_MANGLER_H #define LLVM_SUPPORT_MANGLER_H +namespace llvm { + class Value; class Module; + +} // End llvm namespace + #include #include #include +namespace llvm { + class Mangler { /// This keeps track of which global values have had their names /// mangled in the current module. @@ -54,4 +61,6 @@ public: static std::string makeNameProper(const std::string &x); }; +} // End llvm namespace + #endif // LLVM_SUPPORT_MANGLER_H diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index ec742324b0..74958fbc35 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -16,6 +16,8 @@ #include "Support/DataTypes.h" +namespace llvm { + inline unsigned log2(uint64_t C) { unsigned getPow; for (getPow = 0; C > 1; ++getPow) @@ -33,4 +35,6 @@ inline bool isPowerOf2(int64_t C, unsigned &getPow) { return false; } +} // End llvm namespace + #endif diff --git a/include/llvm/Support/PassNameParser.h b/include/llvm/Support/PassNameParser.h index f63666ba66..0ffcabad52 100644 --- a/include/llvm/Support/PassNameParser.h +++ b/include/llvm/Support/PassNameParser.h @@ -28,6 +28,8 @@ #include #include +namespace llvm { + //===----------------------------------------------------------------------===// // PassNameParser class - Make use of the pass registration mechanism to // automatically add a command line argument to opt for each pass. @@ -114,4 +116,6 @@ struct FilteredPassNameParser : public PassNameParser { } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Support/SystemUtils.h b/include/llvm/Support/SystemUtils.h index ccde86cce6..c874d9932c 100644 --- a/include/llvm/Support/SystemUtils.h +++ b/include/llvm/Support/SystemUtils.h @@ -17,6 +17,8 @@ #include +namespace llvm { + /// isExecutableFile - This function returns true if the filename specified /// exists and is executable. /// @@ -45,4 +47,7 @@ int RunProgramWithTimeout(const std::string &ProgramPath, const char **Args, /// wait for it to terminate. /// int ExecWait (const char * const argv[], const char * const envp[]); + +} // End llvm namespace + #endif diff --git a/include/llvm/Support/Timer.h b/include/llvm/Support/Timer.h index 57ef3f0d64..ac465bb95b 100644 --- a/include/llvm/Support/Timer.h +++ b/include/llvm/Support/Timer.h @@ -20,6 +20,8 @@ #include #include +namespace llvm { + class TimerGroup; /// Timer - This class is used to track the amount of time spent between @@ -157,4 +159,6 @@ private: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Support/ToolRunner.h b/include/llvm/Support/ToolRunner.h index e23ec7f312..8ce3f5d8f3 100644 --- a/include/llvm/Support/ToolRunner.h +++ b/include/llvm/Support/ToolRunner.h @@ -20,6 +20,8 @@ #include "Support/SystemUtils.h" #include +namespace llvm { + class CBE; class LLC; @@ -137,4 +139,6 @@ public: int OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Support/TypeInfo.h b/include/llvm/Support/TypeInfo.h index aa2093a43d..5d9035076f 100644 --- a/include/llvm/Support/TypeInfo.h +++ b/include/llvm/Support/TypeInfo.h @@ -18,6 +18,8 @@ #include +namespace llvm { + struct TypeInfo { TypeInfo() { // needed for containers struct Nil {}; // Anonymous class distinct from all others... @@ -69,4 +71,6 @@ inline bool operator>=(const TypeInfo &lhs, const TypeInfo &rhs) { return !(lhs < rhs); } +} // End llvm namespace + #endif diff --git a/include/llvm/Support/ValueHolder.h b/include/llvm/Support/ValueHolder.h index 62ab9d9ca2..bab201287e 100644 --- a/include/llvm/Support/ValueHolder.h +++ b/include/llvm/Support/ValueHolder.h @@ -20,6 +20,8 @@ #include "llvm/User.h" +namespace llvm { + struct ValueHolder : public User { ValueHolder(Value *V = 0); ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) { @@ -46,4 +48,6 @@ struct ValueHolder : public User { } }; +} // End llvm namespace + #endif diff --git a/include/llvm/SymbolTable.h b/include/llvm/SymbolTable.h index 42f15aa626..8502375581 100644 --- a/include/llvm/SymbolTable.h +++ b/include/llvm/SymbolTable.h @@ -26,6 +26,8 @@ #include "llvm/Value.h" #include +namespace llvm { + class SymbolTable : public AbstractTypeUser, public std::map > { @@ -132,4 +134,6 @@ private: virtual void typeBecameConcrete(const DerivedType *AbsTy); }; +} // End llvm namespace + #endif diff --git a/include/llvm/SymbolTableListTraits.h b/include/llvm/SymbolTableListTraits.h index 820f391d40..46be356151 100644 --- a/include/llvm/SymbolTableListTraits.h +++ b/include/llvm/SymbolTableListTraits.h @@ -25,6 +25,8 @@ #ifndef LLVM_SYMBOLTABLELISTTRAITS_H #define LLVM_SYMBOLTABLELISTTRAITS_H +namespace llvm { + template class ilist_iterator; template class iplist; template struct ilist_traits; @@ -72,4 +74,6 @@ public: void setParent(SymTabClass *Parent); // This is private! }; +} // End llvm namespace + #endif diff --git a/include/llvm/System/Signals.h b/include/llvm/System/Signals.h index ce12301a15..0cbf398798 100644 --- a/include/llvm/System/Signals.h +++ b/include/llvm/System/Signals.h @@ -17,10 +17,13 @@ #include +namespace llvm { + // RemoveFileOnSignal - This function registers signal handlers to ensure that // if a signal gets delivered that the named file is removed. // void RemoveFileOnSignal(const std::string &Filename); -#endif +} // End llvm namespace +#endif diff --git a/include/llvm/Target/MRegisterInfo.h b/include/llvm/Target/MRegisterInfo.h index a87c74fc4e..3217b47b72 100644 --- a/include/llvm/Target/MRegisterInfo.h +++ b/include/llvm/Target/MRegisterInfo.h @@ -19,6 +19,8 @@ #include "llvm/CodeGen/MachineBasicBlock.h" #include +namespace llvm { + class Type; class MachineFunction; @@ -280,4 +282,6 @@ public: MachineBasicBlock &MBB) const = 0; }; +} // End llvm namespace + #endif diff --git a/include/llvm/Target/TargetCacheInfo.h b/include/llvm/Target/TargetCacheInfo.h index 56f20bf524..357adf0685 100644 --- a/include/llvm/Target/TargetCacheInfo.h +++ b/include/llvm/Target/TargetCacheInfo.h @@ -16,6 +16,8 @@ #include "Support/DataTypes.h" +namespace llvm { + class TargetMachine; struct TargetCacheInfo { @@ -59,4 +61,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index 8dcb6255d4..9be9564f16 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -24,6 +24,9 @@ #include "Support/Annotation.h" #include "Support/DataTypes.h" #include + +namespace llvm { + class Value; class Type; class StructType; @@ -101,4 +104,6 @@ private: inline StructLayout(const StructType *ST, const TargetData &TD); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Target/TargetFrameInfo.h b/include/llvm/Target/TargetFrameInfo.h index 0f82e27470..2b968fab1a 100644 --- a/include/llvm/Target/TargetFrameInfo.h +++ b/include/llvm/Target/TargetFrameInfo.h @@ -14,6 +14,8 @@ #ifndef LLVM_TARGET_TARGETFRAMEINFO_H #define LLVM_TARGET_TARGETFRAMEINFO_H +namespace llvm { + class MachineFunction; struct TargetFrameInfo { @@ -99,4 +101,6 @@ public: virtual int getDynamicAreaBaseRegNum() const { abort(); } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h index 76cfb392ae..c6afba5a15 100644 --- a/include/llvm/Target/TargetInstrInfo.h +++ b/include/llvm/Target/TargetInstrInfo.h @@ -18,6 +18,8 @@ #include #include +namespace llvm { + class MachineInstr; class TargetMachine; class Value; @@ -415,4 +417,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index af06349aa9..c0771a1746 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -17,6 +17,8 @@ #include "llvm/Target/TargetData.h" #include +namespace llvm { + class TargetInstrInfo; class TargetInstrDescriptor; class TargetSchedInfo; @@ -117,4 +119,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/Target/TargetMachineImpls.h b/include/llvm/Target/TargetMachineImpls.h index 670b2dc4b6..3ca20c74e9 100644 --- a/include/llvm/Target/TargetMachineImpls.h +++ b/include/llvm/Target/TargetMachineImpls.h @@ -15,6 +15,8 @@ #ifndef LLVM_TARGET_TARGETMACHINEIMPLS_H #define LLVM_TARGET_TARGETMACHINEIMPLS_H +namespace llvm { + class TargetMachine; class Module; @@ -30,4 +32,6 @@ TargetMachine *allocateSparcTargetMachine(const Module &M); // TargetMachine *allocateX86TargetMachine(const Module &M); +} // End llvm namespace + #endif diff --git a/include/llvm/Target/TargetRegInfo.h b/include/llvm/Target/TargetRegInfo.h index 36bfc0b915..f9f67c7424 100644 --- a/include/llvm/Target/TargetRegInfo.h +++ b/include/llvm/Target/TargetRegInfo.h @@ -19,6 +19,8 @@ #include #include +namespace llvm { + class TargetMachine; class IGNode; class Type; @@ -289,4 +291,6 @@ public: virtual int getSpilledRegSize(int RegType) const = 0; }; +} // End llvm namespace + #endif diff --git a/include/llvm/Target/TargetSchedInfo.h b/include/llvm/Target/TargetSchedInfo.h index dd8df32044..ae97d109e3 100644 --- a/include/llvm/Target/TargetSchedInfo.h +++ b/include/llvm/Target/TargetSchedInfo.h @@ -18,6 +18,8 @@ #include "Support/hash_map" #include +namespace llvm { + typedef long long cycles_t; static const cycles_t HUGE_LATENCY = ~((long long) 1 << (sizeof(cycles_t)-2)); static const cycles_t INVALID_LATENCY = -HUGE_LATENCY; @@ -36,13 +38,17 @@ private: OpCodePair(); // disable for now }; +} // End llvm namespace + namespace HASH_NAMESPACE { - template <> struct hash { - size_t operator()(const OpCodePair& pair) const { + template <> struct hash { + size_t operator()(const llvm::OpCodePair& pair) const { return hash()(pair.val); } }; -} +} // End HASH_NAMESPACE (a macro) namespace + +namespace llvm { //--------------------------------------------------------------------------- // class MachineResource @@ -321,4 +327,6 @@ protected: }; +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/IPO.h b/include/llvm/Transforms/IPO.h index 62ed93c5bb..80f5a527ab 100644 --- a/include/llvm/Transforms/IPO.h +++ b/include/llvm/Transforms/IPO.h @@ -15,6 +15,8 @@ #ifndef LLVM_TRANSFORMS_IPO_H #define LLVM_TRANSFORMS_IPO_H +namespace llvm { + class Pass; class Function; @@ -119,4 +121,6 @@ Pass *createIPConstantPropagationPass(); Pass *createSwapElementsPass(); Pass *createSortElementsPass(); +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/Instrumentation.h b/include/llvm/Transforms/Instrumentation.h index abe4fc46f6..035b8d1e0c 100644 --- a/include/llvm/Transforms/Instrumentation.h +++ b/include/llvm/Transforms/Instrumentation.h @@ -14,6 +14,8 @@ #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_H #define LLVM_TRANSFORMS_INSTRUMENTATION_H +namespace llvm { + class Pass; //===----------------------------------------------------------------------===// @@ -23,4 +25,6 @@ class Pass; Pass *createTraceValuesPassForFunction(); // Just trace function entry/exit Pass *createTraceValuesPassForBasicBlocks(); // Trace BB's and methods +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/MutateStructTypes.h b/include/llvm/Transforms/MutateStructTypes.h index f9b753caf4..c68f2ddf27 100644 --- a/include/llvm/Transforms/MutateStructTypes.h +++ b/include/llvm/Transforms/MutateStructTypes.h @@ -24,6 +24,8 @@ #include "llvm/Pass.h" #include "llvm/AbstractTypeUser.h" +namespace llvm { + class Value; class Type; class StructType; @@ -111,4 +113,6 @@ private: unsigned idx = 0); }; +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h index 81fd59767d..da17b8d10c 100644 --- a/include/llvm/Transforms/Scalar.h +++ b/include/llvm/Transforms/Scalar.h @@ -15,6 +15,8 @@ #ifndef LLVM_TRANSFORMS_SCALAR_H #define LLVM_TRANSFORMS_SCALAR_H +namespace llvm { + class Pass; class FunctionPass; class GetElementPtrInst; @@ -268,4 +270,6 @@ FunctionPass *createLowerInvokePass(); Pass *createSymbolStrippingPass(); Pass *createFullSymbolStrippingPass(); +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/Utils/BasicBlockUtils.h b/include/llvm/Transforms/Utils/BasicBlockUtils.h index 4630d5399a..155eae8e36 100644 --- a/include/llvm/Transforms/Utils/BasicBlockUtils.h +++ b/include/llvm/Transforms/Utils/BasicBlockUtils.h @@ -19,6 +19,9 @@ #include "llvm/BasicBlock.h" #include "llvm/Support/CFG.h" + +namespace llvm { + class Instruction; class Pass; @@ -50,7 +53,6 @@ void ReplaceInstWithInst(Instruction *From, Instruction *To); // void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum); - /// isCriticalEdge - Return true if the specified edge is a critical edge. /// Critical edges are edges from a block with multiple successors to a block /// with multiple predecessors. @@ -82,5 +84,6 @@ inline bool SplitCriticalEdge(BasicBlock *Succ, pred_iterator PI, Pass *P = 0) { return MadeChange; } +} // End llvm namespace #endif diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h index 351deefa8c..f6351d4876 100644 --- a/include/llvm/Transforms/Utils/Cloning.h +++ b/include/llvm/Transforms/Utils/Cloning.h @@ -20,6 +20,9 @@ #include #include + +namespace llvm { + class Module; class Function; class BasicBlock; @@ -109,4 +112,6 @@ bool InlineFunction(CallSite CS); /// no jump to it) and returns the new vector of basic blocks. std::vector CloneTrace(const std::vector &origTrace); +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/Utils/DemoteRegToStack.h b/include/llvm/Transforms/Utils/DemoteRegToStack.h index 1d6d2c6595..5810087f82 100644 --- a/include/llvm/Transforms/Utils/DemoteRegToStack.h +++ b/include/llvm/Transforms/Utils/DemoteRegToStack.h @@ -24,7 +24,11 @@ // //===----------------------------------------------------------------------===// +namespace llvm { + class Instruction; class AllocaInst; AllocaInst *DemoteRegToStack(Instruction &X); + +} // End llvm namespace diff --git a/include/llvm/Transforms/Utils/Linker.h b/include/llvm/Transforms/Utils/Linker.h index ac399034d4..9f4c8c25f6 100644 --- a/include/llvm/Transforms/Utils/Linker.h +++ b/include/llvm/Transforms/Utils/Linker.h @@ -15,6 +15,9 @@ #define LLVM_TRANSFORMATIONS_UTILS_LINKER_H #include + +namespace llvm { + class Module; // LinkModules - This function links two modules together, with the resulting @@ -24,5 +27,7 @@ class Module; // bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg = 0); +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/Utils/Local.h b/include/llvm/Transforms/Utils/Local.h index 286aef993e..2f83174249 100644 --- a/include/llvm/Transforms/Utils/Local.h +++ b/include/llvm/Transforms/Utils/Local.h @@ -16,6 +16,9 @@ #define LLVM_TRANSFORMS_UTILS_LOCAL_H #include "llvm/Function.h" + +namespace llvm { + class Pass; //===----------------------------------------------------------------------===// @@ -67,4 +70,6 @@ bool dceInstruction(BasicBlock::iterator &BBI); /// bool SimplifyCFG(BasicBlock *BB); +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/Utils/PromoteMemToReg.h b/include/llvm/Transforms/Utils/PromoteMemToReg.h index 57d5dae43c..38ea373885 100644 --- a/include/llvm/Transforms/Utils/PromoteMemToReg.h +++ b/include/llvm/Transforms/Utils/PromoteMemToReg.h @@ -15,11 +15,14 @@ #ifndef TRANSFORMS_UTILS_PROMOTEMEMTOREG_H #define TRANSFORMS_UTILS_PROMOTEMEMTOREG_H +#include + +namespace llvm { + class AllocaInst; class DominatorTree; class DominanceFrontier; class TargetData; -#include /// isAllocaPromotable - Return true if this alloca is legal for promotion. /// This is true if there are only loads and stores to the alloca... @@ -35,4 +38,6 @@ void PromoteMemToReg(const std::vector &Allocas, DominatorTree &DT, DominanceFrontier &DF, const TargetData &TD); +} // End llvm namespace + #endif diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h index a59517c689..590d51034b 100644 --- a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h +++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h @@ -20,6 +20,8 @@ #include "llvm/Pass.h" +namespace llvm { + struct UnifyFunctionExitNodes : public FunctionPass { BasicBlock *ReturnBlock, *UnwindBlock; public: @@ -39,4 +41,6 @@ public: Pass *createUnifyFunctionExitNodesPass(); +} // End llvm namespace + #endif diff --git a/include/llvm/Type.def b/include/llvm/Type.def index 566a9a3f02..6101cd0aa0 100644 --- a/include/llvm/Type.def +++ b/include/llvm/Type.def @@ -16,7 +16,7 @@ // NOTE: NO INCLUDE GUARD DESIRED! -// If the user didn't specify one of the macros, give a default noop defn. +// If the user did not specify one of the macros, give a default noop defn. // #ifndef HANDLE_PRIM_TYPE #define HANDLE_PRIM_TYPE(x,y) diff --git a/include/llvm/Type.h b/include/llvm/Type.h index 4c9fd1db48..ba4ac3415f 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -37,6 +37,8 @@ #include "Support/GraphTraits.h" #include "Support/iterator" +namespace llvm { + class DerivedType; class FunctionType; class ArrayType; @@ -324,4 +326,6 @@ template <> inline bool isa_impl(const Type &Ty) { return Ty.getPrimitiveID() == Type::PointerTyID; } +} // End llvm namespace + #endif diff --git a/include/llvm/Use.h b/include/llvm/Use.h index 4deee300f6..f94045b39e 100644 --- a/include/llvm/Use.h +++ b/include/llvm/Use.h @@ -17,6 +17,9 @@ #define LLVM_USE_H #include "Support/ilist" + +namespace llvm { + template struct ilist_traits; class Value; class User; @@ -77,13 +80,13 @@ struct ilist_traits { }; -template<> struct simplify_type { +template<> struct std::simplify_type { typedef Value* SimpleType; static SimpleType getSimplifiedValue(const Use &Val) { return (SimpleType)Val.get(); } }; -template<> struct simplify_type { +template<> struct std::simplify_type { typedef Value* SimpleType; static SimpleType getSimplifiedValue(const Use &Val) { return (SimpleType)Val.get(); @@ -150,4 +153,6 @@ struct UseListConstIteratorWrapper : public iplist::const_iterator { } }; +} // End llvm namespace + #endif diff --git a/include/llvm/User.h b/include/llvm/User.h index aba56d5819..cdd9b539ca 100644 --- a/include/llvm/User.h +++ b/include/llvm/User.h @@ -22,6 +22,8 @@ #include "llvm/Value.h" #include +namespace llvm { + class User : public Value { User(const User &); // Do not implement protected: @@ -110,4 +112,6 @@ template<> struct simplify_type { template<> struct simplify_type : public simplify_type {}; +} // End llvm namespace + #endif diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 537bcba11b..e92d6fc6cb 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -23,6 +23,8 @@ #include "Support/Casting.h" #include +namespace llvm { + class Type; class Constant; class Argument; @@ -198,4 +200,6 @@ template <> inline bool isa_impl(const Value &Val) { return isa(Val) || isa(Val); } +} // End llvm namespace + #endif diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h index db82b54c01..e0a551a0f7 100644 --- a/include/llvm/iMemory.h +++ b/include/llvm/iMemory.h @@ -16,6 +16,9 @@ #define LLVM_IMEMORY_H #include "llvm/Instruction.h" + +namespace llvm { + class PointerType; //===----------------------------------------------------------------------===// @@ -296,4 +299,6 @@ public: } }; +} // End llvm namespace + #endif // LLVM_IMEMORY_H diff --git a/include/llvm/iOperators.h b/include/llvm/iOperators.h index 39bfe14660..ecf99172a1 100644 --- a/include/llvm/iOperators.h +++ b/include/llvm/iOperators.h @@ -16,6 +16,8 @@ #include "llvm/InstrTypes.h" +namespace llvm { + /// SetCondInst class - Represent a setCC operator, where CC is eq, ne, lt, gt, /// le, or ge. /// @@ -63,4 +65,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/iOther.h b/include/llvm/iOther.h index 4e23afdc89..c611e06612 100644 --- a/include/llvm/iOther.h +++ b/include/llvm/iOther.h @@ -17,6 +17,8 @@ #include "llvm/InstrTypes.h" +namespace llvm { + //===----------------------------------------------------------------------===// // CastInst Class //===----------------------------------------------------------------------===// @@ -195,4 +197,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/iPHINode.h b/include/llvm/iPHINode.h index 54b867d59d..191de040e7 100644 --- a/include/llvm/iPHINode.h +++ b/include/llvm/iPHINode.h @@ -15,6 +15,9 @@ #define LLVM_IPHINODE_H #include "llvm/Instruction.h" + +namespace llvm { + class BasicBlock; //===----------------------------------------------------------------------===// @@ -112,4 +115,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/include/llvm/iTerminators.h b/include/llvm/iTerminators.h index 5f435a05c6..93e3adce76 100644 --- a/include/llvm/iTerminators.h +++ b/include/llvm/iTerminators.h @@ -18,6 +18,8 @@ #include "llvm/InstrTypes.h" +namespace llvm { + //===--------------------------------------------------------------------------- // ReturnInst - Return a value (possibly void), from a function. Execution does // not continue in this function any longer. @@ -306,4 +308,6 @@ struct UnwindInst : public TerminatorInst { } }; +} // End llvm namespace + #endif diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index 3acdf7841d..c881ec283a 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -29,6 +29,8 @@ #include "llvm/iMemory.h" #include "llvm/Target/TargetData.h" +namespace llvm { + // Register the AliasAnalysis interface, providing a nice name to refer to. namespace { RegisterAnalysisGroup Z("Alias Analysis"); @@ -123,3 +125,5 @@ namespace { // Declare that we implement the AliasAnalysis interface RegisterAnalysisGroup Y; } // End of anonymous namespace + +} // End llvm namespace diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index 5820565223..59036a4c39 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -16,6 +16,8 @@ #include "llvm/Pass.h" #include +namespace llvm { + namespace { class AliasAnalysisCounter : public Pass, public AliasAnalysis { unsigned No, May, Must; @@ -108,3 +110,5 @@ namespace { X("count-aa", "Count Alias Analysis Query Responses"); RegisterAnalysisGroup Y; } + +} // End llvm namespace diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index d4a7d18dcd..2c967c5daa 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -26,6 +26,8 @@ #include "Support/CommandLine.h" #include +namespace llvm { + namespace { cl::opt PrintNo ("print-no-aliases", cl::ReallyHidden); cl::opt PrintMay ("print-may-aliases", cl::ReallyHidden); @@ -114,3 +116,5 @@ bool AAEval::doFinalization(Module &M) { << May*100/Sum << "%/" << Must*100/Sum<<"%\n"; return false; } + +} // End llvm namespace diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index c2800326c2..4a293448ed 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -21,6 +21,8 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/InstIterator.h" +namespace llvm { + /// mergeSetIn - Merge the specified alias set into this alias set... /// void AliasSet::mergeSetIn(AliasSet &AS) { @@ -294,7 +296,6 @@ void AliasSetTracker::print(std::ostream &OS) const { void AliasSet::dump() const { print (std::cerr); } void AliasSetTracker::dump() const { print(std::cerr); } - //===----------------------------------------------------------------------===// // AliasSetPrinter Pass //===----------------------------------------------------------------------===// @@ -328,3 +329,5 @@ namespace { RegisterPass X("print-alias-sets", "Alias Set Printer", PassInfo::Analysis | PassInfo::Optimization); } + +} // End llvm namespace diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index e60922ac04..16512c0e17 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -23,10 +23,11 @@ #include "llvm/DerivedTypes.h" #include "llvm/Target/TargetData.h" +namespace llvm { + // Make sure that anything that uses AliasAnalysis pulls in this file... void BasicAAStub() {} - namespace { struct BasicAliasAnalysis : public ImmutablePass, public AliasAnalysis { @@ -60,8 +61,6 @@ void BasicAliasAnalysis::initializePass() { InitializeAliasAnalysis(this); } - - // hasUniqueAddress - Return true if the specified value points to something // with a unique, discernable, address. static inline bool hasUniqueAddress(const Value *V) { @@ -364,3 +363,4 @@ BasicAliasAnalysis::CheckGEPInstructions(GetElementPtrInst *GEP1, unsigned G1S, return MayAlias; } +} // End llvm namespace diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index ac93d4c1ca..bd11522c96 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -26,6 +26,8 @@ #include #include +namespace llvm { + /// CFGOnly flag - This is used to control whether or not the CFG graph printer /// prints out the contents of basic blocks or not. This is acceptable because /// this code is only really used for debugging purposes. @@ -112,9 +114,6 @@ namespace { "Print CFG of function to 'dot' file"); }; - - - /// viewCFG - This function is meant for use from the debugger. You can just /// say 'call F->viewCFG()' and a ghostview window should pop up from the /// program, displaying the CFG of the current function. This depends on there @@ -154,3 +153,5 @@ void Function::viewCFGOnly() const { viewCFG(); CFGOnly = false; } + +} // End llvm namespace diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp index a9e1204de5..e180f12a1a 100644 --- a/lib/Analysis/ConstantRange.cpp +++ b/lib/Analysis/ConstantRange.cpp @@ -26,6 +26,8 @@ #include "llvm/Instruction.h" #include "llvm/ConstantHandling.h" +namespace llvm { + /// Initialize a full (the default) or empty set for the specified type. /// ConstantRange::ConstantRange(const Type *Ty, bool Full) { @@ -248,3 +250,5 @@ void ConstantRange::print(std::ostream &OS) const { void ConstantRange::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp index b4b2e48b4e..66990fd923 100644 --- a/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -20,6 +20,8 @@ #include "Support/Debug.h" #include "DSCallSiteIterator.h" +namespace llvm { + namespace { Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph"); Statistic<> NumBUInlines("budatastructures", "Number of graphs inlined"); @@ -316,3 +318,4 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) { //Graph.writeGraphToFile(std::cerr, "bu_" + F.getName()); } +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/DSCallSiteIterator.h b/lib/Analysis/DataStructure/DSCallSiteIterator.h index 324111cffa..df9f36908a 100644 --- a/lib/Analysis/DataStructure/DSCallSiteIterator.h +++ b/lib/Analysis/DataStructure/DSCallSiteIterator.h @@ -19,6 +19,8 @@ #include "llvm/Analysis/DSGraph.h" #include "llvm/Function.h" +namespace llvm { + struct DSCallSiteIterator { // FCs are the edges out of the current node are the call site targets... const std::vector *FCs; @@ -129,4 +131,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index d53c7fa5d7..9cf77ae122 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -23,6 +23,8 @@ #include "Support/Timer.h" #include +namespace llvm { + namespace { Statistic<> NumFolds ("dsnode", "Number of nodes completely folded"); Statistic<> NumCallNodesMerged("dsnode", "Number of call nodes merged"); @@ -161,7 +163,6 @@ bool DSNode::isNodeCompletelyFolded() const { return getSize() == 1 && Ty == Type::VoidTy && isArray(); } - namespace { /// TypeElementWalker Class - Used for implementation of physical subtyping... /// @@ -252,7 +253,7 @@ namespace { } } }; -} +} // end anonymous namespace /// ElementTypesAreCompatible - Check to see if the specified types are /// "physically" compatible. If so, return true, else return false. We only @@ -1639,6 +1640,7 @@ void DSGraph::mergeInGlobalsGraph() { removeTriviallyDeadNodes(); } + /// computeNodeMapping - Given roots in two different DSGraphs, traverse the /// nodes reachable from the two graphs, computing the mapping of nodes from /// the first to the second graph. @@ -1669,3 +1671,4 @@ void DSGraph::computeNodeMapping(const DSNodeHandle &NH1, computeNodeMapping(N1->getLink(i), N2->getLink(N2Idx+i), NodeMap); } +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/DataStructureAA.cpp b/lib/Analysis/DataStructure/DataStructureAA.cpp index 99773e3936..4b55da7aa5 100644 --- a/lib/Analysis/DataStructure/DataStructureAA.cpp +++ b/lib/Analysis/DataStructure/DataStructureAA.cpp @@ -17,6 +17,8 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Module.h" +namespace llvm { + namespace { class DSAA : public Pass, public AliasAnalysis { TDDataStructures *TD; @@ -176,3 +178,5 @@ void DSAA::getMustAliases(Value *P, std::vector &RetVals) { #endif return getAnalysis().getMustAliases(P, RetVals); } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/DataStructureOpt.cpp b/lib/Analysis/DataStructure/DataStructureOpt.cpp index 0ca7d6bffc..d037b52145 100644 --- a/lib/Analysis/DataStructure/DataStructureOpt.cpp +++ b/lib/Analysis/DataStructure/DataStructureOpt.cpp @@ -18,6 +18,8 @@ #include "llvm/Constant.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumGlobalsConstanted("ds-opt", "Number of globals marked constant"); @@ -47,7 +49,6 @@ namespace { RegisterOpt X("ds-opt", "DSA-based simple optimizations"); } - /// OptimizeGlobals - This method uses information taken from DSA to optimize /// global variables. /// @@ -96,3 +97,5 @@ bool DSOpt::OptimizeGlobals(Module &M) { } return Changed; } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/DataStructureStats.cpp b/lib/Analysis/DataStructure/DataStructureStats.cpp index 8d2984845a..3659c90697 100644 --- a/lib/Analysis/DataStructure/DataStructureStats.cpp +++ b/lib/Analysis/DataStructure/DataStructureStats.cpp @@ -19,6 +19,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> TotalNumCallees("totalcallees", "Total number of callee functions at all indirect call sites"); @@ -139,3 +141,5 @@ bool DSGraphStats::runOnFunction(Function& F) { visit(F); return true; } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/GraphChecker.cpp b/lib/Analysis/DataStructure/GraphChecker.cpp index b0164da322..11ebc6920c 100644 --- a/lib/Analysis/DataStructure/GraphChecker.cpp +++ b/lib/Analysis/DataStructure/GraphChecker.cpp @@ -29,6 +29,8 @@ #include "llvm/Value.h" #include +namespace llvm { + namespace { enum DSPass { local, bu, td }; cl::opt @@ -193,3 +195,5 @@ void DSGC::verify(const DSGraph &G) { } } } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/IPModRef.cpp b/lib/Analysis/DataStructure/IPModRef.cpp index 64b60d48ba..01b5bd0023 100644 --- a/lib/Analysis/DataStructure/IPModRef.cpp +++ b/lib/Analysis/DataStructure/IPModRef.cpp @@ -23,6 +23,8 @@ #include "Support/StringExtras.h" #include +namespace llvm { + //---------------------------------------------------------------------------- // Private constants and data //---------------------------------------------------------------------------- @@ -441,3 +443,5 @@ void IPModRef::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 0aca21a437..253cbf7a35 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -28,6 +28,8 @@ // #include "llvm/Module.h" +namespace llvm { + static RegisterAnalysis X("datastructure", "Local Data Structure Analysis"); @@ -41,8 +43,8 @@ namespace DS { return false; } } -using namespace DS; +using namespace DS; namespace { cl::opt @@ -144,6 +146,8 @@ namespace { }; } +using namespace DS; + //===----------------------------------------------------------------------===// // DSGraph constructor - Simply use the GraphBuilder to construct the local // graph. @@ -617,3 +621,5 @@ void LocalDataStructures::releaseMemory() { delete GlobalsGraph; GlobalsGraph = 0; } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp b/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp index 076836a5ce..e61c076f30 100644 --- a/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp +++ b/lib/Analysis/DataStructure/MemoryDepAnalysis.cpp @@ -31,6 +31,7 @@ #include "Support/hash_map" #include "Support/hash_set" +namespace llvm { ///-------------------------------------------------------------------------- /// struct ModRefTable: @@ -122,7 +123,7 @@ struct ModRefTable { class ModRefInfoBuilder : public InstVisitor { const DSGraph& funcGraph; const FunctionModRefInfo& funcModRef; - ModRefTable& modRefTable; + struct ModRefTable& modRefTable; ModRefInfoBuilder(); // DO NOT IMPLEMENT ModRefInfoBuilder(const ModRefInfoBuilder&); // DO NOT IMPLEMENT @@ -498,3 +499,5 @@ void MemoryDepAnalysis::dump() const static RegisterAnalysis Z("memdep", "Memory Dependence Analysis"); + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/Parallelize.cpp b/lib/Analysis/DataStructure/Parallelize.cpp index 77e6ed3040..fd39b6b12a 100644 --- a/lib/Analysis/DataStructure/Parallelize.cpp +++ b/lib/Analysis/DataStructure/Parallelize.cpp @@ -53,6 +53,8 @@ #include #include +namespace llvm { + //---------------------------------------------------------------------------- // Global constants used in marking Cilk functions and function calls. //---------------------------------------------------------------------------- @@ -535,3 +537,5 @@ bool Parallelize::run(Module& M) return true; } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/PgmDependenceGraph.cpp b/lib/Analysis/DataStructure/PgmDependenceGraph.cpp index ef44cb3efb..b861c89947 100644 --- a/lib/Analysis/DataStructure/PgmDependenceGraph.cpp +++ b/lib/Analysis/DataStructure/PgmDependenceGraph.cpp @@ -30,6 +30,7 @@ #include "llvm/Analysis/PostDominators.h" #include "llvm/Function.h" +namespace llvm { //---------------------------------------------------------------------------- // class DepIterState @@ -253,3 +254,5 @@ void PgmDependenceGraph::dump() const static RegisterAnalysis Z("pgmdep", "Enumerate Program Dependence Graph (data and control)"); + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index 9587979560..9902906e19 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -23,6 +23,8 @@ #include #include +namespace llvm { + // OnlyPrintMain - The DataStructure printer exposes this option to allow // printing of only the graph for "main". // @@ -32,7 +34,6 @@ namespace { Statistic<> NumFoldedNodes ("dsnode", "Number of folded nodes (in final graph)"); } - void DSNode::dump() const { print(std::cerr, 0); } static std::string getCaption(const DSNode *N, const DSGraph *G) { @@ -280,3 +281,5 @@ void BUDataStructures::print(std::ostream &O, const Module *M) const { void TDDataStructures::print(std::ostream &O, const Module *M) const { printCollection(*this, O, M, "td."); } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/Steensgaard.cpp b/lib/Analysis/DataStructure/Steensgaard.cpp index 8bf917f048..d868d250f7 100644 --- a/lib/Analysis/DataStructure/Steensgaard.cpp +++ b/lib/Analysis/DataStructure/Steensgaard.cpp @@ -20,6 +20,8 @@ #include "llvm/Module.h" #include "Support/Debug.h" +namespace llvm { + namespace { class Steens : public Pass, public AliasAnalysis { DSGraph *ResultGraph; @@ -76,7 +78,6 @@ namespace { RegisterAnalysisGroup Y; } - /// ResolveFunctionCall - Resolve the actual arguments of a call to function F /// with the specified call site descriptor. This function links the arguments /// and the return value for the call site context-insensitively. @@ -235,3 +236,5 @@ AliasAnalysis::AliasResult Steens::alias(const Value *V1, unsigned V1Size, // return getAnalysis().alias(V1, V1Size, V2, V2Size); } + +} // End llvm namespace diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp index ad5a9d7220..696368a866 100644 --- a/lib/Analysis/DataStructure/TopDownClosure.cpp +++ b/lib/Analysis/DataStructure/TopDownClosure.cpp @@ -21,6 +21,8 @@ #include "Support/Debug.h" #include "Support/Statistic.h" +namespace llvm { + namespace { RegisterAnalysis // Register the pass Y("tddatastructure", "Top-down Data Structure Analysis"); @@ -310,3 +312,4 @@ void TDDataStructures::inlineGraphIntoCallees(DSGraph &Graph) { << Graph.getFunctionCalls().size() << "]\n"); } +} // End llvm namespace diff --git a/lib/Analysis/Expressions.cpp b/lib/Analysis/Expressions.cpp index 4d8897e7ff..b316390469 100644 --- a/lib/Analysis/Expressions.cpp +++ b/lib/Analysis/Expressions.cpp @@ -18,6 +18,8 @@ #include "llvm/ConstantHandling.h" #include "llvm/Function.h" +namespace llvm { + ExprType::ExprType(Value *Val) { if (Val) if (ConstantInt *CPI = dyn_cast(Val)) { @@ -352,3 +354,5 @@ ExprType ClassifyExpression(Value *Expr) { // Otherwise, I don't know anything about this value! return I; } + +} // End llvm namespace diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index 8d44242050..506198c4fa 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -53,6 +53,8 @@ #include "llvm/Support/CallSite.h" #include "Support/STLExtras.h" +namespace llvm { + static RegisterAnalysis X("callgraph", "Call Graph Construction"); static const char * const KnownExternalFunctions[] = { @@ -349,3 +351,5 @@ Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) { } void CallGraph::stub() {} + +} // End llvm namespace diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp index 74da70131e..e9ab6500c8 100644 --- a/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -19,6 +19,8 @@ #include "llvm/Analysis/CallGraph.h" #include "Support/SCCIterator.h" +namespace llvm { + /// getAnalysisUsage - For this class, we declare that we require and preserve /// the call graph. If the derived class implements this method, it should /// always explicitly call the implementation here. @@ -35,3 +37,5 @@ bool CallGraphSCCPass::run(Module &M) { Changed = runOnSCC(*I); return Changed; } + +} // End llvm namespace diff --git a/lib/Analysis/IPA/DependenceGraph.cpp b/lib/Analysis/IPA/DependenceGraph.cpp index ead777aa13..7d62ef0350 100644 --- a/lib/Analysis/IPA/DependenceGraph.cpp +++ b/lib/Analysis/IPA/DependenceGraph.cpp @@ -24,6 +24,7 @@ #include "llvm/Analysis/DependenceGraph.h" #include "llvm/Function.h" +namespace llvm { //---------------------------------------------------------------------------- // class Dependence: @@ -82,3 +83,5 @@ void DependenceGraph::print(const Function& func, std::ostream &O) const if (const DepGraphNode* dgNode = this->getNode(*II)) dgNode->print(O); } + +} // End llvm namespace diff --git a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp index 7eeff7dbc7..45f5b72ecf 100644 --- a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp +++ b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp @@ -30,6 +30,8 @@ #include "llvm/Support/InstIterator.h" #include "Support/CommandLine.h" +namespace llvm { + static RegisterAnalysis X("unsafepointertypes", "Find Unsafe Pointer Types"); @@ -99,3 +101,5 @@ void FindUnsafePointerTypes::print(std::ostream &o, const Module *M) const { CW << " #" << Counter << ". " << (Value*)*I << "\n"; } } + +} // End llvm namespace diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp index 80bf378b5e..e930499e2e 100644 --- a/lib/Analysis/IPA/FindUsedTypes.cpp +++ b/lib/Analysis/IPA/FindUsedTypes.cpp @@ -21,6 +21,8 @@ #include "llvm/Assembly/CachedWriter.h" #include "llvm/Support/InstIterator.h" +namespace llvm { + static RegisterAnalysis X("printusedtypes", "Find Used Types"); @@ -106,3 +108,5 @@ void FindUsedTypes::print(std::ostream &o, const Module *M) const { E = UsedTypes.end(); I != E; ++I) o << " " << *I << "\n"; } + +} // End llvm namespace diff --git a/lib/Analysis/IPA/IPModRef.cpp b/lib/Analysis/IPA/IPModRef.cpp index 64b60d48ba..01b5bd0023 100644 --- a/lib/Analysis/IPA/IPModRef.cpp +++ b/lib/Analysis/IPA/IPModRef.cpp @@ -23,6 +23,8 @@ #include "Support/StringExtras.h" #include +namespace llvm { + //---------------------------------------------------------------------------- // Private constants and data //---------------------------------------------------------------------------- @@ -441,3 +443,5 @@ void IPModRef::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/lib/Analysis/IPA/MemoryDepAnalysis.cpp b/lib/Analysis/IPA/MemoryDepAnalysis.cpp index 076836a5ce..e61c076f30 100644 --- a/lib/Analysis/IPA/MemoryDepAnalysis.cpp +++ b/lib/Analysis/IPA/MemoryDepAnalysis.cpp @@ -31,6 +31,7 @@ #include "Support/hash_map" #include "Support/hash_set" +namespace llvm { ///-------------------------------------------------------------------------- /// struct ModRefTable: @@ -122,7 +123,7 @@ struct ModRefTable { class ModRefInfoBuilder : public InstVisitor { const DSGraph& funcGraph; const FunctionModRefInfo& funcModRef; - ModRefTable& modRefTable; + struct ModRefTable& modRefTable; ModRefInfoBuilder(); // DO NOT IMPLEMENT ModRefInfoBuilder(const ModRefInfoBuilder&); // DO NOT IMPLEMENT @@ -498,3 +499,5 @@ void MemoryDepAnalysis::dump() const static RegisterAnalysis Z("memdep", "Memory Dependence Analysis"); + +} // End llvm namespace diff --git a/lib/Analysis/IPA/PgmDependenceGraph.cpp b/lib/Analysis/IPA/PgmDependenceGraph.cpp index ef44cb3efb..b861c89947 100644 --- a/lib/Analysis/IPA/PgmDependenceGraph.cpp +++ b/lib/Analysis/IPA/PgmDependenceGraph.cpp @@ -30,6 +30,7 @@ #include "llvm/Analysis/PostDominators.h" #include "llvm/Function.h" +namespace llvm { //---------------------------------------------------------------------------- // class DepIterState @@ -253,3 +254,5 @@ void PgmDependenceGraph::dump() const static RegisterAnalysis Z("pgmdep", "Enumerate Program Dependence Graph (data and control)"); + +} // End llvm namespace diff --git a/lib/Analysis/IPA/PrintSCC.cpp b/lib/Analysis/IPA/PrintSCC.cpp index 3459381158..ce89fff90e 100644 --- a/lib/Analysis/IPA/PrintSCC.cpp +++ b/lib/Analysis/IPA/PrintSCC.cpp @@ -31,6 +31,8 @@ #include "llvm/Support/CFG.h" #include "Support/SCCIterator.h" +namespace llvm { + namespace { struct CFGSCC : public FunctionPass { bool runOnFunction(Function& func); @@ -101,3 +103,5 @@ bool CallGraphSCC::run(Module &M) { return true; } + +} // End llvm namespace diff --git a/lib/Analysis/InductionVariable.cpp b/lib/Analysis/InductionVariable.cpp index 3119d31ded..6e9a209b7e 100644 --- a/lib/Analysis/InductionVariable.cpp +++ b/lib/Analysis/InductionVariable.cpp @@ -36,6 +36,8 @@ #include "llvm/Assembly/Writer.h" #include "Support/Debug.h" +namespace llvm { + static bool isLoopInvariant(const Value *V, const Loop *L) { if (const Instruction *I = dyn_cast(V)) return !L->contains(I->getParent()); @@ -299,3 +301,5 @@ void InductionVariable::print(std::ostream &o) const { } o << "\n"; } + +} // End llvm namespace diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp index 4d49478a9e..9177e44800 100644 --- a/lib/Analysis/InstCount.cpp +++ b/lib/Analysis/InstCount.cpp @@ -16,6 +16,8 @@ #include "llvm/Support/InstVisitor.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> TotalInsts ("instcount", "Number of instructions (of all types)"); Statistic<> TotalBlocks("instcount", "Number of basic blocks"); @@ -62,3 +64,5 @@ bool InstCount::runOnFunction(Function &F) { visit(F); return false; } + +} // End llvm namespace diff --git a/lib/Analysis/Interval.cpp b/lib/Analysis/Interval.cpp index 28cee83631..8f0bdfa003 100644 --- a/lib/Analysis/Interval.cpp +++ b/lib/Analysis/Interval.cpp @@ -17,6 +17,8 @@ #include "llvm/Support/CFG.h" #include +using namespace llvm; + //===----------------------------------------------------------------------===// // Interval Implementation //===----------------------------------------------------------------------===// diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp index 2729930998..12c196f2f7 100644 --- a/lib/Analysis/IntervalPartition.cpp +++ b/lib/Analysis/IntervalPartition.cpp @@ -15,6 +15,8 @@ #include "llvm/Analysis/IntervalIterator.h" #include "Support/STLExtras.h" +namespace llvm { + static RegisterAnalysis X("intervals", "Interval Partition Construction", true); @@ -108,3 +110,5 @@ IntervalPartition::IntervalPartition(IntervalPartition &IP, bool) { for_each(Intervals.begin(), Intervals.end(), bind_obj(this, &IntervalPartition::updatePredecessors)); } + +} // End llvm namespace diff --git a/lib/Analysis/LiveVar/BBLiveVar.cpp b/lib/Analysis/LiveVar/BBLiveVar.cpp index 68eaebf7d2..758f1b1539 100644 --- a/lib/Analysis/LiveVar/BBLiveVar.cpp +++ b/lib/Analysis/LiveVar/BBLiveVar.cpp @@ -21,6 +21,7 @@ /// BROKEN: Should not include sparc stuff directly into here #include "../../Target/Sparc/SparcInternals.h" // Only for PHI defn +namespace llvm { BBLiveVar::BBLiveVar(const BasicBlock &bb, MachineBasicBlock &mbb, unsigned id) : BB(bb), MBB(mbb), POID(id) { @@ -229,6 +230,4 @@ void BBLiveVar::printInOutSets() const { std::cerr << " Out: "; printSet(OutSet); std::cerr << "\n"; } - - - +} // End llvm namespace diff --git a/lib/Analysis/LiveVar/BBLiveVar.h b/lib/Analysis/LiveVar/BBLiveVar.h index 33a4faf2b1..781143a93d 100644 --- a/lib/Analysis/LiveVar/BBLiveVar.h +++ b/lib/Analysis/LiveVar/BBLiveVar.h @@ -17,6 +17,9 @@ #include "llvm/CodeGen/ValueSet.h" #include "Support/hash_map" + +namespace llvm { + class BasicBlock; class Value; class MachineBasicBlock; @@ -82,4 +85,6 @@ public: void printInOutSets() const; // for printing In/Out sets }; +} // End llvm namespace + #endif diff --git a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp index 588ec646da..8f0e31811a 100644 --- a/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp +++ b/lib/Analysis/LiveVar/FunctionLiveVarInfo.cpp @@ -23,6 +23,8 @@ #include "Support/CommandLine.h" #include "BBLiveVar.h" +namespace llvm { + static RegisterAnalysis X("livevar", "Live Variable Analysis"); @@ -318,3 +320,5 @@ void FunctionLiveVarInfo::calcLiveVarSetsForBB(const BasicBlock *BB) { SetAI = NewSet; } } + +} // End llvm namespace diff --git a/lib/Analysis/LiveVar/ValueSet.cpp b/lib/Analysis/LiveVar/ValueSet.cpp index ba944cb8cc..fd8289675a 100644 --- a/lib/Analysis/LiveVar/ValueSet.cpp +++ b/lib/Analysis/LiveVar/ValueSet.cpp @@ -11,6 +11,8 @@ #include "llvm/Value.h" #include +namespace llvm { + std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value const Value &v = V.V; if (v.hasName()) @@ -26,3 +28,4 @@ void printSet(const ValueSet &S) { std::cerr << RAV(*I); } +} // End llvm namespace diff --git a/lib/Analysis/LoadValueNumbering.cpp b/lib/Analysis/LoadValueNumbering.cpp index cbcdd0f178..2d26379417 100644 --- a/lib/Analysis/LoadValueNumbering.cpp +++ b/lib/Analysis/LoadValueNumbering.cpp @@ -31,6 +31,8 @@ #include #include +namespace llvm { + namespace { // FIXME: This should not be a FunctionPass. struct LoadVN : public FunctionPass, public ValueNumbering { @@ -70,8 +72,6 @@ namespace { RegisterAnalysisGroup Y; } - - Pass *createLoadValueNumberingPass() { return new LoadVN(); } @@ -340,3 +340,5 @@ bool LoadVN::haveEqualValueNumber(LoadInst *Load, StoreInst *Store, return true; } } + +} // End llvm namespace diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index c1f97889e6..68e7d2f845 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -21,6 +21,8 @@ #include "Support/DepthFirstIterator.h" #include +namespace llvm { + static RegisterAnalysis X("loops", "Natural Loop Construction", true); @@ -367,3 +369,5 @@ void Loop::changeExitBlock(BasicBlock *Old, BasicBlock *New) { I = std::find(I+1, ExitBlocks.end(), Old); } } + +} // End llvm namespace diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp index ee31c36b3e..2589c85773 100644 --- a/lib/Analysis/PostDominators.cpp +++ b/lib/Analysis/PostDominators.cpp @@ -17,6 +17,8 @@ #include "Support/DepthFirstIterator.h" #include "Support/SetOperations.h" +namespace llvm { + //===----------------------------------------------------------------------===// // PostDominatorSet Implementation //===----------------------------------------------------------------------===// @@ -214,3 +216,5 @@ PostDominanceFrontier::calculate(const PostDominatorTree &DT, // stub - a dummy function to make linking work ok. void PostDominanceFrontier::stub() { } + +} // End llvm namespace diff --git a/lib/Analysis/PrintSCC.cpp b/lib/Analysis/PrintSCC.cpp index 3459381158..ce89fff90e 100644 --- a/lib/Analysis/PrintSCC.cpp +++ b/lib/Analysis/PrintSCC.cpp @@ -31,6 +31,8 @@ #include "llvm/Support/CFG.h" #include "Support/SCCIterator.h" +namespace llvm { + namespace { struct CFGSCC : public FunctionPass { bool runOnFunction(Function& func); @@ -101,3 +103,5 @@ bool CallGraphSCC::run(Module &M) { return true; } + +} // End llvm namespace diff --git a/lib/Analysis/ValueNumbering.cpp b/lib/Analysis/ValueNumbering.cpp index 075c1c2b3f..191e190e20 100644 --- a/lib/Analysis/ValueNumbering.cpp +++ b/lib/Analysis/ValueNumbering.cpp @@ -19,6 +19,8 @@ #include "llvm/Type.h" #include "llvm/iMemory.h" +namespace llvm { + // Register the ValueNumbering interface, providing a nice name to refer to. static RegisterAnalysisGroup X("Value Numbering"); @@ -39,6 +41,7 @@ ValueNumbering::~ValueNumbering() {} // into the tool that uses it. As such, we register and implement the class // here. // + namespace { /// BasicVN - This class is the default implementation of the ValueNumbering /// interface. It walks the SSA def-use chains to trivially identify @@ -62,9 +65,7 @@ namespace { // Declare that we implement the ValueNumbering interface RegisterAnalysisGroup Y; -} // End of anonymous namespace -namespace { /// BVNImpl - Implement BasicVN in terms of a visitor class that /// handles the different types of instructions as appropriate. /// @@ -190,3 +191,5 @@ void BVNImpl::visitGetElementPtrInst(GetElementPtrInst &I) { RetVals.push_back(Other); } } + +} // End llvm namespace diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp index d155b69bee..33ae24b60e 100644 --- a/lib/Archive/ArchiveReader.cpp +++ b/lib/Archive/ArchiveReader.cpp @@ -22,6 +22,8 @@ #include "Config/sys/mman.h" #include "Config/fcntl.h" +namespace llvm { + namespace { struct ar_hdr { char name[16]; @@ -40,7 +42,6 @@ namespace { }; } - // getObjectType - Determine the type of object that this header represents. // This is capable of parsing the variety of special sections used for various // purposes. @@ -173,3 +174,5 @@ bool ReadArchiveFile(const std::string &Filename, std::vector &Objects, return Result; } + +} // End llvm namespace diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l index 6466cb721b..b0e174af50 100644 --- a/lib/AsmParser/Lexer.l +++ b/lib/AsmParser/Lexer.l @@ -35,6 +35,7 @@ #define RET_TOK(type, Enum, sym) \ llvmAsmlval.type = Instruction::Enum; return sym +namespace llvm { // TODO: All of the static identifiers are figured out by the lexer, // these should be hashed to reduce the lexer size @@ -121,6 +122,10 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) { return BOut; } +} // End llvm namespace + +using namespace llvm; + #define YY_NEVER_INTERACTIVE 1 %} diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp index e8a7bdbbb9..2d6185efeb 100644 --- a/lib/AsmParser/Parser.cpp +++ b/lib/AsmParser/Parser.cpp @@ -15,6 +15,8 @@ #include "llvm/Module.h" #include "llvm/Analysis/Verifier.h" +namespace llvm { + // The useful interface defined by this file... Parse an ASCII file, and return // the internal representation in a nice slice'n'dice'able representation. // @@ -82,3 +84,5 @@ const std::string ParseException::getMessage() const { return Result + ": " + Message; } + +} // End llvm namespace diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h index c7837959e6..c18434d1f0 100644 --- a/lib/AsmParser/ParserInternals.h +++ b/lib/AsmParser/ParserInternals.h @@ -22,18 +22,22 @@ #include "llvm/Assembly/Parser.h" #include "Support/StringExtras.h" -class Module; - // Global variables exported from the lexer... extern std::FILE *llvmAsmin; extern int llvmAsmlineno; +// Globals exported by the parser... +extern char* llvmAsmtext; +extern int llvmAsmleng; + +namespace llvm { + // Globals exported by the parser... extern std::string CurFilename; + +class Module; Module *RunVMAsmParser(const std::string &Filename, FILE *F); -extern char* llvmAsmtext; -extern int llvmAsmleng; // UnEscapeLexed - Run through the specified buffer and change \xx codes to the // appropriate character. If AllowNull is set to false, a \00 value will cause @@ -209,4 +213,6 @@ static inline int getLineNumFromPlaceHolder(const Value *Val) { } } +} // End llvm namespace + #endif diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 96d2daeec4..a55e735ca4 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -29,6 +29,8 @@ int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit int yylex(); // declaration" of xxx warnings. int yyparse(); +namespace llvm { + static Module *ParserResult; std::string CurFilename; @@ -686,30 +688,34 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) { return Result; } +} // End llvm namespace + +using namespace llvm; + %} %union { - Module *ModuleVal; - Function *FunctionVal; - std::pair *ArgVal; - BasicBlock *BasicBlockVal; - TerminatorInst *TermInstVal; - Instruction *InstVal; - Constant *ConstVal; - - const Type *PrimType; - PATypeHolder *TypeVal; - Value *ValueVal; - - std::vector > *ArgList; - std::vector *ValueList; - std::list *TypeList; - std::list > *PHIList; // Represent the RHS of PHI node - std::vector > *JumpTable; - std::vector *ConstVector; - - GlobalValue::LinkageTypes Linkage; + llvm::Module *ModuleVal; + llvm::Function *FunctionVal; + std::pair *ArgVal; + llvm::BasicBlock *BasicBlockVal; + llvm::TerminatorInst *TermInstVal; + llvm::Instruction *InstVal; + llvm::Constant *ConstVal; + + const llvm::Type *PrimType; + llvm::PATypeHolder *TypeVal; + llvm::Value *ValueVal; + + std::vector > *ArgList; + std::vector *ValueList; + std::list *TypeList; + std::list > *PHIList; // Represent the RHS of PHI node + std::vector > *JumpTable; + std::vector *ConstVector; + + llvm::GlobalValue::LinkageTypes Linkage; int64_t SInt64Val; uint64_t UInt64Val; int SIntVal; @@ -718,13 +724,13 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) { bool BoolVal; char *StrVal; // This memory is strdup'd! - ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - Instruction::BinaryOps BinaryOpVal; - Instruction::TermOps TermOpVal; - Instruction::MemoryOps MemOpVal; - Instruction::OtherOps OtherOpVal; - Module::Endianness Endianness; + llvm::Instruction::BinaryOps BinaryOpVal; + llvm::Instruction::TermOps TermOpVal; + llvm::Instruction::MemoryOps MemOpVal; + llvm::Instruction::OtherOps OtherOpVal; + llvm::Module::Endianness Endianness; } %type Module FunctionList @@ -1892,6 +1898,7 @@ MemoryInst : MALLOC Types { delete $2; delete $4; }; + %% int yyerror(const char *ErrorMsg) { std::string where diff --git a/lib/Bytecode/Archive/ArchiveReader.cpp b/lib/Bytecode/Archive/ArchiveReader.cpp index d155b69bee..33ae24b60e 100644 --- a/lib/Bytecode/Archive/ArchiveReader.cpp +++ b/lib/Bytecode/Archive/ArchiveReader.cpp @@ -22,6 +22,8 @@ #include "Config/sys/mman.h" #include "Config/fcntl.h" +namespace llvm { + namespace { struct ar_hdr { char name[16]; @@ -40,7 +42,6 @@ namespace { }; } - // getObjectType - Determine the type of object that this header represents. // This is capable of parsing the variety of special sections used for various // purposes. @@ -173,3 +174,5 @@ bool ReadArchiveFile(const std::string &Filename, std::vector &Objects, return Result; } + +} // End llvm namespace diff --git a/lib/Bytecode/Reader/ArchiveReader.cpp b/lib/Bytecode/Reader/ArchiveReader.cpp index d155b69bee..33ae24b60e 100644 --- a/lib/Bytecode/Reader/ArchiveReader.cpp +++ b/lib/Bytecode/Reader/ArchiveReader.cpp @@ -22,6 +22,8 @@ #include "Config/sys/mman.h" #include "Config/fcntl.h" +namespace llvm { + namespace { struct ar_hdr { char name[16]; @@ -40,7 +42,6 @@ namespace { }; } - // getObjectType - Determine the type of object that this header represents. // This is capable of parsing the variety of special sections used for various // purposes. @@ -173,3 +174,5 @@ bool ReadArchiveFile(const std::string &Filename, std::vector &Objects, return Result; } + +} // End llvm namespace diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp index 00f44b3665..b4553548e8 100644 --- a/lib/Bytecode/Reader/ConstantReader.cpp +++ b/lib/Bytecode/Reader/ConstantReader.cpp @@ -20,6 +20,8 @@ #include "llvm/Constants.h" #include +namespace llvm { + const Type *BytecodeParser::parseTypeConstant(const unsigned char *&Buf, const unsigned char *EndBuf) { unsigned PrimType; @@ -356,3 +358,5 @@ void BytecodeParser::ParseConstantPool(const unsigned char *&Buf, if (Buf > EndBuf) throw std::string("Read past end of buffer."); } + +} // End llvm namespace diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp index a409ceebef..ec8944e7a8 100644 --- a/lib/Bytecode/Reader/InstructionReader.cpp +++ b/lib/Bytecode/Reader/InstructionReader.cpp @@ -22,6 +22,8 @@ #include "llvm/iOther.h" #include "llvm/Module.h" +namespace llvm { + namespace { struct RawInst { // The raw fields out of the bytecode stream... unsigned NumOperands; @@ -33,8 +35,6 @@ namespace { }; } - - RawInst::RawInst(const unsigned char *&Buf, const unsigned char *EndBuf, std::vector &Args) { unsigned Op, Typ; @@ -389,3 +389,5 @@ void BytecodeParser::ParseInstruction(const unsigned char *&Buf, BB->getInstList().push_back(Result); BCR_TRACE(4, *Result); } + +} // End llvm namespace diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index a36ea7a734..9acb93d48a 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -32,6 +32,8 @@ #include #include +namespace llvm { + static inline void ALIGN32(const unsigned char *&begin, const unsigned char *end) { if (align32(begin, end)) @@ -693,3 +695,5 @@ void BytecodeParser::ParseBytecode(const unsigned char *Buf, unsigned Length, throw; } } + +} // End llvm namespace diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h index c8905454e6..81ccde97ff 100644 --- a/lib/Bytecode/Reader/ReaderInternals.h +++ b/lib/Bytecode/Reader/ReaderInternals.h @@ -22,6 +22,8 @@ #include #include +namespace llvm { + // Enable to trace to figure out what the heck is going on when parsing fails //#define TRACE_LEVEL 10 //#define DEBUG_OUTPUT @@ -226,4 +228,6 @@ static inline void readBlock(const unsigned char *&Buf, #endif } +} // End llvm namespace + #endif diff --git a/lib/Bytecode/Reader/ReaderWrappers.cpp b/lib/Bytecode/Reader/ReaderWrappers.cpp index 0df6ea5ff2..1cbead02e8 100644 --- a/lib/Bytecode/Reader/ReaderWrappers.cpp +++ b/lib/Bytecode/Reader/ReaderWrappers.cpp @@ -21,6 +21,8 @@ #include "Config/unistd.h" #include "Config/sys/mman.h" +namespace llvm { + //===----------------------------------------------------------------------===// // BytecodeFileReader - Read from an mmap'able file descriptor. // @@ -163,7 +165,7 @@ BytecodeStdinReader::BytecodeStdinReader() { unsigned char Buffer[4096*4]; // Read in all of the data from stdin, we cannot mmap stdin... - while ((BlockSize = read(0 /*stdin*/, Buffer, 4096*4))) { + while ((BlockSize = ::read(0 /*stdin*/, Buffer, 4096*4))) { if (BlockSize == -1) throw std::string("Error reading from stdin!"); @@ -249,7 +251,6 @@ static ModuleProvider *CheckVarargs(ModuleProvider *MP) { return MP; } - //===----------------------------------------------------------------------===// // Wrapper functions //===----------------------------------------------------------------------===// @@ -296,3 +297,5 @@ Module *ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr) { return 0; } } + +} // End llvm namespace diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp index a9aaffe3ec..303672d166 100644 --- a/lib/Bytecode/Writer/ConstantWriter.cpp +++ b/lib/Bytecode/Writer/ConstantWriter.cpp @@ -17,6 +17,8 @@ #include "llvm/SymbolTable.h" #include "llvm/DerivedTypes.h" +namespace llvm { + void BytecodeWriter::outputType(const Type *T) { output_vbr((unsigned)T->getPrimitiveID(), Out); @@ -202,3 +204,5 @@ bool BytecodeWriter::outputConstant(const Constant *CPV) { } return false; } + +} // End llvm namespace diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp index faa576ecb4..d52f24145f 100644 --- a/lib/Bytecode/Writer/InstructionWriter.cpp +++ b/lib/Bytecode/Writer/InstructionWriter.cpp @@ -19,6 +19,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + static Statistic<> NumInstrs("bytecodewriter", "Number of instructions"); @@ -295,3 +297,5 @@ void BytecodeWriter::processInstruction(const Instruction &I) { // operands or a large operand index that we are referring to. outputInstructionFormat0(&I, Opcode, Table, Type, Out); } + +} // End llvm namespace diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index aef71763c4..c6e44e8266 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -27,6 +27,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + #if 0 #define SC_DEBUG(X) std::cerr << X #else @@ -361,3 +363,5 @@ int SlotCalculator::doInsertValue(const Value *D) { SC_DEBUG("]\n"); return (int)DestSlot; } + +} // End llvm namespace diff --git a/lib/Bytecode/Writer/SlotCalculator.h b/lib/Bytecode/Writer/SlotCalculator.h index 7e56de99dc..596f9324ed 100644 --- a/lib/Bytecode/Writer/SlotCalculator.h +++ b/lib/Bytecode/Writer/SlotCalculator.h @@ -22,6 +22,9 @@ #include #include + +namespace llvm { + class Value; class Module; class Function; @@ -92,4 +95,6 @@ protected: void processSymbolTableConstants(const SymbolTable *ST); }; +} // End llvm namespace + #endif diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index 9381e355f0..9c9e1abcdd 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -36,6 +36,8 @@ #include "Config/string.h" #include +namespace llvm { + static RegisterPass X("emitbytecode", "Bytecode Writer"); static Statistic<> @@ -304,3 +306,5 @@ void WriteBytecodeToFile(const Module *C, std::ostream &Out) { Out.flush(); } + +} // End llvm namespace diff --git a/lib/Bytecode/Writer/WriterInternals.h b/lib/Bytecode/Writer/WriterInternals.h index 5564f4238e..8cb4bfd8d6 100644 --- a/lib/Bytecode/Writer/WriterInternals.h +++ b/lib/Bytecode/Writer/WriterInternals.h @@ -25,6 +25,8 @@ #include "llvm/SlotCalculator.h" #include "llvm/Instruction.h" +namespace llvm { + class BytecodeWriter { std::deque &Out; SlotCalculator Table; @@ -79,5 +81,6 @@ public: } }; +} // End llvm namespace #endif diff --git a/lib/CodeGen/InstrSched/InstrScheduling.cpp b/lib/CodeGen/InstrSched/InstrScheduling.cpp index a50439de7f..4e2bf47876 100644 --- a/lib/CodeGen/InstrSched/InstrScheduling.cpp +++ b/lib/CodeGen/InstrSched/InstrScheduling.cpp @@ -22,6 +22,8 @@ #include "Support/CommandLine.h" #include +namespace llvm { + SchedDebugLevel_t SchedDebugLevel; static cl::opt 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/CodeGen/InstrSched/SchedGraph.cpp b/lib/CodeGen/InstrSched/SchedGraph.cpp index e7cd47881a..3a8088043b 100644 --- a/lib/CodeGen/InstrSched/SchedGraph.cpp +++ b/lib/CodeGen/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/CodeGen/InstrSched/SchedGraph.h b/lib/CodeGen/InstrSched/SchedGraph.h index 50cc0520e6..5aee9b25f6 100644 --- a/lib/CodeGen/InstrSched/SchedGraph.h +++ b/lib/CodeGen/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 { } }; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/InstrSched/SchedGraphCommon.cpp b/lib/CodeGen/InstrSched/SchedGraphCommon.cpp index b75e3397cb..d96c201c8a 100644 --- a/lib/CodeGen/InstrSched/SchedGraphCommon.cpp +++ b/lib/CodeGen/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/CodeGen/InstrSched/SchedPriorities.cpp b/lib/CodeGen/InstrSched/SchedPriorities.cpp index 1644d5ecbc..7e05d1417f 100644 --- a/lib/CodeGen/InstrSched/SchedPriorities.cpp +++ b/lib/CodeGen/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/CodeGen/InstrSched/SchedPriorities.h b/lib/CodeGen/InstrSched/SchedPriorities.h index de321f9fcb..7470467806 100644 --- a/lib/CodeGen/InstrSched/SchedPriorities.h +++ b/lib/CodeGen/InstrSched/SchedPriorities.h @@ -26,6 +26,8 @@ #include "Support/hash_set" #include +namespace llvm { + class Function; class MachineInstr; class SchedulingManager; @@ -214,4 +216,6 @@ inline void SchedPriorities::updateTime(cycles_t c) { std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd); +} // End llvm namespace + #endif diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp index 5496502d5e..fd5056d22d 100644 --- a/lib/CodeGen/InstrSelection/InstrForest.cpp +++ b/lib/CodeGen/InstrSelection/InstrForest.cpp @@ -30,6 +30,8 @@ #include "Support/STLExtras.h" #include "Config/alloca.h" +namespace llvm { + //------------------------------------------------------------------------ // class InstrTreeNode //------------------------------------------------------------------------ @@ -330,3 +332,5 @@ InstructionNode* InstrForest::buildTreeForInstruction(Instruction *instr) { delete [] childArray; return treeNode; } + +} // End llvm namespace diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp index 0e3e2cdbf2..760976509c 100644 --- a/lib/CodeGen/InstrSelection/InstrSelection.cpp +++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp @@ -28,6 +28,8 @@ #include "Support/LeakDetector.h" #include +namespace llvm { + std::vector FixConstantOperandsForInstr(Instruction* vmInstr, MachineInstr* minstr, TargetMachine& target); @@ -82,6 +84,8 @@ namespace { }; } +namespace llvm { + TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi, Value *s1, Value *s2, const std::string &name) : Instruction(s1->getType(), Instruction::UserOp1, name) @@ -114,6 +118,7 @@ TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi, LeakDetector::removeGarbageObject(this); } +} // End llvm namespace bool InstructionSelection::runOnFunction(Function &F) { @@ -375,7 +380,6 @@ InstructionSelection::PostprocessMachineCodeForTree(InstructionNode* instrNode, } - //===----------------------------------------------------------------------===// // createInstructionSelectionPass - Public entrypoint for instruction selection // and this file as a whole... @@ -383,3 +387,5 @@ InstructionSelection::PostprocessMachineCodeForTree(InstructionNode* instrNode, FunctionPass *createInstructionSelectionPass(TargetMachine &T) { return new InstructionSelection(T); } + +} // End llvm namespace diff --git a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp index 93f7618641..44a43596ee 100644 --- a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp +++ b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp @@ -25,6 +25,7 @@ #include "llvm/DerivedTypes.h" #include "../../Target/Sparc/SparcInstrSelectionSupport.h" // FIXME! +namespace llvm { // Generate code to load the constant into a TmpInstruction (virtual reg) and // returns the virtual register. @@ -257,3 +258,5 @@ FixConstantOperandsForInstr(Instruction* vmInstr, return MVec; } + +} // End llvm namespace diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 50b90b1fdc..7ec4d32c1e 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -33,6 +33,8 @@ #include "llvm/Support/CFG.h" #include "Support/DepthFirstIterator.h" +namespace llvm { + static RegisterAnalysis X("livevars", "Live Variable Analysis"); const std::pair & @@ -307,3 +309,5 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) { return false; } + +} // End llvm namespace diff --git a/lib/CodeGen/MachineCodeEmitter.cpp b/lib/CodeGen/MachineCodeEmitter.cpp index 6e56594a10..d9b1f7ce45 100644 --- a/lib/CodeGen/MachineCodeEmitter.cpp +++ b/lib/CodeGen/MachineCodeEmitter.cpp @@ -16,6 +16,8 @@ #include "llvm/Function.h" #include +namespace llvm { + namespace { struct DebugMachineCodeEmitter : public MachineCodeEmitter { void startFunction(MachineFunction &F) { @@ -54,18 +56,7 @@ namespace { return 0; } }; -} - - -/// createDebugMachineCodeEmitter - Return a dynamically allocated machine -/// code emitter, which just prints the opcodes and fields out the cout. This -/// can be used for debugging users of the MachineCodeEmitter interface. -/// -MachineCodeEmitter *MachineCodeEmitter::createDebugEmitter() { - return new DebugMachineCodeEmitter(); -} -namespace { class FilePrinterEmitter : public MachineCodeEmitter { std::ofstream actual; std::ostream &o; @@ -169,7 +160,18 @@ namespace { }; } +/// createDebugMachineCodeEmitter - Return a dynamically allocated machine +/// code emitter, which just prints the opcodes and fields out the cout. This +/// can be used for debugging users of the MachineCodeEmitter interface. +/// +MachineCodeEmitter * +MachineCodeEmitter::createDebugEmitter() { + return new DebugMachineCodeEmitter(); +} + MachineCodeEmitter * MachineCodeEmitter::createFilePrinterEmitter(MachineCodeEmitter &MCE) { return new FilePrinterEmitter(MCE, std::cerr); } + +} // End llvm namespace diff --git a/lib/CodeGen/MachineCodeForInstruction.cpp b/lib/CodeGen/MachineCodeForInstruction.cpp index 36bafe2ff9..000f3d175b 100644 --- a/lib/CodeGen/MachineCodeForInstruction.cpp +++ b/lib/CodeGen/MachineCodeForInstruction.cpp @@ -27,6 +27,8 @@ #include "llvm/CodeGen/MachineInstrAnnot.h" #include "llvm/CodeGen/InstrSelection.h" +namespace llvm { + AnnotationID MCFI_AID( AnnotationManager::getID("CodeGen::MachineCodeForInstruction")); @@ -68,3 +70,5 @@ MachineCodeForInstruction::~MachineCodeForInstruction() if (callArgsDesc) delete callArgsDesc; } + +} // End llvm namespace diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index c1eb30a196..790859bc87 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -28,6 +28,8 @@ #include "llvm/Pass.h" #include "Config/limits.h" +namespace llvm { + const int INVALID_FRAME_OFFSET = INT_MAX; // std::numeric_limits::max(); static AnnotationID MF_AID( @@ -414,3 +416,5 @@ MachineFunctionInfo::getOffset(const Value* val) const hash_map::const_iterator pair = offsets.find(val); return (pair == offsets.end()) ? INVALID_FRAME_OFFSET : pair->second; } + +} // End llvm namespace diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 7fb8b4569e..ef31cc4cb3 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -16,6 +16,8 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/MRegisterInfo.h" +namespace llvm { + // Global variable holding an array of descriptors for machine instructions. // The actual object needs to be created separately for each target machine. // This variable is initialized and reset by class TargetInstrInfo. @@ -289,7 +291,7 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const { // Specialize printing if op#0 is definition if (getNumOperands() && (getOperand(0).opIsDefOnly() || getOperand(0).opIsDefAndUse())) { - ::print(getOperand(0), OS, TM); + llvm::print(getOperand(0), OS, TM); OS << " = "; ++StartOp; // Don't print this operand again! } @@ -300,7 +302,7 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const { if (i != StartOp) OS << ","; OS << " "; - ::print(mop, OS, TM); + llvm::print(mop, OS, TM); if (mop.opIsDefAndUse()) OS << ""; @@ -433,3 +435,5 @@ std::ostream &operator<<(std::ostream &OS, const MachineOperand &MO) return OS; } + +} // End llvm namespace diff --git a/lib/CodeGen/MachineInstrAnnot.cpp b/lib/CodeGen/MachineInstrAnnot.cpp index bf4e68e112..b4b41ac176 100644 --- a/lib/CodeGen/MachineInstrAnnot.cpp +++ b/lib/CodeGen/MachineInstrAnnot.cpp @@ -18,6 +18,7 @@ #include "llvm/iOther.h" #include "llvm/Type.h" +namespace llvm { CallArgsDescriptor::CallArgsDescriptor(CallInst* _callInstr, TmpInstruction* _retAddrReg, @@ -76,3 +77,5 @@ CallArgsDescriptor *CallArgsDescriptor::get(const MachineInstr* MI) assert(desc->getCallInst()==callInstr && "Incorrect call args descriptor?"); return desc; } + +} // End llvm namespace diff --git a/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp b/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp index 6318c5ab46..8aaaa2b6b5 100644 --- a/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp +++ b/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.cpp @@ -13,6 +13,8 @@ #include "ModuloSchedGraph.h" #include "llvm/Type.h" +namespace llvm { + ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned id, int index, const Instruction *inst, const TargetMachine &targ) @@ -135,3 +137,4 @@ ModuloSchedGraphSet::~ModuloSchedGraphSet(){ //delete all the graphs } +} // End llvm namespace diff --git a/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h b/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h index 214e24cc8b..552d699e76 100644 --- a/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h +++ b/lib/CodeGen/ModuloScheduling/ModuloSchedGraph.h @@ -22,6 +22,7 @@ #include "Support/hash_map" #include +namespace llvm { class ModuloSchedGraphNode : public SchedGraphNodeCommon { @@ -106,4 +107,6 @@ public: }; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp b/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp index 91ec6c28f5..219d892d31 100644 --- a/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp +++ b/lib/CodeGen/ModuloScheduling/ModuloScheduling.cpp @@ -16,6 +16,8 @@ #include "llvm/Function.h" #include "llvm/Pass.h" +namespace llvm { + namespace { class ModuloScheduling : public FunctionPass { @@ -40,3 +42,5 @@ bool ModuloScheduling::runOnFunction(Function &F) { bool Changed = false; return Changed; } + +} // End llvm namespace diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index 5a988bafe3..c4b811aef6 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/lib/CodeGen/PHIElimination.cpp @@ -21,6 +21,8 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/CFG.h" +namespace llvm { + namespace { struct PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { @@ -52,6 +54,7 @@ namespace { "Eliminate PHI nodes for register allocation"); } + const PassInfo *PHIEliminationID = X.getPassInfo(); /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in @@ -260,3 +263,5 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) { return true; } + +} // End llvm namespace diff --git a/lib/CodeGen/Passes.cpp b/lib/CodeGen/Passes.cpp index 7a51a53ad8..239eacde4c 100644 --- a/lib/CodeGen/Passes.cpp +++ b/lib/CodeGen/Passes.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/Passes.h" #include "Support/CommandLine.h" +namespace llvm { + namespace { enum RegAllocName { simple, local }; @@ -40,3 +42,5 @@ FunctionPass *createRegisterAllocator() return 0; // not reached } } + +} // End llvm namespace diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index a60b8b127b..8fc9b5b2c2 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -25,6 +25,8 @@ #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" +namespace llvm { + namespace { struct PEI : public MachineFunctionPass { const char *getPassName() const { @@ -66,6 +68,7 @@ namespace { }; } + /// createPrologEpilogCodeInserter - This function returns a pass that inserts /// prolog and epilog code, and eliminates abstract frame references. /// @@ -258,3 +261,5 @@ void PEI::replaceFrameIndices(MachineFunction &Fn) { break; } } + +} // End llvm namespace diff --git a/lib/CodeGen/RegAlloc/AllocInfo.h b/lib/CodeGen/RegAlloc/AllocInfo.h index f83f2103be..67f58a7ed0 100644 --- a/lib/CodeGen/RegAlloc/AllocInfo.h +++ b/lib/CodeGen/RegAlloc/AllocInfo.h @@ -19,6 +19,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" +namespace llvm { + /// AllocInfo - Structure representing one instruction's operand's-worth of /// register allocation state. We create tables made out of these data /// structures to generate mapping information for this register allocator. @@ -77,4 +79,6 @@ struct AllocInfo { } }; +} // End llvm namespace + #endif // ALLOCINFO_H diff --git a/lib/CodeGen/RegAlloc/IGNode.cpp b/lib/CodeGen/RegAlloc/IGNode.cpp index f883fb13c1..a76fdeaa03 100644 --- a/lib/CodeGen/RegAlloc/IGNode.cpp +++ b/lib/CodeGen/RegAlloc/IGNode.cpp @@ -16,6 +16,8 @@ #include #include +namespace llvm { + //----------------------------------------------------------------------------- // Sets this IGNode on stack and reduce the degree of neighbors //----------------------------------------------------------------------------- @@ -56,3 +58,5 @@ IGNode::getCombinedDegree(const IGNode* otherNode) const { std::vector::iterator new_end = unique(nbrs.begin(), nbrs.end()); return new_end - nbrs.begin(); } + +} // End llvm namespace diff --git a/lib/CodeGen/RegAlloc/IGNode.h b/lib/CodeGen/RegAlloc/IGNode.h index 82f07e0c7e..9fdc7a6ac0 100644 --- a/lib/CodeGen/RegAlloc/IGNode.h +++ b/lib/CodeGen/RegAlloc/IGNode.h @@ -32,6 +32,9 @@ #include "LiveRange.h" #include + +namespace llvm { + class RegClass; //---------------------------------------------------------------------------- @@ -115,4 +118,6 @@ public: inline LiveRange *getParentLR() const { return ParentLR; } }; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/RegAlloc/InterferenceGraph.cpp b/lib/CodeGen/RegAlloc/InterferenceGraph.cpp index 392a96c11c..3cef19ea0e 100644 --- a/lib/CodeGen/RegAlloc/InterferenceGraph.cpp +++ b/lib/CodeGen/RegAlloc/InterferenceGraph.cpp @@ -17,6 +17,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + // for asserting this IG node is infact in the IGNodeList of this class inline static void assertIGNode(const InterferenceGraph *IG, const IGNode *Node) { @@ -246,3 +248,5 @@ void InterferenceGraph::printIGNodeList() const { } } } + +} // End llvm namespace diff --git a/lib/CodeGen/RegAlloc/InterferenceGraph.h b/lib/CodeGen/RegAlloc/InterferenceGraph.h index 6b8cf3cd05..79850c1fcf 100644 --- a/lib/CodeGen/RegAlloc/InterferenceGraph.h +++ b/lib/CodeGen/RegAlloc/InterferenceGraph.h @@ -30,6 +30,9 @@ #define INTERFERENCEGRAPH_H #include + +namespace llvm { + class LiveRange; class RegClass; class IGNode; @@ -67,4 +70,6 @@ class InterferenceGraph { void printIGNodeList() const; }; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/RegAlloc/LiveRange.h b/lib/CodeGen/RegAlloc/LiveRange.h index aa409c63fb..d6e2cf6307 100644 --- a/lib/CodeGen/RegAlloc/LiveRange.h +++ b/lib/CodeGen/RegAlloc/LiveRange.h @@ -21,6 +21,8 @@ #include "llvm/Value.h" #include "llvm/CodeGen/ValueSet.h" +namespace llvm { + class RegClass; class IGNode; @@ -177,4 +179,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp index b9fcda789f..9fd04d2b0e 100644 --- a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp +++ b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp @@ -23,6 +23,8 @@ #include "llvm/Target/TargetRegInfo.h" #include "Support/SetOperations.h" +namespace llvm { + unsigned LiveRange::getRegClassID() const { return getRegClass()->getID(); } LiveRangeInfo::LiveRangeInfo(const Function *F, const TargetMachine &tm, @@ -411,3 +413,5 @@ void LiveRangeInfo::printLiveRanges() { } } } + +} // End llvm namespace diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.h b/lib/CodeGen/RegAlloc/LiveRangeInfo.h index 5c5244bd62..a8d0e7152f 100644 --- a/lib/CodeGen/RegAlloc/LiveRangeInfo.h +++ b/lib/CodeGen/RegAlloc/LiveRangeInfo.h @@ -29,6 +29,8 @@ #include "llvm/CodeGen/ValueSet.h" #include "Support/hash_map" +namespace llvm { + class LiveRange; class MachineInstr; class RegClass; @@ -121,4 +123,6 @@ public: void printLiveRanges(); }; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp index 99917cdf0b..332ae9524c 100644 --- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp +++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp @@ -47,6 +47,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + RegAllocDebugLevel_t DEBUG_RA; /// The reoptimizer wants to be able to grovel through the register @@ -1392,3 +1394,5 @@ bool PhyRegAlloc::runOnFunction (Function &F) { if (DEBUG_RA) std::cerr << "\nRegister allocation complete!\n"; return false; // Function was not modified } + +} // End llvm namespace diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.h b/lib/CodeGen/RegAlloc/PhyRegAlloc.h index c524f9f56c..4ec083c8ea 100644 --- a/lib/CodeGen/RegAlloc/PhyRegAlloc.h +++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.h @@ -31,6 +31,8 @@ #include "llvm/Target/TargetRegInfo.h" #include +namespace llvm { + class MachineFunction; class FunctionLiveVarInfo; class MachineInstr; @@ -179,4 +181,6 @@ private: void addInterf4PseudoInstr(const MachineInstr *MI); }; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/RegAlloc/RegAllocCommon.h b/lib/CodeGen/RegAlloc/RegAllocCommon.h index 97d102a253..7dd86b205a 100644 --- a/lib/CodeGen/RegAlloc/RegAllocCommon.h +++ b/lib/CodeGen/RegAlloc/RegAllocCommon.h @@ -14,6 +14,8 @@ #ifndef REGALLOCCOMMON_H #define REGALLOCCOMMON_H +namespace llvm { + enum RegAllocDebugLevel_t { RA_DEBUG_None = 0, RA_DEBUG_Results = 1, @@ -25,4 +27,6 @@ enum RegAllocDebugLevel_t { extern RegAllocDebugLevel_t DEBUG_RA; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/RegAlloc/RegClass.cpp b/lib/CodeGen/RegAlloc/RegClass.cpp index 9c8603b82c..9af87ba0e8 100644 --- a/lib/CodeGen/RegAlloc/RegClass.cpp +++ b/lib/CodeGen/RegAlloc/RegClass.cpp @@ -16,6 +16,8 @@ #include "RegClass.h" #include "llvm/Target/TargetRegInfo.h" +namespace llvm { + //---------------------------------------------------------------------------- // This constructor inits IG. The actual matrix is created by a call to // createInterferenceGraph() above. @@ -245,4 +247,4 @@ void RegClass::printIG() { IG.printIG(); } - +} // End llvm namespace diff --git a/lib/CodeGen/RegAlloc/RegClass.h b/lib/CodeGen/RegAlloc/RegClass.h index c861fbae21..0071f7c212 100644 --- a/lib/CodeGen/RegAlloc/RegClass.h +++ b/lib/CodeGen/RegAlloc/RegClass.h @@ -20,6 +20,9 @@ #include "llvm/Target/TargetRegInfo.h" #include "InterferenceGraph.h" #include + +namespace llvm { + class TargetRegClassInfo; @@ -139,4 +142,6 @@ class RegClass { void printIG(); }; +} // End llvm namespace + #endif diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index 8d19b69471..080e6c69c0 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumSpilled ("ra-local", "Number of registers spilled"); Statistic<> NumReloaded("ra-local", "Number of registers reloaded"); @@ -203,7 +205,6 @@ namespace { }; } - /// getStackSpaceFor - This allocates space for the specified virtual register /// to be held on the stack. int RA::getStackSpaceFor(unsigned VirtReg, const TargetRegisterClass *RC) { @@ -674,3 +675,5 @@ bool RA::runOnMachineFunction(MachineFunction &Fn) { FunctionPass *createLocalRegisterAllocator() { return new RA(); } + +} // End llvm namespace diff --git a/lib/CodeGen/RegAllocSimple.cpp b/lib/CodeGen/RegAllocSimple.cpp index a210790b8d..202123ad10 100644 --- a/lib/CodeGen/RegAllocSimple.cpp +++ b/lib/CodeGen/RegAllocSimple.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumSpilled ("ra-simple", "Number of registers spilled"); Statistic<> NumReloaded("ra-simple", "Number of registers reloaded"); @@ -234,3 +236,5 @@ bool RegAllocSimple::runOnMachineFunction(MachineFunction &Fn) { FunctionPass *createSimpleRegisterAllocator() { return new RegAllocSimple(); } + +} // End llvm namespace diff --git a/lib/CodeGen/SelectionDAG/DAGBuilder.cpp b/lib/CodeGen/SelectionDAG/DAGBuilder.cpp index a972ddf602..fd4e7a90c7 100644 --- a/lib/CodeGen/SelectionDAG/DAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/DAGBuilder.cpp @@ -21,6 +21,8 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/InstVisitor.h" +namespace llvm { + struct SelectionDAGBuilder : public InstVisitor { // DAG - the current dag we are building. SelectionDAG &DAG; @@ -270,3 +272,5 @@ SelectionDAG::SelectionDAG(MachineFunction &f, const TargetMachine &tm, SDB.visitBB(const_cast(*I)); Root = SDB.CurRoot; } + +} // End llvm namespace diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 58a9639c92..db5941060d 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/Type.h" +namespace llvm { + SelectionDAG::~SelectionDAG() { for (unsigned i = 0, e = AllNodes.size(); i != e; ++i) delete AllNodes[i]; @@ -126,3 +128,5 @@ void SelectionDAGNode::printit(unsigned Offset, unsigned &LastID, std::cerr << "\n"; } + +} // End llvm namespace diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index dd647247c3..b7da23ca71 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -27,6 +27,8 @@ #include "Support/DynamicLinker.h" #include "Config/dlfcn.h" +namespace llvm { + Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized"); ExecutionEngine::ExecutionEngine(ModuleProvider *P) : @@ -390,3 +392,4 @@ void ExecutionEngine::emitGlobals() { InitializeMemory(I->getInitializer(), GlobalAddress[I]); } +} // End llvm namespace diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index b04f974911..aa32983cc3 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -18,12 +18,14 @@ #include "Support/Statistic.h" #include // For fmod -Interpreter *TheEE = 0; +namespace llvm { namespace { Statistic<> NumDynamicInsts("lli", "Number of dynamic instructions executed"); } +Interpreter *TheEE = 0; + //===----------------------------------------------------------------------===// // Value Manipulation code //===----------------------------------------------------------------------===// @@ -910,3 +912,5 @@ void Interpreter::run() { visit(I); // Dispatch to one of the visit* methods... } } + +} // End llvm namespace diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index ecf19c2f8d..f516f5de23 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -32,6 +32,8 @@ #include using std::vector; +namespace llvm { + typedef GenericValue (*ExFunc)(FunctionType *, const vector &); static std::map Functions; static std::map FuncNames; @@ -767,3 +769,5 @@ void Interpreter::initializeExternalFunctions() { FuncNames["lle_X_llvm.va_end"] = llvm_va_end; FuncNames["lle_X_llvm.va_copy"] = llvm_va_copy; } + +} // End llvm namespace diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/lib/ExecutionEngine/Interpreter/Interpreter.cpp index bcaa8569dc..bb14cd2ee8 100644 --- a/lib/ExecutionEngine/Interpreter/Interpreter.cpp +++ b/lib/ExecutionEngine/Interpreter/Interpreter.cpp @@ -17,6 +17,8 @@ #include "llvm/Module.h" #include "llvm/DerivedTypes.h" +namespace llvm { + /// create - Create a new interpreter object. This can never fail. /// ExecutionEngine *Interpreter::create(Module *M){ @@ -97,3 +99,5 @@ GenericValue Interpreter::run(Function *F, rv.IntVal = ExitCode; return rv; } + +} // End llvm namespace diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.h b/lib/ExecutionEngine/Interpreter/Interpreter.h index 00784adb71..e9015a203e 100644 --- a/lib/ExecutionEngine/Interpreter/Interpreter.h +++ b/lib/ExecutionEngine/Interpreter/Interpreter.h @@ -22,6 +22,8 @@ #include "llvm/Target/TargetData.h" #include "Support/DataTypes.h" +namespace llvm { + struct FunctionInfo; // Defined in ExecutionAnnotations.h // AllocaHolder - Object to track all of the blocks of memory allocated by @@ -166,4 +168,6 @@ private: // Helper functions void popStackAndReturnValueToCaller(const Type *RetTy, GenericValue Result); }; +} // End llvm namespace + #endif diff --git a/lib/ExecutionEngine/JIT/Intercept.cpp b/lib/ExecutionEngine/JIT/Intercept.cpp index 6162e938ab..191b57d22a 100644 --- a/lib/ExecutionEngine/JIT/Intercept.cpp +++ b/lib/ExecutionEngine/JIT/Intercept.cpp @@ -19,6 +19,8 @@ #include "Support/DynamicLinker.h" #include +namespace llvm { + // AtExitHandlers - List of functions to call when the program exits, // registered with the atexit() library function. static std::vector AtExitHandlers; @@ -75,3 +77,5 @@ void *VM::getPointerToNamedFunction(const std::string &Name) { return Ptr; } + +} // End llvm namespace diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index fedb6e46b0..61d9629d93 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -24,6 +24,8 @@ #define NO_JITS_ENABLED #endif +namespace llvm { + namespace { enum ArchName { x86, Sparc }; @@ -118,3 +120,5 @@ GenericValue VM::run(Function *F, const std::vector &ArgValues) rv.IntVal = ExitCode; return rv; } + +} // End llvm namespace diff --git a/lib/ExecutionEngine/JIT/JIT.h b/lib/ExecutionEngine/JIT/JIT.h index 685c4bd053..9a17c967c7 100644 --- a/lib/ExecutionEngine/JIT/JIT.h +++ b/lib/ExecutionEngine/JIT/JIT.h @@ -18,6 +18,8 @@ #include "llvm/PassManager.h" #include +namespace llvm { + class Function; class GlobalValue; class Constant; @@ -78,4 +80,6 @@ private: void runJITOnFunction (Function *F); }; +} // End llvm namespace + #endif diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 98f526a5f5..32d0651f22 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -27,6 +27,8 @@ #include "Config/unistd.h" #include "Config/sys/mman.h" +namespace llvm { + namespace { Statistic<> NumBytes("jit", "Number of bytes of machine code compiled"); VM *TheVM = 0; @@ -265,3 +267,5 @@ extern "C" { return TheVM->getPointerToNamedFunction(Name); } } + +} // End llvm namespace diff --git a/lib/ExecutionEngine/JIT/VM.cpp b/lib/ExecutionEngine/JIT/VM.cpp index 2dda271fa0..d7e7685978 100644 --- a/lib/ExecutionEngine/JIT/VM.cpp +++ b/lib/ExecutionEngine/JIT/VM.cpp @@ -19,6 +19,8 @@ #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/Target/TargetMachine.h" +namespace llvm { + VM::~VM() { delete MCE; delete &TM; @@ -98,3 +100,5 @@ void *VM::recompileAndRelinkFunction(Function *F) { TM.replaceMachineCodeForFunction (OldAddr, Addr); return Addr; } + +} // End llvm namespace diff --git a/lib/ExecutionEngine/JIT/VM.h b/lib/ExecutionEngine/JIT/VM.h index 685c4bd053..9a17c967c7 100644 --- a/lib/ExecutionEngine/JIT/VM.h +++ b/lib/ExecutionEngine/JIT/VM.h @@ -18,6 +18,8 @@ #include "llvm/PassManager.h" #include +namespace llvm { + class Function; class GlobalValue; class Constant; @@ -78,4 +80,6 @@ private: void runJITOnFunction (Function *F); }; +} // End llvm namespace + #endif diff --git a/lib/Linker/LinkArchives.cpp b/lib/Linker/LinkArchives.cpp index 06f0635749..9c22891775 100644 --- a/lib/Linker/LinkArchives.cpp +++ b/lib/Linker/LinkArchives.cpp @@ -30,6 +30,8 @@ #include #include +namespace llvm { + /// FindLib - Try to convert Filename into the name of a file that we can open, /// if it does not already name a file we can open, by first trying to open /// Filename, then libFilename. for each of a set of several common @@ -405,3 +407,5 @@ bool LinkLibraries(const char *progname, return false; } + +} // End llvm namespace diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 0be840fb6c..4bc78a4cde 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -23,6 +23,8 @@ #include "llvm/iOther.h" #include "llvm/Constants.h" +namespace llvm { + // Error - Simple wrapper function to conditionally assign to E and return true. // This just makes error return conditions a little bit simpler... // @@ -902,3 +904,4 @@ bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { return false; } +} // End llvm namespace diff --git a/lib/Support/Annotation.cpp b/lib/Support/Annotation.cpp index 890b18de06..b88624dd1f 100644 --- a/lib/Support/Annotation.cpp +++ b/lib/Support/Annotation.cpp @@ -14,6 +14,8 @@ #include #include "Support/Annotation.h" +namespace llvm { + typedef std::map IDMapType; static unsigned IDCounter = 0; // Unique ID counter @@ -94,3 +96,5 @@ Annotation *AnnotationManager::createAnnotation(AnnotationID ID, if (I == getFactMap().end()) return 0; return I->second.first(ID, Obj, I->second.second); } + +} // End llvm namespace diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index de895c9117..235dc12843 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -24,6 +24,8 @@ #include #include +namespace llvm { + using namespace cl; //===----------------------------------------------------------------------===// @@ -887,3 +889,5 @@ HHOp("help-hidden", cl::desc("display all available options"), cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed); } // End anonymous namespace + +} // End llvm namespace diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index a9e1204de5..e180f12a1a 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -26,6 +26,8 @@ #include "llvm/Instruction.h" #include "llvm/ConstantHandling.h" +namespace llvm { + /// Initialize a full (the default) or empty set for the specified type. /// ConstantRange::ConstantRange(const Type *Ty, bool Full) { @@ -248,3 +250,5 @@ void ConstantRange::print(std::ostream &OS) const { void ConstantRange::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/lib/Support/Debug.cpp b/lib/Support/Debug.cpp index 895abbb1f7..1af23380a2 100644 --- a/lib/Support/Debug.cpp +++ b/lib/Support/Debug.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include "Support/CommandLine.h" +namespace llvm { + bool DebugFlag; // DebugFlag - Exported boolean set by the -debug option namespace { @@ -62,3 +64,5 @@ bool isCurrentDebugType(const char *DebugType) { return false; #endif } + +} // End llvm namespace diff --git a/lib/Support/DynamicLinker.cpp b/lib/Support/DynamicLinker.cpp index 74b3603679..1c9385eea7 100644 --- a/lib/Support/DynamicLinker.cpp +++ b/lib/Support/DynamicLinker.cpp @@ -23,6 +23,8 @@ #include "Config/dlfcn.h" #include +namespace llvm { + bool LinkDynamicObject (const char *filename, std::string *ErrorMessage) { #if defined (HAVE_DLOPEN) if (dlopen (filename, RTLD_NOW | RTLD_GLOBAL) == 0) { @@ -52,3 +54,5 @@ void *GetAddressOfSymbol (const char *symbolName) { void *GetAddressOfSymbol (const std::string &symbolName) { return GetAddressOfSymbol (symbolName.c_str ()); } + +} // End llvm namespace diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp index 3262ecce31..cde288925b 100644 --- a/lib/Support/FileUtilities.cpp +++ b/lib/Support/FileUtilities.cpp @@ -20,6 +20,9 @@ #include #include +namespace llvm +{ + /// CheckMagic - Returns true IFF the file named FN begins with Magic. FN must /// name a readable file. /// @@ -182,3 +185,5 @@ bool MakeFileExecutable (const std::string &Filename) { bool MakeFileReadable (const std::string &Filename) { return AddPermissionsBits (Filename, 0444); } + +} // End llvm namespace diff --git a/lib/Support/LeakDetector.cpp b/lib/Support/LeakDetector.cpp index 24c946ab6e..ffb081a998 100644 --- a/lib/Support/LeakDetector.cpp +++ b/lib/Support/LeakDetector.cpp @@ -15,6 +15,8 @@ #include "llvm/Value.h" #include +namespace llvm { + // Lazily allocate set so that release build doesn't have to do anything. static std::set *Objects = 0; static std::set *LLVMObjects = 0; @@ -87,3 +89,5 @@ void LeakDetector::checkForGarbageImpl(const std::string &Message) { Objects = 0; LLVMObjects = 0; } } + +} // End llvm namespace diff --git a/lib/Support/Mangler.cpp b/lib/Support/Mangler.cpp index 44c697d3d8..567fe05e32 100644 --- a/lib/Support/Mangler.cpp +++ b/lib/Support/Mangler.cpp @@ -16,6 +16,8 @@ #include "llvm/Type.h" #include "Support/StringExtras.h" +namespace llvm { + static char HexDigit(int V) { return V < 10 ? V+'0' : V+'A'-10; } @@ -99,3 +101,4 @@ Mangler::Mangler(Module &m, bool addUnderscorePrefix) FoundNames.insert(I->getName()); // Otherwise, keep track of name } +} // End llvm namespace diff --git a/lib/Support/PluginLoader.cpp b/lib/Support/PluginLoader.cpp index 1582a10c65..1729bb3365 100644 --- a/lib/Support/PluginLoader.cpp +++ b/lib/Support/PluginLoader.cpp @@ -23,6 +23,8 @@ #include "Config/link.h" #include +namespace llvm { + namespace { struct PluginLoader { void operator=(const std::string &Filename) { @@ -38,3 +40,5 @@ namespace { static cl::opt > LoadOpt("load", cl::ZeroOrMore, cl::value_desc("plugin.so"), cl::desc("Load the specified plugin")); + +} // End llvm namespace diff --git a/lib/Support/Signals.cpp b/lib/Support/Signals.cpp index efc5f71257..73decfd89b 100644 --- a/lib/Support/Signals.cpp +++ b/lib/Support/Signals.cpp @@ -20,6 +20,8 @@ #include #include "Config/config.h" // Get the signal handler return type +namespace llvm { + static std::vector FilesToRemove; // IntSigs - Signals that may interrupt the program at any time. @@ -62,3 +64,5 @@ void RemoveFileOnSignal(const std::string &Filename) { std::for_each(IntSigs, IntSigsEnd, RegisterHandler); std::for_each(KillSigs, KillSigsEnd, RegisterHandler); } + +} // End llvm namespace diff --git a/lib/Support/Statistic.cpp b/lib/Support/Statistic.cpp index c60a85cdeb..3ac2bf97fb 100644 --- a/lib/Support/Statistic.cpp +++ b/lib/Support/Statistic.cpp @@ -27,8 +27,10 @@ #include #include +namespace llvm { + // GetLibSupportInfoOutputFile - Return a file stream to print our output on... -std::ostream *GetLibSupportInfoOutputFile(); +extern std::ostream *GetLibSupportInfoOutputFile(); unsigned StatisticBase::NumStats = 0; @@ -104,3 +106,5 @@ void StatisticBase::destroy() const { delete OutStream; // Close the file... } } + +} // End llvm namespace diff --git a/lib/Support/SystemUtils.cpp b/lib/Support/SystemUtils.cpp index 8c009ffb57..ec535ad45a 100644 --- a/lib/Support/SystemUtils.cpp +++ b/lib/Support/SystemUtils.cpp @@ -24,6 +24,8 @@ #include "Config/unistd.h" #include "Config/errno.h" +namespace llvm { + /// isExecutableFile - This function returns true if the filename specified /// exists and is executable. /// @@ -272,3 +274,4 @@ ExecWait (const char * const old_argv[], const char * const old_envp[]) return 1; } +} // End llvm namespace diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp index 5e84f38852..d14a225fcf 100644 --- a/lib/Support/Timer.cpp +++ b/lib/Support/Timer.cpp @@ -23,6 +23,8 @@ #include #include +namespace llvm { + // getLibSupportInfoOutputFilename - This ugly hack is brought to you courtesy // of constructor/destructor ordering being unspecified by C++. Basically the // problem is that a Statistic<> object gets destroyed, which ends up calling @@ -265,7 +267,8 @@ void Timer::print(const Timer &Total, std::ostream &OS) { } // GetLibSupportInfoOutputFile - Return a file stream to print our output on... -std::ostream *GetLibSupportInfoOutputFile() { +std::ostream * +GetLibSupportInfoOutputFile() { std::string &LibSupportInfoOutputFilename = getLibSupportInfoOutputFilename(); if (LibSupportInfoOutputFilename.empty()) return &std::cerr; @@ -349,3 +352,5 @@ void TimerGroup::removeTimer() { DefaultTimerGroup = 0; } } + +} // End llvm namespace diff --git a/lib/Support/ToolRunner.cpp b/lib/Support/ToolRunner.cpp index a66b868c22..50a9ad21c8 100644 --- a/lib/Support/ToolRunner.cpp +++ b/lib/Support/ToolRunner.cpp @@ -18,6 +18,8 @@ #include #include +namespace llvm { + //===---------------------------------------------------------------------===// // LLI Implementation of AbstractIntepreter interface // @@ -391,3 +393,5 @@ GCC *GCC::create(const std::string &ProgramPath, std::string &Message) { Message = "Found gcc: " + GCCPath + "\n"; return new GCC(GCCPath); } + +} // End llvm namespace diff --git a/lib/Support/ValueHolder.cpp b/lib/Support/ValueHolder.cpp index 8661402b06..77fdaf6b44 100644 --- a/lib/Support/ValueHolder.cpp +++ b/lib/Support/ValueHolder.cpp @@ -18,6 +18,10 @@ #include "llvm/Support/ValueHolder.h" #include "llvm/Type.h" +namespace llvm { + ValueHolder::ValueHolder(Value *V) : User(Type::TypeTy, Value::TypeVal) { Operands.push_back(Use(V, this)); } + +} // End llvm namespace 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 #include +namespace llvm { + namespace { class CWriter : public Pass, public InstVisitor { 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(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 #include +namespace llvm { + namespace { class CWriter : public Pass, public InstVisitor { 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(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 +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 +namespace llvm { + SchedDebugLevel_t SchedDebugLevel; static cl::opt 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 { } }; +} // 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 +namespace llvm { + class Function; class MachineInstr; class SchedulingManager; @@ -214,4 +216,6 @@ inline void SchedPriorities::updateTime(cycles_t c) { std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd); +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp index 5496502d5e..fd5056d22d 100644 --- a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp +++ b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp @@ -30,6 +30,8 @@ #include "Support/STLExtras.h" #include "Config/alloca.h" +namespace llvm { + //------------------------------------------------------------------------ // class InstrTreeNode //------------------------------------------------------------------------ @@ -330,3 +332,5 @@ InstructionNode* InstrForest::buildTreeForInstruction(Instruction *instr) { delete [] childArray; return treeNode; } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp index 0e3e2cdbf2..760976509c 100644 --- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp +++ b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp @@ -28,6 +28,8 @@ #include "Support/LeakDetector.h" #include +namespace llvm { + std::vector FixConstantOperandsForInstr(Instruction* vmInstr, MachineInstr* minstr, TargetMachine& target); @@ -82,6 +84,8 @@ namespace { }; } +namespace llvm { + TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi, Value *s1, Value *s2, const std::string &name) : Instruction(s1->getType(), Instruction::UserOp1, name) @@ -114,6 +118,7 @@ TmpInstruction::TmpInstruction(MachineCodeForInstruction& mcfi, LeakDetector::removeGarbageObject(this); } +} // End llvm namespace bool InstructionSelection::runOnFunction(Function &F) { @@ -375,7 +380,6 @@ InstructionSelection::PostprocessMachineCodeForTree(InstructionNode* instrNode, } - //===----------------------------------------------------------------------===// // createInstructionSelectionPass - Public entrypoint for instruction selection // and this file as a whole... @@ -383,3 +387,5 @@ InstructionSelection::PostprocessMachineCodeForTree(InstructionNode* instrNode, FunctionPass *createInstructionSelectionPass(TargetMachine &T) { return new InstructionSelection(T); } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp index 93f7618641..44a43596ee 100644 --- a/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp +++ b/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp @@ -25,6 +25,7 @@ #include "llvm/DerivedTypes.h" #include "../../Target/Sparc/SparcInstrSelectionSupport.h" // FIXME! +namespace llvm { // Generate code to load the constant into a TmpInstruction (virtual reg) and // returns the virtual register. @@ -257,3 +258,5 @@ FixConstantOperandsForInstr(Instruction* vmInstr, return MVec; } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp index 68eaebf7d2..758f1b1539 100644 --- a/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp +++ b/lib/Target/SparcV9/LiveVar/BBLiveVar.cpp @@ -21,6 +21,7 @@ /// BROKEN: Should not include sparc stuff directly into here #include "../../Target/Sparc/SparcInternals.h" // Only for PHI defn +namespace llvm { BBLiveVar::BBLiveVar(const BasicBlock &bb, MachineBasicBlock &mbb, unsigned id) : BB(bb), MBB(mbb), POID(id) { @@ -229,6 +230,4 @@ void BBLiveVar::printInOutSets() const { std::cerr << " Out: "; printSet(OutSet); std::cerr << "\n"; } - - - +} // End llvm namespace diff --git a/lib/Target/SparcV9/LiveVar/BBLiveVar.h b/lib/Target/SparcV9/LiveVar/BBLiveVar.h index 33a4faf2b1..781143a93d 100644 --- a/lib/Target/SparcV9/LiveVar/BBLiveVar.h +++ b/lib/Target/SparcV9/LiveVar/BBLiveVar.h @@ -17,6 +17,9 @@ #include "llvm/CodeGen/ValueSet.h" #include "Support/hash_map" + +namespace llvm { + class BasicBlock; class Value; class MachineBasicBlock; @@ -82,4 +85,6 @@ public: void printInOutSets() const; // for printing In/Out sets }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp index 588ec646da..8f0e31811a 100644 --- a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp +++ b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp @@ -23,6 +23,8 @@ #include "Support/CommandLine.h" #include "BBLiveVar.h" +namespace llvm { + static RegisterAnalysis X("livevar", "Live Variable Analysis"); @@ -318,3 +320,5 @@ void FunctionLiveVarInfo::calcLiveVarSetsForBB(const BasicBlock *BB) { SetAI = NewSet; } } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/LiveVar/ValueSet.cpp b/lib/Target/SparcV9/LiveVar/ValueSet.cpp index ba944cb8cc..fd8289675a 100644 --- a/lib/Target/SparcV9/LiveVar/ValueSet.cpp +++ b/lib/Target/SparcV9/LiveVar/ValueSet.cpp @@ -11,6 +11,8 @@ #include "llvm/Value.h" #include +namespace llvm { + std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value const Value &v = V.V; if (v.hasName()) @@ -26,3 +28,4 @@ void printSet(const ValueSet &S) { std::cerr << RAV(*I); } +} // End llvm namespace diff --git a/lib/Target/SparcV9/MachineCodeForInstruction.h b/lib/Target/SparcV9/MachineCodeForInstruction.h index d421f3e971..9a08de79af 100644 --- a/lib/Target/SparcV9/MachineCodeForInstruction.h +++ b/lib/Target/SparcV9/MachineCodeForInstruction.h @@ -28,6 +28,8 @@ #include "Support/Annotation.h" #include +namespace llvm { + class MachineInstr; class Instruction; class Value; @@ -96,4 +98,6 @@ public: CallArgsDescriptor* getCallArgsDescriptor() const { return callArgsDesc; } }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/MachineFunctionInfo.h b/lib/Target/SparcV9/MachineFunctionInfo.h index db73322278..fdf135b16b 100644 --- a/lib/Target/SparcV9/MachineFunctionInfo.h +++ b/lib/Target/SparcV9/MachineFunctionInfo.h @@ -17,6 +17,9 @@ #include "Support/HashExtras.h" #include "Support/hash_set" + +namespace llvm { + class MachineFunction; class Value; class Constant; @@ -112,4 +115,6 @@ private: int allocateOptionalArg(const Type* type); }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/MachineInstrAnnot.h b/lib/Target/SparcV9/MachineInstrAnnot.h index 98dde590b8..19d93ab56a 100644 --- a/lib/Target/SparcV9/MachineInstrAnnot.h +++ b/lib/Target/SparcV9/MachineInstrAnnot.h @@ -17,6 +17,8 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Target/TargetRegInfo.h" +namespace llvm { + class Value; class TmpInstruction; class CallInst; @@ -88,5 +90,6 @@ public: static CallArgsDescriptor *get(const MachineInstr* MI); }; +} // End llvm namespace #endif diff --git a/lib/Target/SparcV9/MappingInfo.cpp b/lib/Target/SparcV9/MappingInfo.cpp index db03f13b97..2afde6bdf5 100644 --- a/lib/Target/SparcV9/MappingInfo.cpp +++ b/lib/Target/SparcV9/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/lib/Target/SparcV9/MappingInfo.h b/lib/Target/SparcV9/MappingInfo.h index f86e2b42b7..6af116a6da 100644 --- a/lib/Target/SparcV9/MappingInfo.h +++ b/lib/Target/SparcV9/MappingInfo.h @@ -18,6 +18,9 @@ #include #include #include + +namespace llvm { + class Pass; Pass *getMappingInfoAsmPrinterPass(std::ostream &out); @@ -41,4 +44,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/ModuloScheduling/ModuloSchedGraph.cpp b/lib/Target/SparcV9/ModuloScheduling/ModuloSchedGraph.cpp index 6318c5ab46..8aaaa2b6b5 100644 --- a/lib/Target/SparcV9/ModuloScheduling/ModuloSchedGraph.cpp +++ b/lib/Target/SparcV9/ModuloScheduling/ModuloSchedGraph.cpp @@ -13,6 +13,8 @@ #include "ModuloSchedGraph.h" #include "llvm/Type.h" +namespace llvm { + ModuloSchedGraphNode::ModuloSchedGraphNode(unsigned id, int index, const Instruction *inst, const TargetMachine &targ) @@ -135,3 +137,4 @@ ModuloSchedGraphSet::~ModuloSchedGraphSet(){ //delete all the graphs } +} // End llvm namespace diff --git a/lib/Target/SparcV9/ModuloScheduling/ModuloSchedGraph.h b/lib/Target/SparcV9/ModuloScheduling/ModuloSchedGraph.h index 214e24cc8b..552d699e76 100644 --- a/lib/Target/SparcV9/ModuloScheduling/ModuloSchedGraph.h +++ b/lib/Target/SparcV9/ModuloScheduling/ModuloSchedGraph.h @@ -22,6 +22,7 @@ #include "Support/hash_map" #include +namespace llvm { class ModuloSchedGraphNode : public SchedGraphNodeCommon { @@ -106,4 +107,6 @@ public: }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp b/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp index 91ec6c28f5..219d892d31 100644 --- a/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp +++ b/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp @@ -16,6 +16,8 @@ #include "llvm/Function.h" #include "llvm/Pass.h" +namespace llvm { + namespace { class ModuloScheduling : public FunctionPass { @@ -40,3 +42,5 @@ bool ModuloScheduling::runOnFunction(Function &F) { bool Changed = false; return Changed; } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/RegAlloc/AllocInfo.h b/lib/Target/SparcV9/RegAlloc/AllocInfo.h index f83f2103be..67f58a7ed0 100644 --- a/lib/Target/SparcV9/RegAlloc/AllocInfo.h +++ b/lib/Target/SparcV9/RegAlloc/AllocInfo.h @@ -19,6 +19,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" +namespace llvm { + /// AllocInfo - Structure representing one instruction's operand's-worth of /// register allocation state. We create tables made out of these data /// structures to generate mapping information for this register allocator. @@ -77,4 +79,6 @@ struct AllocInfo { } }; +} // End llvm namespace + #endif // ALLOCINFO_H diff --git a/lib/Target/SparcV9/RegAlloc/IGNode.cpp b/lib/Target/SparcV9/RegAlloc/IGNode.cpp index f883fb13c1..a76fdeaa03 100644 --- a/lib/Target/SparcV9/RegAlloc/IGNode.cpp +++ b/lib/Target/SparcV9/RegAlloc/IGNode.cpp @@ -16,6 +16,8 @@ #include #include +namespace llvm { + //----------------------------------------------------------------------------- // Sets this IGNode on stack and reduce the degree of neighbors //----------------------------------------------------------------------------- @@ -56,3 +58,5 @@ IGNode::getCombinedDegree(const IGNode* otherNode) const { std::vector::iterator new_end = unique(nbrs.begin(), nbrs.end()); return new_end - nbrs.begin(); } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/RegAlloc/IGNode.h b/lib/Target/SparcV9/RegAlloc/IGNode.h index 82f07e0c7e..9fdc7a6ac0 100644 --- a/lib/Target/SparcV9/RegAlloc/IGNode.h +++ b/lib/Target/SparcV9/RegAlloc/IGNode.h @@ -32,6 +32,9 @@ #include "LiveRange.h" #include + +namespace llvm { + class RegClass; //---------------------------------------------------------------------------- @@ -115,4 +118,6 @@ public: inline LiveRange *getParentLR() const { return ParentLR; } }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/RegAlloc/InterferenceGraph.cpp b/lib/Target/SparcV9/RegAlloc/InterferenceGraph.cpp index 392a96c11c..3cef19ea0e 100644 --- a/lib/Target/SparcV9/RegAlloc/InterferenceGraph.cpp +++ b/lib/Target/SparcV9/RegAlloc/InterferenceGraph.cpp @@ -17,6 +17,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + // for asserting this IG node is infact in the IGNodeList of this class inline static void assertIGNode(const InterferenceGraph *IG, const IGNode *Node) { @@ -246,3 +248,5 @@ void InterferenceGraph::printIGNodeList() const { } } } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/RegAlloc/InterferenceGraph.h b/lib/Target/SparcV9/RegAlloc/InterferenceGraph.h index 6b8cf3cd05..79850c1fcf 100644 --- a/lib/Target/SparcV9/RegAlloc/InterferenceGraph.h +++ b/lib/Target/SparcV9/RegAlloc/InterferenceGraph.h @@ -30,6 +30,9 @@ #define INTERFERENCEGRAPH_H #include + +namespace llvm { + class LiveRange; class RegClass; class IGNode; @@ -67,4 +70,6 @@ class InterferenceGraph { void printIGNodeList() const; }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/RegAlloc/LiveRange.h b/lib/Target/SparcV9/RegAlloc/LiveRange.h index aa409c63fb..d6e2cf6307 100644 --- a/lib/Target/SparcV9/RegAlloc/LiveRange.h +++ b/lib/Target/SparcV9/RegAlloc/LiveRange.h @@ -21,6 +21,8 @@ #include "llvm/Value.h" #include "llvm/CodeGen/ValueSet.h" +namespace llvm { + class RegClass; class IGNode; @@ -177,4 +179,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp index b9fcda789f..9fd04d2b0e 100644 --- a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp +++ b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp @@ -23,6 +23,8 @@ #include "llvm/Target/TargetRegInfo.h" #include "Support/SetOperations.h" +namespace llvm { + unsigned LiveRange::getRegClassID() const { return getRegClass()->getID(); } LiveRangeInfo::LiveRangeInfo(const Function *F, const TargetMachine &tm, @@ -411,3 +413,5 @@ void LiveRangeInfo::printLiveRanges() { } } } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h index 5c5244bd62..a8d0e7152f 100644 --- a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h +++ b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.h @@ -29,6 +29,8 @@ #include "llvm/CodeGen/ValueSet.h" #include "Support/hash_map" +namespace llvm { + class LiveRange; class MachineInstr; class RegClass; @@ -121,4 +123,6 @@ public: void printLiveRanges(); }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp index 99917cdf0b..332ae9524c 100644 --- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp +++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp @@ -47,6 +47,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + RegAllocDebugLevel_t DEBUG_RA; /// The reoptimizer wants to be able to grovel through the register @@ -1392,3 +1394,5 @@ bool PhyRegAlloc::runOnFunction (Function &F) { if (DEBUG_RA) std::cerr << "\nRegister allocation complete!\n"; return false; // Function was not modified } + +} // End llvm namespace diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h index c524f9f56c..4ec083c8ea 100644 --- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h +++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h @@ -31,6 +31,8 @@ #include "llvm/Target/TargetRegInfo.h" #include +namespace llvm { + class MachineFunction; class FunctionLiveVarInfo; class MachineInstr; @@ -179,4 +181,6 @@ private: void addInterf4PseudoInstr(const MachineInstr *MI); }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/RegAlloc/RegAllocCommon.h b/lib/Target/SparcV9/RegAlloc/RegAllocCommon.h index 97d102a253..7dd86b205a 100644 --- a/lib/Target/SparcV9/RegAlloc/RegAllocCommon.h +++ b/lib/Target/SparcV9/RegAlloc/RegAllocCommon.h @@ -14,6 +14,8 @@ #ifndef REGALLOCCOMMON_H #define REGALLOCCOMMON_H +namespace llvm { + enum RegAllocDebugLevel_t { RA_DEBUG_None = 0, RA_DEBUG_Results = 1, @@ -25,4 +27,6 @@ enum RegAllocDebugLevel_t { extern RegAllocDebugLevel_t DEBUG_RA; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/RegAlloc/RegClass.cpp b/lib/Target/SparcV9/RegAlloc/RegClass.cpp index 9c8603b82c..9af87ba0e8 100644 --- a/lib/Target/SparcV9/RegAlloc/RegClass.cpp +++ b/lib/Target/SparcV9/RegAlloc/RegClass.cpp @@ -16,6 +16,8 @@ #include "RegClass.h" #include "llvm/Target/TargetRegInfo.h" +namespace llvm { + //---------------------------------------------------------------------------- // This constructor inits IG. The actual matrix is created by a call to // createInterferenceGraph() above. @@ -245,4 +247,4 @@ void RegClass::printIG() { IG.printIG(); } - +} // End llvm namespace diff --git a/lib/Target/SparcV9/RegAlloc/RegClass.h b/lib/Target/SparcV9/RegAlloc/RegClass.h index c861fbae21..0071f7c212 100644 --- a/lib/Target/SparcV9/RegAlloc/RegClass.h +++ b/lib/Target/SparcV9/RegAlloc/RegClass.h @@ -20,6 +20,9 @@ #include "llvm/Target/TargetRegInfo.h" #include "InterferenceGraph.h" #include + +namespace llvm { + class TargetRegClassInfo; @@ -139,4 +142,6 @@ class RegClass { void printIG(); }; +} // End llvm namespace + #endif diff --git a/lib/Target/SparcV9/SparcV9.burg.in b/lib/Target/SparcV9/SparcV9.burg.in index a5bc98fa89..38dc2439ce 100644 --- a/lib/Target/SparcV9/SparcV9.burg.in +++ b/lib/Target/SparcV9/SparcV9.burg.in @@ -11,7 +11,7 @@ Xinclude Xinclude -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/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp index 25034177da..6af9836e29 100644 --- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp +++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp @@ -33,6 +33,8 @@ #include "SparcInternals.h" #include +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/lib/Target/SparcV9/SparcV9CodeEmitter.cpp b/lib/Target/SparcV9/SparcV9CodeEmitter.cpp index d60d9151c1..c50dca55e7 100644 --- a/lib/Target/SparcV9/SparcV9CodeEmitter.cpp +++ b/lib/Target/SparcV9/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/lib/Target/SparcV9/SparcV9CodeEmitter.h b/lib/Target/SparcV9/SparcV9CodeEmitter.h index 7e19c44ce0..d21345ec04 100644 --- a/lib/Target/SparcV9/SparcV9CodeEmitter.h +++ b/lib/Target/SparcV9/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/lib/Target/SparcV9/SparcV9InstrInfo.cpp b/lib/Target/SparcV9/SparcV9InstrInfo.cpp index d92e3be9ca..11b0c7beab 100644 --- a/lib/Target/SparcV9/SparcV9InstrInfo.cpp +++ b/lib/Target/SparcV9/SparcV9InstrInfo.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/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp index b377658b9c..21e884be8e 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp +++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp @@ -32,6 +32,8 @@ #include #include +namespace llvm { + static inline void Add3OperandInstr(unsigned Opcode, InstructionNode* Node, std::vector& 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& 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(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/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h index d49863c1c8..b69c5c2b6e 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h +++ b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.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/lib/Target/SparcV9/SparcV9Internals.h b/lib/Target/SparcV9/SparcV9Internals.h index 4d0a48e4d5..5e5f155e39 100644 --- a/lib/Target/SparcV9/SparcV9Internals.h +++ b/lib/Target/SparcV9/SparcV9Internals.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/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp b/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp index 83081b7120..9713a02d95 100644 --- a/lib/Target/SparcV9/SparcV9PeepholeOpts.cpp +++ b/lib/Target/SparcV9/SparcV9PeepholeOpts.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/lib/Target/SparcV9/SparcV9PreSelection.cpp b/lib/Target/SparcV9/SparcV9PreSelection.cpp index 9078dc13b1..205ecd3145 100644 --- a/lib/Target/SparcV9/SparcV9PreSelection.cpp +++ b/lib/Target/SparcV9/SparcV9PreSelection.cpp @@ -29,6 +29,8 @@ #include "llvm/Transforms/Scalar.h" #include +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/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp b/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp index ff7bd7d026..555b6b14fe 100644 --- a/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp +++ b/lib/Target/SparcV9/SparcV9PrologEpilogInserter.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/lib/Target/SparcV9/SparcV9RegClassInfo.cpp b/lib/Target/SparcV9/SparcV9RegClassInfo.cpp index d6de5f9c0d..564e59cd70 100644 --- a/lib/Target/SparcV9/SparcV9RegClassInfo.cpp +++ b/lib/Target/SparcV9/SparcV9RegClassInfo.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/lib/Target/SparcV9/SparcV9RegClassInfo.h b/lib/Target/SparcV9/SparcV9RegClassInfo.h index 321ce60ab0..cc492e77c7 100644 --- a/lib/Target/SparcV9/SparcV9RegClassInfo.h +++ b/lib/Target/SparcV9/SparcV9RegClassInfo.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/lib/Target/SparcV9/SparcV9RegInfo.cpp b/lib/Target/SparcV9/SparcV9RegInfo.cpp index 84dc92e246..5edbbe0647 100644 --- a/lib/Target/SparcV9/SparcV9RegInfo.cpp +++ b/lib/Target/SparcV9/SparcV9RegInfo.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/lib/Target/SparcV9/SparcV9SchedInfo.cpp b/lib/Target/SparcV9/SparcV9SchedInfo.cpp index fd03ad69d6..7d8ea05066 100644 --- a/lib/Target/SparcV9/SparcV9SchedInfo.cpp +++ b/lib/Target/SparcV9/SparcV9SchedInfo.cpp @@ -13,6 +13,8 @@ #include "SparcInternals.h" +using namespace llvm; + /*--------------------------------------------------------------------------- Scheduling guidelines for SPARC IIi: diff --git a/lib/Target/SparcV9/SparcV9StackSlots.cpp b/lib/Target/SparcV9/SparcV9StackSlots.cpp index 551dd92b49..5fd0ba1927 100644 --- a/lib/Target/SparcV9/SparcV9StackSlots.cpp +++ b/lib/Target/SparcV9/SparcV9StackSlots.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/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp index d20fc758d0..73f2fd8139 100644 --- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp +++ b/lib/Target/SparcV9/SparcV9TargetMachine.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/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index a377fd0d7f..ed6936dd12 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -22,13 +22,14 @@ #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" +namespace llvm { + // Handle the Pass registration stuff necessary to use TargetData's. namespace { // Register the default SparcV9 implementation... RegisterPass X("targetdata", "Target Data Layout"); } - static inline void getTypeInfo(const Type *Ty, const TargetData *TD, uint64_t &Size, unsigned char &Alignment); @@ -221,3 +222,5 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy, return Result; } + +} // End llvm namespace diff --git a/lib/Target/TargetInstrInfo.cpp b/lib/Target/TargetInstrInfo.cpp index f377d67b66..0f9015f8a6 100644 --- a/lib/Target/TargetInstrInfo.cpp +++ b/lib/Target/TargetInstrInfo.cpp @@ -15,6 +15,8 @@ #include "llvm/Constant.h" #include "llvm/DerivedTypes.h" +namespace llvm { + // External object describing the machine instructions // Initialized only when the TargetMachine class is created // and reset when that class is destroyed. @@ -59,3 +61,5 @@ bool TargetInstrInfo::ConstantTypeMustBeLoaded(const Constant* CV) const { assert(CV->getType()->isPrimitiveType() || isa(CV->getType())); return !(CV->getType()->isIntegral() || isa(CV->getType())); } + +} // End llvm namespace diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index b7c1b342e1..e7630b4ab3 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -16,6 +16,8 @@ #include "llvm/Target/TargetCacheInfo.h" #include "llvm/Type.h" +namespace llvm { + //--------------------------------------------------------------------------- // class TargetMachine // @@ -49,3 +51,5 @@ void TargetCacheInfo::Initialize() { cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20); cacheAssoc.push_back(1); cacheAssoc.push_back(4); } + +} // End llvm namespace diff --git a/lib/Target/TargetSchedInfo.cpp b/lib/Target/TargetSchedInfo.cpp index 0dbde45c38..f33223c43a 100644 --- a/lib/Target/TargetSchedInfo.cpp +++ b/lib/Target/TargetSchedInfo.cpp @@ -15,6 +15,8 @@ #include "llvm/Target/TargetSchedInfo.h" #include "llvm/Target/TargetMachine.h" +namespace llvm { + resourceId_t MachineResource::nextId = 0; // Check if fromRVec and toRVec have *any* common entries. @@ -249,3 +251,5 @@ void InstrRUsage::addUsageDelta(const InstrRUsageDelta &delta) { assert(r >= 0 && "Resource to remove was unused in cycle c!"); } } + +} // End llvm namespace diff --git a/lib/Target/X86/FloatingPoint.cpp b/lib/Target/X86/FloatingPoint.cpp index 07e58ba171..5c6e6ebfdd 100644 --- a/lib/Target/X86/FloatingPoint.cpp +++ b/lib/Target/X86/FloatingPoint.cpp @@ -25,6 +25,8 @@ #include #include +namespace llvm { + namespace { Statistic<> NumFXCH("x86-codegen", "Number of fxch instructions inserted"); Statistic<> NumFP ("x86-codegen", "Number of floating point instructions"); @@ -70,7 +72,7 @@ namespace { // getSTReg - Return the X86::ST(i) register which contains the specified // FP register unsigned getSTReg(unsigned RegNo) const { - return StackTop - 1 - getSlot(RegNo) + X86::ST0; + return StackTop - 1 - getSlot(RegNo) + llvm::X86::ST0; } // pushReg - Push the specifiex FP register onto the stack @@ -598,3 +600,5 @@ void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) { I = MBB->erase(I)-1; // Remove the pseudo instruction } + +} // End llvm namespace diff --git a/lib/Target/X86/InstSelectPattern.cpp b/lib/Target/X86/InstSelectPattern.cpp index 434ceee91c..e518294564 100644 --- a/lib/Target/X86/InstSelectPattern.cpp +++ b/lib/Target/X86/InstSelectPattern.cpp @@ -28,6 +28,8 @@ // Include the generated instruction selector... #include "X86GenInstrSelector.inc" +namespace llvm { + namespace { struct ISel : public FunctionPass, SelectionDAGTargetBuilder { TargetMachine &TM; @@ -114,7 +116,6 @@ void ISel::expandCall(SelectionDAG &SD, CallInst &CI) { assert(0 && "ISel::expandCall not implemented!"); } - /// createX86PatternInstructionSelector - This pass converts an LLVM function /// into a machine code representation using pattern matching and a machine /// description file. @@ -122,3 +123,5 @@ void ISel::expandCall(SelectionDAG &SD, CallInst &CI) { FunctionPass *createX86PatternInstructionSelector(TargetMachine &TM) { return new ISel(TM); } + +} // End llvm namespace diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp index 1242545d83..de341c477d 100644 --- a/lib/Target/X86/InstSelectSimple.cpp +++ b/lib/Target/X86/InstSelectSimple.cpp @@ -29,6 +29,8 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/InstVisitor.h" +namespace llvm { + /// BMI - A special BuildMI variant that takes an iterator to insert the /// instruction at as well as a basic block. This is the version for when you /// have a destination register in mind. @@ -138,7 +140,7 @@ namespace { void doCall(const ValueRecord &Ret, MachineInstr *CallMI, const std::vector &Args); void visitCallInst(CallInst &I); - void visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &I); + void visitIntrinsicCall(Intrinsic::ID ID, CallInst &I); // Arithmetic operators void visitSimpleBinary(BinaryOperator &B, unsigned OpcodeClass); @@ -1045,7 +1047,7 @@ void ISel::visitCallInst(CallInst &CI) { MachineInstr *TheCall; if (Function *F = CI.getCalledFunction()) { // Is it an intrinsic function call? - if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) { + if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) { visitIntrinsicCall(ID, CI); // Special intrinsics are not handled here return; } @@ -1066,29 +1068,29 @@ void ISel::visitCallInst(CallInst &CI) { } -void ISel::visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &CI) { +void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { unsigned TmpReg1, TmpReg2; switch (ID) { - case LLVMIntrinsic::va_start: + case Intrinsic::va_start: // Get the address of the first vararg value... TmpReg1 = getReg(CI); addFrameReference(BuildMI(BB, X86::LEAr32, 5, TmpReg1), VarArgsFrameIndex); return; - case LLVMIntrinsic::va_copy: + case Intrinsic::va_copy: TmpReg1 = getReg(CI); TmpReg2 = getReg(CI.getOperand(1)); BuildMI(BB, X86::MOVrr32, 1, TmpReg1).addReg(TmpReg2); return; - case LLVMIntrinsic::va_end: return; // Noop on X86 + case Intrinsic::va_end: return; // Noop on X86 - case LLVMIntrinsic::longjmp: - case LLVMIntrinsic::siglongjmp: + case Intrinsic::longjmp: + case Intrinsic::siglongjmp: BuildMI(BB, X86::CALLpcrel32, 1).addExternalSymbol("abort", true); return; - case LLVMIntrinsic::setjmp: - case LLVMIntrinsic::sigsetjmp: + case Intrinsic::setjmp: + case Intrinsic::sigsetjmp: // Setjmp always returns zero... BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0); return; @@ -2127,7 +2129,6 @@ void ISel::visitFreeInst(FreeInst &I) { doCall(ValueRecord(0, Type::VoidTy), TheCall, Args); } - /// createX86SimpleInstructionSelector - This pass converts an LLVM function /// into a machine code representation is a very simple peep-hole fashion. The /// generated code sucks but the implementation is nice and simple. @@ -2135,3 +2136,5 @@ void ISel::visitFreeInst(FreeInst &I) { FunctionPass *createX86SimpleInstructionSelector(TargetMachine &TM) { return new ISel(TM); } + +} // End llvm namespace diff --git a/lib/Target/X86/PeepholeOptimizer.cpp b/lib/Target/X86/PeepholeOptimizer.cpp index fbc84f7e87..2f3280a4bb 100644 --- a/lib/Target/X86/PeepholeOptimizer.cpp +++ b/lib/Target/X86/PeepholeOptimizer.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +namespace llvm { + namespace { struct PH : public MachineFunctionPass { virtual bool runOnMachineFunction(MachineFunction &MF); @@ -131,3 +133,5 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB, return false; } } + +} // End llvm namespace diff --git a/lib/Target/X86/Printer.cpp b/lib/Target/X86/Printer.cpp index 3d073f77c6..292a465e72 100644 --- a/lib/Target/X86/Printer.cpp +++ b/lib/Target/X86/Printer.cpp @@ -29,6 +29,8 @@ #include "Support/StringExtras.h" #include "Support/CommandLine.h" +namespace llvm { + namespace { Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); @@ -960,3 +962,5 @@ bool Printer::doFinalization(Module &M) { delete Mang; return false; // success } + +} // End llvm namespace diff --git a/lib/Target/X86/X86.h b/lib/Target/X86/X86.h index 01041f8d3a..5cf897fa71 100644 --- a/lib/Target/X86/X86.h +++ b/lib/Target/X86/X86.h @@ -16,6 +16,9 @@ #define TARGET_X86_H #include + +namespace llvm { + class TargetMachine; class FunctionPass; @@ -58,6 +61,8 @@ FunctionPass *createEmitX86CodeToMemory(); // Defines symbolic names for X86 registers. This defines a mapping from // register name to register number. // +} // End llvm namespace + #include "X86GenRegisterNames.inc" // Defines symbolic names for the X86 instructions. diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 3d073f77c6..292a465e72 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -29,6 +29,8 @@ #include "Support/StringExtras.h" #include "Support/CommandLine.h" +namespace llvm { + namespace { Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed"); @@ -960,3 +962,5 @@ bool Printer::doFinalization(Module &M) { delete Mang; return false; // success } + +} // End llvm namespace diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index f49fde58d2..e24e2904b5 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -24,6 +24,8 @@ #include "Support/Statistic.h" #include "Config/alloca.h" +namespace llvm { + namespace { Statistic<> NumEmitted("x86-emitter", "Number of machine instructions emitted"); @@ -589,3 +591,5 @@ void Emitter::emitInstruction(MachineInstr &MI) { break; } } + +} // End llvm namespace diff --git a/lib/Target/X86/X86FloatingPoint.cpp b/lib/Target/X86/X86FloatingPoint.cpp index 07e58ba171..5c6e6ebfdd 100644 --- a/lib/Target/X86/X86FloatingPoint.cpp +++ b/lib/Target/X86/X86FloatingPoint.cpp @@ -25,6 +25,8 @@ #include #include +namespace llvm { + namespace { Statistic<> NumFXCH("x86-codegen", "Number of fxch instructions inserted"); Statistic<> NumFP ("x86-codegen", "Number of floating point instructions"); @@ -70,7 +72,7 @@ namespace { // getSTReg - Return the X86::ST(i) register which contains the specified // FP register unsigned getSTReg(unsigned RegNo) const { - return StackTop - 1 - getSlot(RegNo) + X86::ST0; + return StackTop - 1 - getSlot(RegNo) + llvm::X86::ST0; } // pushReg - Push the specifiex FP register onto the stack @@ -598,3 +600,5 @@ void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) { I = MBB->erase(I)-1; // Remove the pseudo instruction } + +} // End llvm namespace diff --git a/lib/Target/X86/X86ISelPattern.cpp b/lib/Target/X86/X86ISelPattern.cpp index 434ceee91c..e518294564 100644 --- a/lib/Target/X86/X86ISelPattern.cpp +++ b/lib/Target/X86/X86ISelPattern.cpp @@ -28,6 +28,8 @@ // Include the generated instruction selector... #include "X86GenInstrSelector.inc" +namespace llvm { + namespace { struct ISel : public FunctionPass, SelectionDAGTargetBuilder { TargetMachine &TM; @@ -114,7 +116,6 @@ void ISel::expandCall(SelectionDAG &SD, CallInst &CI) { assert(0 && "ISel::expandCall not implemented!"); } - /// createX86PatternInstructionSelector - This pass converts an LLVM function /// into a machine code representation using pattern matching and a machine /// description file. @@ -122,3 +123,5 @@ void ISel::expandCall(SelectionDAG &SD, CallInst &CI) { FunctionPass *createX86PatternInstructionSelector(TargetMachine &TM) { return new ISel(TM); } + +} // End llvm namespace diff --git a/lib/Target/X86/X86ISelSimple.cpp b/lib/Target/X86/X86ISelSimple.cpp index 1242545d83..de341c477d 100644 --- a/lib/Target/X86/X86ISelSimple.cpp +++ b/lib/Target/X86/X86ISelSimple.cpp @@ -29,6 +29,8 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/InstVisitor.h" +namespace llvm { + /// BMI - A special BuildMI variant that takes an iterator to insert the /// instruction at as well as a basic block. This is the version for when you /// have a destination register in mind. @@ -138,7 +140,7 @@ namespace { void doCall(const ValueRecord &Ret, MachineInstr *CallMI, const std::vector &Args); void visitCallInst(CallInst &I); - void visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &I); + void visitIntrinsicCall(Intrinsic::ID ID, CallInst &I); // Arithmetic operators void visitSimpleBinary(BinaryOperator &B, unsigned OpcodeClass); @@ -1045,7 +1047,7 @@ void ISel::visitCallInst(CallInst &CI) { MachineInstr *TheCall; if (Function *F = CI.getCalledFunction()) { // Is it an intrinsic function call? - if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) { + if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) { visitIntrinsicCall(ID, CI); // Special intrinsics are not handled here return; } @@ -1066,29 +1068,29 @@ void ISel::visitCallInst(CallInst &CI) { } -void ISel::visitIntrinsicCall(LLVMIntrinsic::ID ID, CallInst &CI) { +void ISel::visitIntrinsicCall(Intrinsic::ID ID, CallInst &CI) { unsigned TmpReg1, TmpReg2; switch (ID) { - case LLVMIntrinsic::va_start: + case Intrinsic::va_start: // Get the address of the first vararg value... TmpReg1 = getReg(CI); addFrameReference(BuildMI(BB, X86::LEAr32, 5, TmpReg1), VarArgsFrameIndex); return; - case LLVMIntrinsic::va_copy: + case Intrinsic::va_copy: TmpReg1 = getReg(CI); TmpReg2 = getReg(CI.getOperand(1)); BuildMI(BB, X86::MOVrr32, 1, TmpReg1).addReg(TmpReg2); return; - case LLVMIntrinsic::va_end: return; // Noop on X86 + case Intrinsic::va_end: return; // Noop on X86 - case LLVMIntrinsic::longjmp: - case LLVMIntrinsic::siglongjmp: + case Intrinsic::longjmp: + case Intrinsic::siglongjmp: BuildMI(BB, X86::CALLpcrel32, 1).addExternalSymbol("abort", true); return; - case LLVMIntrinsic::setjmp: - case LLVMIntrinsic::sigsetjmp: + case Intrinsic::setjmp: + case Intrinsic::sigsetjmp: // Setjmp always returns zero... BuildMI(BB, X86::MOVir32, 1, getReg(CI)).addZImm(0); return; @@ -2127,7 +2129,6 @@ void ISel::visitFreeInst(FreeInst &I) { doCall(ValueRecord(0, Type::VoidTy), TheCall, Args); } - /// createX86SimpleInstructionSelector - This pass converts an LLVM function /// into a machine code representation is a very simple peep-hole fashion. The /// generated code sucks but the implementation is nice and simple. @@ -2135,3 +2136,5 @@ void ISel::visitFreeInst(FreeInst &I) { FunctionPass *createX86SimpleInstructionSelector(TargetMachine &TM) { return new ISel(TM); } + +} // End llvm namespace diff --git a/lib/Target/X86/X86InstrBuilder.h b/lib/Target/X86/X86InstrBuilder.h index a6d65d4749..a5643bdbfb 100644 --- a/lib/Target/X86/X86InstrBuilder.h +++ b/lib/Target/X86/X86InstrBuilder.h @@ -26,6 +26,8 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" +namespace llvm { + /// addDirectMem - This function is used to add a direct memory reference to the /// current instruction -- that is, a dereference of an address in a register, /// with no scale, index or displacement. An example is: DWORD PTR [EAX]. @@ -69,4 +71,6 @@ addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI, return MIB.addConstantPoolIndex(CPI).addZImm(1).addReg(0).addSImm(Offset); } +} // End llvm namespace + #endif diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 012ceadff0..681bf023d9 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -17,6 +17,8 @@ #include "X86GenInstrInfo.inc" +using namespace llvm; + X86InstrInfo::X86InstrInfo() : TargetInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) { } diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h index 26b2618a01..2bf82d16c6 100644 --- a/lib/Target/X86/X86InstrInfo.h +++ b/lib/Target/X86/X86InstrInfo.h @@ -17,6 +17,8 @@ #include "llvm/Target/TargetInstrInfo.h" #include "X86RegisterInfo.h" +namespace llvm { + /// X86II - This namespace holds all of the target specific flags that /// instruction info tracks. /// @@ -181,4 +183,6 @@ public: } }; +} // End llvm namespace + #endif diff --git a/lib/Target/X86/X86PeepholeOpt.cpp b/lib/Target/X86/X86PeepholeOpt.cpp index fbc84f7e87..2f3280a4bb 100644 --- a/lib/Target/X86/X86PeepholeOpt.cpp +++ b/lib/Target/X86/X86PeepholeOpt.cpp @@ -15,6 +15,8 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +namespace llvm { + namespace { struct PH : public MachineFunctionPass { virtual bool runOnMachineFunction(MachineFunction &MF); @@ -131,3 +133,5 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB, return false; } } + +} // End llvm namespace diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index fd8a615e31..0e8b889ad8 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -25,6 +25,8 @@ #include "llvm/Target/TargetFrameInfo.h" #include "Support/CommandLine.h" +namespace llvm { + namespace { cl::opt NoFPElim("disable-fp-elim", @@ -253,8 +255,12 @@ int X86RegisterInfo::emitEpilogue(MachineFunction &MF, return MBB.size() - oldSize; } +} // End llvm namespace + #include "X86GenRegisterInfo.inc" +namespace llvm { + const TargetRegisterClass* X86RegisterInfo::getRegClassForType(const Type* Ty) const { switch (Ty->getPrimitiveID()) { @@ -274,3 +280,5 @@ X86RegisterInfo::getRegClassForType(const Type* Ty) const { case Type::DoubleTyID: return &RFPInstance; } } + +} // End llvm namespace diff --git a/lib/Target/X86/X86RegisterInfo.h b/lib/Target/X86/X86RegisterInfo.h index 0db8e18bee..77a8a1a405 100644 --- a/lib/Target/X86/X86RegisterInfo.h +++ b/lib/Target/X86/X86RegisterInfo.h @@ -16,10 +16,12 @@ #include "llvm/Target/MRegisterInfo.h" -class Type; +class llvm::Type; #include "X86GenRegisterInfo.h.inc" +namespace llvm { + struct X86RegisterInfo : public X86GenRegisterInfo { X86RegisterInfo(); const TargetRegisterClass* getRegClassForType(const Type* Ty) const; @@ -52,4 +54,6 @@ struct X86RegisterInfo : public X86GenRegisterInfo { int emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; }; +} // End llvm namespace + #endif diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 954d4f4ced..31eb4bd61c 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -22,6 +22,8 @@ #include "Support/CommandLine.h" #include "Support/Statistic.h" +namespace llvm { + namespace { cl::opt PrintCode("print-machineinstrs", cl::desc("Print generated machine code")); @@ -153,3 +155,5 @@ void X86TargetMachine::replaceMachineCodeForFunction (void *Old, void *New) { int32_t OldAddr = (intptr_t) OldWord; *OldWord = NewAddr - OldAddr - 4; // Emit PC-relative addr of New code. } + +} // End llvm namespace diff --git a/lib/Target/X86/X86TargetMachine.h b/lib/Target/X86/X86TargetMachine.h index 5581da4d81..12f5c0e6a2 100644 --- a/lib/Target/X86/X86TargetMachine.h +++ b/lib/Target/X86/X86TargetMachine.h @@ -19,6 +19,8 @@ #include "llvm/PassManager.h" #include "X86InstrInfo.h" +namespace llvm { + class X86TargetMachine : public TargetMachine { X86InstrInfo InstrInfo; TargetFrameInfo FrameInfo; @@ -55,4 +57,6 @@ public: virtual void replaceMachineCodeForFunction (void *Old, void *New); }; +} // End llvm namespace + #endif diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index d3e9287de4..970be52aa4 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -23,6 +23,8 @@ #include "Support/Debug.h" #include +namespace llvm { + static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty, ValueTypeCache &ConvertedTypes, const TargetData &TD); @@ -1298,3 +1300,5 @@ ValueHandle::~ValueHandle() { // << Operands[0]->use_size() << " " << Operands[0]); } } + +} // End llvm namespace diff --git a/lib/Transforms/Hello/Hello.cpp b/lib/Transforms/Hello/Hello.cpp index a71bd34288..4ed281a40a 100644 --- a/lib/Transforms/Hello/Hello.cpp +++ b/lib/Transforms/Hello/Hello.cpp @@ -15,6 +15,8 @@ #include "llvm/Pass.h" #include "llvm/Function.h" +namespace llvm { + namespace { // Hello - The first implementation, without getAnalysisUsage. struct Hello : public FunctionPass { @@ -39,3 +41,5 @@ namespace { }; RegisterOpt Y("hello2", "Hello World Pass (with getAnalysisUsage implemented)"); } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp index a4526820e6..498cd7bb14 100644 --- a/lib/Transforms/IPO/ConstantMerge.cpp +++ b/lib/Transforms/IPO/ConstantMerge.cpp @@ -22,6 +22,8 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumMerged("constmerge", "Number of global constants merged"); @@ -37,7 +39,6 @@ namespace { Pass *createConstantMergePass() { return new ConstantMerge(); } - bool ConstantMerge::run(Module &M) { std::map CMap; bool MadeChanges = false; @@ -78,3 +79,5 @@ bool ConstantMerge::run(Module &M) { return MadeChanges; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 9003f8877f..197710d650 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -30,6 +30,8 @@ #include "Support/iterator" #include +namespace llvm { + namespace { Statistic<> NumArgumentsEliminated("deadargelim", "Number of unread args removed"); @@ -576,3 +578,6 @@ bool DAE::run(Module &M) { RemoveDeadArgumentsFromFunction(*DeadRetVal.begin()); return true; } + +} // End llvm namespace + diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp index c3eb416002..126991d3e6 100644 --- a/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -19,6 +19,8 @@ #include "llvm/DerivedTypes.h" #include "Support/Statistic.h" +namespace llvm { + namespace { struct DTE : public Pass { // doPassInitialization - For this pass, it removes global symbol table @@ -45,7 +47,6 @@ Pass *createDeadTypeEliminationPass() { } - // ShouldNukeSymtabEntry - Return true if this module level symbol table entry // should be eliminated. // @@ -95,3 +96,5 @@ bool DTE::run(Module &M) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp index 1656c512dd..c1ae2d45e4 100644 --- a/lib/Transforms/IPO/ExtractFunction.cpp +++ b/lib/Transforms/IPO/ExtractFunction.cpp @@ -10,6 +10,8 @@ #include "llvm/Pass.h" #include "llvm/Module.h" +namespace llvm { + namespace { class FunctionExtractorPass : public Pass { Function *Named; @@ -90,3 +92,5 @@ namespace { Pass *createFunctionExtractionPass(Function *F) { return new FunctionExtractorPass(F); } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp index a21853d207..2a366c84cd 100644 --- a/lib/Transforms/IPO/FunctionResolution.cpp +++ b/lib/Transforms/IPO/FunctionResolution.cpp @@ -29,6 +29,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<>NumResolved("funcresolve", "Number of varargs functions resolved"); Statistic<> NumGlobals("funcresolve", "Number of global variables resolved"); @@ -329,3 +331,5 @@ bool FunctionResolvingPass::run(Module &M) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index dc400269e6..8e7920dc1b 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -22,6 +22,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumFunctions("globaldce","Number of functions removed"); Statistic<> NumVariables("globaldce","Number of global variables removed"); @@ -195,3 +197,5 @@ bool GlobalDCE::SafeToDestroyConstant(Constant *C) { return true; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index b592138b08..b0135d1531 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -22,6 +22,8 @@ #include "llvm/Support/CallSite.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumArgumentsProped("ipconstprop", "Number of args turned into constants"); @@ -121,3 +123,5 @@ bool IPCP::processFunction(Function &F) { } return MadeChange; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 169e57745a..715f4462b2 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -17,6 +17,8 @@ #include "llvm/Support/CallSite.h" #include "llvm/Transforms/IPO.h" +namespace llvm { + namespace { // FunctionInfo - For each function, calculate the size of it in blocks and // instructions. @@ -114,3 +116,5 @@ int SimpleInliner::getInlineCost(CallSite CS) { InlineCost += CalleeFI.NumInsts*10 + CalleeFI.NumBlocks*20; return InlineCost; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 8ad72ab9a1..bd1bd8370f 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -24,6 +24,8 @@ #include "Support/Debug.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumInlined("inline", "Number of functions inlined"); Statistic<> NumDeleted("inline", "Number of functions deleted because all callers found"); @@ -134,3 +136,5 @@ bool Inliner::performInlining(CallSite CS, std::set &SCC) { } return true; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/Inliner.h b/lib/Transforms/IPO/Inliner.h index 1f3d0d2dc2..805876c54d 100644 --- a/lib/Transforms/IPO/Inliner.h +++ b/lib/Transforms/IPO/Inliner.h @@ -20,6 +20,9 @@ #define DEBUG_TYPE "inline" #include "llvm/CallGraphSCCPass.h" #include + +namespace llvm { + class CallSite; /// Inliner - This class contains all of the helper code which is used to @@ -61,5 +64,6 @@ private: bool performInlining(CallSite CS, std::set &SCC); }; +} // End llvm namespace #endif diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index 92d389a33d..574c8bf268 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -22,6 +22,8 @@ #include #include +namespace llvm { + namespace { Statistic<> NumFunctions("internalize", "Number of functions internalized"); Statistic<> NumGlobals ("internalize", "Number of global vars internalized"); @@ -119,3 +121,5 @@ namespace { Pass *createInternalizePass() { return new InternalizePass(); } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index abbc2c92c4..276523b00b 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -47,6 +47,8 @@ #include "Support/StringExtras.h" #include "Support/VectorExtras.h" +namespace llvm { + namespace { Statistic<> LongJmpsTransformed("lowersetjmp", "Number of longjmps transformed"); @@ -538,3 +540,5 @@ Pass* createLowerSetJmpPass() { return new LowerSetJmp(); } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp index dfaf8a89c6..41835adb48 100644 --- a/lib/Transforms/IPO/MutateStructTypes.cpp +++ b/lib/Transforms/IPO/MutateStructTypes.cpp @@ -28,6 +28,8 @@ #include "Support/Debug.h" #include +using namespace llvm; + // ValuePlaceHolder - A stupid little marker value. It appears as an // instruction of type Instruction::UserOp1. // diff --git a/lib/Transforms/IPO/Parallelize.cpp b/lib/Transforms/IPO/Parallelize.cpp index 77e6ed3040..fd39b6b12a 100644 --- a/lib/Transforms/IPO/Parallelize.cpp +++ b/lib/Transforms/IPO/Parallelize.cpp @@ -53,6 +53,8 @@ #include #include +namespace llvm { + //---------------------------------------------------------------------------- // Global constants used in marking Cilk functions and function calls. //---------------------------------------------------------------------------- @@ -535,3 +537,5 @@ bool Parallelize::run(Module& M) return true; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp index b377a8befe..30e2514872 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -23,6 +23,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumRemoved("prune-eh", "Number of invokes removed"); @@ -104,3 +106,5 @@ bool PruneEH::runOnSCC(const std::vector &SCC) { return MadeChange; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp index 81abda0006..fd5b7fb1f1 100644 --- a/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/lib/Transforms/IPO/RaiseAllocations.cpp @@ -22,6 +22,8 @@ #include "llvm/Support/CallSite.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumRaised("raiseallocs", "Number of allocations raised"); @@ -194,3 +196,5 @@ bool RaiseAllocations::run(Module &M) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp index 012fa22770..0c7091696e 100644 --- a/lib/Transforms/IPO/SimpleStructMutation.cpp +++ b/lib/Transforms/IPO/SimpleStructMutation.cpp @@ -23,6 +23,8 @@ using std::vector; using std::set; using std::pair; +namespace llvm { + namespace { struct SimpleStructMutation : public MutateStructTypes { enum Transform { SwapElements, SortElements }; @@ -188,3 +190,5 @@ SimpleStructMutation::TransformsType return Transforms; } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp index c371a9fa69..90ef14df7e 100644 --- a/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp @@ -25,6 +25,8 @@ #include "llvm/Module.h" #include "llvm/Pass.h" +namespace llvm { + static void insertInitializationCall(Function *MainFn, const char *FnName, GlobalValue *Array) { const Type *ArgVTy = PointerType::get(PointerType::get(Type::SByteTy)); @@ -181,3 +183,5 @@ bool BlockProfiler::run(Module &M) { insertInitializationCall(Main, "llvm_start_block_profiling", Counters); return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp index 9c395a9c1f..57254b9080 100644 --- a/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp @@ -17,6 +17,8 @@ #include "llvm/Pass.h" #include "llvm/Support/CFG.h" +namespace llvm { + enum Color{ WHITE, GREY, @@ -104,3 +106,5 @@ bool EmitFunctionTable::run(Module &M){ M.getGlobalList().push_back(fnCount); return true; // Always modifies program } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp index 6c7bb5f360..04207820a5 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp @@ -27,6 +27,8 @@ #include "llvm/Function.h" #include "llvm/Pass.h" +namespace llvm { + //this is used to color vertices //during DFS @@ -36,7 +38,7 @@ enum Color{ BLACK }; -namespace{ +namespace { struct CombineBranches : public FunctionPass { private: //DominatorSet *DS; @@ -225,3 +227,5 @@ bool CombineBranches::runOnFunction(Function &F){ return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp index 6a7f50e333..3cb5698a11 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp @@ -27,8 +27,10 @@ #define INSERT_LOAD_COUNT #define INSERT_STORE + using std::vector; +namespace llvm { static void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo, Value *cnt, Instruction *rInst){ @@ -369,3 +371,4 @@ void insertBB(Edge ed, } } +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp index cae699a8d6..d69c4c3b4c 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp @@ -19,6 +19,8 @@ using std::vector; +namespace llvm { + const graphListElement *findNodeInList(const Graph::nodeList &NL, Node *N) { for(Graph::nodeList::const_iterator NI = NL.begin(), NE=NL.end(); NI != NE; @@ -564,4 +566,4 @@ void Graph::getBackEdgesVisit(Node *u, vector &be, color[u]=BLACK;//done with visiting the node and its neighbors } - +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h index 5597b599e0..44b63a91ea 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h +++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h @@ -19,6 +19,8 @@ #include #include +namespace llvm { + class Module; class Function; @@ -112,8 +114,13 @@ struct graphListElement{ } }; +} // End llvm namespace + namespace std { + +using namespace llvm; + template<> struct less : public binary_function { bool operator()(Node *n1, Node *n2) const { @@ -135,6 +142,8 @@ namespace std { }; } +namespace llvm { + struct BBSort{ bool operator()(BasicBlock *BB1, BasicBlock *BB2) const{ std::string name1=BB1->getName(); @@ -465,6 +474,7 @@ int valueAssignmentToEdges(Graph& g, std::map nodePriority, std::vector &be); void getBBtrace(std::vector &vBB, int pathNo, Function *M); -#endif +} // End llvm namespace +#endif diff --git a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp index 66b8ccd6c4..d9dc011cd5 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp @@ -24,6 +24,8 @@ using std::map; using std::vector; using std::cerr; +namespace llvm { + //check if 2 edges are equal (same endpoints and same weight) static bool edgesEqual(Edge ed1, Edge ed2){ return ((ed1==ed2) && ed1.getWeight()==ed2.getWeight()); @@ -673,3 +675,5 @@ void printGraph(Graph &g){ } cerr<<"--------------------Graph\n"; } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp index b5e9d8c30c..9d6107cd2d 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp @@ -27,6 +27,8 @@ #include "llvm/Function.h" #include "llvm/Pass.h" +namespace llvm { + //this is used to color vertices //during DFS @@ -181,3 +183,5 @@ bool InstLoops::runOnFunction(Function &F){ findAndInstrumentBackEdges(F); return true; // Function was modified. } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index d4973be25e..5728265f42 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp @@ -43,6 +43,8 @@ #include #include +namespace llvm { + struct ProfilePaths : public FunctionPass { bool runOnFunction(Function &F); @@ -245,3 +247,5 @@ bool ProfilePaths::runOnFunction(Function &F){ return true; // Always modifies function } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp index 58b3840587..cbb2ae6aee 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp @@ -21,6 +21,8 @@ using std::vector; using std::map; using std::cerr; +namespace llvm { + //Routines to get the path trace! void getPathFrmNode(Node *n, vector &vBB, int pathNo, Graph &g, @@ -303,3 +305,5 @@ void getBBtrace(vector &vBB, int pathNo, Function *M){//, } */ } + +} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index f19ba74000..c802f73604 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -26,6 +26,8 @@ #include #include +namespace llvm { + static cl::opt DisablePtrHashing("tracedisablehashdisable", cl::Hidden, cl::desc("Disable pointer hashing in the -trace or -tracem " @@ -433,3 +435,5 @@ bool InsertTraceCode::runOnFunction(Function &F) { return true; } + +} // End llvm namespace diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index cf64aea1cd..c5be82fca7 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -29,6 +29,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + // StartInst - This enables the -raise-start-inst=foo option to cause the level // raising pass to start at instruction "foo", which is immensely useful for // debugging! @@ -55,7 +57,6 @@ NumDCEorCP("raise", "Number of insts DCEd or constprop'd"); static Statistic<> NumVarargCallChanges("raise", "Number of vararg call peepholes"); - #define PRINT_PEEPHOLE(ID, NUM, I) \ DEBUG(std::cerr << "Inst P/H " << ID << "[" << NUM << "] " << I) @@ -86,12 +87,12 @@ namespace { RegisterOpt X("raise", "Raise Pointer References"); } + Pass *createRaisePointerReferencesPass() { return new RPR(); } - // isReinterpretingCast - Return true if the cast instruction specified will // cause the operand to be "reinterpreted". A value is reinterpreted if the // cast instruction would cause the underlying bits to change. @@ -617,3 +618,5 @@ bool RPR::runOnFunction(Function &F) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 2735f95d89..e45b273190 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -28,6 +28,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + namespace { Statistic<> NumBlockRemoved("adce", "Number of basic blocks removed"); Statistic<> NumInstRemoved ("adce", "Number of instructions removed"); @@ -456,3 +458,5 @@ bool ADCE::doADCE() { return MadeChanges; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index ceef34e54e..66e78960f7 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -27,6 +27,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumInstKilled("constprop", "Number of instructions killed"); @@ -73,3 +75,5 @@ bool ConstantPropagation::runOnFunction(Function &F) { } return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp index aad9b7f309..a0358b54ad 100644 --- a/lib/Transforms/Scalar/CorrelatedExprs.cpp +++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp @@ -42,6 +42,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumSetCCRemoved("cee", "Number of setcc instruction eliminated"); Statistic<> NumOperandsCann("cee", "Number of operands canonicalized"); @@ -1314,3 +1316,5 @@ void Relation::print(std::ostream &OS) const { void Relation::dump() const { print(std::cerr); } void ValueInfo::dump() const { print(std::cerr, 0); } void RegionInfo::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index e3fc8de396..3e63cadd3e 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -24,6 +24,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> DIEEliminated("die", "Number of insts removed"); Statistic<> DCEEliminated("dce", "Number of insts removed"); @@ -57,7 +59,6 @@ Pass *createDeadInstEliminationPass() { } - //===----------------------------------------------------------------------===// // DeadCodeElimination pass implementation // @@ -124,3 +125,5 @@ bool DCE::runOnFunction(Function &F) { Pass *createDeadCodeEliminationPass() { return new DCE(); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index d6aee14f24..e110cdac8b 100644 --- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp @@ -25,6 +25,8 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumAdded("lowerrefs", "# of getelementptr instructions added"); @@ -36,13 +38,6 @@ namespace { RegisterOpt X("lowerrefs", "Decompose multi-dimensional " "structure/array references"); -FunctionPass -*createDecomposeMultiDimRefsPass() -{ - return new DecomposePass(); -} - - // runOnBasicBlock - Entry point for array or structure references with multiple // indices. // @@ -57,6 +52,11 @@ DecomposePass::runOnBasicBlock(BasicBlock &BB) return changed; } +FunctionPass +*createDecomposeMultiDimRefsPass() +{ + return new DecomposePass(); +} // Function: DecomposeArrayRef() // @@ -134,3 +134,5 @@ DecomposeArrayRef(GetElementPtrInst* GEP) return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index e1654e5d7f..b00d3005bf 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -23,6 +23,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumInstRemoved("gcse", "Number of instructions removed"); Statistic<> NumLoadRemoved("gcse", "Number of loads removed"); @@ -56,7 +58,6 @@ namespace { // createGCSEPass - The public interface to this file... FunctionPass *createGCSEPass() { return new GCSE(); } - // GCSE::runOnFunction - This is the main transformation entry point for a // function. // @@ -269,3 +270,5 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) { return Ret; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 1744fe41b2..0777a1e09f 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include "Support/STLExtras.h" +namespace llvm { + namespace { Statistic<> NumRemoved ("indvars", "Number of aux indvars removed"); Statistic<> NumInserted("indvars", "Number of canonical indvars added"); @@ -217,3 +219,5 @@ namespace { Pass *createIndVarSimplifyPass() { return new InductionVariableSimplify(); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 07736b57c2..8522b610e1 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -49,6 +49,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumCombined ("instcombine", "Number of insts combined"); Statistic<> NumConstProp("instcombine", "Number of constant folds"); @@ -2196,3 +2198,5 @@ bool InstCombiner::runOnFunction(Function &F) { Pass *createInstructionCombiningPass() { return new InstCombiner(); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 0f582c1feb..be635dff35 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -44,6 +44,8 @@ #include "llvm/Assembly/Writer.h" #include +namespace llvm { + namespace { cl::opt DisablePromotion("disable-licm-promotion", cl::Hidden, @@ -466,3 +468,5 @@ void LICM::findPromotableValuesInLoop( } } } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/PRE.cpp b/lib/Transforms/Scalar/PRE.cpp index fad5789d5a..770cd44d75 100644 --- a/lib/Transforms/Scalar/PRE.cpp +++ b/lib/Transforms/Scalar/PRE.cpp @@ -36,10 +36,12 @@ #include "Support/Statistic.h" #include "Support/hash_set" +namespace llvm { + namespace { Statistic<> NumExprsEliminated("pre", "Number of expressions constantified"); Statistic<> NumRedundant ("pre", "Number of redundant exprs eliminated"); - Statistic<> NumInserted ("pre", "Number of expressions inserted"); + static Statistic<> NumInserted ("pre", "Number of expressions inserted"); struct PRE : public FunctionPass { virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -630,3 +632,5 @@ bool PRE::ProcessExpression(Instruction *Expr) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/PiNodeInsertion.cpp b/lib/Transforms/Scalar/PiNodeInsertion.cpp index b5011af286..89ec20e069 100644 --- a/lib/Transforms/Scalar/PiNodeInsertion.cpp +++ b/lib/Transforms/Scalar/PiNodeInsertion.cpp @@ -42,6 +42,8 @@ #include "llvm/Support/CFG.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumInserted("pinodes", "Number of Pi nodes inserted"); @@ -182,3 +184,5 @@ bool PiNodeInserter::insertPiNodeFor(Value *V, BasicBlock *Succ, Value *Rep) { return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index befdcfec77..9e22ec4e7e 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -34,6 +34,8 @@ #include "Support/PostOrderIterator.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumLinear ("reassociate","Number of insts linearized"); Statistic<> NumChanged("reassociate","Number of insts reassociated"); @@ -58,6 +60,7 @@ namespace { RegisterOpt X("reassociate", "Reassociate expressions"); } +// Public interface to the Reassociate pass FunctionPass *createReassociatePass() { return new Reassociate(); } void Reassociate::BuildRankMap(Function &F) { @@ -291,3 +294,5 @@ bool Reassociate::runOnFunction(Function &F) { ValueRankMap.clear(); return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 01e3e26ab5..44a553a01b 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -33,6 +33,8 @@ #include #include +namespace llvm { + // InstVal class - This class represents the different lattice values that an // instruction may occupy. It is a simple class with value semantics. // @@ -253,7 +255,6 @@ private: // createSCCPPass - This is the public interface to this file... -// Pass *createSCCPPass() { return new SCCP(); } @@ -585,3 +586,5 @@ void SCCP::visitGetElementPtrInst(GetElementPtrInst &I) { markConstant(&I, ConstantExpr::getGetElementPtr(Ptr, Operands)); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 9342a5cf40..d29119061d 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -32,6 +32,8 @@ #include "Support/Statistic.h" #include "Support/StringExtras.h" +namespace llvm { + namespace { Statistic<> NumReplaced("scalarrepl", "Number of allocas broken up"); Statistic<> NumPromoted("scalarrepl", "Number of allocas promoted"); @@ -61,6 +63,7 @@ namespace { RegisterOpt X("scalarrepl", "Scalar Replacement of Aggregates"); } +// Public interface to the ScalarReplAggregates pass Pass *createScalarReplAggregatesPass() { return new SROA(); } @@ -298,3 +301,5 @@ bool SROA::isSafeAllocaToPromote(AllocationInst *AI) { } return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp index 224d6c5f9a..5a8d428153 100644 --- a/lib/Transforms/Scalar/SimplifyCFG.cpp +++ b/lib/Transforms/Scalar/SimplifyCFG.cpp @@ -26,6 +26,8 @@ #include "Support/Statistic.h" #include +namespace llvm { + namespace { Statistic<> NumSimpl("cfgsimplify", "Number of blocks simplified"); @@ -35,6 +37,7 @@ namespace { RegisterOpt X("simplifycfg", "Simplify the CFG"); } +// Public interface to the CFGSimplification pass FunctionPass *createCFGSimplificationPass() { return new CFGSimplifyPass(); } @@ -100,3 +103,5 @@ bool CFGSimplifyPass::runOnFunction(Function &F) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp index 58395c55ab..9e058e7939 100644 --- a/lib/Transforms/Scalar/SymbolStripping.cpp +++ b/lib/Transforms/Scalar/SymbolStripping.cpp @@ -26,6 +26,8 @@ #include "llvm/SymbolTable.h" #include "llvm/Pass.h" +namespace llvm { + static bool StripSymbolTable(SymbolTable &SymTab) { bool RemovedSymbol = false; @@ -74,3 +76,5 @@ Pass *createSymbolStrippingPass() { Pass *createFullSymbolStrippingPass() { return new FullSymbolStripping(); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index d0a7765818..07a3b1e492 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -31,6 +31,8 @@ #include "Support/Debug.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumEliminated("tailduplicate", "Number of unconditional branches eliminated"); @@ -53,6 +55,7 @@ namespace { RegisterOpt X("tailduplicate", "Tail Duplication"); } +// Public interface to the Tail Duplication pass Pass *createTailDuplicationPass() { return new TailDup(); } /// runOnFunction - Top level algorithm - Loop over each unconditional branch in @@ -339,3 +342,5 @@ Value *TailDup::GetValueOutBlock(BasicBlock *BB, Value *OrigVal, return GetValueInBlock(BB, OrigVal, ValueMap, OutValueMap); } + +} // End llvm namespace diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index d07f4e857e..dbe91a7940 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -33,6 +33,8 @@ #include "llvm/Pass.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumEliminated("tailcallelim", "Number of tail calls removed"); @@ -42,6 +44,7 @@ namespace { RegisterOpt X("tailcallelim", "Tail Call Elimination"); } +// Public interface to the TailCallElimination pass FunctionPass *createTailCallEliminationPass() { return new TailCallElim(); } @@ -105,3 +108,4 @@ bool TailCallElim::runOnFunction(Function &F) { return MadeChange; } +} // End llvm namespace diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp index 3a1d51c3a0..b553f03a41 100644 --- a/lib/Transforms/TransformInternals.cpp +++ b/lib/Transforms/TransformInternals.cpp @@ -18,6 +18,8 @@ #include "llvm/Function.h" #include "llvm/iOther.h" +namespace llvm { + static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset, std::vector &Indices, const TargetData &TD) { @@ -193,3 +195,5 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, return NextTy; } + +} // End llvm namespace diff --git a/lib/Transforms/TransformInternals.h b/lib/Transforms/TransformInternals.h index 4f92dc4eda..3b80146a27 100644 --- a/lib/Transforms/TransformInternals.h +++ b/lib/Transforms/TransformInternals.h @@ -22,6 +22,8 @@ #include #include +namespace llvm { + static inline int64_t getConstantValue(const ConstantInt *CPI) { return (int64_t)cast(CPI)->getRawValue(); } @@ -139,4 +141,6 @@ const Type *getStructOffsetType(const Type *Ty, unsigned &Offset, std::vector &Offsets, const TargetData &TD, bool StopEarly = true); +} // End llvm namespace + #endif diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index 22fd555a46..5fb5469332 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -19,6 +19,8 @@ #include "llvm/Type.h" #include +namespace llvm { + // ReplaceInstWithValue - Replace all uses of an instruction (specified by BI) // with a value, then remove and delete the original instruction. // @@ -112,3 +114,5 @@ void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) { if (NewTI) // If it's a different instruction, replace. ReplaceInstWithInst(TI, NewTI); } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp index de59db2f9b..e8201cc391 100644 --- a/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -25,6 +25,8 @@ #include "llvm/Support/CFG.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumBroken("break-crit-edges", "Number of blocks inserted"); @@ -168,3 +170,5 @@ bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) { } return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index e0312f2efb..d8aa9aebe4 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/lib/Transforms/Utils/CloneFunction.cpp @@ -19,6 +19,8 @@ #include "llvm/Function.h" #include "ValueMapper.h" +namespace llvm { + // RemapInstruction - Convert the instruction operands from referencing the // current values into those specified by ValueMap. // @@ -140,3 +142,5 @@ Function *CloneFunction(const Function *F, CloneFunctionInto(NewF, F, ValueMap, Returns); return NewF; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp index cc22c7214a..21a8675f07 100644 --- a/lib/Transforms/Utils/CloneModule.cpp +++ b/lib/Transforms/Utils/CloneModule.cpp @@ -19,6 +19,8 @@ #include "llvm/Constant.h" #include "ValueMapper.h" +namespace llvm { + /// CloneModule - Return an exact copy of the specified module. This is not as /// easy as it might seem because we have to worry about making copies of global /// variables and functions, and making their (initializers and references, @@ -88,3 +90,5 @@ Module *CloneModule(const Module *M) { return New; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneTrace.cpp b/lib/Transforms/Utils/CloneTrace.cpp index 9d995464bf..990e54c783 100644 --- a/lib/Transforms/Utils/CloneTrace.cpp +++ b/lib/Transforms/Utils/CloneTrace.cpp @@ -20,6 +20,8 @@ #include "llvm/Function.h" +namespace llvm { + //Clones the trace (a vector of basic blocks) std::vector CloneTrace(const std::vector &origTrace) { @@ -86,3 +88,5 @@ std::vector CloneTrace(const std::vector &origTrace) //return new vector of basic blocks return clonedTrace; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/DemoteRegToStack.cpp b/lib/Transforms/Utils/DemoteRegToStack.cpp index bd605ca789..e35dca4de0 100644 --- a/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/lib/Transforms/Utils/DemoteRegToStack.cpp @@ -22,6 +22,8 @@ #include "llvm/Type.h" #include "Support/hash_set" +namespace llvm { + typedef hash_set PhiSet; typedef hash_set::iterator PhiSetIterator; @@ -160,3 +162,5 @@ AllocaInst* DemoteRegToStack(Instruction& X) { return XSlot; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 1481324330..265d5c419a 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -24,6 +24,8 @@ #include "llvm/Support/CallSite.h" #include "llvm/Transforms/Utils/Local.h" +namespace llvm { + bool InlineFunction(CallInst *CI) { return InlineFunction(CallSite(CI)); } bool InlineFunction(InvokeInst *II) { return InlineFunction(CallSite(II)); } @@ -278,3 +280,5 @@ bool InlineFunction(CallSite CS) { SimplifyCFG(AfterCallBB); return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp index 0be840fb6c..4bc78a4cde 100644 --- a/lib/Transforms/Utils/Linker.cpp +++ b/lib/Transforms/Utils/Linker.cpp @@ -23,6 +23,8 @@ #include "llvm/iOther.h" #include "llvm/Constants.h" +namespace llvm { + // Error - Simple wrapper function to conditionally assign to E and return true. // This just makes error return conditions a little bit simpler... // @@ -902,3 +904,4 @@ bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { return false; } +} // End llvm namespace diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 2f9b07ca94..894699596e 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -17,6 +17,8 @@ #include "llvm/iOperators.h" #include "llvm/ConstantHandling.h" +namespace llvm { + //===----------------------------------------------------------------------===// // Local constant propagation... // @@ -180,3 +182,5 @@ bool dceInstruction(BasicBlock::iterator &BBI) { } return false; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index a1f86486b5..b999ed40cc 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -43,6 +43,8 @@ #include "Support/Statistic.h" #include "Support/DepthFirstIterator.h" +namespace llvm { + namespace { Statistic<> NumInserted("loopsimplify", "Number of pre-header blocks inserted"); @@ -82,7 +84,6 @@ namespace { const PassInfo *LoopSimplifyID = X.getPassInfo(); Pass *createLoopSimplifyPass() { return new LoopSimplify(); } - /// runOnFunction - Run down all loops in the CFG (recursively, but we could do /// it in any convenient order) inserting preheaders... /// @@ -566,3 +567,5 @@ void LoopSimplify::UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB, } } } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index 96008881bb..eea800ad54 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -22,6 +22,8 @@ #include "llvm/Target/TargetData.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumLowered("lowerallocs", "Number of allocations lowered"); @@ -131,3 +133,5 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index 4885d96f19..ec97ca2040 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -23,6 +23,8 @@ #include "llvm/Constant.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumLowered("lowerinvoke", "Number of invoke & unwinds replaced"); @@ -37,6 +39,7 @@ namespace { X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators"); } +// Public Interface To the LowerInvoke pass. FunctionPass *createLowerInvokePass() { return new LowerInvoke(); } // doInitialization - Make sure that there is a prototype for abort in the @@ -79,3 +82,5 @@ bool LowerInvoke::runOnFunction(Function &F) { } return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index a45192bb0c..1d0e47145a 100644 --- a/lib/Transforms/Utils/LowerSwitch.cpp +++ b/lib/Transforms/Utils/LowerSwitch.cpp @@ -23,6 +23,8 @@ #include "Support/Debug.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumLowered("lowerswitch", "Number of SwitchInst's replaced"); @@ -224,3 +226,5 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) { // We are now done with the switch instruction, delete it. delete SI; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp index d915155ed4..4d99280805 100644 --- a/lib/Transforms/Utils/Mem2Reg.cpp +++ b/lib/Transforms/Utils/Mem2Reg.cpp @@ -20,6 +20,8 @@ #include "llvm/Target/TargetData.h" #include "Support/Statistic.h" +namespace llvm { + namespace { Statistic<> NumPromoted("mem2reg", "Number of alloca's promoted"); @@ -78,3 +80,5 @@ bool PromotePass::runOnFunction(Function &F) { Pass *createPromoteMemoryToRegister() { return new PromotePass(); } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index f920718c3a..0859f69980 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -25,6 +25,8 @@ #include "llvm/Support/CFG.h" #include "Support/StringExtras.h" +namespace llvm { + /// isAllocaPromotable - Return true if this alloca is legal for promotion. /// This is true if there are only loads and stores to the alloca... /// @@ -459,3 +461,5 @@ void PromoteMemToReg(const std::vector &Allocas, if (Allocas.empty()) return; PromoteMem2Reg(Allocas, DT, DF, TD).run(); } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index a5f54b1326..158d9119ae 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -21,6 +21,8 @@ #include #include +namespace llvm { + // PropagatePredecessors - This gets "Succ" ready to have the predecessors from // "BB". This is a little tricky because "Succ" has PHI nodes, which need to // have extra slots added to them to hold the merge edges from BB's @@ -298,3 +300,5 @@ bool SimplifyCFG(BasicBlock *BB) { return Changed; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp index 180871b093..2591ffd6d7 100644 --- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp +++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp @@ -22,6 +22,8 @@ #include "llvm/iPHINode.h" #include "llvm/Type.h" +namespace llvm { + static RegisterOpt X("mergereturn", "Unify function exit nodes"); @@ -112,3 +114,5 @@ bool UnifyFunctionExitNodes::runOnFunction(Function &F) { ReturnBlock = NewRetBlock; return true; } + +} // End llvm namespace diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 6590498bbc..248ebace7a 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -16,6 +16,8 @@ #include "llvm/Constants.h" #include "llvm/Instruction.h" +namespace llvm { + Value *MapValue(const Value *V, std::map &VM) { Value *&VMSlot = VM[V]; if (VMSlot) return VMSlot; // Does it exist in the map yet? @@ -105,3 +107,4 @@ Value *MapValue(const Value *V, std::map &VM) { return 0; } +} // End llvm namespace diff --git a/lib/Transforms/Utils/ValueMapper.h b/lib/Transforms/Utils/ValueMapper.h index 8264ade108..e67b3261db 100644 --- a/lib/Transforms/Utils/ValueMapper.h +++ b/lib/Transforms/Utils/ValueMapper.h @@ -16,8 +16,13 @@ #define LIB_TRANSFORMS_UTILS_VALUE_MAPPER_H #include + +namespace llvm { + class Value; Value *MapValue(const Value *V, std::map &VM); +} // End llvm namespace + #endif diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index c9c4dde7e8..67ccdd0f8d 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -33,6 +33,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + static RegisterPass X("printm", "Print module to stderr",PassInfo::Analysis|PassInfo::Optimization); static RegisterPass @@ -1052,3 +1054,5 @@ CachedWriter &CachedWriter::operator<<(const Value *V) { } return *this; } + +} // End llvm namespace diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 2458cda203..63a722b33e 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -22,6 +22,8 @@ #include "SymbolTableListTraitsImpl.h" #include +namespace llvm { + // DummyInst - An instance of this class is used to mark the end of the // instruction list. This is not a real instruction. // @@ -141,7 +143,7 @@ void BasicBlock::dropAllReferences() { // bool BasicBlock::hasConstantReferences() const { for (use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) - if (::isa((Value*)*I)) + if (isa((Value*)*I)) return true; return false; @@ -263,3 +265,5 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) { } return New; } + +} // End llvm namespace diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 32b9ebba74..7fb7a05e55 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -17,6 +17,8 @@ #include "llvm/DerivedTypes.h" #include +namespace llvm { + AnnotationID ConstRules::AID(AnnotationManager::getID("opt::ConstRules", &ConstRules::find)); @@ -638,3 +640,5 @@ ConstRules *ConstRules::getConstantExprRules() { static EmptyRules CERules; return &CERules; } + +} // End llvm namespace diff --git a/lib/VMCore/ConstantFold.h b/lib/VMCore/ConstantFold.h index a27283c440..a0a01e5306 100644 --- a/lib/VMCore/ConstantFold.h +++ b/lib/VMCore/ConstantFold.h @@ -42,6 +42,9 @@ #include "llvm/Constants.h" #include "llvm/Type.h" + +namespace llvm { + class PointerType; //===----------------------------------------------------------------------===// @@ -244,4 +247,7 @@ Constant *ConstantFoldShiftInstruction(unsigned Opcode, const Constant *V1, const Constant *V2); Constant *ConstantFoldGetElementPtr(const Constant *C, const std::vector &IdxList); + +} // End llvm namespace + #endif diff --git a/lib/VMCore/ConstantFolding.h b/lib/VMCore/ConstantFolding.h index a27283c440..a0a01e5306 100644 --- a/lib/VMCore/ConstantFolding.h +++ b/lib/VMCore/ConstantFolding.h @@ -42,6 +42,9 @@ #include "llvm/Constants.h" #include "llvm/Type.h" + +namespace llvm { + class PointerType; //===----------------------------------------------------------------------===// @@ -244,4 +247,7 @@ Constant *ConstantFoldShiftInstruction(unsigned Opcode, const Constant *V1, const Constant *V2); Constant *ConstantFoldGetElementPtr(const Constant *C, const std::vector &IdxList); + +} // End llvm namespace + #endif diff --git a/lib/VMCore/ConstantRange.cpp b/lib/VMCore/ConstantRange.cpp index a9e1204de5..e180f12a1a 100644 --- a/lib/VMCore/ConstantRange.cpp +++ b/lib/VMCore/ConstantRange.cpp @@ -26,6 +26,8 @@ #include "llvm/Instruction.h" #include "llvm/ConstantHandling.h" +namespace llvm { + /// Initialize a full (the default) or empty set for the specified type. /// ConstantRange::ConstantRange(const Type *Ty, bool Full) { @@ -248,3 +250,5 @@ void ConstantRange::print(std::ostream &OS) const { void ConstantRange::dump() const { print(std::cerr); } + +} // End llvm namespace diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 28cc9d24e0..527eff5490 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -20,6 +20,8 @@ #include "Support/StringExtras.h" #include +namespace llvm { + ConstantBool *ConstantBool::True = new ConstantBool(true); ConstantBool *ConstantBool::False = new ConstantBool(false); @@ -1029,3 +1031,5 @@ unsigned Constant::mutateReferences(Value *OldV, Value *NewV) { return NumReplaced; } } + +} // End llvm namespace diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index c3bce78b5a..cad66853c9 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -20,6 +20,8 @@ #include "Support/DepthFirstIterator.h" #include "Support/SetOperations.h" +namespace llvm { + //===----------------------------------------------------------------------===// // DominatorSet Implementation //===----------------------------------------------------------------------===// @@ -358,3 +360,5 @@ void DominanceFrontierBase::print(std::ostream &o) const { o << " is:\t" << I->second << "\n"; } } + +} // End llvm namespace diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index f47ecea7af..364cc6f733 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -19,6 +19,8 @@ #include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" +namespace llvm { + BasicBlock *ilist_traits::createNode() { BasicBlock *Ret = new BasicBlock(); // This should not be garbage monitored. @@ -158,7 +160,7 @@ void Function::dropAllReferences() { } /// getIntrinsicID - This method returns the ID number of the specified -/// function, or LLVMIntrinsic::not_intrinsic if the function is not an +/// function, or Intrinsic::not_intrinsic if the function is not an /// intrinsic, or if the pointer is null. This value is always defined to be /// zero to allow easy checking for whether a function is intrinsic or not. The /// particular intrinsic functions which correspond to this value are defined in @@ -176,21 +178,21 @@ unsigned Function::getIntrinsicID() const { std::string name; // The name of the intrinsic unsigned id; // Its ID number } alpha_intrinsics[] = { - { "llvm.alpha.ctlz", LLVMIntrinsic::alpha_ctlz }, - { "llvm.alpha.cttz", LLVMIntrinsic::alpha_cttz }, - { "llvm.alpha.ctpop", LLVMIntrinsic::alpha_ctpop }, - { "llvm.alpha.umulh", LLVMIntrinsic::alpha_umulh }, - { "llvm.alpha.vecop", LLVMIntrinsic::alpha_vecop }, - { "llvm.alpha.pup", LLVMIntrinsic::alpha_pup }, - { "llvm.alpha.bytezap", LLVMIntrinsic::alpha_bytezap }, - { "llvm.alpha.bytemanip", LLVMIntrinsic::alpha_bytemanip }, - { "llvm.alpha.dfp_bop", LLVMIntrinsic::alpha_dfpbop }, - { "llvm.alpha.dfp_uop", LLVMIntrinsic::alpha_dfpuop }, - { "llvm.alpha.unordered", LLVMIntrinsic::alpha_unordered }, - { "llvm.alpha.uqtodfp", LLVMIntrinsic::alpha_uqtodfp }, - { "llvm.alpha.uqtosfp", LLVMIntrinsic::alpha_uqtosfp }, - { "llvm.alpha.dfptosq", LLVMIntrinsic::alpha_dfptosq }, - { "llvm.alpha.sfptosq", LLVMIntrinsic::alpha_sfptosq }, + { "llvm.alpha.ctlz", Intrinsic::alpha_ctlz }, + { "llvm.alpha.cttz", Intrinsic::alpha_cttz }, + { "llvm.alpha.ctpop", Intrinsic::alpha_ctpop }, + { "llvm.alpha.umulh", Intrinsic::alpha_umulh }, + { "llvm.alpha.vecop", Intrinsic::alpha_vecop }, + { "llvm.alpha.pup", Intrinsic::alpha_pup }, + { "llvm.alpha.bytezap", Intrinsic::alpha_bytezap }, + { "llvm.alpha.bytemanip", Intrinsic::alpha_bytemanip }, + { "llvm.alpha.dfp_bop", Intrinsic::alpha_dfpbop }, + { "llvm.alpha.dfp_uop", Intrinsic::alpha_dfpuop }, + { "llvm.alpha.unordered", Intrinsic::alpha_unordered }, + { "llvm.alpha.uqtodfp", Intrinsic::alpha_uqtodfp }, + { "llvm.alpha.uqtosfp", Intrinsic::alpha_uqtosfp }, + { "llvm.alpha.dfptosq", Intrinsic::alpha_dfptosq }, + { "llvm.alpha.sfptosq", Intrinsic::alpha_sfptosq }, }; const unsigned num_alpha_intrinsics = sizeof(alpha_intrinsics) / sizeof(*alpha_intrinsics); @@ -204,17 +206,17 @@ unsigned Function::getIntrinsicID() const { return alpha_intrinsics[i].id; break; case 'l': - if (getName() == "llvm.longjmp") return LLVMIntrinsic::longjmp; + if (getName() == "llvm.longjmp") return Intrinsic::longjmp; break; case 's': - if (getName() == "llvm.setjmp") return LLVMIntrinsic::setjmp; - if (getName() == "llvm.sigsetjmp") return LLVMIntrinsic::sigsetjmp; - if (getName() == "llvm.siglongjmp") return LLVMIntrinsic::siglongjmp; + if (getName() == "llvm.setjmp") return Intrinsic::setjmp; + if (getName() == "llvm.sigsetjmp") return Intrinsic::sigsetjmp; + if (getName() == "llvm.siglongjmp") return Intrinsic::siglongjmp; break; case 'v': - if (getName() == "llvm.va_copy") return LLVMIntrinsic::va_copy; - if (getName() == "llvm.va_end") return LLVMIntrinsic::va_end; - if (getName() == "llvm.va_start") return LLVMIntrinsic::va_start; + if (getName() == "llvm.va_copy") return Intrinsic::va_copy; + if (getName() == "llvm.va_end") return Intrinsic::va_end; + if (getName() == "llvm.va_start") return Intrinsic::va_start; break; } // The "llvm." namespace is reserved! @@ -257,3 +259,5 @@ void GlobalVariable::setName(const std::string &name, SymbolTable *ST) { Value::setName(name); if (P && getName() != "") P->getSymbolTable().insert(this); } + +} // End llvm namespace diff --git a/lib/VMCore/InstrTypes.cpp b/lib/VMCore/InstrTypes.cpp index ba1d4b7160..17e16fa733 100644 --- a/lib/VMCore/InstrTypes.cpp +++ b/lib/VMCore/InstrTypes.cpp @@ -19,6 +19,8 @@ #include "llvm/Type.h" #include // find +namespace llvm { + //===----------------------------------------------------------------------===// // TerminatorInst Class //===----------------------------------------------------------------------===// @@ -56,3 +58,5 @@ Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) { } return Removed; } + +} // End llvm namespace diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index b72656bdc2..9ca2fedbf4 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -16,6 +16,8 @@ #include "llvm/Type.h" #include "Support/LeakDetector.h" +namespace llvm { + Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name, Instruction *InsertBefore) : User(ty, Value::InstructionVal, Name) { @@ -163,3 +165,5 @@ bool Instruction::isTrapping(unsigned op) { return false; } } + +} // End llvm namespace diff --git a/lib/VMCore/LeakDetector.cpp b/lib/VMCore/LeakDetector.cpp index 24c946ab6e..ffb081a998 100644 --- a/lib/VMCore/LeakDetector.cpp +++ b/lib/VMCore/LeakDetector.cpp @@ -15,6 +15,8 @@ #include "llvm/Value.h" #include +namespace llvm { + // Lazily allocate set so that release build doesn't have to do anything. static std::set *Objects = 0; static std::set *LLVMObjects = 0; @@ -87,3 +89,5 @@ void LeakDetector::checkForGarbageImpl(const std::string &Message) { Objects = 0; LLVMObjects = 0; } } + +} // End llvm namespace diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index 0be840fb6c..4bc78a4cde 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/Linker.cpp @@ -23,6 +23,8 @@ #include "llvm/iOther.h" #include "llvm/Constants.h" +namespace llvm { + // Error - Simple wrapper function to conditionally assign to E and return true. // This just makes error return conditions a little bit simpler... // @@ -902,3 +904,4 @@ bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { return false; } +} // End llvm namespace diff --git a/lib/VMCore/Mangler.cpp b/lib/VMCore/Mangler.cpp index 44c697d3d8..567fe05e32 100644 --- a/lib/VMCore/Mangler.cpp +++ b/lib/VMCore/Mangler.cpp @@ -16,6 +16,8 @@ #include "llvm/Type.h" #include "Support/StringExtras.h" +namespace llvm { + static char HexDigit(int V) { return V < 10 ? V+'0' : V+'A'-10; } @@ -99,3 +101,4 @@ Mangler::Mangler(Module &m, bool addUnderscorePrefix) FoundNames.insert(I->getName()); // Otherwise, keep track of name } +} // End llvm namespace diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index e62c83f67a..6b15929506 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -22,6 +22,8 @@ #include #include +namespace llvm { + Function *ilist_traits::createNode() { FunctionType *FTy = FunctionType::get(Type::VoidTy, std::vector(), false); @@ -307,3 +309,5 @@ void Module::mutateConstantPointerRef(GlobalValue *OldGV, GlobalValue *NewGV) { delete Ref; } } + +} // End llvm namespace diff --git a/lib/VMCore/ModuleProvider.cpp b/lib/VMCore/ModuleProvider.cpp index ba324d0894..8be033622d 100644 --- a/lib/VMCore/ModuleProvider.cpp +++ b/lib/VMCore/ModuleProvider.cpp @@ -14,6 +14,8 @@ #include "llvm/ModuleProvider.h" #include "llvm/Module.h" +namespace llvm { + /// ctor - always have a valid Module /// ModuleProvider::ModuleProvider() : TheModule(0) { } @@ -35,3 +37,5 @@ Module* ModuleProvider::materializeModule() { return TheModule; } + +} // End llvm namespace diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index 96ad3c94e9..b387fc3524 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -21,6 +21,8 @@ #include "Support/TypeInfo.h" #include +namespace llvm { + // IncludeFile - Stub function used to help linking out. IncludeFile::IncludeFile(void*) {} @@ -467,3 +469,5 @@ void PassRegistrationListener::enumeratePasses() { E = PassInfoMap->end(); I != E; ++I) passEnumerate(I->second); } + +} // End llvm namespace diff --git a/lib/VMCore/PassManagerT.h b/lib/VMCore/PassManagerT.h index a715f5148e..c5cac1d7fe 100644 --- a/lib/VMCore/PassManagerT.h +++ b/lib/VMCore/PassManagerT.h @@ -28,6 +28,9 @@ #include "Support/Timer.h" #include #include + +namespace llvm { + class Annotable; //===----------------------------------------------------------------------===// @@ -792,4 +795,6 @@ inline bool PassManagerTraits::doFinalization(Module &M) { return Changed; } +} // End llvm namespace + #endif diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp index aef71763c4..c6e44e8266 100644 --- a/lib/VMCore/SlotCalculator.cpp +++ b/lib/VMCore/SlotCalculator.cpp @@ -27,6 +27,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + #if 0 #define SC_DEBUG(X) std::cerr << X #else @@ -361,3 +363,5 @@ int SlotCalculator::doInsertValue(const Value *D) { SC_DEBUG("]\n"); return (int)DestSlot; } + +} // End llvm namespace diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp index 9452cdfec4..834d619898 100644 --- a/lib/VMCore/SymbolTable.cpp +++ b/lib/VMCore/SymbolTable.cpp @@ -17,6 +17,8 @@ #include "Support/StringExtras.h" #include +namespace llvm { + #define DEBUG_SYMBOL_TABLE 0 #define DEBUG_ABSTYPE 0 @@ -354,3 +356,5 @@ void SymbolTable::dump() const { std::cout << "Symbol table dump:\n"; for_each(begin(), end(), DumpPlane); } + +} // End llvm namespace diff --git a/lib/VMCore/SymbolTableListTraitsImpl.h b/lib/VMCore/SymbolTableListTraitsImpl.h index aec7520cef..22d2e1d6c7 100644 --- a/lib/VMCore/SymbolTableListTraitsImpl.h +++ b/lib/VMCore/SymbolTableListTraitsImpl.h @@ -19,6 +19,8 @@ #include "llvm/SymbolTableListTraits.h" #include "llvm/SymbolTable.h" +namespace llvm { + template void SymbolTableListTraits @@ -94,4 +96,6 @@ void SymbolTableListTraits } } +} // End llvm namespace + #endif diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index ed468022cb..9e33303b7f 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -18,6 +18,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + // DEBUG_MERGE_TYPES - Enable this #define to see how and when derived types are // created and later destroyed, all in an effort to make sure that there is only // a single canonical version of a type. @@ -1114,3 +1116,4 @@ void PointerType::typeBecameConcrete(const DerivedType *AbsTy) { refineAbstractType(AbsTy, AbsTy); } +} // End llvm namespace diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 709ae3e9ae..f389eb0132 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -18,6 +18,8 @@ #include "Support/LeakDetector.h" #include +namespace llvm { + //===----------------------------------------------------------------------===// // Value Class //===----------------------------------------------------------------------===// @@ -107,3 +109,5 @@ void User::replaceUsesOfWith(Value *From, Value *To) { setOperand(i, To); // Fix it now... } } + +} // End llvm namespace diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 14c14f3c08..1362eaab0f 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -57,6 +57,8 @@ #include "Support/STLExtras.h" #include +namespace llvm { + namespace { // Anonymous namespace for class struct Verifier : public FunctionPass, InstVisitor { @@ -149,7 +151,7 @@ namespace { // Anonymous namespace for class void visitReturnInst(ReturnInst &RI); void visitUserOp1(Instruction &I); void visitUserOp2(Instruction &I) { visitUserOp1(I); } - void visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI); + void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI); // CheckFailed - A check failed, so print out the condition and the message // that failed. This provides a nice place to put a breakpoint if you want @@ -168,7 +170,6 @@ namespace { // Anonymous namespace for class }; RegisterPass X("verify", "Module Verifier"); -} // Assert - We know that cond should be true, if not print an error message. #define Assert(C, M) \ @@ -368,7 +369,7 @@ void Verifier::visitCallInst(CallInst &CI) { CI.getOperand(i+1), FTy->getParamType(i)); if (Function *F = CI.getCalledFunction()) - if (LLVMIntrinsic::ID ID = (LLVMIntrinsic::ID)F->getIntrinsicID()) + if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID()) visitIntrinsicFunctionCall(ID, CI); visitInstruction(CI); @@ -500,7 +501,7 @@ void Verifier::visitInstruction(Instruction &I) { } /// visitIntrinsicFunction - Allow intrinsics to be verified in different ways. -void Verifier::visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI) { +void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { Function *IF = CI.getCalledFunction(); const FunctionType *FT = IF->getFunctionType(); Assert1(IF->isExternal(), "Intrinsic functions should never be defined!", IF); @@ -509,37 +510,37 @@ void Verifier::visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI) { // FIXME: this should check the return type of each intrinsic as well, also // arguments! switch (ID) { - case LLVMIntrinsic::va_start: + case Intrinsic::va_start: Assert1(CI.getParent()->getParent()->getFunctionType()->isVarArg(), "llvm.va_start intrinsic may only occur in function with variable" " args!", &CI); NumArgs = 0; break; - case LLVMIntrinsic::va_end: NumArgs = 1; break; - case LLVMIntrinsic::va_copy: NumArgs = 1; break; + case Intrinsic::va_end: NumArgs = 1; break; + case Intrinsic::va_copy: NumArgs = 1; break; - case LLVMIntrinsic::setjmp: NumArgs = 1; break; - case LLVMIntrinsic::longjmp: NumArgs = 2; break; - case LLVMIntrinsic::sigsetjmp: NumArgs = 2; break; - case LLVMIntrinsic::siglongjmp: NumArgs = 2; break; + case Intrinsic::setjmp: NumArgs = 1; break; + case Intrinsic::longjmp: NumArgs = 2; break; + case Intrinsic::sigsetjmp: NumArgs = 2; break; + case Intrinsic::siglongjmp: NumArgs = 2; break; - case LLVMIntrinsic::alpha_ctlz: NumArgs = 1; break; - case LLVMIntrinsic::alpha_cttz: NumArgs = 1; break; - case LLVMIntrinsic::alpha_ctpop: NumArgs = 1; break; - case LLVMIntrinsic::alpha_umulh: NumArgs = 2; break; - case LLVMIntrinsic::alpha_vecop: NumArgs = 4; break; - case LLVMIntrinsic::alpha_pup: NumArgs = 3; break; - case LLVMIntrinsic::alpha_bytezap: NumArgs = 2; break; - case LLVMIntrinsic::alpha_bytemanip: NumArgs = 3; break; - case LLVMIntrinsic::alpha_dfpbop: NumArgs = 3; break; - case LLVMIntrinsic::alpha_dfpuop: NumArgs = 2; break; - case LLVMIntrinsic::alpha_unordered: NumArgs = 2; break; - case LLVMIntrinsic::alpha_uqtodfp: NumArgs = 2; break; - case LLVMIntrinsic::alpha_uqtosfp: NumArgs = 2; break; - case LLVMIntrinsic::alpha_dfptosq: NumArgs = 2; break; - case LLVMIntrinsic::alpha_sfptosq: NumArgs = 2; break; - - case LLVMIntrinsic::not_intrinsic: + case Intrinsic::alpha_ctlz: NumArgs = 1; break; + case Intrinsic::alpha_cttz: NumArgs = 1; break; + case Intrinsic::alpha_ctpop: NumArgs = 1; break; + case Intrinsic::alpha_umulh: NumArgs = 2; break; + case Intrinsic::alpha_vecop: NumArgs = 4; break; + case Intrinsic::alpha_pup: NumArgs = 3; break; + case Intrinsic::alpha_bytezap: NumArgs = 2; break; + case Intrinsic::alpha_bytemanip: NumArgs = 3; break; + case Intrinsic::alpha_dfpbop: NumArgs = 3; break; + case Intrinsic::alpha_dfpuop: NumArgs = 2; break; + case Intrinsic::alpha_unordered: NumArgs = 2; break; + case Intrinsic::alpha_uqtodfp: NumArgs = 2; break; + case Intrinsic::alpha_uqtosfp: NumArgs = 2; break; + case Intrinsic::alpha_dfptosq: NumArgs = 2; break; + case Intrinsic::alpha_sfptosq: NumArgs = 2; break; + + case Intrinsic::not_intrinsic: assert(0 && "Invalid intrinsic!"); NumArgs = 0; break; } @@ -548,6 +549,7 @@ void Verifier::visitIntrinsicFunctionCall(LLVMIntrinsic::ID ID, CallInst &CI) { "Illegal # arguments for intrinsic function!", IF); } +} // End anonymous namespace //===----------------------------------------------------------------------===// // Implement the public interfaces to this file... @@ -585,3 +587,5 @@ bool verifyModule(const Module &M) { PM.run((Module&)M); return V->Broken; } + +} // End llvm namespace diff --git a/lib/VMCore/iBranch.cpp b/lib/VMCore/iBranch.cpp index bcba7145cc..59dc303d70 100644 --- a/lib/VMCore/iBranch.cpp +++ b/lib/VMCore/iBranch.cpp @@ -16,6 +16,8 @@ #include "llvm/BasicBlock.h" #include "llvm/Type.h" +namespace llvm { + BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond, Instruction *InsertBefore) : TerminatorInst(Instruction::Br, InsertBefore) { @@ -49,3 +51,5 @@ BranchInst::BranchInst(const BranchInst &BI) : TerminatorInst(Instruction::Br) { Operands.push_back(Use(BI.Operands[2], this)); } } + +} // End llvm namespace diff --git a/lib/VMCore/iCall.cpp b/lib/VMCore/iCall.cpp index b99c9e7bb3..c385afc778 100644 --- a/lib/VMCore/iCall.cpp +++ b/lib/VMCore/iCall.cpp @@ -17,6 +17,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Function.h" +namespace llvm { + //===----------------------------------------------------------------------===// // CallInst Implementation //===----------------------------------------------------------------------===// @@ -144,8 +146,12 @@ Function *InvokeInst::getCalledFunction() { return 0; } +} // End llvm namespace + #include "llvm/Support/CallSite.h" +namespace llvm { + Function *CallSite::getCalledFunction() const { Value *Callee = getCalledValue(); if (Function *F = dyn_cast(Callee)) @@ -155,3 +161,4 @@ Function *CallSite::getCalledFunction() const { return 0; } +} // End llvm namespace diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp index 75309ad8dc..c1a06576cd 100644 --- a/lib/VMCore/iMemory.cpp +++ b/lib/VMCore/iMemory.cpp @@ -15,6 +15,8 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" +using namespace llvm; + AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, const std::string &Name, Instruction *InsertBef) : Instruction(PointerType::get(Ty), iTy, Name, InsertBef) { diff --git a/lib/VMCore/iOperators.cpp b/lib/VMCore/iOperators.cpp index d893290198..79fac335fe 100644 --- a/lib/VMCore/iOperators.cpp +++ b/lib/VMCore/iOperators.cpp @@ -16,6 +16,8 @@ #include "llvm/Constants.h" #include "llvm/BasicBlock.h" +namespace llvm { + //===----------------------------------------------------------------------===// // BinaryOperator Class //===----------------------------------------------------------------------===// @@ -194,3 +196,5 @@ Instruction::BinaryOps SetCondInst::getSwappedCondition(BinaryOps Opcode) { case SetLE: return SetGE; } } + +} // End llvm namespace diff --git a/lib/VMCore/iSwitch.cpp b/lib/VMCore/iSwitch.cpp index e6a4f48ef4..4386b7b837 100644 --- a/lib/VMCore/iSwitch.cpp +++ b/lib/VMCore/iSwitch.cpp @@ -14,6 +14,8 @@ #include "llvm/iTerminators.h" #include "llvm/BasicBlock.h" +namespace llvm { + SwitchInst::SwitchInst(Value *V, BasicBlock *DefaultDest, Instruction *InsertBefore) : TerminatorInst(Instruction::Switch, InsertBefore) { @@ -48,3 +50,5 @@ void SwitchInst::removeCase(unsigned idx) { assert(idx*2 < Operands.size() && "Successor index out of range!!!"); Operands.erase(Operands.begin()+idx*2, Operands.begin()+(idx+1)*2); } + +} // End llvm namespace diff --git a/projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp b/projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp index 1d06c2d0dd..a1b68449f3 100644 --- a/projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp +++ b/projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp @@ -12,6 +12,8 @@ #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" +using namespace llvm; + int main() { // Create the "module" or "program" or "translation unit" to hold the // function diff --git a/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp b/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp index 1d06c2d0dd..a1b68449f3 100644 --- a/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp +++ b/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp @@ -12,6 +12,8 @@ #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" +using namespace llvm; + int main() { // Create the "module" or "program" or "translation unit" to hold the // function diff --git a/tools/analyze/AnalysisWrappers.cpp b/tools/analyze/AnalysisWrappers.cpp index 6c4c99f5a3..a9b9cd0470 100644 --- a/tools/analyze/AnalysisWrappers.cpp +++ b/tools/analyze/AnalysisWrappers.cpp @@ -26,6 +26,8 @@ #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/InstIterator.h" +using namespace llvm; + namespace { struct InstForestHelper : public FunctionPass { Function *F; diff --git a/tools/analyze/GraphPrinters.cpp b/tools/analyze/GraphPrinters.cpp index 34c937f0d4..6d2750f5e2 100644 --- a/tools/analyze/GraphPrinters.cpp +++ b/tools/analyze/GraphPrinters.cpp @@ -20,6 +20,8 @@ #include "llvm/Analysis/CallGraph.h" #include +namespace llvm { + template static void WriteGraphToFile(std::ostream &O, const std::string &GraphName, const GraphType >) { @@ -72,3 +74,5 @@ namespace { RegisterAnalysis P2("print-callgraph", "Print Call Graph to 'dot' file"); }; + +} // End llvm namespace diff --git a/tools/analyze/PrintSCC.cpp b/tools/analyze/PrintSCC.cpp index 3459381158..ce89fff90e 100644 --- a/tools/analyze/PrintSCC.cpp +++ b/tools/analyze/PrintSCC.cpp @@ -31,6 +31,8 @@ #include "llvm/Support/CFG.h" #include "Support/SCCIterator.h" +namespace llvm { + namespace { struct CFGSCC : public FunctionPass { bool runOnFunction(Function& func); @@ -101,3 +103,5 @@ bool CallGraphSCC::run(Module &M) { return true; } + +} // End llvm namespace diff --git a/tools/analyze/analyze.cpp b/tools/analyze/analyze.cpp index 836b6aa8d7..3e1e51600e 100644 --- a/tools/analyze/analyze.cpp +++ b/tools/analyze/analyze.cpp @@ -26,6 +26,7 @@ #include "Support/Timer.h" #include +using namespace llvm; struct ModulePassPrinter : public Pass { const PassInfo *PassToPrint; diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index f0fb785db9..12843588c8 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -23,6 +23,8 @@ #include "Support/FileUtilities.h" #include +using namespace llvm; + // Anonymous namespace to define command line options for debugging. // namespace { @@ -36,6 +38,8 @@ namespace { "(for miscompilation detection)")); } +namespace llvm { + /// getPassesString - Turn a list of passes into a string which indicates the /// command line options that must be passed to add the passes. /// @@ -179,3 +183,5 @@ void BugDriver::PrintFunctionList(const std::vector &Funcs) { } std::cout << std::flush; } + +} // End llvm namespace diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h index e1af721a75..af04a7d61a 100644 --- a/tools/bugpoint/BugDriver.h +++ b/tools/bugpoint/BugDriver.h @@ -19,6 +19,8 @@ #include #include +namespace llvm { + class PassInfo; class Module; class Function; @@ -207,4 +209,6 @@ std::string getPassesString(const std::vector &Passes); // void DeleteFunctionBody(Function *F); +} // End llvm namespace + #endif diff --git a/tools/bugpoint/CodeGeneratorBug.cpp b/tools/bugpoint/CodeGeneratorBug.cpp index 41df79a110..b24620ea14 100644 --- a/tools/bugpoint/CodeGeneratorBug.cpp +++ b/tools/bugpoint/CodeGeneratorBug.cpp @@ -33,6 +33,8 @@ #include #include +namespace llvm { + extern cl::list InputArgv; class ReduceMisCodegenFunctions : public ListReducer { @@ -408,3 +410,5 @@ bool BugDriver::debugCodeGenerator() { return false; } + +} // End llvm namespace diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index 0b2851f220..8c29ea226a 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -29,6 +29,8 @@ #include #include +namespace llvm { + class DebugCrashes : public ListReducer { BugDriver &BD; public: @@ -397,3 +399,5 @@ bool BugDriver::debugCrash() { return false; } + +} // End llvm namespace diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index 596aeb95a8..9a3bd55055 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -30,6 +30,8 @@ BUGPOINT NOTES: #include #include +using namespace llvm; + namespace { // OutputType - Allow the user to specify the way code should be run, to test // for miscompilation. @@ -58,6 +60,8 @@ namespace { "into executing programs")); } +namespace llvm { + // Anything specified after the --args option are taken as arguments to the // program being debugged. cl::list @@ -232,3 +236,5 @@ bool BugDriver::diffProgram(const std::string &BytecodeFile, bool BugDriver::isExecutingJIT() { return InterpreterSel == RunJIT; } + +} // End llvm namespace diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index 38e25864e4..4c671be62f 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -25,8 +25,15 @@ #include "llvm/Target/TargetData.h" #include "Support/CommandLine.h" + +namespace llvm { + bool DisableSimplifyCFG = false; +} // End llvm namespace + +using namespace llvm; + namespace { cl::opt NoADCE("disable-adce", @@ -39,6 +46,8 @@ namespace { cl::desc("Do not use the -simplifycfg pass to reduce testcases")); } +namespace llvm { + /// deleteInstructionFromProgram - This method clones the current Program and /// deletes the specified instruction from the cloned module. It then runs a /// series of cleanup passes (ADCE and SimplifyCFG) to eliminate any code which @@ -125,3 +134,5 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) { } return M; } + +} // End llvm namespace diff --git a/tools/bugpoint/ListReducer.h b/tools/bugpoint/ListReducer.h index 0ab2ef9927..0ad24065cf 100644 --- a/tools/bugpoint/ListReducer.h +++ b/tools/bugpoint/ListReducer.h @@ -17,6 +17,8 @@ #include +namespace llvm { + template struct ListReducer { enum TestResult { @@ -109,4 +111,6 @@ struct ListReducer { } }; +} // End llvm namespace + #endif diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 5ec8b1543e..1fb46a62bc 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -19,6 +19,8 @@ #include "llvm/Transforms/Utils/Linker.h" #include "Support/FileUtilities.h" +namespace llvm { + class ReduceMiscompilingPasses : public ListReducer { BugDriver &BD; public: @@ -308,3 +310,5 @@ bool BugDriver::debugMiscompilation() { return false; } + +} // End llvm namespace diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 600a25ad72..af9d1e5a94 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -26,6 +26,8 @@ #include #include +namespace llvm { + /// writeProgramToFile - This writes the current "Program" to the named bytecode /// file. If an error occurs, true is returned. /// @@ -159,3 +161,5 @@ bool BugDriver::runPasses(const std::vector &Passes, // Was the child successful? return !ExitedOK; } + +} // End llvm namespace diff --git a/tools/bugpoint/TestPasses.cpp b/tools/bugpoint/TestPasses.cpp index af5c045788..ee2c0d7248 100644 --- a/tools/bugpoint/TestPasses.cpp +++ b/tools/bugpoint/TestPasses.cpp @@ -18,6 +18,8 @@ #include "llvm/Pass.h" #include "llvm/Support/InstVisitor.h" +using namespace llvm; + namespace { /// CrashOnCalls - This pass is used to test bugpoint. It intentionally /// crashes on any call instructions. diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index a66b868c22..50a9ad21c8 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -18,6 +18,8 @@ #include #include +namespace llvm { + //===---------------------------------------------------------------------===// // LLI Implementation of AbstractIntepreter interface // @@ -391,3 +393,5 @@ GCC *GCC::create(const std::string &ProgramPath, std::string &Message) { Message = "Found gcc: " + GCCPath + "\n"; return new GCC(GCCPath); } + +} // End llvm namespace diff --git a/tools/bugpoint/ToolRunner.h b/tools/bugpoint/ToolRunner.h index e23ec7f312..8ce3f5d8f3 100644 --- a/tools/bugpoint/ToolRunner.h +++ b/tools/bugpoint/ToolRunner.h @@ -20,6 +20,8 @@ #include "Support/SystemUtils.h" #include +namespace llvm { + class CBE; class LLC; @@ -137,4 +139,6 @@ public: int OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile); }; +} // End llvm namespace + #endif diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp index 8f55804e0c..9bca7fd6fc 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/tools/bugpoint/bugpoint.cpp @@ -19,6 +19,8 @@ #include "Config/unistd.h" #include +using namespace llvm; + static cl::list InputFilenames(cl::Positional, cl::OneOrMore, cl::desc("")); diff --git a/tools/extract/extract.cpp b/tools/extract/extract.cpp index 272d473180..72412b8b09 100644 --- a/tools/extract/extract.cpp +++ b/tools/extract/extract.cpp @@ -21,6 +21,8 @@ #include "Support/CommandLine.h" #include +using namespace llvm; + // InputFilename - The filename to read from. static cl::opt InputFilename(cl::Positional, cl::desc(""), diff --git a/tools/gccas/gccas.cpp b/tools/gccas/gccas.cpp index d97c716da1..c7a2204e32 100644 --- a/tools/gccas/gccas.cpp +++ b/tools/gccas/gccas.cpp @@ -27,6 +27,8 @@ #include #include +using namespace llvm; + namespace { cl::opt InputFilename(cl::Positional,cl::desc(""),cl::init("-")); diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp index bf32400c63..aac1f93d32 100644 --- a/tools/gccld/GenerateCode.cpp +++ b/tools/gccld/GenerateCode.cpp @@ -25,11 +25,14 @@ #include "Support/SystemUtils.h" #include "Support/CommandLine.h" +using namespace llvm; + namespace { cl::opt DisableInline("disable-inlining", cl::desc("Do not run the inliner pass")); } +namespace llvm { /// GenerateBytecode - generates a bytecode file from the specified module. /// @@ -221,3 +224,5 @@ GenerateNative(const std::string &OutputFilename, // Run the compiler to assembly and link together the program. return ExecWait(&(cmd[0]), clean_env); } + +} // End llvm namespace diff --git a/tools/gccld/Linker.cpp b/tools/gccld/Linker.cpp index 06f0635749..9c22891775 100644 --- a/tools/gccld/Linker.cpp +++ b/tools/gccld/Linker.cpp @@ -30,6 +30,8 @@ #include #include +namespace llvm { + /// FindLib - Try to convert Filename into the name of a file that we can open, /// if it does not already name a file we can open, by first trying to open /// Filename, then libFilename. for each of a set of several common @@ -405,3 +407,5 @@ bool LinkLibraries(const char *progname, return false; } + +} // End llvm namespace diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp index 45163f4396..5a1b26100a 100644 --- a/tools/gccld/gccld.cpp +++ b/tools/gccld/gccld.cpp @@ -36,6 +36,8 @@ #include #include +using namespace llvm; + namespace { cl::list InputFilenames(cl::Positional, cl::desc(""), @@ -86,6 +88,8 @@ namespace { CO5("eh-frame-hdr", cl::Hidden, cl::desc("Compatibility option: ignored")); } +namespace llvm { + // // Function: PrintAndReturn () // @@ -211,6 +215,7 @@ void RemoveEnv(const char * name, char ** const envp) { return; } +} // End llvm namespace int main(int argc, char **argv, char **envp) { cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n"); diff --git a/tools/gccld/gccld.h b/tools/gccld/gccld.h index e3c5504209..9b7eb1e877 100644 --- a/tools/gccld/gccld.h +++ b/tools/gccld/gccld.h @@ -17,6 +17,8 @@ #include #include +namespace llvm { + int PrintAndReturn (const char *progname, const std::string &Message, @@ -69,3 +71,4 @@ LinkFiles (const char * progname, const std::vector & Files, bool Verbose); +} // End llvm namespace diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 0143d086e7..f219b6ea16 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -23,6 +23,8 @@ #include #include +using namespace llvm; + // General options for llc. Other pass-specific options are specified // within the corresponding llc passes, and target-specific options // and back-end code generation options are specified with the target machine. diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 87fe461ce0..82b354dc18 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -28,6 +28,8 @@ #include "Support/Debug.h" #include "Support/SystemUtils.h" +using namespace llvm; + namespace { cl::opt InputFile(cl::desc(""), cl::Positional, cl::init("-")); diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 879d847630..e9a4dbf095 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -25,6 +25,8 @@ #include #include +using namespace llvm; + using std::string; using std::vector; using std::cout; @@ -69,7 +71,7 @@ namespace { //Option to generate symbol table or not //running llvm-ar -s is the same as ranlib -cl::opt SymbolTable ("s", cl::desc("Generate an archive symbol table")); +cl::opt SymbolTableOption ("s", cl::desc("Generate an archive symbol table")); //Archive name cl::opt Archive (cl::Positional, cl::desc(""), @@ -335,7 +337,7 @@ void CreateArchive() { ArchiveFile << ARMAG; //If the '-s' option was specified, generate symbol table. - if(SymbolTable) { + if(SymbolTableOption) { cout << "Symbol Table Start: " << ArchiveFile.tellp() << "\n"; if(!WriteSymbolTable(ArchiveFile)) { std::cerr << "Error creating symbol table. Exiting program."; diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 0905466780..9be5afff11 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -24,6 +24,8 @@ #include #include +using namespace llvm; + static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-")); diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 915755903b..8d0ca7bc2d 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -29,10 +29,12 @@ // OutputMode - The different orderings to print basic blocks in... enum OutputMode { - llvm = 0, // Generate LLVM assembly (the default) + LLVM = 0, // Generate LLVM assembly (the default) c, // Generate C code }; +using namespace llvm; + static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-")); @@ -45,8 +47,8 @@ Force("f", cl::desc("Overwrite output files")); static cl::opt WriteMode(cl::desc("Specify the output format:"), - cl::values(clEnumVal(llvm, "Output LLVM assembly"), - clEnumVal(c , "Output C code for program"), + cl::values(clEnumVal(LLVM, "Output LLVM assembly"), + clEnumVal(c, "Output C code for program"), 0)); int main(int argc, char **argv) { @@ -116,7 +118,7 @@ int main(int argc, char **argv) { PassManager Passes; switch (WriteMode) { - case llvm: // Output LLVM assembly + case LLVM: // Output LLVM assembly Passes.add(new PrintModulePass(Out)); break; case c: // Convert LLVM to C diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index 272d473180..72412b8b09 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -21,6 +21,8 @@ #include "Support/CommandLine.h" #include +using namespace llvm; + // InputFilename - The filename to read from. static cl::opt InputFilename(cl::Positional, cl::desc(""), diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index 764b59b43f..3b49214516 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -24,6 +24,8 @@ #include // For FileExists #include +using namespace llvm; + static cl::list InputFilenames(cl::Positional, cl::OneOrMore, cl::desc("")); diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index f7a0ef6746..878aa24f43 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -21,6 +21,8 @@ #include "Support/CommandLine.h" #include +using namespace llvm; + namespace { enum OutputFormatTy { bsd, sysv, posix }; cl::opt diff --git a/tools/llvm-prof/ProfileInfo.cpp b/tools/llvm-prof/ProfileInfo.cpp index 78de9c16c7..1d37c4291a 100644 --- a/tools/llvm-prof/ProfileInfo.cpp +++ b/tools/llvm-prof/ProfileInfo.cpp @@ -20,6 +20,8 @@ #include #include +using namespace llvm; + enum ProfilingType { ArgumentInfo = 1, // The command line argument block FunctionInfo = 2, // Function profiling information diff --git a/tools/llvm-prof/ProfileInfo.h b/tools/llvm-prof/ProfileInfo.h index 24e4296156..db4500127d 100644 --- a/tools/llvm-prof/ProfileInfo.h +++ b/tools/llvm-prof/ProfileInfo.h @@ -18,6 +18,9 @@ #include #include #include + +namespace llvm { + class Module; class Function; class BasicBlock; @@ -55,4 +58,6 @@ public: void getBlockCounts(std::vector > &Counts); }; +} // End llvm namespace + #endif diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index 4492fd67b7..438fecf07a 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -23,6 +23,8 @@ #include #include +using namespace llvm; + namespace { cl::opt BytecodeFile(cl::Positional, cl::desc(""), diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp index 6c4c99f5a3..a9b9cd0470 100644 --- a/tools/opt/AnalysisWrappers.cpp +++ b/tools/opt/AnalysisWrappers.cpp @@ -26,6 +26,8 @@ #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/InstIterator.h" +using namespace llvm; + namespace { struct InstForestHelper : public FunctionPass { Function *F; diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp index 34c937f0d4..6d2750f5e2 100644 --- a/tools/opt/GraphPrinters.cpp +++ b/tools/opt/GraphPrinters.cpp @@ -20,6 +20,8 @@ #include "llvm/Analysis/CallGraph.h" #include +namespace llvm { + template static void WriteGraphToFile(std::ostream &O, const std::string &GraphName, const GraphType >) { @@ -72,3 +74,5 @@ namespace { RegisterAnalysis P2("print-callgraph", "Print Call Graph to 'dot' file"); }; + +} // End llvm namespace diff --git a/tools/opt/PrintSCC.cpp b/tools/opt/PrintSCC.cpp index 3459381158..ce89fff90e 100644 --- a/tools/opt/PrintSCC.cpp +++ b/tools/opt/PrintSCC.cpp @@ -31,6 +31,8 @@ #include "llvm/Support/CFG.h" #include "Support/SCCIterator.h" +namespace llvm { + namespace { struct CFGSCC : public FunctionPass { bool runOnFunction(Function& func); @@ -101,3 +103,5 @@ bool CallGraphSCC::run(Module &M) { return true; } + +} // End llvm namespace diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index bc0a5fcb6f..30c72f1c9e 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -27,6 +27,7 @@ #include #include +using namespace llvm; // The OptimizationList is automatically populated with registered Passes by the // PassNameParser. diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index bd3d2ffea5..2c3e374b16 100644 --- a/utils/TableGen/CodeEmitterGen.cpp +++ b/utils/TableGen/CodeEmitterGen.cpp @@ -15,6 +15,8 @@ #include "Record.h" #include "Support/Debug.h" +namespace llvm { + void CodeEmitterGen::run(std::ostream &o) { std::vector Insts = Records.getAllDerivedDefinitions("Instruction"); @@ -221,4 +223,8 @@ void CodeEmitterGen::run(std::ostream &o) { << " }\n" << " return Value;\n" << "}\n"; + + EmitSourceFileTail(o); } + +} // End llvm namespace diff --git a/utils/TableGen/CodeEmitterGen.h b/utils/TableGen/CodeEmitterGen.h index d7b4bc1adf..19ca5452f5 100644 --- a/utils/TableGen/CodeEmitterGen.h +++ b/utils/TableGen/CodeEmitterGen.h @@ -16,6 +16,8 @@ #include "TableGenBackend.h" +namespace llvm { + class CodeEmitterGen : public TableGenBackend { RecordKeeper &Records; public: @@ -28,4 +30,6 @@ private: void emitGetValueBit(std::ostream &o, const std::string &Namespace); }; +} // End llvm namespace + #endif diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index 5039ccaad0..bf641fa276 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -17,6 +17,8 @@ #include "CodeGenWrappers.h" #include "Record.h" +namespace llvm { + /// getValueType - Return the MCV::ValueType that the specified TableGen record /// corresponds to. MVT::ValueType getValueType(Record *Rec) { @@ -94,3 +96,5 @@ const std::string &CodeGenTarget::getName() const { Record *CodeGenTarget::getInstructionSet() const { return TargetRec->getValueAsDef("InstructionSet"); } + +} // End llvm namespace diff --git a/utils/TableGen/CodeGenTarget.h b/utils/TableGen/CodeGenTarget.h index f0b7200edc..948360e2b1 100644 --- a/utils/TableGen/CodeGenTarget.h +++ b/utils/TableGen/CodeGenTarget.h @@ -21,6 +21,9 @@ #include #include #include + +namespace llvm { + class Record; class RecordKeeper; @@ -60,4 +63,6 @@ public: // CodeGenInstructionSet *getInstructionSet - }; +} // End llvm namespace + #endif diff --git a/utils/TableGen/CodeGenWrappers.cpp b/utils/TableGen/CodeGenWrappers.cpp index 5039ccaad0..bf641fa276 100644 --- a/utils/TableGen/CodeGenWrappers.cpp +++ b/utils/TableGen/CodeGenWrappers.cpp @@ -17,6 +17,8 @@ #include "CodeGenWrappers.h" #include "Record.h" +namespace llvm { + /// getValueType - Return the MCV::ValueType that the specified TableGen record /// corresponds to. MVT::ValueType getValueType(Record *Rec) { @@ -94,3 +96,5 @@ const std::string &CodeGenTarget::getName() const { Record *CodeGenTarget::getInstructionSet() const { return TargetRec->getValueAsDef("InstructionSet"); } + +} // End llvm namespace diff --git a/utils/TableGen/CodeGenWrappers.h b/utils/TableGen/CodeGenWrappers.h index f0b7200edc..948360e2b1 100644 --- a/utils/TableGen/CodeGenWrappers.h +++ b/utils/TableGen/CodeGenWrappers.h @@ -21,6 +21,9 @@ #include #include #include + +namespace llvm { + class Record; class RecordKeeper; @@ -60,4 +63,6 @@ public: // CodeGenInstructionSet *getInstructionSet - }; +} // End llvm namespace + #endif diff --git a/utils/TableGen/FileLexer.l b/utils/TableGen/FileLexer.l index 0858a8c5e4..48070b34a1 100644 --- a/utils/TableGen/FileLexer.l +++ b/utils/TableGen/FileLexer.l @@ -28,9 +28,13 @@ %{ #include "Record.h" -typedef std::pair*> SubClassRefTy; +typedef std::pair*> SubClassRefTy; #include "FileParser.h" +int Fileparse(); + +namespace llvm { + // Global variable recording the location of the include directory std::string IncludeDirectory; @@ -69,7 +73,6 @@ std::ostream &err() { } -int Fileparse(); // // Function: ParseFile() @@ -171,6 +174,10 @@ int yywrap() { return 0; } +} // End llvm namespace + +using namespace llvm; + %} Comment \/\/.* diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y index 491cca310d..e95e59785c 100644 --- a/utils/TableGen/FileParser.y +++ b/utils/TableGen/FileParser.y @@ -20,6 +20,9 @@ int yyerror(const char *ErrorMsg); int yylex(); + +namespace llvm { + extern int Filelineno; static Record *CurRec = 0; @@ -160,20 +163,23 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { addSuperClass(SC); } +} // End llvm namespace + +using namespace llvm; %} %union { - std::string *StrVal; - int IntVal; - RecTy *Ty; - Init *Initializer; - std::vector *FieldList; - std::vector*BitList; - Record *Rec; - SubClassRefTy *SubClassRef; - std::vector *SubClassList; - std::vector > *DagValueList; + std::string* StrVal; + int IntVal; + llvm::RecTy* Ty; + llvm::Init* Initializer; + std::vector* FieldList; + std::vector* BitList; + llvm::Record* Rec; + SubClassRefTy* SubClassRef; + std::vector* SubClassList; + std::vector >* DagValueList; }; %token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD LET IN @@ -193,6 +199,7 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { %type Declaration OptID OptVarName %start File + %% ClassID : ID { diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp index a11244dd98..ed040b15d9 100644 --- a/utils/TableGen/InstrInfoEmitter.cpp +++ b/utils/TableGen/InstrInfoEmitter.cpp @@ -16,6 +16,8 @@ #include "CodeGenWrappers.h" #include "Record.h" +namespace llvm { + // runEnums - Print out enum values for all of the instructions. void InstrInfoEmitter::runEnums(std::ostream &OS) { std::vector Insts = Records.getAllDerivedDefinitions("Instruction"); @@ -47,6 +49,7 @@ void InstrInfoEmitter::runEnums(std::ostream &OS) { OS << " };\n"; if (!Namespace.empty()) OS << "}\n"; + EmitSourceFileTail(OS); } void InstrInfoEmitter::printDefList(ListInit *LI, const std::string &Name, @@ -93,6 +96,7 @@ void InstrInfoEmitter::run(std::ostream &OS) { if (Instructions[i] != PHI) emitRecord(Instructions[i], i+1, InstrInfo, OS); OS << "};\n"; + EmitSourceFileTail(OS); } void InstrInfoEmitter::emitRecord(Record *R, unsigned Num, Record *InstrInfo, @@ -169,3 +173,5 @@ void InstrInfoEmitter::emitShiftedValue(Record *R, StringInit *Val, std::cerr << "Unhandled initializer: " << *Val << "\n"; throw "In record '" + R->getName() + "' for TSFlag emission."; } + +} // End llvm namespace diff --git a/utils/TableGen/InstrInfoEmitter.h b/utils/TableGen/InstrInfoEmitter.h index 4adac31264..2a6b063deb 100644 --- a/utils/TableGen/InstrInfoEmitter.h +++ b/utils/TableGen/InstrInfoEmitter.h @@ -16,6 +16,9 @@ #define INSTRINFO_EMITTER_H #include "TableGenBackend.h" + +namespace llvm { + class StringInit; class IntInit; class ListInit; @@ -38,4 +41,6 @@ private: std::ostream &OS); }; +} // End llvm namespace + #endif diff --git a/utils/TableGen/InstrSelectorEmitter.cpp b/utils/TableGen/InstrSelectorEmitter.cpp index 9988d55684..5d945bb841 100644 --- a/utils/TableGen/InstrSelectorEmitter.cpp +++ b/utils/TableGen/InstrSelectorEmitter.cpp @@ -19,6 +19,8 @@ #include "Support/StringExtras.h" #include +namespace llvm { + NodeType::ArgResultTypes NodeType::Translate(Record *R) { const std::string &Name = R->getName(); if (Name == "DNVT_any") return Any; @@ -978,9 +980,10 @@ void InstrSelectorEmitter::run(std::ostream &OS) { CalculateComputableValues(); + OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n"; + EmitSourceFileHeader("Instruction Selector for the " + Target.getName() + " target", OS); - OS << "#include \"llvm/CodeGen/MachineInstrBuilder.h\"\n"; // Output the slot number enums... OS << "\nenum { // Slot numbers...\n" @@ -1290,5 +1293,7 @@ void InstrSelectorEmitter::run(std::ostream &OS) { << " }\n\n N->addValue(Val); // Do not ever recalculate this\n" << " return Val;\n}\n\n"; } + EmitSourceFileTail(OS); } +} // End llvm namespace diff --git a/utils/TableGen/InstrSelectorEmitter.h b/utils/TableGen/InstrSelectorEmitter.h index 2f9175c95a..a0fbbcf408 100644 --- a/utils/TableGen/InstrSelectorEmitter.h +++ b/utils/TableGen/InstrSelectorEmitter.h @@ -21,6 +21,8 @@ #include #include +namespace llvm { + class DagInit; class Init; class InstrSelectorEmitter; @@ -391,4 +393,6 @@ private: bool PrintArg, std::ostream &OS); }; +} // End llvm namespace + #endif diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index 32ffe6245a..00751a1824 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -16,6 +16,8 @@ // Type implementations //===----------------------------------------------------------------------===// +namespace llvm { + void RecTy::dump() const { print(std::cerr); } Init *BitRecTy::convertValue(BitsInit *BI) { @@ -681,3 +683,5 @@ RecordKeeper::getAllDerivedDefinitions(const std::string &ClassName) const { return Defs; } + +} // End llvm namespace diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h index e2233f88a8..d8a96495e7 100644 --- a/utils/TableGen/Record.h +++ b/utils/TableGen/Record.h @@ -21,6 +21,8 @@ #include #include +namespace llvm { + // RecTy subclasses... class BitRecTy; class BitsRecTy; @@ -853,4 +855,6 @@ std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK); extern RecordKeeper Records; +} // End llvm namespace + #endif diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp index 67acc3f333..4e7aa9b584 100644 --- a/utils/TableGen/RegisterInfoEmitter.cpp +++ b/utils/TableGen/RegisterInfoEmitter.cpp @@ -19,6 +19,8 @@ #include "Support/StringExtras.h" #include +namespace llvm { + // runEnums - Print out enum values for all of the registers. void RegisterInfoEmitter::runEnums(std::ostream &OS) { std::vector Registers = Records.getAllDerivedDefinitions("Register"); @@ -40,6 +42,7 @@ void RegisterInfoEmitter::runEnums(std::ostream &OS) { OS << " };\n"; if (!Namespace.empty()) OS << "}\n"; + EmitSourceFileTail(OS); } void RegisterInfoEmitter::runHeader(std::ostream &OS) { @@ -68,6 +71,7 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) { OS << " extern TargetRegisterClass *" << Name << "RegisterClass;\n"; } OS << "} // end of namespace " << TargetName << "\n\n"; + EmitSourceFileTail(OS); } // RegisterInfoEmitter::run - Main register file description emitter. @@ -240,4 +244,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) { for (unsigned i = 0, e = CSR.size(); i != e; ++i) OS << getQualifiedName(CSR[i]) << ", "; OS << " 0\n };\n return CalleeSaveRegs;\n}\n\n"; + EmitSourceFileTail(OS); } + +} // End llvm namespace diff --git a/utils/TableGen/RegisterInfoEmitter.h b/utils/TableGen/RegisterInfoEmitter.h index 22c759facf..1e6380b70a 100644 --- a/utils/TableGen/RegisterInfoEmitter.h +++ b/utils/TableGen/RegisterInfoEmitter.h @@ -18,6 +18,8 @@ #include "TableGenBackend.h" +namespace llvm { + class RegisterInfoEmitter : public TableGenBackend { RecordKeeper &Records; public: @@ -33,4 +35,6 @@ public: void runEnums(std::ostream &o); }; +} // End llvm namespace + #endif diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index 803d0f0fdd..c05ccb0bb1 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -27,6 +27,8 @@ #include #include +namespace llvm { + enum ActionType { PrintRecords, GenEmitter, @@ -406,6 +408,9 @@ static void ParseMachineCode() { } } +} // End llvm namespace + +using namespace llvm; int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); @@ -459,12 +464,17 @@ int main(int argc, char **argv) { InstrSelectorEmitter(Records).run(*Out); break; case PrintEnums: + { std::vector Recs = Records.getAllDerivedDefinitions(Class); for (unsigned i = 0, e = Recs.size(); i != e; ++i) *Out << Recs[i] << ", "; *Out << "\n"; break; } + default: + assert(1 && "Invalid Action"); + return 1; + } } catch (const std::string &Error) { std::cerr << Error << "\n"; if (Out != &std::cout) { diff --git a/utils/TableGen/TableGenBackend.cpp b/utils/TableGen/TableGenBackend.cpp index 161b2eeb60..67a37885db 100644 --- a/utils/TableGen/TableGenBackend.cpp +++ b/utils/TableGen/TableGenBackend.cpp @@ -15,12 +15,18 @@ #include "Record.h" #include +namespace llvm { + void TableGenBackend::EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const { OS << "//===- TableGen'erated file -------------------------------------*-" " C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate" "d file, do not edit!\n//\n//===------------------------------------" - "----------------------------------===//\n\n"; + "----------------------------------===//\n\nnamespace llvm {\n\n"; +} + +void TableGenBackend::EmitSourceFileTail( std::ostream& OS ) const { + OS << "} // End llvm namespace \n"; } /// getQualifiedName - Return the name of the specified record, with a @@ -32,3 +38,4 @@ std::string TableGenBackend::getQualifiedName(Record *R) const { return Namespace + "::" + R->getName(); } +} // End llvm namespace diff --git a/utils/TableGen/TableGenBackend.h b/utils/TableGen/TableGenBackend.h index 23b83cac7e..869d7e939d 100644 --- a/utils/TableGen/TableGenBackend.h +++ b/utils/TableGen/TableGenBackend.h @@ -17,6 +17,9 @@ #include #include + +namespace llvm { + class Record; class RecordKeeper; @@ -33,9 +36,15 @@ public: // Useful helper routines... /// ostream. void EmitSourceFileHeader(const std::string &Desc, std::ostream &OS) const; + /// EmitSourceFileTail - Output an LLVm styelf ile tail to the specified + /// ostream. + void EmitSourceFileTail( std::ostream& OS ) const; + /// getQualifiedName - Return the name of the specified record, with a /// namespace qualifier if the record contains one. std::string getQualifiedName(Record *R) const; }; +} // End llvm namespace + #endif -- cgit v1.2.3-70-g09d2 From 321f8319dafc1374cd9512d6555b7a1a07887d94 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sun, 4 Jul 2004 12:22:14 +0000 Subject: Add #include since Value.h doesn't include it any more. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14624 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/ModuleMaker.cpp | 1 + examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp | 1 + projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp | 1 + projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp | 1 + projects/Stacker/tools/stkrc/stkrc.cpp | 1 + 5 files changed, 5 insertions(+) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index a1b68449f3..71e6c8cd76 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -11,6 +11,7 @@ #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" +#include using namespace llvm; diff --git a/examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp index a1b68449f3..71e6c8cd76 100644 --- a/examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp @@ -11,6 +11,7 @@ #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" +#include using namespace llvm; diff --git a/projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp b/projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp index a1b68449f3..71e6c8cd76 100644 --- a/projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp +++ b/projects/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp @@ -11,6 +11,7 @@ #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" +#include using namespace llvm; diff --git a/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp b/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp index a1b68449f3..71e6c8cd76 100644 --- a/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp +++ b/projects/SmallExamples/ModuleMaker/tools/ModuleMaker/ModuleMaker.cpp @@ -11,6 +11,7 @@ #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" +#include using namespace llvm; diff --git a/projects/Stacker/tools/stkrc/stkrc.cpp b/projects/Stacker/tools/stkrc/stkrc.cpp index fb8bbaaa05..58ef8d710b 100644 --- a/projects/Stacker/tools/stkrc/stkrc.cpp +++ b/projects/Stacker/tools/stkrc/stkrc.cpp @@ -24,6 +24,7 @@ #include "Support/CommandLine.h" #include "llvm/System/Signals.h" #include +#include #include using namespace llvm; -- cgit v1.2.3-70-g09d2 From 66e7cd0eea6f116f3ed79acb8948c6d8db50833c Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sat, 11 Sep 2004 20:30:11 +0000 Subject: Correct the file header to reflect the new "examples" home for the file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16295 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/Fibonacci/Makefile | 2 +- examples/Fibonacci/fibonacci.cpp | 2 +- examples/HowToUseJIT/HowToUseJIT.cpp | 2 +- examples/HowToUseJIT/Makefile | 2 +- examples/ModuleMaker/Makefile | 2 +- examples/ModuleMaker/ModuleMaker.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/Fibonacci/Makefile b/examples/Fibonacci/Makefile index 60392e2b06..ac6de5df5f 100644 --- a/examples/Fibonacci/Makefile +++ b/examples/Fibonacci/Makefile @@ -1,4 +1,4 @@ -##===- projects/Fibonacci/Makefile -------------------------*- Makefile -*-===## +##===- examples/Fibonacci/Makefile -------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp index 776378dc1f..f34aed762a 100644 --- a/examples/Fibonacci/fibonacci.cpp +++ b/examples/Fibonacci/fibonacci.cpp @@ -1,4 +1,4 @@ -//===--- fibonacci.cpp - An example use of the JIT ----------------------===// +//===--- examples/Fibonacci/fibonacci.cpp - An example use of the JIT -----===// // // The LLVM Compiler Infrastructure // diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp index 889b34aa95..6cea720bb4 100644 --- a/examples/HowToUseJIT/HowToUseJIT.cpp +++ b/examples/HowToUseJIT/HowToUseJIT.cpp @@ -1,4 +1,4 @@ -//===--- HowToUseJIT.cpp - An example use of the JIT ----------------------===// +//===-- examples/HowToUseJIT/HowToUseJIT.cpp - An example use of the JIT --===// // // The LLVM Compiler Infrastructure // diff --git a/examples/HowToUseJIT/Makefile b/examples/HowToUseJIT/Makefile index 9e42223d43..3b3947e690 100644 --- a/examples/HowToUseJIT/Makefile +++ b/examples/HowToUseJIT/Makefile @@ -1,4 +1,4 @@ -##===- projects/HowToUseJIT/Makefile -----------------------*- Makefile -*-===## +##===- examples/HowToUseJIT/Makefile -----------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/examples/ModuleMaker/Makefile b/examples/ModuleMaker/Makefile index 4ae28ccb7a..c99b7e7891 100644 --- a/examples/ModuleMaker/Makefile +++ b/examples/ModuleMaker/Makefile @@ -1,4 +1,4 @@ -##===- examples/ModuleMaker --------------------------------*- Makefile -*-===## +##===- examples/ModuleMaker/Makefile -----------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 71e6c8cd76..a057a8c8a1 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -1,4 +1,4 @@ -//===- ModuleMaker.cpp - Example project which creates modules --*- C++ -*-===// +//===- examples/ModuleMaker/ModuleMaker.cpp - Example project ---*- C++ -*-===// // // This programs is a simple example that creates an LLVM module "from scratch", // emitting it as a bytecode file to standard out. This is just to show how -- cgit v1.2.3-70-g09d2 From 7db7fa0828bc4ac375032a847b3fd530cef131e2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 15 Mar 2005 15:46:23 +0000 Subject: add missing copyright header git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20614 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/ModuleMaker.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index a057a8c8a1..1076446369 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -1,4 +1,11 @@ //===- examples/ModuleMaker/ModuleMaker.cpp - Example project ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// // // This programs is a simple example that creates an LLVM module "from scratch", // emitting it as a bytecode file to standard out. This is just to show how -- cgit v1.2.3-70-g09d2 From 237cef4b0b94b17ca065efad484f386f42579b61 Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Wed, 20 Apr 2005 16:42:34 +0000 Subject: Remove trailing whitespace at the end of lines git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21380 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/BFtoLLVM/BFtoLLVM.cpp | 12 ++++++------ examples/Fibonacci/fibonacci.cpp | 18 +++++++++--------- examples/HowToUseJIT/HowToUseJIT.cpp | 30 +++++++++++++++--------------- examples/ModuleMaker/ModuleMaker.cpp | 22 +++++++++++----------- 4 files changed, 41 insertions(+), 41 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/BFtoLLVM/BFtoLLVM.cpp b/examples/BFtoLLVM/BFtoLLVM.cpp index b870676fb8..159d0b619d 100644 --- a/examples/BFtoLLVM/BFtoLLVM.cpp +++ b/examples/BFtoLLVM/BFtoLLVM.cpp @@ -1,10 +1,10 @@ //===-- BFtoLLVM.cpp - BF language Front End for LLVM ---------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This is a simple front end for the BF language. It is compatible with the @@ -60,7 +60,7 @@ void emitArith (std::string op, char delta, std::ofstream &dest) { std::string ptr = gensym (op + "ptr"), val = gensym (op + "val"), result = gensym (op + "result"); - dest << ptr << " = load sbyte** %ptrbox\n" + dest << ptr << " = load sbyte** %ptrbox\n" << val << " = load sbyte* " << ptr << "\n" << result << " = add sbyte " << val << ", " << (int)delta << "\n" << "store sbyte " << result << ", sbyte* " << ptr << "\n"; @@ -172,7 +172,7 @@ int main (int argc, char **argv) { char *sourceFileName = argv[1]; char *destFileName = argv[2]; - + std::ifstream src (sourceFileName); if (!src.good()) { std::cerr << sourceFileName << ": " << strerror(errno) << "\n"; @@ -184,7 +184,7 @@ int main (int argc, char **argv) { std::cerr << destFileName << ": " << strerror(errno) << "\n"; return 1; } - + emitDeclarations(dest); emitMainFunctionProlog(dest); @@ -199,7 +199,7 @@ int main (int argc, char **argv) { repeatCount = 0; } consume (lastCh, repeatCount, dest); - + emitMainFunctionEpilog(dest); src.close(); diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp index afffce7408..2bef63bb15 100644 --- a/examples/Fibonacci/fibonacci.cpp +++ b/examples/Fibonacci/fibonacci.cpp @@ -1,10 +1,10 @@ //===--- examples/Fibonacci/fibonacci.cpp - An example use of the JIT -----===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by Valery A. Khamenya and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This small program provides an example of how to build quickly a small module @@ -17,7 +17,7 @@ // if(x<=2) return 1; // return fib(x-1)+fib(x-2); // } -// +// // Once we have this, we compile the module via JIT, then execute the `fib' // function and return result to a driver, i.e. to a "host program". // @@ -38,10 +38,10 @@ static Function *CreateFibFunction(Module *M) { // Create the fib function and insert it into module M. This function is said // to return an int and take an int parameter. Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy, 0); - + // Add a basic block to the function. BasicBlock *BB = new BasicBlock("EntryBlock", FibF); - + // Get pointers to the constants. Value *One = ConstantSInt::get(Type::IntTy, 1); Value *Two = ConstantSInt::get(Type::IntTy, 2); @@ -61,11 +61,11 @@ static Function *CreateFibFunction(Module *M) { // Create: ret int 1 new ReturnInst(One, RetBB); - + // create fib(x-1) Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB); Value *CallFibX1 = new CallInst(FibF, Sub, "fibx1", RecurseBB); - + // create fib(x-2) Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB); Value *CallFibX2 = new CallInst(FibF, Sub, "fibx2", RecurseBB); @@ -73,7 +73,7 @@ static Function *CreateFibFunction(Module *M) { // fib(x-1)+fib(x-2) Value *Sum = BinaryOperator::createAdd(CallFibX1, CallFibX2, "addresult", RecurseBB); - + // Create the return instruction and add it to the basic block new ReturnInst(Sum, RecurseBB); @@ -90,7 +90,7 @@ int main(int argc, char **argv) { // We are about to create the "fib" function: Function *FibF = CreateFibFunction(M); - // Now we going to create JIT + // Now we going to create JIT ExistingModuleProvider *MP = new ExistingModuleProvider(M); ExecutionEngine *EE = ExecutionEngine::create(MP, false); diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp index 3762dfe3cb..31ea4f4540 100644 --- a/examples/HowToUseJIT/HowToUseJIT.cpp +++ b/examples/HowToUseJIT/HowToUseJIT.cpp @@ -1,37 +1,37 @@ //===-- examples/HowToUseJIT/HowToUseJIT.cpp - An example use of the JIT --===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by Valery A. Khamenya and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This small program provides an example of how to quickly build a small -// module with two functions and execute it with the JIT. -// -// Goal: +// module with two functions and execute it with the JIT. +// +// Goal: // The goal of this snippet is to create in the memory // the LLVM module consisting of two functions as follow: // // int add1(int x) { // return x+1; // } -// +// // int foo() { // return add1(10); // } -// -// then compile the module via JIT, then execute the `foo' +// +// then compile the module via JIT, then execute the `foo' // function and return result to a driver, i.e. to a "host program". -// +// // Some remarks and questions: -// +// // - could we invoke some code using noname functions too? -// e.g. evaluate "foo()+foo()" without fears to introduce +// e.g. evaluate "foo()+foo()" without fears to introduce // conflict of temporary function name with some real // existing function name? -// +// //===----------------------------------------------------------------------===// #include "llvm/Module.h" @@ -56,7 +56,7 @@ int main() { // Add a basic block to the function. As before, it automatically inserts // because of the last argument. BasicBlock *BB = new BasicBlock("EntryBlock", Add1F); - + // Get pointers to the constant `1'. Value *One = ConstantSInt::get(Type::IntTy, 1); @@ -67,7 +67,7 @@ int main() { // Create the add instruction, inserting it into the end of BB. Instruction *Add = BinaryOperator::createAdd(One, ArgX, "addresult", BB); - + // Create the return instruction and add it to the basic block new ReturnInst(Add, BB); @@ -88,7 +88,7 @@ int main() { std::vector Params; Params.push_back(Ten); CallInst * Add1CallRes = new CallInst(Add1F, Params, "add1", BB); - + // Create the return instruction and add it to the basic block. new ReturnInst(Add1CallRes, BB); diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 1076446369..04c6a9f95b 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -1,10 +1,10 @@ //===- examples/ModuleMaker/ModuleMaker.cpp - Example project ---*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This programs is a simple example that creates an LLVM module "from scratch", @@ -26,36 +26,36 @@ int main() { // Create the "module" or "program" or "translation unit" to hold the // function Module *M = new Module("test"); - + // Create the main function: first create the type 'int ()' FunctionType *FT = FunctionType::get(Type::IntTy, std::vector(), /*not vararg*/false); - + // By passing a module as the last parameter to the Function constructor, // it automatically gets appended to the Module. Function *F = new Function(FT, Function::ExternalLinkage, "main", M); - + // Add a basic block to the function... again, it automatically inserts // because of the last argument. BasicBlock *BB = new BasicBlock("EntryBlock", F); - + // Get pointers to the constant integers... Value *Two = ConstantSInt::get(Type::IntTy, 2); Value *Three = ConstantSInt::get(Type::IntTy, 3); - + // Create the add instruction... does not insert... Instruction *Add = BinaryOperator::create(Instruction::Add, Two, Three, "addresult"); - + // explicitly insert it into the basic block... BB->getInstList().push_back(Add); - + // Create the return instruction and add it to the basic block BB->getInstList().push_back(new ReturnInst(Add)); - + // Output the bytecode file to stdout WriteBytecodeToFile(M, std::cout); - + // Delete the module and all of its contents. delete M; return 0; -- cgit v1.2.3-70-g09d2 From b461131c99d79a4e7f1cf01bd5ef4a98b169af96 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 May 2006 19:08:39 +0000 Subject: Catch a potentially thrown exception. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28295 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/ModuleMaker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 04c6a9f95b..4c09db4df7 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -54,7 +54,12 @@ int main() { BB->getInstList().push_back(new ReturnInst(Add)); // Output the bytecode file to stdout - WriteBytecodeToFile(M, std::cout); + try { + WriteBytecodeToFile(M, std::cout); + } catch (const std::string &Error) { + std::cerr << "Error writing file: " << Error << "\n"; + return 1; + } // Delete the module and all of its contents. delete M; -- cgit v1.2.3-70-g09d2 From 4645cdca8af4d60623205a642b3e727e91f5570a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 28 Jul 2006 22:08:23 +0000 Subject: WriteBytecodeToFile actually can't throw. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29397 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/Makefile | 1 - examples/ModuleMaker/ModuleMaker.cpp | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/Makefile b/examples/ModuleMaker/Makefile index a6899ef05a..e24e0df49d 100644 --- a/examples/ModuleMaker/Makefile +++ b/examples/ModuleMaker/Makefile @@ -9,7 +9,6 @@ LEVEL=../.. TOOLNAME=ModuleMaker EXAMPLE_TOOL = 1 -REQUIRES_EH = 1 USEDLIBS= LLVMBCWriter.a LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a include $(LEVEL)/Makefile.common diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 4c09db4df7..04c6a9f95b 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -54,12 +54,7 @@ int main() { BB->getInstList().push_back(new ReturnInst(Add)); // Output the bytecode file to stdout - try { - WriteBytecodeToFile(M, std::cout); - } catch (const std::string &Error) { - std::cerr << "Error writing file: " << Error << "\n"; - return 1; - } + WriteBytecodeToFile(M, std::cout); // Delete the module and all of its contents. delete M; -- cgit v1.2.3-70-g09d2 From b83eb6447ba155342598f0fabe1f08f5baa9164a Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Fri, 20 Oct 2006 07:07:24 +0000 Subject: For PR950: This patch implements the first increment for the Signless Types feature. All changes pertain to removing the ConstantSInt and ConstantUInt classes in favor of just using ConstantInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/ProgrammersManual.html | 19 +- docs/Stacker.html | 10 +- examples/Fibonacci/fibonacci.cpp | 4 +- examples/HowToUseJIT/HowToUseJIT.cpp | 4 +- examples/ModuleMaker/ModuleMaker.cpp | 4 +- examples/ParallelJIT/ParallelJIT.cpp | 6 +- include/llvm/Constants.h | 148 +- include/llvm/IntrinsicInst.h | 4 +- include/llvm/Value.h | 3 +- lib/Analysis/BasicAliasAnalysis.cpp | 15 +- lib/Analysis/ConstantFolding.cpp | 11 +- lib/Analysis/ConstantRange.cpp | 4 +- lib/Analysis/DataStructure/Local.cpp | 2 +- lib/Analysis/ScalarEvolution.cpp | 28 +- lib/Analysis/ScalarEvolutionExpander.cpp | 2 +- lib/AsmParser/Lexer.cpp.cvs | 269 +- lib/AsmParser/llvmAsmParser.cpp.cvs | 6425 +++++++++++--------- lib/AsmParser/llvmAsmParser.h.cvs | 370 +- lib/AsmParser/llvmAsmParser.y | 28 +- lib/AsmParser/llvmAsmParser.y.cvs | 28 +- lib/Bytecode/Reader/Reader.cpp | 24 +- lib/Bytecode/Writer/Writer.cpp | 12 +- lib/CodeGen/AsmPrinter.cpp | 23 +- lib/CodeGen/IntrinsicLowering.cpp | 35 +- lib/CodeGen/MachineDebugInfo.cpp | 29 +- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 6 +- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 70 +- lib/Debugger/ProgramInfo.cpp | 8 +- lib/ExecutionEngine/ExecutionEngine.cpp | 26 +- lib/ExecutionEngine/Interpreter/Execution.cpp | 4 +- lib/ExecutionEngine/JIT/JIT.cpp | 24 +- lib/Support/ConstantRange.cpp | 4 +- lib/Target/ARM/ARMISelDAGToDAG.cpp | 3 +- lib/Target/Alpha/AlphaISelDAGToDAG.cpp | 3 +- lib/Target/CBackend/CBackend.cpp | 22 +- lib/Target/CBackend/Writer.cpp | 22 +- lib/Target/TargetData.cpp | 4 +- lib/Target/X86/X86IntelAsmPrinter.cpp | 2 +- lib/Transforms/IPO/ArgumentPromotion.cpp | 6 +- lib/Transforms/IPO/GlobalOpt.cpp | 39 +- lib/Transforms/IPO/LowerSetJmp.cpp | 4 +- lib/Transforms/IPO/SimplifyLibCalls.cpp | 138 +- lib/Transforms/Instrumentation/EmitFunctions.cpp | 2 +- lib/Transforms/Instrumentation/ProfilingUtils.cpp | 4 +- lib/Transforms/Instrumentation/RSProfiling.cpp | 22 +- .../Instrumentation/TraceBasicBlocks.cpp | 2 +- lib/Transforms/Scalar/InstructionCombining.cpp | 594 +- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 +- lib/Transforms/Scalar/LoopUnroll.cpp | 4 +- lib/Transforms/Scalar/LowerGC.cpp | 12 +- lib/Transforms/Scalar/LowerPacked.cpp | 22 +- lib/Transforms/Scalar/Reassociate.cpp | 2 +- lib/Transforms/Scalar/ScalarReplAggregates.cpp | 24 +- lib/Transforms/TransformInternals.cpp | 9 +- lib/Transforms/TransformInternals.h | 2 +- lib/Transforms/Utils/CodeExtractor.cpp | 14 +- lib/Transforms/Utils/Local.cpp | 14 +- lib/Transforms/Utils/LowerAllocations.cpp | 4 +- lib/Transforms/Utils/LowerInvoke.cpp | 8 +- lib/Transforms/Utils/LowerSwitch.cpp | 11 +- lib/Transforms/Utils/SimplifyCFG.cpp | 2 +- lib/VMCore/AsmWriter.cpp | 9 +- lib/VMCore/ConstantFold.cpp | 309 +- lib/VMCore/Constants.cpp | 122 +- lib/VMCore/Instructions.cpp | 14 +- lib/VMCore/Type.cpp | 6 +- lib/VMCore/Verifier.cpp | 2 +- projects/Stacker/lib/compiler/StackerCompiler.cpp | 16 +- tools/bugpoint/ExtractFunction.cpp | 6 +- tools/llvm2cpp/CppWriter.cpp | 11 +- 70 files changed, 5049 insertions(+), 4096 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index bd79747626..950c937824 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -2390,8 +2390,8 @@ provide a name for it (probably based on the name of the translation unit).

Constant represents a base class for different types of constants. It -is subclassed by ConstantBool, ConstantInt, ConstantSInt, ConstantUInt, -ConstantArray etc for representing the various types of Constants.

+is subclassed by ConstantBool, ConstantInt, ConstantArray etc for representing +the various types of Constants.

@@ -2406,17 +2406,12 @@ ConstantArray etc for representing the various types of Constants.

Important Subclasses of Constant
    -
  • ConstantSInt : This subclass of Constant represents a signed integer - constant. +
  • ConstantInt : This subclass of Constant represents an integer constant.
      -
    • int64_t getValue() const: Returns the underlying value of - this constant.
    • -
    -
  • -
  • ConstantUInt : This class represents an unsigned integer. -
      -
    • uint64_t getValue() const: Returns the underlying value of - this constant.
    • +
    • int64_t getSExtValue() const: Returns the underlying value of + this constant as a sign extended signed integer value.
    • +
    • uint64_t getZExtValue() const: Returns the underlying value + of this constant as a zero extended unsigned integer value.
  • ConstantFP : This class represents a floating point constant. diff --git a/docs/Stacker.html b/docs/Stacker.html index 7656dc10c0..a49b56de86 100644 --- a/docs/Stacker.html +++ b/docs/Stacker.html @@ -139,7 +139,7 @@ this:

    Value* expression(BasicBlock* bb, Value* a, Value* b, Value* x, Value* y ) { - ConstantSInt* one = ConstantSInt::get(Type::IntTy, 1); + ConstantInt* one = ConstantInt::get(Type::IntTy, 1); BinaryOperator* or1 = BinaryOperator::createOr(a, b, "", bb); BinaryOperator* add1 = BinaryOperator::createAdd(x, one, "", bb); BinaryOperator* add2 = BinaryOperator::createAdd(y, one, "", bb); @@ -308,7 +308,7 @@ things, this leads to the idiom:

     std::vector<Value*> index_vector;
    -index_vector.push_back( ConstantSInt::get( Type::LongTy, 0 );
    +index_vector.push_back( ConstantInt::get( Type::LongTy, 0 );
     // ... push other indices ...
     GetElementPtrInst* gep = new GetElementPtrInst( ptr, index_vector );
     
    @@ -367,9 +367,9 @@ functions in the LLVM IR that make things easier. Here's what I learned:

    • Constants are Values like anything else and can be operands of instructions
    • Integer constants, frequently needed, can be created using the static "get" - methods of the ConstantInt, ConstantSInt, and ConstantUInt classes. The nice thing - about these is that you can "get" any kind of integer quickly.
    • -
    • There's a special method on Constant class which allows you to get the null + methods of the ConstantInt class. The nice thing about these is that you can + "get" any kind of integer quickly.
    • +
    • There's a special method on Constant class which allows you to get the null constant for any type. This is really handy for initializing large arrays or structures, etc.
    diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp index cdc84ca212..6f775515fb 100644 --- a/examples/Fibonacci/fibonacci.cpp +++ b/examples/Fibonacci/fibonacci.cpp @@ -45,8 +45,8 @@ static Function *CreateFibFunction(Module *M) { BasicBlock *BB = new BasicBlock("EntryBlock", FibF); // Get pointers to the constants. - Value *One = ConstantSInt::get(Type::IntTy, 1); - Value *Two = ConstantSInt::get(Type::IntTy, 2); + Value *One = ConstantInt::get(Type::IntTy, 1); + Value *Two = ConstantInt::get(Type::IntTy, 2); // Get pointer to the integer argument of the add1 function... Argument *ArgX = FibF->arg_begin(); // Get the arg. diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp index 8fb9e5659d..8023cc7a18 100644 --- a/examples/HowToUseJIT/HowToUseJIT.cpp +++ b/examples/HowToUseJIT/HowToUseJIT.cpp @@ -60,7 +60,7 @@ int main() { BasicBlock *BB = new BasicBlock("EntryBlock", Add1F); // Get pointers to the constant `1'. - Value *One = ConstantSInt::get(Type::IntTy, 1); + Value *One = ConstantInt::get(Type::IntTy, 1); // Get pointers to the integer argument of the add1 function... assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg @@ -84,7 +84,7 @@ int main() { BB = new BasicBlock("EntryBlock", FooF); // Get pointers to the constant `10'. - Value *Ten = ConstantSInt::get(Type::IntTy, 10); + Value *Ten = ConstantInt::get(Type::IntTy, 10); // Pass Ten to the call call: std::vector Params; diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 04c6a9f95b..2ec5437c36 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -40,8 +40,8 @@ int main() { BasicBlock *BB = new BasicBlock("EntryBlock", F); // Get pointers to the constant integers... - Value *Two = ConstantSInt::get(Type::IntTy, 2); - Value *Three = ConstantSInt::get(Type::IntTy, 3); + Value *Two = ConstantInt::get(Type::IntTy, 2); + Value *Three = ConstantInt::get(Type::IntTy, 3); // Create the add instruction... does not insert... Instruction *Add = BinaryOperator::create(Instruction::Add, Two, Three, diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp index b70f3db5bb..dfda126378 100644 --- a/examples/ParallelJIT/ParallelJIT.cpp +++ b/examples/ParallelJIT/ParallelJIT.cpp @@ -42,7 +42,7 @@ static Function* createAdd1(Module* M) BasicBlock *BB = new BasicBlock("EntryBlock", Add1F); // Get pointers to the constant `1'. - Value *One = ConstantSInt::get(Type::IntTy, 1); + Value *One = ConstantInt::get(Type::IntTy, 1); // Get pointers to the integer argument of the add1 function... assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg @@ -70,8 +70,8 @@ static Function *CreateFibFunction(Module *M) BasicBlock *BB = new BasicBlock("EntryBlock", FibF); // Get pointers to the constants. - Value *One = ConstantSInt::get(Type::IntTy, 1); - Value *Two = ConstantSInt::get(Type::IntTy, 2); + Value *One = ConstantInt::get(Type::IntTy, 1); + Value *Two = ConstantInt::get(Type::IntTy, 2); // Get pointer to the integer argument of the add1 function... Argument *ArgX = FibF->arg_begin(); // Get the arg. diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 6b8e91958b..bc76248c15 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -41,22 +41,14 @@ struct ConvertConstantType; /// @brief An abstract class for integer constants. class ConstantIntegral : public Constant { protected: - union { - int64_t Signed; - uint64_t Unsigned; - } Val; + uint64_t Val; ConstantIntegral(const Type *Ty, ValueTy VT, uint64_t V); public: - - /// @brief Return the raw value of the constant as a 64-bit integer value. - inline uint64_t getRawValue() const { return Val.Unsigned; } - /// Return the constant as a 64-bit unsigned integer value after it /// has been zero extended as appropriate for the type of this constant. /// @brief Return the zero extended value. inline uint64_t getZExtValue() const { - unsigned Size = getType()->getPrimitiveSizeInBits(); - return Val.Unsigned & (~uint64_t(0UL) >> (64-Size)); + return Val; } /// Return the constant as a 64-bit integer value after it has been sign @@ -64,7 +56,7 @@ public: /// @brief Return the sign extended value. inline int64_t getSExtValue() const { unsigned Size = getType()->getPrimitiveSizeInBits(); - return (Val.Signed << (64-Size)) >> (64-Size); + return (int64_t(Val) << (64-Size)) >> (64-Size); } /// This function is implemented by subclasses and will return true iff this @@ -111,8 +103,7 @@ public: static inline bool classof(const ConstantIntegral *) { return true; } static bool classof(const Value *V) { return V->getValueType() == ConstantBoolVal || - V->getValueType() == ConstantSIntVal || - V->getValueType() == ConstantUIntVal; + V->getValueType() == ConstantIntVal; } }; @@ -147,7 +138,7 @@ public: /// @returns the value of this ConstantBool /// @brief return the boolean value of this constant. - inline bool getValue() const { return static_cast(getRawValue()); } + inline bool getValue() const { return static_cast(getZExtValue()); } /// @see ConstantIntegral for details /// @brief Implement overrides @@ -165,13 +156,15 @@ public: //===----------------------------------------------------------------------===// -/// This is the abstract superclass of ConstantSInt & ConstantUInt, to make -/// dealing with integral constants easier when sign is irrelevant. -/// @brief Abstract clas for constant integers. +/// This is concrete integer subclass of ConstantIntegral that represents +/// both signed and unsigned integral constants, other than boolean. +/// @brief Class for constant integers. class ConstantInt : public ConstantIntegral { protected: ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT - ConstantInt(const Type *Ty, ValueTy VT, uint64_t V); + ConstantInt(const Type *Ty, uint64_t V); + ConstantInt(const Type *Ty, int64_t V); + friend struct ConstantCreator; public: /// A helper method that can be used to determine if the constant contained /// within is equal to a constant. This only works for very small values, @@ -180,48 +173,15 @@ public: bool equalsInt(unsigned char V) const { assert(V <= 127 && "equalsInt: Can only be used with very small positive constants!"); - return Val.Unsigned == V; + return Val == V; } /// Return a ConstantInt with the specified value for the specified type. - /// This only works for very small values, because this is all that can be - /// represented with all types integer types. + /// Overloads for ll the integer types are provided to ensure that implicit + /// conversions don't bite us and to get around compiler errors where the + /// compiler can't find a suitable overload for a given integer value. /// @brief Get a ConstantInt for a specific value. - static ConstantInt *get(const Type *Ty, unsigned char V); - - /// @returns true if this is the null integer value. - /// @see ConstantIntegral for details - /// @brief Implement override. - virtual bool isNullValue() const { return Val.Unsigned == 0; } - - /// @brief Methods to support type inquiry through isa, cast, and dyn_cast. - static inline bool classof(const ConstantInt *) { return true; } - static bool classof(const Value *V) { - return V->getValueType() == ConstantSIntVal || - V->getValueType() == ConstantUIntVal; - } -}; - - -//===----------------------------------------------------------------------===// -/// A concrete class to represent constant signed integer values for the types -/// sbyte, short, int, and long. -/// @brief Constant Signed Integer Class. -class ConstantSInt : public ConstantInt { - ConstantSInt(const ConstantSInt &); // DO NOT IMPLEMENT - friend struct ConstantCreator; - -protected: - ConstantSInt(const Type *Ty, int64_t V); -public: - /// This static factory methods returns objects of the specified value. Note - /// that repeated calls with the same operands return the same object. - /// @returns A ConstantSInt instant for the type and value requested. - /// @brief Get a signed integer constant. - static ConstantSInt *get( - const Type *Ty, ///< The type of constant (SByteTy, IntTy, ShortTy, LongTy) - int64_t V ///< The value for the constant integer. - ); + static ConstantInt *get(const Type *Ty, int64_t V); /// This static method returns true if the type Ty is big enough to /// represent the value V. This can be used to avoid having the get method @@ -230,24 +190,28 @@ public: /// @brief Determine if the value is in range for the given type. static bool isValueValidForType(const Type *Ty, int64_t V); - /// @returns the underlying value of this constant. - /// @brief Get the constant value. - inline int64_t getValue() const { return Val.Signed; } + /// @returns true if this is the null integer value. + /// @see ConstantIntegral for details + /// @brief Implement override. + virtual bool isNullValue() const { return Val == 0; } /// @returns true iff this constant's bits are all set to true. /// @see ConstantIntegral /// @brief Override implementation - virtual bool isAllOnesValue() const { return getValue() == -1; } + virtual bool isAllOnesValue() const { return getSExtValue() == -1; } /// @returns true iff this is the largest value that may be represented /// by this type. /// @see ConstantIntegeral /// @brief Override implementation virtual bool isMaxValue() const { - int64_t V = getValue(); - if (V < 0) return false; // Be careful about wrap-around on 'long's - ++V; - return !isValueValidForType(getType(), V) || V < 0; + if (getType()->isSigned()) { + int64_t V = getSExtValue(); + if (V < 0) return false; // Be careful about wrap-around on 'long's + ++V; + return !isValueValidForType(getType(), V) || V < 0; + } + return isAllOnesValue(); } /// @returns true if this is the smallest value that may be represented by @@ -255,52 +219,19 @@ public: /// @see ConstantIntegral /// @brief Override implementation virtual bool isMinValue() const { - int64_t V = getValue(); - if (V > 0) return false; // Be careful about wrap-around on 'long's - --V; - return !isValueValidForType(getType(), V) || V > 0; + if (getType()->isSigned()) { + int64_t V = getSExtValue(); + if (V > 0) return false; // Be careful about wrap-around on 'long's + --V; + return !isValueValidForType(getType(), V) || V > 0; + } + return getZExtValue() == 0; } - /// @brief Methods to support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const ConstantSInt *) { return true; } - static bool classof(const Value *V) { - return V->getValueType() == ConstantSIntVal; - } -}; - -//===----------------------------------------------------------------------===// -/// A concrete class that represents constant unsigned integer values of type -/// Type::UByteTy, Type::UShortTy, Type::UIntTy, or Type::ULongTy. -/// @brief Constant Unsigned Integer Class -class ConstantUInt : public ConstantInt { - ConstantUInt(const ConstantUInt &); // DO NOT IMPLEMENT - friend struct ConstantCreator; -protected: - ConstantUInt(const Type *Ty, uint64_t V); -public: - /// get() - Static factory methods - Return objects of the specified value - /// - static ConstantUInt *get(const Type *Ty, uint64_t V); - - /// isValueValidForType - return true if Ty is big enough to represent V. - /// - static bool isValueValidForType(const Type *Ty, uint64_t V); - - /// getValue - return the underlying value of this constant. - /// - inline uint64_t getValue() const { return Val.Unsigned; } - - /// isMaxValue - Return true if this is the largest value that may be - /// represented by this type. - /// - virtual bool isAllOnesValue() const; - virtual bool isMaxValue() const { return isAllOnesValue(); } - virtual bool isMinValue() const { return getValue() == 0; } - - /// Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const ConstantUInt *) { return true; } + /// @brief Methods to support type inquiry through isa, cast, and dyn_cast. + static inline bool classof(const ConstantInt *) { return true; } static bool classof(const Value *V) { - return V->getValueType() == ConstantUIntVal; + return V->getValueType() == ConstantIntVal; } }; @@ -591,8 +522,7 @@ public: } /// getSizeOf constant expr - computes the size of a type in a target - /// independent way (Note: the return type is ULong but the object is not - /// necessarily a ConstantUInt). + /// independent way (Note: the return type is a ULong). /// static Constant *getSizeOf(const Type *Ty); diff --git a/include/llvm/IntrinsicInst.h b/include/llvm/IntrinsicInst.h index 996c83cb8e..4e4d47513d 100644 --- a/include/llvm/IntrinsicInst.h +++ b/include/llvm/IntrinsicInst.h @@ -97,10 +97,10 @@ namespace llvm { } unsigned getLine() const { - return unsigned(cast(getOperand(1))->getRawValue()); + return unsigned(cast(getOperand(1))->getZExtValue()); } unsigned getColumn() const { - return unsigned(cast(getOperand(2))->getRawValue()); + return unsigned(cast(getOperand(2))->getZExtValue()); } std::string getFileName() const; diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 72a4ed9146..157ef6e2b6 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -151,8 +151,7 @@ public: ConstantExprVal, // This is an instance of ConstantExpr ConstantAggregateZeroVal, // This is an instance of ConstantAggregateNull ConstantBoolVal, // This is an instance of ConstantBool - ConstantSIntVal, // This is an instance of ConstantSInt - ConstantUIntVal, // This is an instance of ConstantUInt + ConstantIntVal, // This is an instance of ConstantInt ConstantFPVal, // This is an instance of ConstantFP ConstantArrayVal, // This is an instance of ConstantArray ConstantStructVal, // This is an instance of ConstantStruct diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index fdc452b44f..8d4cbdb93d 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -468,11 +468,10 @@ static bool ValuesEqual(Value *V1, Value *V2) { /// CheckGEPInstructions - Check two GEP instructions with known must-aliasing /// base pointers. This checks to see if the index expressions preclude the /// pointers from aliasing... -AliasAnalysis::AliasResult BasicAliasAnalysis:: -CheckGEPInstructions(const Type* BasePtr1Ty, std::vector &GEP1Ops, - unsigned G1S, - const Type *BasePtr2Ty, std::vector &GEP2Ops, - unsigned G2S) { +AliasAnalysis::AliasResult +BasicAliasAnalysis::CheckGEPInstructions( + const Type* BasePtr1Ty, std::vector &GEP1Ops, unsigned G1S, + const Type *BasePtr2Ty, std::vector &GEP2Ops, unsigned G2S) { // We currently can't handle the case when the base pointers have different // primitive types. Since this is uncommon anyway, we are happy being // extremely conservative. @@ -670,7 +669,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector &GEP1Ops, if (const ConstantInt *Op1C = dyn_cast(Op1)) { // If this is an array index, make sure the array element is in range. if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) - if (Op1C->getRawValue() >= AT->getNumElements()) + if (Op1C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } else { @@ -685,7 +684,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector &GEP1Ops, // value possible. // if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) - GEP1Ops[i] = ConstantSInt::get(Type::LongTy,AT->getNumElements()-1); + GEP1Ops[i] = ConstantInt::get(Type::LongTy, AT->getNumElements()-1); } } @@ -693,7 +692,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector &GEP1Ops, if (const ConstantInt *Op2C = dyn_cast(Op2)) { // If this is an array index, make sure the array element is in range. if (const ArrayType *AT = dyn_cast(BasePtr1Ty)) - if (Op2C->getRawValue() >= AT->getNumElements()) + if (Op2C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } else { // Conservatively assume the minimum value for this index GEP2Ops[i] = Constant::getNullValue(Op2->getType()); diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 7e802ba7dd..359766d444 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -163,14 +163,15 @@ llvm::ConstantFoldCall(Function *F, const std::vector &Operands) { default: break; } - } else if (ConstantUInt *Op = dyn_cast(Operands[0])) { - uint64_t V = Op->getValue(); + } else if (ConstantInt *Op = dyn_cast(Operands[0])) { + assert(Op->getType()->isUnsigned() && "bswap args must be unsigned"); + uint64_t V = Op->getZExtValue(); if (Name == "llvm.bswap.i16") - return ConstantUInt::get(Ty, ByteSwap_16(V)); + return ConstantInt::get(Ty, ByteSwap_16(V)); else if (Name == "llvm.bswap.i32") - return ConstantUInt::get(Ty, ByteSwap_32(V)); + return ConstantInt::get(Ty, ByteSwap_32(V)); else if (Name == "llvm.bswap.i64") - return ConstantUInt::get(Ty, ByteSwap_64(V)); + return ConstantInt::get(Ty, ByteSwap_64(V)); } } else if (Operands.size() == 2) { if (ConstantFP *Op1 = dyn_cast(Operands[0])) { diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp index beb61754fc..9e12c9343d 100644 --- a/lib/Analysis/ConstantRange.cpp +++ b/lib/Analysis/ConstantRange.cpp @@ -161,7 +161,7 @@ uint64_t ConstantRange::getSetSize() const { // Simply subtract the bounds... Constant *Result = ConstantExpr::getSub(Upper, Lower); - return cast(Result)->getRawValue(); + return cast(Result)->getZExtValue(); } /// contains - Return true if the specified value is in the set. @@ -288,7 +288,7 @@ ConstantRange ConstantRange::zeroExtend(const Type *Ty) const { // Change a source full set into [0, 1 << 8*numbytes) unsigned SrcTySize = getLower()->getType()->getPrimitiveSize(); return ConstantRange(Constant::getNullValue(Ty), - ConstantUInt::get(Ty, 1ULL << SrcTySize*8)); + ConstantInt::get(Ty, 1ULL << SrcTySize*8)); } Constant *Lower = getLower(); diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index dbfbea3981..c5c68b3a69 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -407,7 +407,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { I != E; ++I) if (const StructType *STy = dyn_cast(*I)) { unsigned FieldNo = - (unsigned)cast(I.getOperand())->getValue(); + (unsigned)cast(I.getOperand())->getZExtValue(); Offset += (unsigned)TD.getStructLayout(STy)->MemberOffsets[FieldNo]; } else if (const PointerType *PTy = dyn_cast(*I)) { if (!isa(I.getOperand()) || diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 93d20f474f..a992e51e0f 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -177,7 +177,7 @@ SCEVHandle SCEVConstant::get(ConstantInt *V) { // Make sure that SCEVConstant instances are all unsigned. if (V->getType()->isSigned()) { const Type *NewTy = V->getType()->getUnsignedVersion(); - V = cast(ConstantExpr::getCast(V, NewTy)); + V = cast(ConstantExpr::getCast(V, NewTy)); } SCEVConstant *&R = (*SCEVConstants)[V]; @@ -463,9 +463,9 @@ SCEVHandle SCEVUnknown::getIntegerSCEV(int Val, const Type *Ty) { else if (Ty->isFloatingPoint()) C = ConstantFP::get(Ty, Val); else if (Ty->isSigned()) - C = ConstantSInt::get(Ty, Val); + C = ConstantInt::get(Ty, Val); else { - C = ConstantSInt::get(Ty->getSignedVersion(), Val); + C = ConstantInt::get(Ty->getSignedVersion(), Val); C = ConstantExpr::getCast(C, Ty); } return SCEVUnknown::get(C); @@ -507,11 +507,11 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) { // Handle this case efficiently, it is common to have constant iteration // counts while computing loop exit values. if (SCEVConstant *SC = dyn_cast(V)) { - uint64_t Val = SC->getValue()->getRawValue(); + uint64_t Val = SC->getValue()->getZExtValue(); uint64_t Result = 1; for (; NumSteps; --NumSteps) Result *= Val-(NumSteps-1); - Constant *Res = ConstantUInt::get(Type::ULongTy, Result); + Constant *Res = ConstantInt::get(Type::ULongTy, Result); return SCEVUnknown::get(ConstantExpr::getCast(Res, V->getType())); } @@ -1605,7 +1605,7 @@ GetAddressedElementFromGlobal(GlobalVariable *GV, const std::vector &Indices) { Constant *Init = GV->getInitializer(); for (unsigned i = 0, e = Indices.size(); i != e; ++i) { - uint64_t Idx = Indices[i]->getRawValue(); + uint64_t Idx = Indices[i]->getZExtValue(); if (ConstantStruct *CS = dyn_cast(Init)) { assert(Idx < CS->getNumOperands() && "Bad struct index!"); Init = cast(CS->getOperand(Idx)); @@ -1679,8 +1679,8 @@ ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS, unsigned MaxSteps = MaxBruteForceIterations; for (unsigned IterationNum = 0; IterationNum != MaxSteps; ++IterationNum) { - ConstantUInt *ItCst = - ConstantUInt::get(IdxExpr->getType()->getUnsignedVersion(), IterationNum); + ConstantInt *ItCst = + ConstantInt::get(IdxExpr->getType()->getUnsignedVersion(), IterationNum); ConstantInt *Val = EvaluateConstantChrecAtConstant(IdxExpr, ItCst); // Form the GEP offset. @@ -1896,7 +1896,7 @@ ComputeIterationCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen) { if (CondVal->getValue() == ExitWhen) { ConstantEvolutionLoopExitValue[PN] = PHIVal; ++NumBruteForceTripCountsComputed; - return SCEVConstant::get(ConstantUInt::get(Type::UIntTy, IterationNum)); + return SCEVConstant::get(ConstantInt::get(Type::UIntTy, IterationNum)); } // Compute the value of the PHI node for the next iteration. @@ -1935,7 +1935,7 @@ SCEVHandle ScalarEvolutionsImpl::getSCEVAtScope(SCEV *V, const Loop *L) { // this is a constant evolving PHI node, get the final value at // the specified iteration number. Constant *RV = getConstantEvolutionLoopExitValue(PN, - ICC->getValue()->getRawValue(), + ICC->getValue()->getZExtValue(), LI); if (RV) return SCEVUnknown::get(RV); } @@ -2076,10 +2076,10 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { SqrtTerm = ConstantExpr::getSub(ConstantExpr::getMul(B, B), SqrtTerm); // Compute floor(sqrt(B^2-4ac)) - ConstantUInt *SqrtVal = - cast(ConstantExpr::getCast(SqrtTerm, + ConstantInt *SqrtVal = + cast(ConstantExpr::getCast(SqrtTerm, SqrtTerm->getType()->getUnsignedVersion())); - uint64_t SqrtValV = SqrtVal->getValue(); + uint64_t SqrtValV = SqrtVal->getZExtValue(); uint64_t SqrtValV2 = (uint64_t)sqrt((double)SqrtValV); // The square root might not be precise for arbitrary 64-bit integer // values. Do some sanity checks to ensure it's correct. @@ -2089,7 +2089,7 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { return std::make_pair(CNC, CNC); } - SqrtVal = ConstantUInt::get(Type::ULongTy, SqrtValV2); + SqrtVal = ConstantInt::get(Type::ULongTy, SqrtValV2); SqrtTerm = ConstantExpr::getCast(SqrtVal, SqrtTerm->getType()); Constant *NegB = ConstantExpr::getNeg(B); diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index fd33e2fae2..68b52dd4fa 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -144,7 +144,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) { // IF the step is by one, just return the inserted IV. if (ConstantIntegral *CI = dyn_cast(F)) - if (CI->getRawValue() == 1) + if (CI->getZExtValue() == 1) return I; // If the insert point is directly inside of the loop, emit the multiply at diff --git a/lib/AsmParser/Lexer.cpp.cvs b/lib/AsmParser/Lexer.cpp.cvs index f6306aff9d..605a8c9230 100644 --- a/lib/AsmParser/Lexer.cpp.cvs +++ b/lib/AsmParser/Lexer.cpp.cvs @@ -17,7 +17,7 @@ #define yylineno llvmAsmlineno #line 20 "Lexer.cpp" -/* A lexical scanner generated by flex */ +/* A lexical scanner generated by flex*/ /* Scanner skeleton version: * $Header$ @@ -28,6 +28,7 @@ #define YY_FLEX_MINOR_VERSION 5 #include +#include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ @@ -41,7 +42,6 @@ #ifdef __cplusplus #include -#include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS @@ -153,6 +153,15 @@ extern FILE *yyin, *yyout; #define unput(c) yyunput( c, yytext_ptr ) +/* Some routines like yy_flex_realloc() are emitted as static but are + not called by all lexers. This generates warnings in some compilers, + notably GCC. Arrange to suppress these. */ +#ifdef __GNUC__ +#define YY_MAY_BE_UNUSED __attribute__((unused)) +#else +#define YY_MAY_BE_UNUSED +#endif + /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). @@ -259,7 +268,7 @@ YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED; static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer @@ -829,7 +838,7 @@ goto find_rule; \ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 1 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" #define INITIAL 0 /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// // @@ -844,7 +853,7 @@ char *yytext; // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#line 28 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 28 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" #include "ParserInternals.h" #include "llvm/Module.h" #include @@ -970,7 +979,7 @@ using namespace llvm; /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ -#line 974 "Lexer.cpp" +#line 983 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1118,13 +1127,13 @@ YY_MALLOC_DECL YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; + register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 179 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 179 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -#line 1128 "Lexer.cpp" +#line 1137 "Lexer.cpp" if ( yy_init ) { @@ -1217,507 +1226,507 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 181 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 181 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 183 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 183 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 184 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 184 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 185 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 185 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 186 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 186 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 187 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 187 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 188 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 188 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return GLOBAL; } YY_BREAK case 8: YY_RULE_SETUP -#line 189 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 189 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return CONSTANT; } YY_BREAK case 9: YY_RULE_SETUP -#line 190 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 190 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return INTERNAL; } YY_BREAK case 10: YY_RULE_SETUP -#line 191 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 191 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return LINKONCE; } YY_BREAK case 11: YY_RULE_SETUP -#line 192 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 192 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return WEAK; } YY_BREAK case 12: YY_RULE_SETUP -#line 193 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 193 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return APPENDING; } YY_BREAK case 13: YY_RULE_SETUP -#line 194 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 194 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DLLIMPORT; } YY_BREAK case 14: YY_RULE_SETUP -#line 195 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 195 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DLLEXPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 196 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 196 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERN_WEAK; } YY_BREAK case 16: YY_RULE_SETUP -#line 197 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 197 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } /* Deprecated, turn into external */ YY_BREAK case 17: YY_RULE_SETUP -#line 198 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 198 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } YY_BREAK case 18: YY_RULE_SETUP -#line 199 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 199 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return IMPLEMENTATION; } YY_BREAK case 19: YY_RULE_SETUP -#line 200 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 200 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return ZEROINITIALIZER; } YY_BREAK case 20: YY_RULE_SETUP -#line 201 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 201 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DOTDOTDOT; } YY_BREAK case 21: YY_RULE_SETUP -#line 202 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 202 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return UNDEF; } YY_BREAK case 22: YY_RULE_SETUP -#line 203 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 203 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return NULL_TOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 204 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 204 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return TO; } YY_BREAK case 24: YY_RULE_SETUP -#line 205 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 205 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 25: YY_RULE_SETUP -#line 206 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 206 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return NOT; } /* Deprecated, turned into XOR */ YY_BREAK case 26: YY_RULE_SETUP -#line 207 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 207 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return TAIL; } YY_BREAK case 27: YY_RULE_SETUP -#line 208 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 208 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return TARGET; } YY_BREAK case 28: YY_RULE_SETUP -#line 209 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 209 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return TRIPLE; } YY_BREAK case 29: YY_RULE_SETUP -#line 210 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 210 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DEPLIBS; } YY_BREAK case 30: YY_RULE_SETUP -#line 211 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 211 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return ENDIAN; } YY_BREAK case 31: YY_RULE_SETUP -#line 212 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 212 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return POINTERSIZE; } YY_BREAK case 32: YY_RULE_SETUP -#line 213 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 213 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DATA; } YY_BREAK case 33: YY_RULE_SETUP -#line 214 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 214 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return LITTLE; } YY_BREAK case 34: YY_RULE_SETUP -#line 215 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 215 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return BIG; } YY_BREAK case 35: YY_RULE_SETUP -#line 216 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 216 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return VOLATILE; } YY_BREAK case 36: YY_RULE_SETUP -#line 217 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 217 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return ALIGN; } YY_BREAK case 37: YY_RULE_SETUP -#line 218 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 218 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return SECTION; } YY_BREAK case 38: YY_RULE_SETUP -#line 219 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 219 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return MODULE; } YY_BREAK case 39: YY_RULE_SETUP -#line 220 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 220 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return ASM_TOK; } YY_BREAK case 40: YY_RULE_SETUP -#line 221 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 221 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return SIDEEFFECT; } YY_BREAK case 41: YY_RULE_SETUP -#line 223 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 223 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return CC_TOK; } YY_BREAK case 42: YY_RULE_SETUP -#line 224 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 224 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return CCC_TOK; } YY_BREAK case 43: YY_RULE_SETUP -#line 225 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 225 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return CSRETCC_TOK; } YY_BREAK case 44: YY_RULE_SETUP -#line 226 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 226 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return FASTCC_TOK; } YY_BREAK case 45: YY_RULE_SETUP -#line 227 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 227 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return COLDCC_TOK; } YY_BREAK case 46: YY_RULE_SETUP -#line 228 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 228 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return X86_STDCALLCC_TOK; } YY_BREAK case 47: YY_RULE_SETUP -#line 229 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 229 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return X86_FASTCALLCC_TOK; } YY_BREAK case 48: YY_RULE_SETUP -#line 231 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 231 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::VoidTy ; return VOID; } YY_BREAK case 49: YY_RULE_SETUP -#line 232 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 232 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; } YY_BREAK case 50: YY_RULE_SETUP -#line 233 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 233 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; } YY_BREAK case 51: YY_RULE_SETUP -#line 234 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 234 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; } YY_BREAK case 52: YY_RULE_SETUP -#line 235 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 235 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; } YY_BREAK case 53: YY_RULE_SETUP -#line 236 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 236 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; } YY_BREAK case 54: YY_RULE_SETUP -#line 237 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 237 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::IntTy ; return INT; } YY_BREAK case 55: YY_RULE_SETUP -#line 238 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 238 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UIntTy ; return UINT; } YY_BREAK case 56: YY_RULE_SETUP -#line 239 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 239 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::LongTy ; return LONG; } YY_BREAK case 57: YY_RULE_SETUP -#line 240 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 240 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; } YY_BREAK case 58: YY_RULE_SETUP -#line 241 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 241 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; } YY_BREAK case 59: YY_RULE_SETUP -#line 242 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 242 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; } YY_BREAK case 60: YY_RULE_SETUP -#line 243 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 243 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; } YY_BREAK case 61: YY_RULE_SETUP -#line 244 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 244 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return TYPE; } YY_BREAK case 62: YY_RULE_SETUP -#line 245 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 245 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return OPAQUE; } YY_BREAK case 63: YY_RULE_SETUP -#line 247 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 247 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 64: YY_RULE_SETUP -#line 248 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 248 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 65: YY_RULE_SETUP -#line 249 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 249 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 66: YY_RULE_SETUP -#line 250 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 250 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Div, DIV); } YY_BREAK case 67: YY_RULE_SETUP -#line 251 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 251 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Rem, REM); } YY_BREAK case 68: YY_RULE_SETUP -#line 252 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 252 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, And, AND); } YY_BREAK case 69: YY_RULE_SETUP -#line 253 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 253 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Or , OR ); } YY_BREAK case 70: YY_RULE_SETUP -#line 254 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 254 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Xor, XOR); } YY_BREAK case 71: YY_RULE_SETUP -#line 255 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 255 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetNE, SETNE); } YY_BREAK case 72: YY_RULE_SETUP -#line 256 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 256 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } YY_BREAK case 73: YY_RULE_SETUP -#line 257 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 257 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetLT, SETLT); } YY_BREAK case 74: YY_RULE_SETUP -#line 258 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 258 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetGT, SETGT); } YY_BREAK case 75: YY_RULE_SETUP -#line 259 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 259 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetLE, SETLE); } YY_BREAK case 76: YY_RULE_SETUP -#line 260 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 260 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetGE, SETGE); } YY_BREAK case 77: YY_RULE_SETUP -#line 262 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 262 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, PHI, PHI_TOK); } YY_BREAK case 78: YY_RULE_SETUP -#line 263 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 263 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK case 79: YY_RULE_SETUP -#line 264 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 264 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Cast, CAST); } YY_BREAK case 80: YY_RULE_SETUP -#line 265 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 265 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Select, SELECT); } YY_BREAK case 81: YY_RULE_SETUP -#line 266 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 266 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Shl, SHL); } YY_BREAK case 82: YY_RULE_SETUP -#line 267 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 267 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Shr, SHR); } YY_BREAK case 83: YY_RULE_SETUP -#line 268 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 268 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return VANEXT_old; } YY_BREAK case 84: YY_RULE_SETUP -#line 269 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 269 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return VAARG_old; } YY_BREAK case 85: YY_RULE_SETUP -#line 270 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 270 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, VAArg , VAARG); } YY_BREAK case 86: YY_RULE_SETUP -#line 271 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 271 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 87: YY_RULE_SETUP -#line 272 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 272 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 88: YY_RULE_SETUP -#line 273 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 273 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 89: YY_RULE_SETUP -#line 274 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 274 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Invoke, INVOKE); } YY_BREAK case 90: YY_RULE_SETUP -#line 275 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 275 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 91: YY_RULE_SETUP -#line 276 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 276 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } YY_BREAK case 92: YY_RULE_SETUP -#line 278 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 278 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 93: YY_RULE_SETUP -#line 279 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 279 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 94: YY_RULE_SETUP -#line 280 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 280 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 95: YY_RULE_SETUP -#line 281 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 281 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 96: YY_RULE_SETUP -#line 282 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 282 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 97: YY_RULE_SETUP -#line 283 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 283 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } YY_BREAK case 98: YY_RULE_SETUP -#line 285 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 285 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } YY_BREAK case 99: YY_RULE_SETUP -#line 286 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 286 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } YY_BREAK case 100: YY_RULE_SETUP -#line 287 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 287 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } YY_BREAK case 101: YY_RULE_SETUP -#line 290 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 290 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { UnEscapeLexed(yytext+1); llvmAsmlval.StrVal = strdup(yytext+1); // Skip % @@ -1726,7 +1735,7 @@ YY_RULE_SETUP YY_BREAK case 102: YY_RULE_SETUP -#line 295 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 295 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon UnEscapeLexed(yytext); @@ -1736,7 +1745,7 @@ YY_RULE_SETUP YY_BREAK case 103: YY_RULE_SETUP -#line 301 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 301 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-2] = 0; // nuke colon, end quote UnEscapeLexed(yytext+1); @@ -1746,7 +1755,7 @@ YY_RULE_SETUP YY_BREAK case 104: YY_RULE_SETUP -#line 308 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 308 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { // Note that we cannot unescape a string constant here! The // string constant might contain a \00 which would not be // understood by the string stuff. It is valid to make a @@ -1759,12 +1768,12 @@ YY_RULE_SETUP YY_BREAK case 105: YY_RULE_SETUP -#line 319 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 319 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK case 106: YY_RULE_SETUP -#line 320 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 320 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -1776,7 +1785,7 @@ YY_RULE_SETUP YY_BREAK case 107: YY_RULE_SETUP -#line 328 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 328 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; @@ -1784,7 +1793,7 @@ YY_RULE_SETUP YY_BREAK case 108: YY_RULE_SETUP -#line 333 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 333 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -1795,7 +1804,7 @@ YY_RULE_SETUP YY_BREAK case 109: YY_RULE_SETUP -#line 340 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 340 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -1807,16 +1816,16 @@ YY_RULE_SETUP YY_BREAK case 110: YY_RULE_SETUP -#line 349 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 349 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } YY_BREAK case 111: YY_RULE_SETUP -#line 350 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 350 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 352 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 352 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { /* Make sure to free the internal buffers for flex when we are * done reading our input! @@ -1827,20 +1836,20 @@ case YY_STATE_EOF(INITIAL): YY_BREAK case 112: YY_RULE_SETUP -#line 360 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 360 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { /* Ignore whitespace */ } YY_BREAK case 113: YY_RULE_SETUP -#line 361 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 361 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return yytext[0]; } YY_BREAK case 114: YY_RULE_SETUP -#line 363 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 363 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1844 "Lexer.cpp" +#line 1853 "Lexer.cpp" case YY_END_OF_BUFFER: { @@ -2216,6 +2225,7 @@ register char *yy_bp; #endif /* ifndef YY_NO_UNPUT */ +#ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else @@ -2289,7 +2299,7 @@ static int input() return c; } - +#endif /* YY_NO_INPUT */ #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) @@ -2400,11 +2410,6 @@ YY_BUFFER_STATE b; } -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) @@ -2722,5 +2727,5 @@ int main() return 0; } #endif -#line 363 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 363 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" diff --git a/lib/AsmParser/llvmAsmParser.cpp.cvs b/lib/AsmParser/llvmAsmParser.cpp.cvs index 8116e98962..2bcfe0144b 100644 --- a/lib/AsmParser/llvmAsmParser.cpp.cvs +++ b/lib/AsmParser/llvmAsmParser.cpp.cvs @@ -1,124 +1,290 @@ +/* A Bison parser, made by GNU Bison 2.1. */ -/* A Bison parser, made from /Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y - by GNU Bison version 1.28 */ +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -#define YYBISON 1 /* Identify Bison output. */ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 +/* Substitute the variable and function names. */ #define yyparse llvmAsmparse -#define yylex llvmAsmlex +#define yylex llvmAsmlex #define yyerror llvmAsmerror -#define yylval llvmAsmlval -#define yychar llvmAsmchar +#define yylval llvmAsmlval +#define yychar llvmAsmchar #define yydebug llvmAsmdebug #define yynerrs llvmAsmnerrs -#define ESINT64VAL 257 -#define EUINT64VAL 258 -#define SINTVAL 259 -#define UINTVAL 260 -#define FPVAL 261 -#define VOID 262 -#define BOOL 263 -#define SBYTE 264 -#define UBYTE 265 -#define SHORT 266 -#define USHORT 267 -#define INT 268 -#define UINT 269 -#define LONG 270 -#define ULONG 271 -#define FLOAT 272 -#define DOUBLE 273 -#define TYPE 274 -#define LABEL 275 -#define VAR_ID 276 -#define LABELSTR 277 -#define STRINGCONSTANT 278 -#define IMPLEMENTATION 279 -#define ZEROINITIALIZER 280 -#define TRUETOK 281 -#define FALSETOK 282 -#define BEGINTOK 283 -#define ENDTOK 284 -#define DECLARE 285 -#define GLOBAL 286 -#define CONSTANT 287 -#define SECTION 288 -#define VOLATILE 289 -#define TO 290 -#define DOTDOTDOT 291 -#define NULL_TOK 292 -#define UNDEF 293 -#define CONST 294 -#define INTERNAL 295 -#define LINKONCE 296 -#define WEAK 297 -#define APPENDING 298 -#define DLLIMPORT 299 -#define DLLEXPORT 300 -#define EXTERN_WEAK 301 -#define OPAQUE 302 -#define NOT 303 -#define EXTERNAL 304 -#define TARGET 305 -#define TRIPLE 306 -#define ENDIAN 307 -#define POINTERSIZE 308 -#define LITTLE 309 -#define BIG 310 -#define ALIGN 311 -#define DEPLIBS 312 -#define CALL 313 -#define TAIL 314 -#define ASM_TOK 315 -#define MODULE 316 -#define SIDEEFFECT 317 -#define CC_TOK 318 -#define CCC_TOK 319 -#define CSRETCC_TOK 320 -#define FASTCC_TOK 321 -#define COLDCC_TOK 322 -#define X86_STDCALLCC_TOK 323 -#define X86_FASTCALLCC_TOK 324 -#define DATA 325 -#define RET 326 -#define BR 327 -#define SWITCH 328 -#define INVOKE 329 -#define UNWIND 330 -#define UNREACHABLE 331 -#define ADD 332 -#define SUB 333 -#define MUL 334 -#define DIV 335 -#define REM 336 -#define AND 337 -#define OR 338 -#define XOR 339 -#define SETLE 340 -#define SETGE 341 -#define SETLT 342 -#define SETGT 343 -#define SETEQ 344 -#define SETNE 345 -#define MALLOC 346 -#define ALLOCA 347 -#define FREE 348 -#define LOAD 349 -#define STORE 350 -#define GETELEMENTPTR 351 -#define PHI_TOK 352 -#define CAST 353 -#define SELECT 354 -#define SHL 355 -#define SHR 356 -#define VAARG 357 -#define EXTRACTELEMENT 358 -#define INSERTELEMENT 359 -#define SHUFFLEVECTOR 360 -#define VAARG_old 361 -#define VANEXT_old 362 - -#line 14 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ESINT64VAL = 258, + EUINT64VAL = 259, + SINTVAL = 260, + UINTVAL = 261, + FPVAL = 262, + VOID = 263, + BOOL = 264, + SBYTE = 265, + UBYTE = 266, + SHORT = 267, + USHORT = 268, + INT = 269, + UINT = 270, + LONG = 271, + ULONG = 272, + FLOAT = 273, + DOUBLE = 274, + TYPE = 275, + LABEL = 276, + VAR_ID = 277, + LABELSTR = 278, + STRINGCONSTANT = 279, + IMPLEMENTATION = 280, + ZEROINITIALIZER = 281, + TRUETOK = 282, + FALSETOK = 283, + BEGINTOK = 284, + ENDTOK = 285, + DECLARE = 286, + GLOBAL = 287, + CONSTANT = 288, + SECTION = 289, + VOLATILE = 290, + TO = 291, + DOTDOTDOT = 292, + NULL_TOK = 293, + UNDEF = 294, + CONST = 295, + INTERNAL = 296, + LINKONCE = 297, + WEAK = 298, + APPENDING = 299, + DLLIMPORT = 300, + DLLEXPORT = 301, + EXTERN_WEAK = 302, + OPAQUE = 303, + NOT = 304, + EXTERNAL = 305, + TARGET = 306, + TRIPLE = 307, + ENDIAN = 308, + POINTERSIZE = 309, + LITTLE = 310, + BIG = 311, + ALIGN = 312, + DEPLIBS = 313, + CALL = 314, + TAIL = 315, + ASM_TOK = 316, + MODULE = 317, + SIDEEFFECT = 318, + CC_TOK = 319, + CCC_TOK = 320, + CSRETCC_TOK = 321, + FASTCC_TOK = 322, + COLDCC_TOK = 323, + X86_STDCALLCC_TOK = 324, + X86_FASTCALLCC_TOK = 325, + DATA = 326, + RET = 327, + BR = 328, + SWITCH = 329, + INVOKE = 330, + UNWIND = 331, + UNREACHABLE = 332, + ADD = 333, + SUB = 334, + MUL = 335, + DIV = 336, + REM = 337, + AND = 338, + OR = 339, + XOR = 340, + SETLE = 341, + SETGE = 342, + SETLT = 343, + SETGT = 344, + SETEQ = 345, + SETNE = 346, + MALLOC = 347, + ALLOCA = 348, + FREE = 349, + LOAD = 350, + STORE = 351, + GETELEMENTPTR = 352, + PHI_TOK = 353, + CAST = 354, + SELECT = 355, + SHL = 356, + SHR = 357, + VAARG = 358, + EXTRACTELEMENT = 359, + INSERTELEMENT = 360, + SHUFFLEVECTOR = 361, + VAARG_old = 362, + VANEXT_old = 363 + }; +#endif +/* Tokens. */ +#define ESINT64VAL 258 +#define EUINT64VAL 259 +#define SINTVAL 260 +#define UINTVAL 261 +#define FPVAL 262 +#define VOID 263 +#define BOOL 264 +#define SBYTE 265 +#define UBYTE 266 +#define SHORT 267 +#define USHORT 268 +#define INT 269 +#define UINT 270 +#define LONG 271 +#define ULONG 272 +#define FLOAT 273 +#define DOUBLE 274 +#define TYPE 275 +#define LABEL 276 +#define VAR_ID 277 +#define LABELSTR 278 +#define STRINGCONSTANT 279 +#define IMPLEMENTATION 280 +#define ZEROINITIALIZER 281 +#define TRUETOK 282 +#define FALSETOK 283 +#define BEGINTOK 284 +#define ENDTOK 285 +#define DECLARE 286 +#define GLOBAL 287 +#define CONSTANT 288 +#define SECTION 289 +#define VOLATILE 290 +#define TO 291 +#define DOTDOTDOT 292 +#define NULL_TOK 293 +#define UNDEF 294 +#define CONST 295 +#define INTERNAL 296 +#define LINKONCE 297 +#define WEAK 298 +#define APPENDING 299 +#define DLLIMPORT 300 +#define DLLEXPORT 301 +#define EXTERN_WEAK 302 +#define OPAQUE 303 +#define NOT 304 +#define EXTERNAL 305 +#define TARGET 306 +#define TRIPLE 307 +#define ENDIAN 308 +#define POINTERSIZE 309 +#define LITTLE 310 +#define BIG 311 +#define ALIGN 312 +#define DEPLIBS 313 +#define CALL 314 +#define TAIL 315 +#define ASM_TOK 316 +#define MODULE 317 +#define SIDEEFFECT 318 +#define CC_TOK 319 +#define CCC_TOK 320 +#define CSRETCC_TOK 321 +#define FASTCC_TOK 322 +#define COLDCC_TOK 323 +#define X86_STDCALLCC_TOK 324 +#define X86_FASTCALLCC_TOK 325 +#define DATA 326 +#define RET 327 +#define BR 328 +#define SWITCH 329 +#define INVOKE 330 +#define UNWIND 331 +#define UNREACHABLE 332 +#define ADD 333 +#define SUB 334 +#define MUL 335 +#define DIV 336 +#define REM 337 +#define AND 338 +#define OR 339 +#define XOR 340 +#define SETLE 341 +#define SETGE 342 +#define SETLT 343 +#define SETGT 344 +#define SETEQ 345 +#define SETNE 346 +#define MALLOC 347 +#define ALLOCA 348 +#define FREE 349 +#define LOAD 350 +#define STORE 351 +#define GETELEMENTPTR 352 +#define PHI_TOK 353 +#define CAST 354 +#define SELECT 355 +#define SHL 356 +#define SHR 357 +#define VAARG 358 +#define EXTRACTELEMENT 359 +#define INSERTELEMENT 360 +#define SHUFFLEVECTOR 361 +#define VAARG_old 362 +#define VANEXT_old 363 + + + + +/* Copy the first part of user declarations. */ +#line 14 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -415,25 +581,25 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { // Check to make sure that "Ty" is an integral type, and that our // value will fit into the specified type... case ValID::ConstSIntVal: // Is it a constant pool reference?? - if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Signed integral constant '" + itostr(D.ConstPool64) + "' is invalid for type '" + Ty->getDescription() + "'!"); return 0; } - return ConstantSInt::get(Ty, D.ConstPool64); + return ConstantInt::get(Ty, D.ConstPool64); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? - if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) { - if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Integral constant '" + utostr(D.UConstPool64) + "' is invalid or out of range!"); return 0; } else { // This is really a signed reference. Transmogrify. - return ConstantSInt::get(Ty, D.ConstPool64); + return ConstantInt::get(Ty, D.ConstPool64); } } else { - return ConstantUInt::get(Ty, D.UConstPool64); + return ConstantInt::get(Ty, D.UConstPool64); } case ValID::ConstFPVal: // Is it a floating point const pool reference? @@ -1078,8 +1244,28 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { } -#line 974 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -typedef union { + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 974 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -1118,1003 +1304,1457 @@ typedef union { llvm::Instruction::OtherOps OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -#include - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif +/* Line 196 of yacc.c. */ +#line 1309 "llvmAsmParser.tab.c" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif -#define YYFINAL 517 -#define YYFLAG -32768 -#define YYNTBASE 123 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 362 ? yytranslate[x] : 197) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 112, - 113, 121, 2, 110, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 117, - 109, 118, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 114, 111, 116, 2, 2, 2, 2, 2, 122, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 115, - 2, 2, 119, 2, 120, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108 -}; +/* Copy the second part of user declarations. */ -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, - 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, - 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 67, 68, 70, 72, 74, 76, 78, - 80, 82, 83, 84, 86, 88, 90, 92, 94, 96, - 99, 100, 103, 104, 108, 111, 112, 114, 115, 119, - 121, 124, 126, 128, 130, 132, 134, 136, 138, 140, - 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, - 162, 164, 166, 169, 174, 180, 186, 190, 193, 196, - 198, 202, 204, 208, 210, 211, 216, 220, 224, 229, - 234, 238, 241, 244, 247, 250, 253, 256, 259, 262, - 265, 268, 275, 281, 290, 297, 304, 311, 318, 325, - 334, 343, 347, 349, 351, 353, 355, 358, 361, 366, - 369, 371, 376, 379, 384, 385, 393, 394, 402, 403, - 411, 412, 420, 424, 429, 430, 432, 434, 436, 440, - 444, 448, 452, 456, 460, 462, 463, 465, 467, 469, - 470, 473, 477, 479, 481, 485, 487, 488, 497, 499, - 501, 505, 507, 509, 512, 513, 515, 517, 518, 523, - 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, - 546, 548, 554, 556, 558, 560, 562, 565, 568, 571, - 575, 578, 579, 581, 584, 587, 591, 601, 611, 620, - 634, 636, 638, 645, 651, 654, 661, 669, 671, 675, - 677, 678, 681, 683, 689, 695, 701, 704, 709, 714, - 721, 726, 731, 736, 741, 748, 755, 758, 766, 768, - 771, 772, 774, 775, 779, 786, 790, 797, 800, 805, - 812 -}; -static const short yyrhs[] = { 5, - 0, 6, 0, 3, 0, 4, 0, 78, 0, 79, - 0, 80, 0, 81, 0, 82, 0, 83, 0, 84, - 0, 85, 0, 86, 0, 87, 0, 88, 0, 89, - 0, 90, 0, 91, 0, 101, 0, 102, 0, 16, - 0, 14, 0, 12, 0, 10, 0, 17, 0, 15, - 0, 13, 0, 11, 0, 129, 0, 130, 0, 18, - 0, 19, 0, 165, 109, 0, 0, 41, 0, 42, - 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, - 0, 0, 0, 65, 0, 66, 0, 67, 0, 68, - 0, 69, 0, 70, 0, 64, 4, 0, 0, 57, - 4, 0, 0, 110, 57, 4, 0, 34, 24, 0, - 0, 138, 0, 0, 110, 141, 140, 0, 138, 0, - 57, 4, 0, 144, 0, 8, 0, 146, 0, 8, - 0, 146, 0, 9, 0, 10, 0, 11, 0, 12, - 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, - 0, 18, 0, 19, 0, 20, 0, 21, 0, 48, - 0, 145, 0, 180, 0, 111, 4, 0, 143, 112, - 148, 113, 0, 114, 4, 115, 146, 116, 0, 117, - 4, 115, 146, 118, 0, 119, 147, 120, 0, 119, - 120, 0, 146, 121, 0, 146, 0, 147, 110, 146, - 0, 147, 0, 147, 110, 37, 0, 37, 0, 0, - 144, 114, 151, 116, 0, 144, 114, 116, 0, 144, - 122, 24, 0, 144, 117, 151, 118, 0, 144, 119, - 151, 120, 0, 144, 119, 120, 0, 144, 38, 0, - 144, 39, 0, 144, 180, 0, 144, 150, 0, 144, - 26, 0, 129, 124, 0, 130, 4, 0, 9, 27, - 0, 9, 28, 0, 132, 7, 0, 99, 112, 149, - 36, 144, 113, 0, 97, 112, 149, 194, 113, 0, - 100, 112, 149, 110, 149, 110, 149, 113, 0, 125, - 112, 149, 110, 149, 113, 0, 126, 112, 149, 110, - 149, 113, 0, 127, 112, 149, 110, 149, 113, 0, - 128, 112, 149, 110, 149, 113, 0, 104, 112, 149, - 110, 149, 113, 0, 105, 112, 149, 110, 149, 110, - 149, 113, 0, 106, 112, 149, 110, 149, 110, 149, - 113, 0, 151, 110, 149, 0, 149, 0, 32, 0, - 33, 0, 154, 0, 154, 174, 0, 154, 176, 0, - 154, 62, 61, 160, 0, 154, 25, 0, 155, 0, - 155, 133, 20, 142, 0, 155, 176, 0, 155, 62, - 61, 160, 0, 0, 155, 133, 134, 152, 149, 156, - 140, 0, 0, 155, 133, 50, 152, 144, 157, 140, - 0, 0, 155, 133, 45, 152, 144, 158, 140, 0, - 0, 155, 133, 47, 152, 144, 159, 140, 0, 155, - 51, 162, 0, 155, 58, 109, 163, 0, 0, 24, - 0, 56, 0, 55, 0, 53, 109, 161, 0, 54, - 109, 4, 0, 52, 109, 24, 0, 71, 109, 24, - 0, 114, 164, 116, 0, 164, 110, 24, 0, 24, - 0, 0, 22, 0, 24, 0, 165, 0, 0, 144, - 166, 0, 168, 110, 167, 0, 167, 0, 168, 0, - 168, 110, 37, 0, 37, 0, 0, 135, 142, 165, - 112, 169, 113, 139, 136, 0, 29, 0, 119, 0, - 134, 170, 171, 0, 30, 0, 120, 0, 183, 173, - 0, 0, 45, 0, 47, 0, 0, 31, 177, 175, - 170, 0, 0, 63, 0, 3, 0, 4, 0, 7, - 0, 27, 0, 28, 0, 38, 0, 39, 0, 26, - 0, 117, 151, 118, 0, 150, 0, 61, 178, 24, - 110, 24, 0, 123, 0, 165, 0, 180, 0, 179, - 0, 144, 181, 0, 183, 184, 0, 172, 184, 0, - 185, 133, 186, 0, 185, 188, 0, 0, 23, 0, - 72, 182, 0, 72, 8, 0, 73, 21, 181, 0, - 73, 9, 181, 110, 21, 181, 110, 21, 181, 0, - 74, 131, 181, 110, 21, 181, 114, 187, 116, 0, - 74, 131, 181, 110, 21, 181, 114, 116, 0, 75, - 135, 142, 181, 112, 191, 113, 36, 21, 181, 76, - 21, 181, 0, 76, 0, 77, 0, 187, 131, 179, - 110, 21, 181, 0, 131, 179, 110, 21, 181, 0, - 133, 193, 0, 144, 114, 181, 110, 181, 116, 0, - 189, 110, 114, 181, 110, 181, 116, 0, 182, 0, - 190, 110, 182, 0, 190, 0, 0, 60, 59, 0, - 59, 0, 125, 144, 181, 110, 181, 0, 126, 144, - 181, 110, 181, 0, 127, 144, 181, 110, 181, 0, - 49, 182, 0, 128, 182, 110, 182, 0, 99, 182, - 36, 144, 0, 100, 182, 110, 182, 110, 182, 0, - 103, 182, 110, 144, 0, 107, 182, 110, 144, 0, - 108, 182, 110, 144, 0, 104, 182, 110, 182, 0, - 105, 182, 110, 182, 110, 182, 0, 106, 182, 110, - 182, 110, 182, 0, 98, 189, 0, 192, 135, 142, - 181, 112, 191, 113, 0, 196, 0, 110, 190, 0, - 0, 35, 0, 0, 92, 144, 137, 0, 92, 144, - 110, 15, 181, 137, 0, 93, 144, 137, 0, 93, - 144, 110, 15, 181, 137, 0, 94, 182, 0, 195, - 95, 144, 181, 0, 195, 96, 182, 110, 144, 181, - 0, 97, 144, 181, 194, 0 -}; +/* Line 219 of yacc.c. */ +#line 1321 "llvmAsmParser.tab.c" +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int #endif -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 1097, 1098, 1106, 1107, 1117, 1117, 1117, 1117, 1117, 1118, - 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1121, 1121, - 1125, 1125, 1125, 1125, 1126, 1126, 1126, 1126, 1127, 1127, - 1128, 1128, 1131, 1135, 1140, 1140, 1141, 1142, 1143, 1144, - 1145, 1146, 1149, 1149, 1150, 1151, 1152, 1153, 1154, 1155, - 1165, 1165, 1172, 1172, 1181, 1189, 1189, 1195, 1195, 1197, - 1202, 1216, 1216, 1217, 1217, 1219, 1229, 1229, 1229, 1229, - 1229, 1229, 1229, 1230, 1230, 1230, 1230, 1230, 1230, 1231, - 1235, 1239, 1247, 1255, 1268, 1273, 1285, 1295, 1299, 1310, - 1315, 1321, 1322, 1326, 1330, 1341, 1367, 1381, 1411, 1437, - 1458, 1471, 1481, 1486, 1547, 1554, 1563, 1569, 1575, 1579, - 1583, 1591, 1602, 1634, 1642, 1664, 1675, 1681, 1689, 1695, - 1701, 1710, 1714, 1722, 1722, 1732, 1740, 1745, 1749, 1753, - 1757, 1772, 1794, 1797, 1800, 1805, 1808, 1812, 1816, 1820, - 1824, 1829, 1833, 1836, 1839, 1843, 1856, 1857, 1859, 1863, - 1872, 1877, 1883, 1885, 1890, 1895, 1904, 1904, 1905, 1905, - 1907, 1914, 1920, 1927, 1931, 1937, 1942, 1947, 2042, 2042, - 2044, 2052, 2052, 2054, 2059, 2059, 2060, 2063, 2063, 2073, - 2077, 2082, 2086, 2090, 2094, 2098, 2102, 2106, 2110, 2114, - 2139, 2143, 2157, 2161, 2167, 2167, 2173, 2178, 2182, 2191, - 2202, 2207, 2219, 2232, 2236, 2240, 2245, 2254, 2273, 2282, - 2338, 2342, 2349, 2360, 2373, 2382, 2391, 2401, 2405, 2412, - 2412, 2414, 2418, 2423, 2439, 2454, 2468, 2481, 2489, 2497, - 2505, 2511, 2531, 2554, 2560, 2566, 2572, 2587, 2646, 2653, - 2656, 2661, 2665, 2672, 2677, 2683, 2688, 2694, 2702, 2714, - 2729 -}; +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif #endif +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} +# endif +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short int yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined (__GNUC__) && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", -"EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT", -"USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID", -"LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK", -"BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO", -"DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING", -"DLLIMPORT","DLLEXPORT","EXTERN_WEAK","OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE", -"ENDIAN","POINTERSIZE","LITTLE","BIG","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK", -"MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","CSRETCC_TOK","FASTCC_TOK","COLDCC_TOK", -"X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATA","RET","BR","SWITCH","INVOKE", -"UNWIND","UNREACHABLE","ADD","SUB","MUL","DIV","REM","AND","OR","XOR","SETLE", -"SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD","STORE", -"GETELEMENTPTR","PHI_TOK","CAST","SELECT","SHL","SHR","VAARG","EXTRACTELEMENT", -"INSERTELEMENT","SHUFFLEVECTOR","VAARG_old","VANEXT_old","'='","','","'\\\\'", -"'('","')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'*'","'c'","INTVAL","EINT64VAL", -"ArithmeticOps","LogicalOps","SetCondOps","ShiftOps","SIntType","UIntType","IntType", -"FPType","OptAssign","OptLinkage","OptCallingConv","OptAlign","OptCAlign","SectionString", -"OptSection","GlobalVarAttributes","GlobalVarAttribute","TypesV","UpRTypesV", -"Types","PrimType","UpRTypes","TypeListI","ArgTypeListI","ConstVal","ConstExpr", -"ConstVector","GlobalType","Module","FunctionList","ConstPool","@1","@2","@3", -"@4","AsmBlock","BigOrLittle","TargetDefinition","LibrariesDefinition","LibList", -"Name","OptName","ArgVal","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader", -"END","Function","FnDeclareLinkage","FunctionProto","@5","OptSideEffect","ConstValueRef", -"SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList", -"BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","ValueRefListE", -"OptTailCall","InstVal","IndexList","OptVolatile","MemoryInst", NULL -}; #endif -static const short yyr1[] = { 0, - 123, 123, 124, 124, 125, 125, 125, 125, 125, 126, - 126, 126, 127, 127, 127, 127, 127, 127, 128, 128, - 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, - 132, 132, 133, 133, 134, 134, 134, 134, 134, 134, - 134, 134, 135, 135, 135, 135, 135, 135, 135, 135, - 136, 136, 137, 137, 138, 139, 139, 140, 140, 141, - 141, 142, 142, 143, 143, 144, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, - 147, 148, 148, 148, 148, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 151, 151, 152, 152, 153, 154, 154, 154, 154, - 154, 155, 155, 155, 156, 155, 157, 155, 158, 155, - 159, 155, 155, 155, 155, 160, 161, 161, 162, 162, - 162, 162, 163, 164, 164, 164, 165, 165, 166, 166, - 167, 168, 168, 169, 169, 169, 169, 170, 171, 171, - 172, 173, 173, 174, 175, 175, 175, 177, 176, 178, - 178, 179, 179, 179, 179, 179, 179, 179, 179, 179, - 179, 179, 180, 180, 181, 181, 182, 183, 183, 184, - 185, 185, 185, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 187, 187, 188, 189, 189, 190, 190, 191, - 191, 192, 192, 193, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, 193, 194, - 194, 195, 195, 196, 196, 196, 196, 196, 196, 196, - 196 -}; +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; +#endif -static const short yyr2[] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 1, 1, 1, 1, 1, 1, 2, - 0, 2, 0, 3, 2, 0, 1, 0, 3, 1, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 4, 5, 5, 3, 2, 2, 1, - 3, 1, 3, 1, 0, 4, 3, 3, 4, 4, - 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 6, 5, 8, 6, 6, 6, 6, 6, 8, - 8, 3, 1, 1, 1, 1, 2, 2, 4, 2, - 1, 4, 2, 4, 0, 7, 0, 7, 0, 7, - 0, 7, 3, 4, 0, 1, 1, 1, 3, 3, - 3, 3, 3, 3, 1, 0, 1, 1, 1, 0, - 2, 3, 1, 1, 3, 1, 0, 8, 1, 1, - 3, 1, 1, 2, 0, 1, 1, 0, 4, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 5, 1, 1, 1, 1, 2, 2, 2, 3, - 2, 0, 1, 2, 2, 3, 9, 9, 8, 13, - 1, 1, 6, 5, 2, 6, 7, 1, 3, 1, - 0, 2, 1, 5, 5, 5, 2, 4, 4, 6, - 4, 4, 4, 4, 6, 6, 2, 7, 1, 2, - 0, 1, 0, 3, 6, 3, 6, 2, 4, 6, - 4 +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 4 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1339 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 123 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 75 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 252 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 517 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 363 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 112, 113, 121, 2, 110, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 117, 109, 118, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 114, 111, 116, 2, 2, 2, 2, 2, 122, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 115, 2, 2, 119, 2, 120, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108 }; -static const short yydefact[] = { 145, - 42, 131, 130, 178, 35, 36, 37, 38, 39, 40, - 41, 0, 43, 202, 127, 128, 202, 157, 158, 0, - 0, 0, 42, 0, 133, 175, 0, 0, 44, 45, - 46, 47, 48, 49, 0, 0, 203, 199, 34, 172, - 173, 174, 198, 0, 0, 0, 0, 143, 0, 0, - 0, 0, 0, 0, 0, 33, 176, 177, 43, 146, - 129, 50, 1, 2, 63, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, - 0, 0, 0, 193, 0, 0, 62, 81, 66, 194, - 82, 169, 170, 171, 243, 201, 0, 0, 0, 0, - 156, 144, 134, 132, 124, 125, 0, 0, 0, 0, - 179, 83, 0, 0, 65, 88, 90, 0, 0, 95, - 89, 242, 0, 223, 0, 0, 0, 0, 43, 211, - 212, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 0, 0, 0, 0, 0, - 0, 0, 19, 20, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 200, 43, 215, 0, 239, 151, - 148, 147, 149, 150, 152, 155, 0, 139, 141, 137, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 0, 0, 0, 0, 135, 0, 0, 0, 87, - 167, 94, 92, 0, 0, 227, 222, 205, 204, 0, - 0, 24, 28, 23, 27, 22, 26, 21, 25, 29, - 30, 0, 0, 53, 53, 248, 0, 0, 237, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 153, 58, 58, 58, 109, - 110, 3, 4, 107, 108, 111, 106, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 105, 104, 58, 64, 64, 91, 166, - 160, 163, 164, 0, 0, 84, 182, 183, 184, 189, - 185, 186, 187, 188, 180, 0, 191, 196, 195, 197, - 0, 206, 0, 0, 0, 244, 0, 246, 241, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 154, 0, 140, 142, - 138, 0, 0, 0, 0, 0, 0, 97, 123, 0, - 0, 101, 0, 98, 0, 0, 0, 0, 136, 85, - 86, 159, 161, 0, 56, 93, 181, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 251, 0, 0, 229, - 0, 231, 234, 0, 0, 232, 233, 0, 0, 0, - 228, 0, 249, 0, 0, 0, 60, 58, 241, 0, - 0, 0, 0, 0, 0, 96, 99, 100, 0, 0, - 0, 0, 165, 162, 57, 51, 0, 190, 0, 0, - 221, 53, 54, 53, 218, 240, 0, 0, 0, 0, - 0, 224, 225, 226, 221, 0, 55, 61, 59, 0, - 0, 0, 0, 0, 0, 122, 0, 0, 0, 0, - 0, 168, 0, 0, 0, 220, 0, 0, 245, 247, - 0, 0, 0, 230, 235, 236, 0, 250, 113, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 52, 192, - 0, 0, 0, 219, 216, 0, 238, 112, 0, 119, - 0, 0, 115, 116, 117, 118, 0, 209, 0, 0, - 0, 217, 0, 0, 0, 207, 0, 208, 0, 0, - 114, 120, 121, 0, 0, 0, 0, 0, 0, 214, - 0, 0, 213, 210, 0, 0, 0 +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned short int yyprhs[] = +{ + 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, + 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, + 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, + 59, 61, 63, 65, 67, 70, 71, 73, 75, 77, + 79, 81, 83, 85, 86, 87, 89, 91, 93, 95, + 97, 99, 102, 103, 106, 107, 111, 114, 115, 117, + 118, 122, 124, 127, 129, 131, 133, 135, 137, 139, + 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, + 161, 163, 165, 167, 169, 172, 177, 183, 189, 193, + 196, 199, 201, 205, 207, 211, 213, 214, 219, 223, + 227, 232, 237, 241, 244, 247, 250, 253, 256, 259, + 262, 265, 268, 271, 278, 284, 293, 300, 307, 314, + 321, 328, 337, 346, 350, 352, 354, 356, 358, 361, + 364, 369, 372, 374, 379, 382, 387, 388, 396, 397, + 405, 406, 414, 415, 423, 427, 432, 433, 435, 437, + 439, 443, 447, 451, 455, 459, 463, 465, 466, 468, + 470, 472, 473, 476, 480, 482, 484, 488, 490, 491, + 500, 502, 504, 508, 510, 512, 515, 516, 518, 520, + 521, 526, 527, 529, 531, 533, 535, 537, 539, 541, + 543, 545, 549, 551, 557, 559, 561, 563, 565, 568, + 571, 574, 578, 581, 582, 584, 587, 590, 594, 604, + 614, 623, 637, 639, 641, 648, 654, 657, 664, 672, + 674, 678, 680, 681, 684, 686, 692, 698, 704, 707, + 712, 717, 724, 729, 734, 739, 744, 751, 758, 761, + 769, 771, 774, 775, 777, 778, 782, 789, 793, 800, + 803, 808, 815 }; -static const short yydefgoto[] = { 84, - 254, 270, 271, 272, 273, 192, 193, 222, 194, 23, - 13, 35, 442, 306, 387, 406, 329, 388, 85, 86, - 195, 88, 89, 118, 204, 339, 297, 340, 107, 515, - 1, 2, 276, 249, 247, 248, 61, 173, 48, 102, - 177, 90, 353, 282, 283, 284, 36, 94, 14, 42, - 15, 59, 16, 26, 358, 298, 91, 300, 415, 17, - 38, 39, 165, 490, 96, 229, 446, 447, 166, 167, - 367, 168, 169 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const short int yyrhs[] = +{ + 154, 0, -1, 5, -1, 6, -1, 3, -1, 4, + -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, + -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, + -1, 88, -1, 89, -1, 90, -1, 91, -1, 101, + -1, 102, -1, 16, -1, 14, -1, 12, -1, 10, + -1, 17, -1, 15, -1, 13, -1, 11, -1, 130, + -1, 131, -1, 18, -1, 19, -1, 166, 109, -1, + -1, 41, -1, 42, -1, 43, -1, 44, -1, 45, + -1, 46, -1, 47, -1, -1, -1, 65, -1, 66, + -1, 67, -1, 68, -1, 69, -1, 70, -1, 64, + 4, -1, -1, 57, 4, -1, -1, 110, 57, 4, + -1, 34, 24, -1, -1, 139, -1, -1, 110, 142, + 141, -1, 139, -1, 57, 4, -1, 145, -1, 8, + -1, 147, -1, 8, -1, 147, -1, 9, -1, 10, + -1, 11, -1, 12, -1, 13, -1, 14, -1, 15, + -1, 16, -1, 17, -1, 18, -1, 19, -1, 20, + -1, 21, -1, 48, -1, 146, -1, 181, -1, 111, + 4, -1, 144, 112, 149, 113, -1, 114, 4, 115, + 147, 116, -1, 117, 4, 115, 147, 118, -1, 119, + 148, 120, -1, 119, 120, -1, 147, 121, -1, 147, + -1, 148, 110, 147, -1, 148, -1, 148, 110, 37, + -1, 37, -1, -1, 145, 114, 152, 116, -1, 145, + 114, 116, -1, 145, 122, 24, -1, 145, 117, 152, + 118, -1, 145, 119, 152, 120, -1, 145, 119, 120, + -1, 145, 38, -1, 145, 39, -1, 145, 181, -1, + 145, 151, -1, 145, 26, -1, 130, 125, -1, 131, + 4, -1, 9, 27, -1, 9, 28, -1, 133, 7, + -1, 99, 112, 150, 36, 145, 113, -1, 97, 112, + 150, 195, 113, -1, 100, 112, 150, 110, 150, 110, + 150, 113, -1, 126, 112, 150, 110, 150, 113, -1, + 127, 112, 150, 110, 150, 113, -1, 128, 112, 150, + 110, 150, 113, -1, 129, 112, 150, 110, 150, 113, + -1, 104, 112, 150, 110, 150, 113, -1, 105, 112, + 150, 110, 150, 110, 150, 113, -1, 106, 112, 150, + 110, 150, 110, 150, 113, -1, 152, 110, 150, -1, + 150, -1, 32, -1, 33, -1, 155, -1, 155, 175, + -1, 155, 177, -1, 155, 62, 61, 161, -1, 155, + 25, -1, 156, -1, 156, 134, 20, 143, -1, 156, + 177, -1, 156, 62, 61, 161, -1, -1, 156, 134, + 135, 153, 150, 157, 141, -1, -1, 156, 134, 50, + 153, 145, 158, 141, -1, -1, 156, 134, 45, 153, + 145, 159, 141, -1, -1, 156, 134, 47, 153, 145, + 160, 141, -1, 156, 51, 163, -1, 156, 58, 109, + 164, -1, -1, 24, -1, 56, -1, 55, -1, 53, + 109, 162, -1, 54, 109, 4, -1, 52, 109, 24, + -1, 71, 109, 24, -1, 114, 165, 116, -1, 165, + 110, 24, -1, 24, -1, -1, 22, -1, 24, -1, + 166, -1, -1, 145, 167, -1, 169, 110, 168, -1, + 168, -1, 169, -1, 169, 110, 37, -1, 37, -1, + -1, 136, 143, 166, 112, 170, 113, 140, 137, -1, + 29, -1, 119, -1, 135, 171, 172, -1, 30, -1, + 120, -1, 184, 174, -1, -1, 45, -1, 47, -1, + -1, 31, 178, 176, 171, -1, -1, 63, -1, 3, + -1, 4, -1, 7, -1, 27, -1, 28, -1, 38, + -1, 39, -1, 26, -1, 117, 152, 118, -1, 151, + -1, 61, 179, 24, 110, 24, -1, 124, -1, 166, + -1, 181, -1, 180, -1, 145, 182, -1, 184, 185, + -1, 173, 185, -1, 186, 134, 187, -1, 186, 189, + -1, -1, 23, -1, 72, 183, -1, 72, 8, -1, + 73, 21, 182, -1, 73, 9, 182, 110, 21, 182, + 110, 21, 182, -1, 74, 132, 182, 110, 21, 182, + 114, 188, 116, -1, 74, 132, 182, 110, 21, 182, + 114, 116, -1, 75, 136, 143, 182, 112, 192, 113, + 36, 21, 182, 76, 21, 182, -1, 76, -1, 77, + -1, 188, 132, 180, 110, 21, 182, -1, 132, 180, + 110, 21, 182, -1, 134, 194, -1, 145, 114, 182, + 110, 182, 116, -1, 190, 110, 114, 182, 110, 182, + 116, -1, 183, -1, 191, 110, 183, -1, 191, -1, + -1, 60, 59, -1, 59, -1, 126, 145, 182, 110, + 182, -1, 127, 145, 182, 110, 182, -1, 128, 145, + 182, 110, 182, -1, 49, 183, -1, 129, 183, 110, + 183, -1, 99, 183, 36, 145, -1, 100, 183, 110, + 183, 110, 183, -1, 103, 183, 110, 145, -1, 107, + 183, 110, 145, -1, 108, 183, 110, 145, -1, 104, + 183, 110, 183, -1, 105, 183, 110, 183, 110, 183, + -1, 106, 183, 110, 183, 110, 183, -1, 98, 190, + -1, 193, 136, 143, 182, 112, 192, 113, -1, 197, + -1, 110, 191, -1, -1, 35, -1, -1, 92, 145, + 138, -1, 92, 145, 110, 15, 182, 138, -1, 93, + 145, 138, -1, 93, 145, 110, 15, 182, 138, -1, + 94, 183, -1, 196, 95, 145, 182, -1, 196, 96, + 183, 110, 145, 182, -1, 97, 145, 182, 195, -1 }; -static const short yypact[] = {-32768, - 118, 605,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, -46, 131, 10,-32768,-32768, -18,-32768,-32768, 29, - -69, 58, 51, -19,-32768, 106, 114, 144,-32768,-32768, --32768,-32768,-32768,-32768, 1060, -20,-32768,-32768, 130,-32768, --32768,-32768,-32768, 80, 81, 83, 94,-32768, 57, 114, - 1060, 44, 44, 44, 44,-32768,-32768,-32768, 131,-32768, --32768,-32768,-32768,-32768, 90,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 200, - 201, 202, 572,-32768, 130, 99,-32768,-32768, -34,-32768, --32768,-32768,-32768,-32768, 1231,-32768, 191, 77, 212, 193, - 194,-32768,-32768,-32768,-32768,-32768, 1101, 1101, 1101, 1142, --32768,-32768, 104, 107,-32768,-32768, -34, -74, 109, 852, --32768,-32768, 1101,-32768, 165, 1183, 30, 93, 131,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 1101, 1101, 1101, 1101, 1101, - 1101, 1101,-32768,-32768, 1101, 1101, 1101, 1101, 1101, 1101, - 1101, 1101, 1101, 1101,-32768, 131,-32768, 62,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768, -72,-32768,-32768,-32768, - 142, 170, 221, 173, 222, 175, 223, 178, 224, 231, - 232, 183, 225, 233, 425,-32768, 1101, 1101, 1101,-32768, - 893,-32768, 120, 128, 638,-32768,-32768, 90,-32768, 638, - 638,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, 638, 1060, 121, 132,-32768, 638, 129, 134, 214, - 141, 143, 146, 147, 148, 149, 150, 638, 638, 638, - 151, 1060, 1101, 1101, 228,-32768, 152, 152, 152,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 153, - 154, 155, 156, 159, 160, 934, 1142, 592, 230, 161, - 164, 177, 180,-32768,-32768, 152, -37, -99, -34,-32768, - 130,-32768, 184, 174, 978,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768, 227, 1142,-32768,-32768,-32768,-32768, - 186,-32768, 187, 638, 2,-32768, 3,-32768, 188, 638, - 179, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 189, - 190, 195, 1101, 638, 638, 196,-32768, -23,-32768,-32768, --32768, 1142, 1142, 1142, 1142, 1142, 1142,-32768,-32768, -30, - 21,-32768, -73,-32768, 1142, 1142, 1142, 1142,-32768,-32768, --32768,-32768,-32768, 1019, 229,-32768,-32768, 240, 24, 280, - 286, 197, 638, 307, 638, 1101,-32768, 203, 638,-32768, - 205,-32768,-32768, 210, 211,-32768,-32768, 638, 638, 638, --32768, 215,-32768, 1101, 288, 318,-32768, 152, 188, 290, - 218, 219, 220, 226, 1142,-32768,-32768,-32768, 234, 237, - 241, 242,-32768,-32768,-32768, 284, 243,-32768, 638, 638, - 1101, 246,-32768, 246,-32768, 247, 638, 248, 1101, 1101, - 1101,-32768,-32768,-32768, 1101, 638,-32768,-32768,-32768, 252, - 1101, 1142, 1142, 1142, 1142,-32768, 1142, 1142, 1142, 1142, - 338,-32768, 319, 249, 236, 247, 253, 303,-32768,-32768, - 1101, 245, 638,-32768,-32768,-32768, 254,-32768,-32768, 256, - 260, 259, 263, 265, 264, 267, 270, 274,-32768,-32768, - 357, 14, 355,-32768,-32768, 276,-32768,-32768, 1142,-32768, - 1142, 1142,-32768,-32768,-32768,-32768, 638,-32768, 742, 52, - 372,-32768, 281, 282, 287,-32768, 289,-32768, 742, 638, --32768,-32768,-32768, 376, 291, 326, 638, 382, 383,-32768, - 638, 638,-32768,-32768, 405, 406,-32768 +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 1097, 1097, 1098, 1106, 1107, 1117, 1117, 1117, 1117, + 1117, 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1119, + 1121, 1121, 1125, 1125, 1125, 1125, 1126, 1126, 1126, 1126, + 1127, 1127, 1128, 1128, 1131, 1135, 1140, 1141, 1142, 1143, + 1144, 1145, 1146, 1147, 1149, 1150, 1151, 1152, 1153, 1154, + 1155, 1156, 1165, 1166, 1172, 1173, 1181, 1189, 1190, 1195, + 1196, 1197, 1202, 1216, 1216, 1217, 1217, 1219, 1229, 1229, + 1229, 1229, 1229, 1229, 1229, 1230, 1230, 1230, 1230, 1230, + 1230, 1231, 1235, 1239, 1247, 1255, 1268, 1273, 1285, 1295, + 1299, 1310, 1315, 1321, 1322, 1326, 1330, 1341, 1367, 1381, + 1411, 1437, 1458, 1471, 1481, 1486, 1547, 1554, 1563, 1569, + 1575, 1579, 1583, 1591, 1602, 1634, 1642, 1664, 1675, 1681, + 1689, 1695, 1701, 1710, 1714, 1722, 1722, 1732, 1740, 1745, + 1749, 1753, 1757, 1772, 1794, 1797, 1800, 1800, 1808, 1808, + 1816, 1816, 1824, 1824, 1833, 1836, 1839, 1843, 1856, 1857, + 1859, 1863, 1872, 1877, 1883, 1885, 1890, 1895, 1904, 1904, + 1905, 1905, 1907, 1914, 1920, 1927, 1931, 1937, 1942, 1947, + 2042, 2042, 2044, 2052, 2052, 2054, 2059, 2060, 2061, 2063, + 2063, 2073, 2077, 2082, 2086, 2090, 2094, 2098, 2102, 2106, + 2110, 2114, 2139, 2143, 2157, 2161, 2167, 2167, 2173, 2178, + 2182, 2191, 2202, 2207, 2219, 2232, 2236, 2240, 2245, 2254, + 2273, 2282, 2338, 2342, 2349, 2360, 2373, 2382, 2391, 2401, + 2405, 2412, 2412, 2414, 2418, 2423, 2439, 2454, 2468, 2481, + 2489, 2497, 2505, 2511, 2531, 2554, 2560, 2566, 2572, 2587, + 2646, 2653, 2656, 2661, 2665, 2672, 2677, 2683, 2688, 2694, + 2702, 2714, 2729 }; +#endif -static const short yypgoto[] = {-32768, --32768, 312, 313, 314, 315, -127, -126, -458,-32768, 373, - 388, -116,-32768, -221, 59,-32768, -241,-32768, -48,-32768, - -35,-32768, -62, 293,-32768, -100, 239, -226, 91,-32768, --32768,-32768,-32768,-32768,-32768,-32768, 365,-32768,-32768,-32768, --32768, 4,-32768, 63,-32768,-32768, 359,-32768,-32768,-32768, --32768,-32768, 417,-32768,-32768, -414, -55, 64, -103,-32768, - 403,-32768,-32768,-32768,-32768,-32768, 55, -3,-32768,-32768, - 34,-32768,-32768 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", + "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", + "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", + "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", + "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", + "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", + "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", + "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", + "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", + "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", + "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", + "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATA", "RET", + "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", + "DIV", "REM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", + "SETEQ", "SETNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", + "GETELEMENTPTR", "PHI_TOK", "CAST", "SELECT", "SHL", "SHR", "VAARG", + "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", + "VANEXT_old", "'='", "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", + "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", "INTVAL", + "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", "ShiftOps", + "SIntType", "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage", + "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection", + "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV", + "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", + "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList", + "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle", + "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName", + "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", + "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto", + "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", + "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", + "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", + "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile", + "MemoryInst", 0 }; +#endif - -#define YYLAST 1339 - - -static const short yytable[] = { 87, - 220, 221, 104, 308, 37, 24, 330, 331, 92, 196, - 385, 40, 223, 489, 27, 87, 363, 365, 351, 206, - 117, 121, 209, 212, 213, 214, 215, 216, 217, 218, - 219, 499, 37, 386, 349, 199, 395, 245, 210, 49, - 341, 343, 24, 246, 226, 200, 398, 230, 231, 242, - 211, 232, 233, 234, 235, 236, 237, 117, 364, 364, - 241, 212, 213, 214, 215, 216, 217, 218, 219, 359, - 51, 178, 179, 180, 497, 105, 106, -64, 350, 395, - 44, 45, 46, 121, 505, 396, 121, 205, 119, 56, - 205, 5, 6, 7, 8, 52, 10, 53, 93, 47, - 54, 41, 212, 213, 214, 215, 216, 217, 218, 219, - 224, 225, 205, 227, 228, 205, 205, -126, 50, 205, - 205, 205, 205, 205, 205, 238, 239, 240, 205, 488, - 395, 171, 172, 395, 277, 278, 279, 60, 397, 275, - 326, 408, 3, 108, 109, 110, 429, 62, 4, 299, - 57, 18, 58, 19, 299, 299, 243, 244, 5, 6, - 7, 8, 9, 10, 11, 281, 299, 498, 250, 251, - 101, 299, -24, -24, 304, -23, -23, -22, -22, 12, - -21, -21, 299, 299, 299, 252, 253, 87, 97, 98, - 449, 99, 450, 324, 28, 29, 30, 31, 32, 33, - 34, -65, 100, 112, 113, 114, 87, 325, 205, 371, - 120, 373, 374, 375, 170, 174, 175, 176, 197, 381, - 201, 198, 279, 207, -28, -27, -26, -25, 255, 285, - 305, 389, 390, 391, 392, 393, 394, -31, -32, 256, - 286, 307, 310, 311, 399, 400, 401, 402, 299, 312, - 313, 327, 314, 344, 299, 315, 316, 317, 318, 319, - 323, 328, 385, 407, 332, 333, 334, 335, 299, 299, - 336, 337, 345, 301, 302, 346, 370, 205, 372, 205, - 205, 205, 376, 377, 352, 303, 355, 205, 347, 357, - 309, 348, 369, 354, 436, 360, 361, 366, 378, 379, - 409, 320, 321, 322, 380, 384, 410, 299, 411, 299, - 413, 427, 417, 299, 419, 454, 455, 456, 281, 420, - 421, 428, 299, 299, 299, 431, 425, 432, 433, 434, - 205, 461, 462, 463, 464, 435, 465, 466, 467, 468, - 441, 469, 470, 437, 220, 221, 438, 474, 426, 472, - 439, 440, 443, 299, 299, 448, 451, 453, 471, 364, - 475, 299, 220, 221, 459, 473, 477, 362, 478, 479, - 299, 480, 481, 368, 482, 205, 483, 487, 493, 484, - 494, 495, 485, 205, 205, 205, 486, 382, 383, 205, - 491, 492, 500, 501, 502, 460, 507, 299, 504, 503, - 508, 509, 511, 512, 516, 517, 161, 162, 163, 164, - 55, 95, 203, 405, 103, 205, 404, 111, 25, 43, - 416, 457, 430, 0, 0, 0, 412, 0, 414, 63, - 64, 299, 418, 274, 0, 0, 0, 0, 0, 0, - 0, 422, 423, 424, 299, 0, 18, 0, 19, 0, - 257, 299, 0, 0, 0, 299, 299, 0, 0, 0, - 0, 0, 258, 259, 0, 0, 0, 0, 0, 0, - 0, 0, 444, 445, 0, 0, 0, 0, 0, 0, - 452, 0, 0, 0, 0, 0, 0, 0, 0, 458, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 476, 0, 0, 0, - 0, 260, 0, 261, 262, 153, 154, 0, 263, 264, - 265, 0, 0, 0, 0, 0, 0, 0, 266, 0, - 0, 267, 0, 268, 0, 0, 269, 0, 0, 0, - 496, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 506, 0, 0, 0, 0, 0, 0, - 510, 0, 0, 0, 513, 514, 63, 64, 0, 115, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 18, 0, 19, 63, 64, 0, 115, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 77, 78, 18, 0, 19, 0, 0, 0, 79, - 0, 0, 0, 0, -34, 0, 18, 0, 19, 0, - 0, 0, 0, 0, 0, 4, -34, -34, 0, 79, - 287, 288, 63, 64, 289, -34, -34, -34, -34, -34, - -34, -34, 0, 0, -34, 20, 0, 0, 0, 18, - 0, 19, 21, 290, 291, 292, 22, 0, 0, 0, - 0, 0, 0, 0, 0, 293, 294, 0, 0, 0, - 0, 0, 80, 0, 0, 81, 0, 0, 82, 0, - 83, 116, 0, 0, 0, 0, 0, 0, 295, 0, - 0, 0, 80, 0, 0, 81, 0, 0, 82, 0, - 83, 342, 0, 0, 0, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 0, - 0, 0, 0, 0, 260, 0, 261, 262, 153, 154, - 0, 263, 264, 265, 287, 288, 0, 0, 289, 0, - 0, 0, 0, 0, 296, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 290, 291, 292, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 293, - 294, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 295, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 0, 0, 0, 0, 0, 260, 0, - 261, 262, 153, 154, 0, 263, 264, 265, 0, 0, - 0, 0, 0, 0, 0, 0, 63, 64, 296, 115, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 18, 0, 19, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 202, 0, - 0, 0, 0, 0, 0, 0, 0, 63, 64, 79, - 115, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 18, 0, 19, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 280, - 0, 0, 0, 0, 0, 0, 0, 0, 63, 64, - 79, 115, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 77, 78, 18, 0, 19, 0, 0, - 0, 0, 80, 0, 0, 81, 0, 0, 82, 0, - 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 79, 63, 64, 0, 115, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 18, - 0, 19, 0, 80, 0, 0, 81, 0, 0, 82, - 0, 83, 0, 0, 356, 0, 0, 0, 0, 0, - 0, 0, 0, 63, 64, 79, 115, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 18, 0, 19, 0, 80, 0, 0, 81, 0, 338, - 82, 0, 83, 0, 0, 403, 0, 0, 0, 0, - 0, 0, 0, 0, 63, 64, 79, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 18, 0, 19, 0, 0, 0, 0, 80, 0, - 0, 81, 0, 0, 82, 0, 83, 0, 0, 0, - 0, 0, 0, 0, 0, 63, 64, 79, 115, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 18, 0, 19, 0, 0, 0, 0, 80, - 0, 0, 81, 0, 0, 82, 0, 83, 0, 0, - 0, 0, 0, 0, 0, 0, 63, 64, 79, 115, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 77, 78, 18, 0, 19, 0, 0, 0, 0, - 80, 0, 0, 81, 0, 0, 82, 0, 83, 0, - 0, 0, 0, 0, 0, 0, 0, 63, 64, 79, - 208, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 18, 0, 19, 0, 0, 0, - 0, 80, 0, 0, 81, 0, 0, 82, 0, 83, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 80, 0, 0, 81, 0, 0, 82, 0, - 83, 0, 0, 0, 0, 122, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, - 125, 0, 0, 80, 0, 0, 81, 0, 0, 82, - 0, 83, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 0, 0, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160 +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 61, + 44, 92, 40, 41, 91, 120, 93, 60, 62, 123, + 125, 42, 99 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 123, 124, 124, 125, 125, 126, 126, 126, 126, + 126, 127, 127, 127, 128, 128, 128, 128, 128, 128, + 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, + 132, 132, 133, 133, 134, 134, 135, 135, 135, 135, + 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, + 136, 136, 137, 137, 138, 138, 139, 140, 140, 141, + 141, 142, 142, 143, 143, 144, 144, 145, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 148, 148, 149, 149, 149, 149, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, + 151, 151, 151, 152, 152, 153, 153, 154, 155, 155, + 155, 155, 155, 156, 156, 156, 157, 156, 158, 156, + 159, 156, 160, 156, 156, 156, 156, 161, 162, 162, + 163, 163, 163, 163, 164, 165, 165, 165, 166, 166, + 167, 167, 168, 169, 169, 170, 170, 170, 170, 171, + 172, 172, 173, 174, 174, 175, 176, 176, 176, 178, + 177, 179, 179, 180, 180, 180, 180, 180, 180, 180, + 180, 180, 180, 180, 181, 181, 182, 182, 183, 184, + 184, 185, 186, 186, 186, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 188, 188, 189, 190, 190, 191, + 191, 192, 192, 193, 193, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 195, 195, 196, 196, 197, 197, 197, 197, 197, + 197, 197, 197 }; -static const short yycheck[] = { 35, - 128, 128, 51, 225, 23, 2, 248, 249, 29, 110, - 34, 30, 129, 472, 61, 51, 15, 15, 118, 123, - 83, 121, 126, 10, 11, 12, 13, 14, 15, 16, - 17, 490, 23, 57, 276, 110, 110, 110, 9, 109, - 267, 268, 39, 116, 148, 120, 120, 151, 152, 166, - 21, 155, 156, 157, 158, 159, 160, 120, 57, 57, - 164, 10, 11, 12, 13, 14, 15, 16, 17, 296, - 20, 107, 108, 109, 489, 32, 33, 112, 116, 110, - 52, 53, 54, 121, 499, 116, 121, 123, 85, 109, - 126, 41, 42, 43, 44, 45, 46, 47, 119, 71, - 50, 120, 10, 11, 12, 13, 14, 15, 16, 17, - 146, 147, 148, 149, 150, 151, 152, 0, 61, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 116, - 110, 55, 56, 110, 197, 198, 199, 24, 118, 195, - 244, 118, 25, 53, 54, 55, 388, 4, 31, 205, - 45, 22, 47, 24, 210, 211, 95, 96, 41, 42, - 43, 44, 45, 46, 47, 201, 222, 116, 27, 28, - 114, 227, 3, 4, 223, 3, 4, 3, 4, 62, - 3, 4, 238, 239, 240, 3, 4, 223, 109, 109, - 412, 109, 414, 242, 64, 65, 66, 67, 68, 69, - 70, 112, 109, 4, 4, 4, 242, 243, 244, 313, - 112, 315, 316, 317, 24, 4, 24, 24, 115, 323, - 112, 115, 285, 59, 4, 4, 4, 4, 4, 110, - 110, 332, 333, 334, 335, 336, 337, 7, 7, 7, - 113, 110, 114, 110, 345, 346, 347, 348, 304, 36, - 110, 24, 110, 24, 310, 110, 110, 110, 110, 110, - 110, 110, 34, 24, 112, 112, 112, 112, 324, 325, - 112, 112, 112, 210, 211, 112, 312, 313, 314, 315, - 316, 317, 318, 319, 281, 222, 113, 323, 112, 63, - 227, 112, 114, 110, 395, 110, 110, 110, 110, 110, - 21, 238, 239, 240, 110, 110, 21, 363, 112, 365, - 4, 24, 110, 369, 110, 419, 420, 421, 354, 110, - 110, 4, 378, 379, 380, 36, 112, 110, 110, 110, - 366, 432, 433, 434, 435, 110, 437, 438, 439, 440, - 57, 4, 24, 110, 472, 472, 110, 451, 384, 114, - 110, 110, 110, 409, 410, 110, 110, 110, 110, 57, - 116, 417, 490, 490, 113, 113, 113, 304, 113, 110, - 426, 113, 110, 310, 110, 411, 113, 21, 479, 113, - 481, 482, 113, 419, 420, 421, 113, 324, 325, 425, - 36, 116, 21, 113, 113, 431, 21, 453, 110, 113, - 110, 76, 21, 21, 0, 0, 95, 95, 95, 95, - 23, 39, 120, 355, 50, 451, 354, 59, 2, 17, - 366, 425, 389, -1, -1, -1, 363, -1, 365, 5, - 6, 487, 369, 195, -1, -1, -1, -1, -1, -1, - -1, 378, 379, 380, 500, -1, 22, -1, 24, -1, - 26, 507, -1, -1, -1, 511, 512, -1, -1, -1, - -1, -1, 38, 39, -1, -1, -1, -1, -1, -1, - -1, -1, 409, 410, -1, -1, -1, -1, -1, -1, - 417, -1, -1, -1, -1, -1, -1, -1, -1, 426, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 453, -1, -1, -1, - -1, 97, -1, 99, 100, 101, 102, -1, 104, 105, - 106, -1, -1, -1, -1, -1, -1, -1, 114, -1, - -1, 117, -1, 119, -1, -1, 122, -1, -1, -1, - 487, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 500, -1, -1, -1, -1, -1, -1, - 507, -1, -1, -1, 511, 512, 5, 6, -1, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, 5, 6, -1, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, -1, -1, -1, 48, - -1, -1, -1, -1, 20, -1, 22, -1, 24, -1, - -1, -1, -1, -1, -1, 31, 32, 33, -1, 48, - 3, 4, 5, 6, 7, 41, 42, 43, 44, 45, - 46, 47, -1, -1, 50, 51, -1, -1, -1, 22, - -1, 24, 58, 26, 27, 28, 62, -1, -1, -1, - -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, - -1, -1, 111, -1, -1, 114, -1, -1, 117, -1, - 119, 120, -1, -1, -1, -1, -1, -1, 61, -1, - -1, -1, 111, -1, -1, 114, -1, -1, 117, -1, - 119, 120, -1, -1, -1, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, -1, - -1, -1, -1, -1, 97, -1, 99, 100, 101, 102, - -1, 104, 105, 106, 3, 4, -1, -1, 7, -1, - -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 26, 27, 28, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, - 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, -1, -1, -1, -1, -1, 97, -1, - 99, 100, 101, 102, -1, 104, 105, 106, -1, -1, - -1, -1, -1, -1, -1, -1, 5, 6, 117, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, - -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, - 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, - -1, -1, 111, -1, -1, 114, -1, -1, 117, -1, - 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 48, 5, 6, -1, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - -1, 24, -1, 111, -1, -1, 114, -1, -1, 117, - -1, 119, -1, -1, 37, -1, -1, -1, -1, -1, - -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, -1, 24, -1, 111, -1, -1, 114, -1, 116, - 117, -1, 119, -1, -1, 37, -1, -1, -1, -1, - -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, -1, 24, -1, -1, -1, -1, 111, -1, - -1, 114, -1, -1, 117, -1, 119, -1, -1, -1, - -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, -1, 24, -1, -1, -1, -1, 111, - -1, -1, 114, -1, -1, 117, -1, 119, -1, -1, - -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, - 111, -1, -1, 114, -1, -1, 117, -1, 119, -1, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, - -1, 111, -1, -1, 114, -1, -1, 117, -1, 119, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 111, -1, -1, 114, -1, -1, 117, -1, - 119, -1, -1, -1, -1, 35, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, - 60, -1, -1, 111, -1, -1, 114, -1, -1, 117, - -1, 119, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, -1, -1, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108 +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, + 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, + 1, 2, 0, 2, 0, 3, 2, 0, 1, 0, + 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 4, 5, 5, 3, 2, + 2, 1, 3, 1, 3, 1, 0, 4, 3, 3, + 4, 4, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 6, 5, 8, 6, 6, 6, 6, + 6, 8, 8, 3, 1, 1, 1, 1, 2, 2, + 4, 2, 1, 4, 2, 4, 0, 7, 0, 7, + 0, 7, 0, 7, 3, 4, 0, 1, 1, 1, + 3, 3, 3, 3, 3, 3, 1, 0, 1, 1, + 1, 0, 2, 3, 1, 1, 3, 1, 0, 8, + 1, 1, 3, 1, 1, 2, 0, 1, 1, 0, + 4, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 5, 1, 1, 1, 1, 2, 2, + 2, 3, 2, 0, 1, 2, 2, 3, 9, 9, + 8, 13, 1, 1, 6, 5, 2, 6, 7, 1, + 3, 1, 0, 2, 1, 5, 5, 5, 2, 4, + 4, 6, 4, 4, 4, 4, 6, 6, 2, 7, + 1, 2, 0, 1, 0, 3, 6, 3, 6, 2, + 4, 6, 4 }; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison.simple" -/* This file comes from bison-1.28. */ -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = +{ + 146, 0, 43, 132, 1, 131, 179, 36, 37, 38, + 39, 40, 41, 42, 0, 44, 203, 128, 129, 203, + 158, 159, 0, 0, 0, 43, 0, 134, 176, 0, + 0, 45, 46, 47, 48, 49, 50, 0, 0, 204, + 200, 35, 173, 174, 175, 199, 0, 0, 0, 0, + 144, 0, 0, 0, 0, 0, 0, 0, 34, 177, + 178, 44, 147, 130, 51, 2, 3, 64, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 0, 0, 0, 0, 194, 0, 0, 63, + 82, 67, 195, 83, 170, 171, 172, 244, 202, 0, + 0, 0, 0, 157, 145, 135, 133, 125, 126, 0, + 0, 0, 0, 180, 84, 0, 0, 66, 89, 91, + 0, 0, 96, 90, 243, 0, 224, 0, 0, 0, + 0, 44, 212, 213, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, + 0, 0, 0, 0, 0, 20, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 201, 44, 216, + 0, 240, 152, 149, 148, 150, 151, 153, 156, 0, + 140, 142, 138, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 0, 0, 0, 0, 136, 0, + 0, 0, 88, 168, 95, 93, 0, 0, 228, 223, + 206, 205, 0, 0, 25, 29, 24, 28, 23, 27, + 22, 26, 30, 31, 0, 0, 54, 54, 249, 0, + 0, 238, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 154, 59, + 59, 59, 110, 111, 4, 5, 108, 109, 112, 107, + 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 106, 105, 59, 65, + 65, 92, 167, 161, 164, 165, 0, 0, 85, 183, + 184, 185, 190, 186, 187, 188, 189, 181, 0, 192, + 197, 196, 198, 0, 207, 0, 0, 0, 245, 0, + 247, 242, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, + 0, 141, 143, 139, 0, 0, 0, 0, 0, 0, + 98, 124, 0, 0, 102, 0, 99, 0, 0, 0, + 0, 137, 86, 87, 160, 162, 0, 57, 94, 182, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, + 0, 0, 230, 0, 232, 235, 0, 0, 233, 234, + 0, 0, 0, 229, 0, 250, 0, 0, 0, 61, + 59, 242, 0, 0, 0, 0, 0, 0, 97, 100, + 101, 0, 0, 0, 0, 166, 163, 58, 52, 0, + 191, 0, 0, 222, 54, 55, 54, 219, 241, 0, + 0, 0, 0, 0, 225, 226, 227, 222, 0, 56, + 62, 60, 0, 0, 0, 0, 0, 0, 123, 0, + 0, 0, 0, 0, 169, 0, 0, 0, 221, 0, + 0, 246, 248, 0, 0, 0, 231, 236, 237, 0, + 251, 114, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 53, 193, 0, 0, 0, 220, 217, 0, 239, + 113, 0, 120, 0, 0, 116, 117, 118, 119, 0, + 210, 0, 0, 0, 218, 0, 0, 0, 208, 0, + 209, 0, 0, 115, 121, 122, 0, 0, 0, 0, + 0, 0, 215, 0, 0, 214, 211 +}; - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +/* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = +{ + -1, 86, 256, 272, 273, 274, 275, 194, 195, 224, + 196, 25, 15, 37, 444, 308, 389, 408, 331, 390, + 87, 88, 197, 90, 91, 120, 206, 341, 299, 342, + 109, 1, 2, 3, 278, 251, 249, 250, 63, 175, + 50, 104, 179, 92, 355, 284, 285, 286, 38, 96, + 16, 44, 17, 61, 18, 28, 360, 300, 93, 302, + 417, 19, 40, 41, 167, 492, 98, 231, 448, 449, + 168, 169, 369, 170, 171 +}; - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -410 +static const short int yypact[] = +{ + -410, 17, 118, 605, -410, -410, -410, -410, -410, -410, + -410, -410, -410, -410, 24, 160, 67, -410, -410, -15, + -410, -410, 27, -5, 46, -6, 10, -410, 86, 147, + 138, -410, -410, -410, -410, -410, -410, 1060, -20, -410, + -410, 110, -410, -410, -410, -410, 69, 70, 72, 73, + -410, 63, 147, 1060, 68, 68, 68, 68, -410, -410, + -410, 160, -410, -410, -410, -410, -410, 64, -410, -410, + -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, + -410, -410, 182, 183, 186, 572, -410, 110, 77, -410, + -410, -28, -410, -410, -410, -410, -410, 1231, -410, 168, + 83, 199, 180, 181, -410, -410, -410, -410, -410, 1101, + 1101, 1101, 1142, -410, -410, 91, 96, -410, -410, -28, + -98, 103, 852, -410, -410, 1101, -410, 157, 1183, 50, + 185, 160, -410, -410, -410, -410, -410, -410, -410, -410, + -410, -410, -410, -410, -410, -410, -410, -410, 1101, 1101, + 1101, 1101, 1101, 1101, 1101, -410, -410, 1101, 1101, 1101, + 1101, 1101, 1101, 1101, 1101, 1101, 1101, -410, 160, -410, + 49, -410, -410, -410, -410, -410, -410, -410, -410, -14, + -410, -410, -410, 120, 148, 213, 150, 214, 154, 215, + 166, 217, 224, 231, 170, 218, 232, 425, -410, 1101, + 1101, 1101, -410, 893, -410, 130, 128, 638, -410, -410, + 64, -410, 638, 638, -410, -410, -410, -410, -410, -410, + -410, -410, -410, -410, 638, 1060, 132, 133, -410, 638, + 136, 134, 216, 141, 143, 144, 146, 149, 151, 152, + 638, 638, 638, 153, 1060, 1101, 1101, 233, -410, 155, + 155, 155, -410, -410, -410, -410, -410, -410, -410, -410, + -410, -410, 156, 159, 161, 164, 175, 177, 934, 1142, + 592, 234, 178, 184, 187, 188, -410, -410, 155, -70, + -35, -28, -410, 110, -410, 162, 179, 978, -410, -410, + -410, -410, -410, -410, -410, -410, -410, 197, 1142, -410, + -410, -410, -410, 191, -410, 195, 638, 3, -410, 18, + -410, 196, 638, 193, 1101, 1101, 1101, 1101, 1101, 1101, + 1101, 1101, 201, 202, 203, 1101, 638, 638, 205, -410, + 13, -410, -410, -410, 1142, 1142, 1142, 1142, 1142, 1142, + -410, -410, -13, -99, -410, -78, -410, 1142, 1142, 1142, + 1142, -410, -410, -410, -410, -410, 1019, 230, -410, -410, + 242, -23, 246, 272, 208, 638, 290, 638, 1101, -410, + 211, 638, -410, 212, -410, -410, 219, 220, -410, -410, + 638, 638, 638, -410, 229, -410, 1101, 273, 294, -410, + 155, 196, 291, 226, 237, 240, 241, 1142, -410, -410, + -410, 243, 247, 248, 249, -410, -410, -410, 252, 250, + -410, 638, 638, 1101, 251, -410, 251, -410, 255, 638, + 256, 1101, 1101, 1101, -410, -410, -410, 1101, 638, -410, + -410, -410, 239, 1101, 1142, 1142, 1142, 1142, -410, 1142, + 1142, 1142, 1142, 322, -410, 304, 257, 228, 255, 259, + 286, -410, -410, 1101, 253, 638, -410, -410, -410, 260, + -410, -410, 262, 267, 265, 270, 277, 278, 279, 280, + 281, -410, -410, 323, 14, 320, -410, -410, 254, -410, + -410, 1142, -410, 1142, 1142, -410, -410, -410, -410, 638, + -410, 742, 52, 362, -410, 282, 284, 287, -410, 289, + -410, 742, 638, -410, -410, -410, 380, 292, 327, 638, + 383, 384, -410, 638, 638, -410, -410 +}; - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ +/* YYPGOTO[NTERM-NUM]. */ +static const short int yypgoto[] = +{ + -410, -410, -410, 309, 310, 311, 312, -129, -128, -398, + -410, 369, 386, -118, -410, -223, 55, -410, -244, -410, + -50, -410, -37, -410, -64, 293, -410, -102, 221, -192, + 53, -410, -410, -410, -410, -410, -410, -410, 361, -410, + -410, -410, -410, 2, -410, 58, -410, -410, 356, -410, + -410, -410, -410, -410, 416, -410, -410, -409, -57, 62, + -105, -410, 401, -410, -410, -410, -410, -410, 54, -4, + -410, -410, 30, -410, -410 +}; -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -128 +static const short int yytable[] = +{ + 89, 222, 223, 106, 310, 26, 332, 333, 39, 94, + 198, 397, 201, 225, 53, 42, 89, 4, 365, 399, + 208, 119, 202, 211, 214, 215, 216, 217, 218, 219, + 220, 221, 397, 367, 351, 7, 8, 9, 10, 54, + 12, 55, 400, 26, 56, 228, 352, 387, 232, 233, + 244, 123, 234, 235, 236, 237, 238, 239, 119, 212, + 366, 243, 214, 215, 216, 217, 218, 219, 220, 221, + 388, 213, 180, 181, 182, 366, 491, 343, 345, 46, + 47, 48, 499, 353, -65, 29, 123, 397, 207, 121, + 39, 207, 507, 123, 501, 410, 247, 397, 49, 95, + 107, 108, 248, 398, 51, 43, 361, 52, 110, 111, + 112, 226, 227, 207, 229, 230, 207, 207, -127, 58, + 207, 207, 207, 207, 207, 207, 240, 241, 242, 207, + 490, 59, 20, 60, 21, 279, 280, 281, 173, 174, + 277, 328, 64, 5, 245, 246, 431, 252, 253, 6, + 301, -25, -25, -24, -24, 301, 301, -23, -23, 7, + 8, 9, 10, 11, 12, 13, 283, 301, 500, -22, + -22, 62, 301, 254, 255, 306, -66, 103, 99, 100, + 14, 101, 102, 301, 301, 301, 114, 115, 89, 122, + 116, 451, 172, 452, 326, 214, 215, 216, 217, 218, + 219, 220, 221, 176, 177, 178, 199, 89, 327, 207, + 373, 200, 375, 376, 377, 203, 209, -29, -28, -27, + 383, -26, 257, 281, 30, 31, 32, 33, 34, 35, + 36, -32, 391, 392, 393, 394, 395, 396, -33, 258, + 287, 288, 307, 309, 313, 401, 402, 403, 404, 301, + 312, 315, 314, 316, 317, 301, 318, 329, 346, 319, + 359, 320, 321, 325, 387, 330, 409, 411, 334, 301, + 301, 335, 356, 336, 303, 304, 337, 372, 207, 374, + 207, 207, 207, 378, 379, 354, 305, 338, 207, 339, + 347, 311, 357, 412, 415, 438, 348, 429, 430, 349, + 350, 362, 322, 323, 324, 363, 368, 371, 301, 443, + 301, 380, 381, 382, 301, 386, 456, 457, 458, 283, + 413, 419, 421, 301, 301, 301, 471, 433, 472, 422, + 423, 207, 463, 464, 465, 466, 434, 467, 468, 469, + 470, 427, 474, 366, 489, 222, 223, 435, 476, 428, + 436, 437, 461, 439, 301, 301, 493, 440, 441, 442, + 445, 450, 301, 222, 223, 453, 455, 473, 364, 477, + 494, 301, 475, 479, 370, 480, 207, 481, 482, 495, + 483, 496, 497, 502, 207, 207, 207, 484, 384, 385, + 207, 485, 486, 487, 488, 503, 462, 504, 301, 506, + 505, 509, 510, 511, 513, 514, 163, 164, 165, 166, + 97, 57, 407, 105, 406, 205, 207, 113, 276, 27, + 45, 432, 418, 459, 0, 0, 0, 414, 0, 416, + 65, 66, 301, 420, 0, 0, 0, 0, 0, 0, + 0, 0, 424, 425, 426, 301, 0, 20, 0, 21, + 0, 259, 301, 0, 0, 0, 301, 301, 0, 0, + 0, 0, 0, 260, 261, 0, 0, 0, 0, 0, + 0, 0, 0, 446, 447, 0, 0, 0, 0, 0, + 0, 454, 0, 0, 0, 0, 0, 0, 0, 0, + 460, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 147, 478, 0, 0, + 0, 0, 262, 0, 263, 264, 155, 156, 0, 265, + 266, 267, 0, 0, 0, 0, 0, 0, 0, 268, + 0, 0, 269, 0, 270, 0, 0, 271, 0, 0, + 0, 498, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 508, 0, 0, 0, 0, 0, + 0, 512, 0, 0, 0, 515, 516, 65, 66, 0, + 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 20, 0, 21, 65, 66, 0, + 117, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 79, 80, 20, 0, 21, 0, 0, 0, + 81, 0, 0, 0, 0, -35, 0, 20, 0, 21, + 0, 0, 0, 0, 0, 0, 6, -35, -35, 0, + 81, 289, 290, 65, 66, 291, -35, -35, -35, -35, + -35, -35, -35, 0, 0, -35, 22, 0, 0, 0, + 20, 0, 21, 23, 292, 293, 294, 24, 0, 0, + 0, 0, 0, 0, 0, 0, 295, 296, 0, 0, + 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, + 0, 85, 118, 0, 0, 0, 0, 0, 0, 297, + 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, + 0, 85, 344, 0, 0, 0, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 0, 0, 0, 0, 0, 262, 0, 263, 264, 155, + 156, 0, 265, 266, 267, 289, 290, 0, 0, 291, + 0, 0, 0, 0, 0, 298, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 292, 293, + 294, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 295, 296, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 297, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 0, 0, 0, 0, 0, 262, + 0, 263, 264, 155, 156, 0, 265, 266, 267, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 66, 298, + 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 81, 117, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 282, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 66, 81, 117, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 79, 80, 20, 0, 21, 0, + 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, + 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 81, 65, 66, 0, 117, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 20, 0, 21, 0, 82, 0, 0, 83, 0, 0, + 84, 0, 85, 0, 0, 358, 0, 0, 0, 0, + 0, 0, 0, 0, 65, 66, 81, 117, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 20, 0, 21, 0, 82, 0, 0, 83, 0, + 340, 84, 0, 85, 0, 0, 405, 0, 0, 0, + 0, 0, 0, 0, 0, 65, 66, 81, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 20, 0, 21, 0, 0, 0, 0, 82, + 0, 0, 83, 0, 0, 84, 0, 85, 0, 0, + 0, 0, 0, 0, 0, 0, 65, 66, 81, 117, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, + 82, 0, 0, 83, 0, 0, 84, 0, 85, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 66, 81, + 117, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 79, 80, 20, 0, 21, 0, 0, 0, + 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 81, 210, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, + 0, 0, 82, 0, 0, 83, 0, 0, 84, 0, + 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, + 0, 85, 0, 0, 0, 0, 124, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 126, 127, 0, 0, 82, 0, 0, 83, 0, 0, + 84, 0, 85, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 0, 0, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162 +}; -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif +static const short int yycheck[] = +{ + 37, 130, 130, 53, 227, 3, 250, 251, 23, 29, + 112, 110, 110, 131, 20, 30, 53, 0, 15, 118, + 125, 85, 120, 128, 10, 11, 12, 13, 14, 15, + 16, 17, 110, 15, 278, 41, 42, 43, 44, 45, + 46, 47, 120, 41, 50, 150, 116, 34, 153, 154, + 168, 121, 157, 158, 159, 160, 161, 162, 122, 9, + 57, 166, 10, 11, 12, 13, 14, 15, 16, 17, + 57, 21, 109, 110, 111, 57, 474, 269, 270, 52, + 53, 54, 491, 118, 112, 61, 121, 110, 125, 87, + 23, 128, 501, 121, 492, 118, 110, 110, 71, 119, + 32, 33, 116, 116, 109, 120, 298, 61, 55, 56, + 57, 148, 149, 150, 151, 152, 153, 154, 0, 109, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 116, 45, 22, 47, 24, 199, 200, 201, 55, 56, + 197, 246, 4, 25, 95, 96, 390, 27, 28, 31, + 207, 3, 4, 3, 4, 212, 213, 3, 4, 41, + 42, 43, 44, 45, 46, 47, 203, 224, 116, 3, + 4, 24, 229, 3, 4, 225, 112, 114, 109, 109, + 62, 109, 109, 240, 241, 242, 4, 4, 225, 112, + 4, 414, 24, 416, 244, 10, 11, 12, 13, 14, + 15, 16, 17, 4, 24, 24, 115, 244, 245, 246, + 315, 115, 317, 318, 319, 112, 59, 4, 4, 4, + 325, 4, 4, 287, 64, 65, 66, 67, 68, 69, + 70, 7, 334, 335, 336, 337, 338, 339, 7, 7, + 110, 113, 110, 110, 110, 347, 348, 349, 350, 306, + 114, 110, 36, 110, 110, 312, 110, 24, 24, 110, + 63, 110, 110, 110, 34, 110, 24, 21, 112, 326, + 327, 112, 110, 112, 212, 213, 112, 314, 315, 316, + 317, 318, 319, 320, 321, 283, 224, 112, 325, 112, + 112, 229, 113, 21, 4, 397, 112, 24, 4, 112, + 112, 110, 240, 241, 242, 110, 110, 114, 365, 57, + 367, 110, 110, 110, 371, 110, 421, 422, 423, 356, + 112, 110, 110, 380, 381, 382, 4, 36, 24, 110, + 110, 368, 434, 435, 436, 437, 110, 439, 440, 441, + 442, 112, 114, 57, 21, 474, 474, 110, 453, 386, + 110, 110, 113, 110, 411, 412, 36, 110, 110, 110, + 110, 110, 419, 492, 492, 110, 110, 110, 306, 116, + 116, 428, 113, 113, 312, 113, 413, 110, 113, 481, + 110, 483, 484, 21, 421, 422, 423, 110, 326, 327, + 427, 113, 113, 113, 113, 113, 433, 113, 455, 110, + 113, 21, 110, 76, 21, 21, 97, 97, 97, 97, + 41, 25, 357, 52, 356, 122, 453, 61, 197, 3, + 19, 391, 368, 427, -1, -1, -1, 365, -1, 367, + 5, 6, 489, 371, -1, -1, -1, -1, -1, -1, + -1, -1, 380, 381, 382, 502, -1, 22, -1, 24, + -1, 26, 509, -1, -1, -1, 513, 514, -1, -1, + -1, -1, -1, 38, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 411, 412, -1, -1, -1, -1, -1, + -1, 419, -1, -1, -1, -1, -1, -1, -1, -1, + 428, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 455, -1, -1, + -1, -1, 97, -1, 99, 100, 101, 102, -1, 104, + 105, 106, -1, -1, -1, -1, -1, -1, -1, 114, + -1, -1, 117, -1, 119, -1, -1, 122, -1, -1, + -1, 489, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 502, -1, -1, -1, -1, -1, + -1, 509, -1, -1, -1, 513, 514, 5, 6, -1, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, -1, 24, 5, 6, -1, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, + 48, -1, -1, -1, -1, 20, -1, 22, -1, 24, + -1, -1, -1, -1, -1, -1, 31, 32, 33, -1, + 48, 3, 4, 5, 6, 7, 41, 42, 43, 44, + 45, 46, 47, -1, -1, 50, 51, -1, -1, -1, + 22, -1, 24, 58, 26, 27, 28, 62, -1, -1, + -1, -1, -1, -1, -1, -1, 38, 39, -1, -1, + -1, -1, -1, 111, -1, -1, 114, -1, -1, 117, + -1, 119, 120, -1, -1, -1, -1, -1, -1, 61, + -1, -1, -1, 111, -1, -1, 114, -1, -1, 117, + -1, 119, 120, -1, -1, -1, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + -1, -1, -1, -1, -1, 97, -1, 99, 100, 101, + 102, -1, 104, 105, 106, 3, 4, -1, -1, 7, + -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, -1, -1, -1, -1, -1, 97, + -1, 99, 100, 101, 102, -1, 104, 105, 106, -1, + -1, -1, -1, -1, -1, -1, -1, 5, 6, 117, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, + -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, + 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 37, -1, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, + -1, -1, -1, 111, -1, -1, 114, -1, -1, 117, + -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 48, 5, 6, -1, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, -1, 111, -1, -1, 114, -1, -1, + 117, -1, 119, -1, -1, 37, -1, -1, -1, -1, + -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, -1, 111, -1, -1, 114, -1, + 116, 117, -1, 119, -1, -1, 37, -1, -1, -1, + -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, -1, 24, -1, -1, -1, -1, 111, + -1, -1, 114, -1, -1, 117, -1, 119, -1, -1, + -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, + 111, -1, -1, 114, -1, -1, 117, -1, 119, -1, + -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, + -1, 111, -1, -1, 114, -1, -1, 117, -1, 119, + -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, + 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, + -1, -1, 111, -1, -1, 114, -1, -1, 117, -1, + 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 111, -1, -1, 114, -1, -1, 117, + -1, 119, -1, -1, -1, -1, 35, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 59, 60, -1, -1, 111, -1, -1, 114, -1, -1, + 117, -1, 119, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, -1, -1, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108 +}; -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 154, 155, 156, 0, 25, 31, 41, 42, 43, + 44, 45, 46, 47, 62, 135, 173, 175, 177, 184, + 22, 24, 51, 58, 62, 134, 166, 177, 178, 61, + 64, 65, 66, 67, 68, 69, 70, 136, 171, 23, + 185, 186, 30, 120, 174, 185, 52, 53, 54, 71, + 163, 109, 61, 20, 45, 47, 50, 135, 109, 45, + 47, 176, 24, 161, 4, 5, 6, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 48, 111, 114, 117, 119, 124, 143, 144, 145, + 146, 147, 166, 181, 29, 119, 172, 134, 189, 109, + 109, 109, 109, 114, 164, 161, 143, 32, 33, 153, + 153, 153, 153, 171, 4, 4, 4, 8, 120, 147, + 148, 166, 112, 121, 35, 49, 59, 60, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 126, 127, 128, 129, 187, 193, 194, + 196, 197, 24, 55, 56, 162, 4, 24, 24, 165, + 145, 145, 145, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 130, 131, 133, 145, 150, 115, + 115, 110, 120, 112, 37, 148, 149, 145, 183, 59, + 8, 183, 9, 21, 10, 11, 12, 13, 14, 15, + 16, 17, 130, 131, 132, 136, 145, 145, 183, 145, + 145, 190, 183, 183, 183, 183, 183, 183, 183, 183, + 145, 145, 145, 183, 136, 95, 96, 110, 116, 159, + 160, 158, 27, 28, 3, 4, 125, 4, 7, 26, + 38, 39, 97, 99, 100, 104, 105, 106, 114, 117, + 119, 122, 126, 127, 128, 129, 151, 181, 157, 147, + 147, 147, 37, 145, 168, 169, 170, 110, 113, 3, + 4, 7, 26, 27, 28, 38, 39, 61, 117, 151, + 180, 181, 182, 182, 182, 182, 143, 110, 138, 110, + 138, 182, 114, 110, 36, 110, 110, 110, 110, 110, + 110, 110, 182, 182, 182, 110, 143, 145, 183, 24, + 110, 141, 141, 141, 112, 112, 112, 112, 112, 112, + 116, 150, 152, 152, 120, 152, 24, 112, 112, 112, + 112, 141, 116, 118, 166, 167, 110, 113, 37, 63, + 179, 152, 110, 110, 182, 15, 57, 15, 110, 195, + 182, 114, 145, 183, 145, 183, 183, 183, 145, 145, + 110, 110, 110, 183, 182, 182, 110, 34, 57, 139, + 142, 150, 150, 150, 150, 150, 150, 110, 116, 118, + 120, 150, 150, 150, 150, 37, 168, 139, 140, 24, + 118, 21, 21, 112, 182, 4, 182, 183, 191, 110, + 182, 110, 110, 110, 182, 182, 182, 112, 145, 24, + 4, 141, 195, 36, 110, 110, 110, 110, 150, 110, + 110, 110, 110, 57, 137, 110, 182, 182, 191, 192, + 110, 138, 138, 110, 182, 110, 183, 183, 183, 192, + 182, 113, 145, 150, 150, 150, 150, 150, 150, 150, + 150, 4, 24, 110, 114, 113, 183, 116, 182, 113, + 113, 110, 113, 110, 110, 113, 113, 113, 113, 21, + 116, 132, 188, 36, 116, 150, 150, 150, 182, 180, + 116, 132, 21, 113, 113, 113, 110, 180, 182, 21, + 110, 76, 182, 21, 21, 182, 182 +}; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 +#define YYEMPTY (-2) #define YYEOF 0 + #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ + +#define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX yylex() + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) #endif -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif #endif -#else /* not YYLSP_NEEDED */ + + +/* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +# define YYLEX yylex (YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) +# define YYLEX yylex () #endif -#endif /* not YYLSP_NEEDED */ + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short int *bottom, short int *top) +#else +static void +yy_stack_print (bottom, top) + short int *bottom; + short int *top; #endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} -/* If nonreentrant, generate the variables here */ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) -#ifndef YYPURE -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; #endif +{ + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); +} -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ -/* YYINITDEPTH indicates the initial size of the parser's stacks */ +/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -#define YYINITDEPTH 200 +# define YYINITDEPTH 200 #endif -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif + -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif { - register char *f = from; - register char *t = to; - register int i = count; + const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# endif +# endif + +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } - while (i-- > 0) - *t++ = *f++; + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; } +# endif + +#endif /* YYERROR_VERBOSE */ + + -#else /* __cplusplus */ +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else static void -__yy_memcpy (char *to, char *from, unsigned int count) +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif { - register char *t = to; - register char *f = from; - register int i = count; + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; - while (i-- > 0) - *t++ = *f++; + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); } +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; #endif -#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} -#line 217 "/usr/share/bison.simple" -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +/* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); -#else +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM); +# else +int yyparse (); +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) int yyparse (void); +#else +int yyparse (); #endif -#endif +#endif /* ! YYPARSE_PARAM */ + + + +/* The look-ahead symbol. */ +int yychar; +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) +#else int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL +yyparse () + +#endif +#endif { - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + short int *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else #define YYPOPSTACK (yyvsp--, yyssp--) -#endif - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; + YYSIZE_T yystacksize = YYINITDEPTH; -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ int yylen; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; @@ -2126,742 +2766,749 @@ yyparse(YYPARSE_PARAM_ARG) so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss - 1; + yyssp = yyss; yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: + goto yysetstate; - *++yyssp = yystate; +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif + yysetstate: + *yyssp = yystate; + if (yyss + yystacksize - 1 <= yyssp) + { /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + short int *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) + if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif + + { + short int *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - if (yyssp >= yyss + yystacksize - 1) + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ + /* Not known => get a look-ahead token if don't already have one. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif + YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) + if (yyn <= 0) { - if (yyn == YYFLAG) + if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; yystate = yyn; goto yynewstate; -/* Do the default action for the current state. */ -yydefault: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; + -/* Do a reduction. yyn is the number of a rule to reduce with. */ +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ yyreduce: + /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; - switch (yyn) { -case 2: -#line 1098 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 3: +#line 1098 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - yyval.SIntVal = (int32_t)yyvsp[0].UIntVal; + (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); CHECK_FOR_ERROR -; - break;} -case 4: -#line 1107 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range! +;} + break; + + case 5: +#line 1107 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val; - CHECK_FOR_ERROR -; - break;} -case 33: -#line 1131 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = yyvsp[-1].StrVal; - CHECK_FOR_ERROR - ; - break;} -case 34: -#line 1135 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = 0; - CHECK_FOR_ERROR - ; - break;} -case 35: -#line 1140 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::InternalLinkage; ; - break;} -case 36: -#line 1141 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ; - break;} -case 37: -#line 1142 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::WeakLinkage; ; - break;} -case 38: -#line 1143 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::AppendingLinkage; ; - break;} -case 39: -#line 1144 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; - break;} -case 40: -#line 1145 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::DLLExportLinkage; ; - break;} -case 41: -#line 1146 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; - break;} -case 42: -#line 1147 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalLinkage; ; - break;} -case 43: -#line 1149 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::C; ; - break;} -case 44: -#line 1150 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::C; ; - break;} -case 45: -#line 1151 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::CSRet; ; - break;} -case 46: -#line 1152 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::Fast; ; - break;} -case 47: -#line 1153 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::Cold; ; - break;} -case 48: -#line 1154 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::X86_StdCall; ; - break;} -case 49: -#line 1155 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::X86_FastCall; ; - break;} -case 50: -#line 1156 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) - GEN_ERROR("Calling conv too large!"); - yyval.UIntVal = yyvsp[0].UInt64Val; - CHECK_FOR_ERROR - ; - break;} -case 51: -#line 1165 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = 0; ; - break;} -case 52: -#line 1166 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.UIntVal = yyvsp[0].UInt64Val; - if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) - GEN_ERROR("Alignment must be a power of two!"); - CHECK_FOR_ERROR -; - break;} -case 53: -#line 1172 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = 0; ; - break;} -case 54: -#line 1173 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.UIntVal = yyvsp[0].UInt64Val; - if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) - GEN_ERROR("Alignment must be a power of two!"); + (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val); CHECK_FOR_ERROR -; - break;} -case 55: -#line 1181 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) - if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') - GEN_ERROR("Invalid character in section name!"); - yyval.StrVal = yyvsp[0].StrVal; - CHECK_FOR_ERROR -; - break;} -case 56: -#line 1189 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = 0; ; - break;} -case 57: -#line 1190 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = yyvsp[0].StrVal; ; - break;} -case 58: -#line 1195 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{; - break;} -case 59: -#line 1196 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{; - break;} -case 60: -#line 1197 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurGV->setSection(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); +;} + break; + + case 34: +#line 1131 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR - ; - break;} -case 61: -#line 1202 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) + ;} + break; + + case 35: +#line 1135 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = 0; + CHECK_FOR_ERROR + ;} + break; + + case 36: +#line 1140 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} + break; + + case 37: +#line 1141 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} + break; + + case 38: +#line 1142 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} + break; + + case 39: +#line 1143 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} + break; + + case 40: +#line 1144 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} + break; + + case 41: +#line 1145 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} + break; + + case 42: +#line 1146 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} + break; + + case 43: +#line 1147 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} + break; + + case 44: +#line 1149 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::C; ;} + break; + + case 45: +#line 1150 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::C; ;} + break; + + case 46: +#line 1151 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::CSRet; ;} + break; + + case 47: +#line 1152 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::Fast; ;} + break; + + case 48: +#line 1153 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::Cold; ;} + break; + + case 49: +#line 1154 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} + break; + + case 50: +#line 1155 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} + break; + + case 51: +#line 1156 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) + GEN_ERROR("Calling conv too large!"); + (yyval.UIntVal) = (yyvsp[0].UInt64Val); + CHECK_FOR_ERROR + ;} + break; + + case 52: +#line 1165 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = 0; ;} + break; + + case 53: +#line 1166 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.UIntVal) = (yyvsp[0].UInt64Val); + if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) + GEN_ERROR("Alignment must be a power of two!"); + CHECK_FOR_ERROR +;} + break; + + case 54: +#line 1172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = 0; ;} + break; + + case 55: +#line 1173 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.UIntVal) = (yyvsp[0].UInt64Val); + if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) + GEN_ERROR("Alignment must be a power of two!"); + CHECK_FOR_ERROR +;} + break; + + case 56: +#line 1181 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) + if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') + GEN_ERROR("Invalid character in section name!"); + (yyval.StrVal) = (yyvsp[0].StrVal); + CHECK_FOR_ERROR +;} + break; + + case 57: +#line 1189 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} + break; + + case 58: +#line 1190 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = (yyvsp[0].StrVal); ;} + break; + + case 59: +#line 1195 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + {;} + break; + + case 60: +#line 1196 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + {;} + break; + + case 61: +#line 1197 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurGV->setSection((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); + CHECK_FOR_ERROR + ;} + break; + + case 62: +#line 1202 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) GEN_ERROR("Alignment must be a power of two!"); - CurGV->setAlignment(yyvsp[0].UInt64Val); - CHECK_FOR_ERROR - ; - break;} -case 63: -#line 1216 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; - break;} -case 65: -#line 1217 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; - break;} -case 66: -#line 1219 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + CurGV->setAlignment((yyvsp[0].UInt64Val)); + CHECK_FOR_ERROR + ;} + break; + + case 64: +#line 1216 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} + break; + + case 66: +#line 1217 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} + break; + + case 67: +#line 1219 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); - yyval.TypeVal = yyvsp[0].TypeVal; + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); + (yyval.TypeVal) = (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 80: -#line 1231 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeVal = new PATypeHolder(OpaqueType::get()); + ;} + break; + + case 81: +#line 1231 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR - ; - break;} -case 81: -#line 1235 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); - CHECK_FOR_ERROR - ; - break;} -case 82: -#line 1239 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Named types are also simple types... - const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); + ;} + break; + + case 82: +#line 1235 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); + CHECK_FOR_ERROR + ;} + break; + + case 83: +#line 1239 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Named types are also simple types... + const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.TypeVal = new PATypeHolder(tmp); -; - break;} -case 83: -#line 1247 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Type UpReference - if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range!"); + (yyval.TypeVal) = new PATypeHolder(tmp); +;} + break; + + case 84: +#line 1247 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Type UpReference + if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector... - yyval.TypeVal = new PATypeHolder(OT); + UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... + (yyval.TypeVal) = new PATypeHolder(OT); UR_OUT("New Upreference!\n"); CHECK_FOR_ERROR - ; - break;} -case 84: -#line 1255 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Function derived type? + ;} + break; + + case 85: +#line 1255 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Function derived type? std::vector Params; - for (std::list::iterator I = yyvsp[-1].TypeList->begin(), - E = yyvsp[-1].TypeList->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), + E = (yyvsp[-1].TypeList)->end(); I != E; ++I) Params.push_back(*I); bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(FunctionType::get(*yyvsp[-3].TypeVal,Params,isVarArg))); - delete yyvsp[-1].TypeList; // Delete the argument list - delete yyvsp[-3].TypeVal; // Delete the return type handle - CHECK_FOR_ERROR - ; - break;} -case 85: -#line 1268 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Sized array type? - yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 86: -#line 1273 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Packed array type? - const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); - if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg))); + delete (yyvsp[-1].TypeList); // Delete the argument list + delete (yyvsp[-3].TypeVal); // Delete the return type handle + CHECK_FOR_ERROR + ;} + break; + + case 86: +#line 1268 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Sized array type? + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); + delete (yyvsp[-1].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 87: +#line 1273 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Packed array type? + const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); + if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) GEN_ERROR("Unsigned result not equal to signed result"); if (!ElemTy->isPrimitiveType()) GEN_ERROR("Elemental type of a PackedType must be primitive"); - if (!isPowerOf2_32(yyvsp[-3].UInt64Val)) + if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) GEN_ERROR("Vector length should be a power of 2!"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); - delete yyvsp[-1].TypeVal; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 87: -#line 1285 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Structure type? + ;} + break; + + case 88: +#line 1285 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Structure type? std::vector Elements; - for (std::list::iterator I = yyvsp[-1].TypeList->begin(), - E = yyvsp[-1].TypeList->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), + E = (yyvsp[-1].TypeList)->end(); I != E; ++I) Elements.push_back(*I); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); - delete yyvsp[-1].TypeList; - CHECK_FOR_ERROR - ; - break;} -case 88: -#line 1295 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Empty structure type? - yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); - CHECK_FOR_ERROR - ; - break;} -case 89: -#line 1299 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Pointer type? - if (*yyvsp[-1].TypeVal == Type::LabelTy) + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete (yyvsp[-1].TypeList); + CHECK_FOR_ERROR + ;} + break; + + case 89: +#line 1295 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Empty structure type? + (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); + CHECK_FOR_ERROR + ;} + break; + + case 90: +#line 1299 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Pointer type? + if (*(yyvsp[-1].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); - delete yyvsp[-1].TypeVal; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 90: -#line 1310 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeList = new std::list(); - yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; + ;} + break; + + case 91: +#line 1310 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeList) = new std::list(); + (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 91: -#line 1315 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; + ;} + break; + + case 92: +#line 1315 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 93: -#line 1322 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy); + ;} + break; + + case 94: +#line 1322 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR - ; - break;} -case 94: -#line 1326 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.TypeList = new std::list())->push_back(Type::VoidTy); + ;} + break; + + case 95: +#line 1326 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR - ; - break;} -case 95: -#line 1330 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeList = new std::list(); - CHECK_FOR_ERROR - ; - break;} -case 96: -#line 1341 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Nonempty unsized arr - const ArrayType *ATy = dyn_cast(yyvsp[-3].TypeVal->get()); + ;} + break; + + case 96: +#line 1330 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeList) = new std::list(); + CHECK_FOR_ERROR + ;} + break; + + case 97: +#line 1341 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized arr + const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + - utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + + utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 97: -#line 1367 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + ;} + break; + + case 98: +#line 1367 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); int NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +"!"); - yyval.ConstVal = ConstantArray::get(ATy, std::vector()); - delete yyvsp[-2].TypeVal; + (yyval.ConstVal) = ConstantArray::get(ATy, std::vector()); + delete (yyvsp[-2].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 98: -#line 1381 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + ;} + break; + + case 99: +#line 1381 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); int NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); - char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); - if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal)) + char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); + if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) GEN_ERROR("Can't build string constant of size " + - itostr((int)(EndStr-yyvsp[0].StrVal)) + + itostr((int)(EndStr-(yyvsp[0].StrVal))) + " when array has size " + itostr(NumElements) + "!"); std::vector Vals; if (ETy == Type::SByteTy) { - for (signed char *C = (signed char *)yyvsp[0].StrVal; C != (signed char *)EndStr; ++C) - Vals.push_back(ConstantSInt::get(ETy, *C)); + for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C) + Vals.push_back(ConstantInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { - for (unsigned char *C = (unsigned char *)yyvsp[0].StrVal; + for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); C != (unsigned char*)EndStr; ++C) - Vals.push_back(ConstantUInt::get(ETy, *C)); + Vals.push_back(ConstantInt::get(ETy, *C)); } else { - free(yyvsp[0].StrVal); + free((yyvsp[0].StrVal)); GEN_ERROR("Cannot build string arrays of non byte sized elements!"); } - free(yyvsp[0].StrVal); - yyval.ConstVal = ConstantArray::get(ATy, Vals); - delete yyvsp[-2].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 99: -#line 1411 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Nonempty unsized arr - const PackedType *PTy = dyn_cast(yyvsp[-3].TypeVal->get()); + free((yyvsp[0].StrVal)); + (yyval.ConstVal) = ConstantArray::get(ATy, Vals); + delete (yyvsp[-2].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 100: +#line 1411 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized arr + const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make packed constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); const Type *ETy = PTy->getElementType(); int NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + - utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + + utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 100: -#line 1437 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); + ;} + break; + + case 101: +#line 1437 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*yyvsp[-3].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); - if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes()) + if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) GEN_ERROR("Illegal number of initializers for structure type!"); // Check to ensure that constants are compatible with the type initializer! - for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) - if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i)) + for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) + if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) GEN_ERROR("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + " of structure initializer!"); - yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector); - delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 101: -#line 1458 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const StructType *STy = dyn_cast(yyvsp[-2].TypeVal->get()); + ;} + break; + + case 102: +#line 1458 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); if (STy->getNumContainedTypes() != 0) GEN_ERROR("Illegal number of initializers for structure type!"); - yyval.ConstVal = ConstantStruct::get(STy, std::vector()); - delete yyvsp[-2].TypeVal; + (yyval.ConstVal) = ConstantStruct::get(STy, std::vector()); + delete (yyvsp[-2].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 102: -#line 1471 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const PointerType *PTy = dyn_cast(yyvsp[-1].TypeVal->get()); + ;} + break; + + case 103: +#line 1471 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make null pointer constant with type: '" + - (*yyvsp[-1].TypeVal)->getDescription() + "'!"); + (*(yyvsp[-1].TypeVal))->getDescription() + "'!"); - yyval.ConstVal = ConstantPointerNull::get(PTy); - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = ConstantPointerNull::get(PTy); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 103: -#line 1481 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); - delete yyvsp[-1].TypeVal; + ;} + break; + + case 104: +#line 1481 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 104: -#line 1486 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const PointerType *Ty = dyn_cast(yyvsp[-1].TypeVal->get()); + ;} + break; + + case 105: +#line 1486 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); if (Ty == 0) GEN_ERROR("Global const reference must be a pointer type!"); @@ -2875,7 +3522,7 @@ case 104: Function *SavedCurFn = CurFun.CurrentFunction; CurFun.CurrentFunction = 0; - Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal); + Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR CurFun.CurrentFunction = SavedCurFn; @@ -2890,14 +3537,14 @@ case 104: // First check to see if the forward references value is already created! PerModuleInfo::GlobalRefsType::iterator I = - CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal)); + CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); if (I != CurModule.GlobalRefs.end()) { V = I->second; // Placeholder already exists, use it... - yyvsp[0].ValIDVal.destroy(); + (yyvsp[0].ValIDVal).destroy(); } else { std::string Name; - if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name; + if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; // Create the forward referenced global. GlobalValue *GV; @@ -2912,149 +3559,160 @@ case 104: } // Keep track of the fact that we have a forward ref to recycle it - CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV)); + CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV)); V = GV; } } - yyval.ConstVal = cast(V); - delete yyvsp[-1].TypeVal; // Free the type handle + (yyval.ConstVal) = cast(V); + delete (yyvsp[-1].TypeVal); // Free the type handle CHECK_FOR_ERROR - ; - break;} -case 105: -#line 1547 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType()) + ;} + break; + + case 106: +#line 1547 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression!"); - yyval.ConstVal = yyvsp[0].ConstVal; - delete yyvsp[-1].TypeVal; + (yyval.ConstVal) = (yyvsp[0].ConstVal); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 106: -#line 1554 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const Type *Ty = yyvsp[-1].TypeVal->get(); + ;} + break; + + case 107: +#line 1554 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const Type *Ty = (yyvsp[-1].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) GEN_ERROR("Cannot create a null initialized value of this type!"); - yyval.ConstVal = Constant::getNullValue(Ty); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 107: -#line 1563 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // integral constants - if (!ConstantSInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) + (yyval.ConstVal) = Constant::getNullValue(Ty); + delete (yyvsp[-1].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 108: +#line 1563 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - yyval.ConstVal = ConstantSInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); - CHECK_FOR_ERROR - ; - break;} -case 108: -#line 1569 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // integral constants - if (!ConstantUInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) + (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); + CHECK_FOR_ERROR + ;} + break; + + case 109: +#line 1569 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - yyval.ConstVal = ConstantUInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); - CHECK_FOR_ERROR - ; - break;} -case 109: -#line 1575 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Boolean constants - yyval.ConstVal = ConstantBool::getTrue(); - CHECK_FOR_ERROR - ; - break;} -case 110: -#line 1579 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Boolean constants - yyval.ConstVal = ConstantBool::getFalse(); - CHECK_FOR_ERROR - ; - break;} -case 111: -#line 1583 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Float & Double constants - if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal)) + (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); + CHECK_FOR_ERROR + ;} + break; + + case 110: +#line 1575 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + (yyval.ConstVal) = ConstantBool::getTrue(); + CHECK_FOR_ERROR + ;} + break; + + case 111: +#line 1579 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + (yyval.ConstVal) = ConstantBool::getFalse(); + CHECK_FOR_ERROR + ;} + break; + + case 112: +#line 1583 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Float & Double constants + if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) GEN_ERROR("Floating point constant invalid for type!!"); - yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal); + (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); CHECK_FOR_ERROR - ; - break;} -case 112: -#line 1591 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!yyvsp[-3].ConstVal->getType()->isFirstClassType()) + ;} + break; + + case 113: +#line 1591 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + - yyvsp[-3].ConstVal->getType()->getDescription() + "'!"); - if (!yyvsp[-1].TypeVal->get()->isFirstClassType()) + (yyvsp[-3].ConstVal)->getType()->getDescription() + "'!"); + if (!(yyvsp[-1].TypeVal)->get()->isFirstClassType()) GEN_ERROR("cast constant expression to a non-primitive type: '" + - yyvsp[-1].TypeVal->get()->getDescription() + "'!"); - yyval.ConstVal = ConstantExpr::getCast(yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get()); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 113: -#line 1602 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!isa(yyvsp[-2].ConstVal->getType())) + (yyvsp[-1].TypeVal)->get()->getDescription() + "'!"); + (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get()); + delete (yyvsp[-1].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 114: +#line 1602 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa((yyvsp[-2].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand!"); // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct // indices to uint struct indices for compatibility. generic_gep_type_iterator::iterator> - GTI = gep_type_begin(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end()), - GTE = gep_type_end(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end()); - for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI) + GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()), + GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()); + for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI) if (isa(*GTI)) // Only change struct indices - if (ConstantUInt *CUI = dyn_cast((*yyvsp[-1].ValueList)[i])) + if (ConstantInt *CUI = dyn_cast((*(yyvsp[-1].ValueList))[i])) if (CUI->getType() == Type::UByteTy) - (*yyvsp[-1].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); const Type *IdxTy = - GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true); + GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); if (!IdxTy) GEN_ERROR("Index list invalid for constant getelementptr!"); std::vector IdxVec; - for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i) - if (Constant *C = dyn_cast((*yyvsp[-1].ValueList)[i])) + for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) + if (Constant *C = dyn_cast((*(yyvsp[-1].ValueList))[i])) IdxVec.push_back(C); else GEN_ERROR("Indices to constant getelementptr must be constants!"); - delete yyvsp[-1].ValueList; + delete (yyvsp[-1].ValueList); - yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec); + (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec); CHECK_FOR_ERROR - ; - break;} -case 114: -#line 1634 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-5].ConstVal->getType() != Type::BoolTy) + ;} + break; + + case 115: +#line 1634 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Select operand types must match!"); - yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 115: -#line 1642 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ;} + break; + + case 116: +#line 1642 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Binary operator types must match!"); // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the // broken case. See PR424 for more information. - if (!isa(yyvsp[-3].ConstVal->getType())) { - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + if (!isa((yyvsp[-3].ConstVal)->getType())) { + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -3062,138 +3720,154 @@ case 115: case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("invalid pointer binary constant expr!"); } - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, ConstantExpr::getCast(yyvsp[-3].ConstVal, IntPtrTy), - ConstantExpr::getCast(yyvsp[-1].ConstVal, IntPtrTy)); - yyval.ConstVal = ConstantExpr::getCast(yyval.ConstVal, yyvsp[-3].ConstVal->getType()); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy), + ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy)); + (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType()); } CHECK_FOR_ERROR - ; - break;} -case 116: -#line 1664 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ;} + break; + + case 117: +#line 1664 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Logical operator types must match!"); - if (!yyvsp[-3].ConstVal->getType()->isIntegral()) { - if (!isa(yyvsp[-3].ConstVal->getType()) || - !cast(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral()) + if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) { + if (!isa((yyvsp[-3].ConstVal)->getType()) || + !cast((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 117: -#line 1675 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ;} + break; + + case 118: +#line 1675 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("setcc operand types must match!"); - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 118: -#line 1681 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-1].ConstVal->getType() != Type::UByteTy) + ;} + break; + + case 119: +#line 1681 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); - if (!yyvsp[-3].ConstVal->getType()->isInteger()) + if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 119: -#line 1689 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + ;} + break; + + case 120: +#line 1689 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid extractelement operands!"); - yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 120: -#line 1695 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + ;} + break; + + case 121: +#line 1695 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid insertelement operands!"); - yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 121: -#line 1701 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + ;} + break; + + case 122: +#line 1701 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid shufflevector operands!"); - yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 122: -#line 1710 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); + ;} + break; + + case 123: +#line 1710 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 123: -#line 1714 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ConstVector = new std::vector(); - yyval.ConstVector->push_back(yyvsp[0].ConstVal); - CHECK_FOR_ERROR - ; - break;} -case 124: -#line 1722 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = false; ; - break;} -case 125: -#line 1722 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = true; ; - break;} -case 126: -#line 1732 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; + ;} + break; + + case 124: +#line 1714 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ConstVector) = new std::vector(); + (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); + CHECK_FOR_ERROR + ;} + break; + + case 125: +#line 1722 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = false; ;} + break; + + case 126: +#line 1722 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = true; ;} + break; + + case 127: +#line 1732 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); CHECK_FOR_ERROR; -; - break;} -case 127: -#line 1740 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = yyvsp[-1].ModuleVal; +;} + break; + + case 128: +#line 1740 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); CHECK_FOR_ERROR - ; - break;} -case 128: -#line 1745 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = yyvsp[-1].ModuleVal; + ;} + break; + + case 129: +#line 1745 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR - ; - break;} -case 129: -#line 1749 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = yyvsp[-3].ModuleVal; + ;} + break; + + case 130: +#line 1749 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); CHECK_FOR_ERROR - ; - break;} -case 130: -#line 1753 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = yyvsp[-1].ModuleVal; + ;} + break; + + case 131: +#line 1753 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR - ; - break;} -case 131: -#line 1757 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = CurModule.CurrentModule; + ;} + break; + + case 132: +#line 1757 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. if (!CurModule.LateResolveTypes.empty()) { const ValID &DID = CurModule.LateResolveTypes.begin()->first; @@ -3204,11 +3878,12 @@ case 131: } } CHECK_FOR_ERROR - ; - break;} -case 132: -#line 1772 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 133: +#line 1772 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: // @@ -3218,274 +3893,306 @@ case 132: // If types are not resolved eagerly, then the two types will not be // determined to be the same type! // - ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal); + ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); - if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { + if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. - CurModule.Types.push_back(*yyvsp[0].TypeVal); + CurModule.Types.push_back(*(yyvsp[0].TypeVal)); } - delete yyvsp[0].TypeVal; + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 133: -#line 1794 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Function prototypes can be in const pool + ;} + break; + + case 134: +#line 1794 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Function prototypes can be in const pool CHECK_FOR_ERROR - ; - break;} -case 134: -#line 1797 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Asm blocks can be in the const pool + ;} + break; + + case 135: +#line 1797 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Asm blocks can be in the const pool CHECK_FOR_ERROR - ; - break;} -case 135: -#line 1800 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].ConstVal == 0) + ;} + break; + + case 136: +#line 1800 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[0].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!"); - CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal); + CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 136: -#line 1805 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 137: +#line 1805 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; - ; - break;} -case 137: -#line 1808 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + ;} + break; + + case 138: +#line 1808 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR - delete yyvsp[0].TypeVal; - ; - break;} -case 138: -#line 1812 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[0].TypeVal); + ;} + break; + + case 139: +#line 1812 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; CHECK_FOR_ERROR - ; - break;} -case 139: -#line 1816 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + ;} + break; + + case 140: +#line 1816 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR - delete yyvsp[0].TypeVal; - ; - break;} -case 140: -#line 1820 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[0].TypeVal); + ;} + break; + + case 141: +#line 1820 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; CHECK_FOR_ERROR - ; - break;} -case 141: -#line 1824 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 142: +#line 1824 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CurGV = - ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalWeakLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); CHECK_FOR_ERROR - delete yyvsp[0].TypeVal; - ; - break;} -case 142: -#line 1829 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[0].TypeVal); + ;} + break; + + case 143: +#line 1829 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; CHECK_FOR_ERROR - ; - break;} -case 143: -#line 1833 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 144: +#line 1833 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 144: -#line 1836 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 145: +#line 1836 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 145: -#line 1839 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - ; - break;} -case 146: -#line 1843 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 146: +#line 1839 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + ;} + break; + + case 147: +#line 1843 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); - char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); - std::string NewAsm(yyvsp[0].StrVal, EndStr); - free(yyvsp[0].StrVal); + char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); + std::string NewAsm((yyvsp[0].StrVal), EndStr); + free((yyvsp[0].StrVal)); if (AsmSoFar.empty()) CurModule.CurrentModule->setModuleInlineAsm(NewAsm); else CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); CHECK_FOR_ERROR -; - break;} -case 147: -#line 1856 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Endianness = Module::BigEndian; ; - break;} -case 148: -#line 1857 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Endianness = Module::LittleEndian; ; - break;} -case 149: -#line 1859 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness); +;} + break; + + case 148: +#line 1856 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Endianness) = Module::BigEndian; ;} + break; + + case 149: +#line 1857 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.Endianness) = Module::LittleEndian; ;} + break; + + case 150: +#line 1859 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); CHECK_FOR_ERROR - ; - break;} -case 150: -#line 1863 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UInt64Val == 32) + ;} + break; + + case 151: +#line 1863 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[0].UInt64Val) == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); - else if (yyvsp[0].UInt64Val == 64) + else if ((yyvsp[0].UInt64Val) == 64) CurModule.CurrentModule->setPointerSize(Module::Pointer64); else - GEN_ERROR("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!"); + GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!"); CHECK_FOR_ERROR - ; - break;} -case 151: -#line 1872 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + ;} + break; + + case 152: +#line 1872 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR - ; - break;} -case 152: -#line 1877 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + ;} + break; + + case 153: +#line 1877 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR - ; - break;} -case 154: -#line 1885 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + ;} + break; + + case 155: +#line 1885 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR - ; - break;} -case 155: -#line 1890 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + ;} + break; + + case 156: +#line 1890 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR - ; - break;} -case 156: -#line 1895 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 157: +#line 1895 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 160: -#line 1905 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = 0; ; - break;} -case 161: -#line 1907 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (*yyvsp[-1].TypeVal == Type::VoidTy) + ;} + break; + + case 161: +#line 1905 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} + break; + + case 162: +#line 1907 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (*(yyvsp[-1].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); - yyval.ArgVal = new std::pair(yyvsp[-1].TypeVal, yyvsp[0].StrVal); + (yyval.ArgVal) = new std::pair((yyvsp[-1].TypeVal), (yyvsp[0].StrVal)); CHECK_FOR_ERROR -; - break;} -case 162: -#line 1914 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = yyvsp[-2].ArgList; - yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal); - delete yyvsp[0].ArgVal; - CHECK_FOR_ERROR - ; - break;} -case 163: -#line 1920 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = new std::vector >(); - yyval.ArgList->push_back(*yyvsp[0].ArgVal); - delete yyvsp[0].ArgVal; - CHECK_FOR_ERROR - ; - break;} -case 164: -#line 1927 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = yyvsp[0].ArgList; +;} + break; + + case 163: +#line 1914 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = (yyvsp[-2].ArgList); + (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); + delete (yyvsp[0].ArgVal); CHECK_FOR_ERROR - ; - break;} -case 165: -#line 1931 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = yyvsp[-2].ArgList; - yyval.ArgList->push_back(std::pair >(); + (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); + delete (yyvsp[0].ArgVal); + CHECK_FOR_ERROR + ;} + break; + + case 165: +#line 1927 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = (yyvsp[0].ArgList); + CHECK_FOR_ERROR + ;} + break; + + case 166: +#line 1931 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = (yyvsp[-2].ArgList); + (yyval.ArgList)->push_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); CHECK_FOR_ERROR - ; - break;} -case 166: -#line 1937 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = new std::vector >(); - yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); + ;} + break; + + case 167: +#line 1937 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = new std::vector >(); + (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); CHECK_FOR_ERROR - ; - break;} -case 167: -#line 1942 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = 0; + ;} + break; + + case 168: +#line 1942 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = 0; CHECK_FOR_ERROR - ; - break;} -case 168: -#line 1948 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - UnEscapeLexed(yyvsp[-5].StrVal); - std::string FunctionName(yyvsp[-5].StrVal); - free(yyvsp[-5].StrVal); // Free strdup'd memory! + ;} + break; + + case 169: +#line 1948 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + UnEscapeLexed((yyvsp[-5].StrVal)); + std::string FunctionName((yyvsp[-5].StrVal)); + free((yyvsp[-5].StrVal)); // Free strdup'd memory! - if (!(*yyvsp[-6].TypeVal)->isFirstClassType() && *yyvsp[-6].TypeVal != Type::VoidTy) + if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); std::vector ParamTypeList; - if (yyvsp[-3].ArgList) { // If there are arguments... - for (std::vector >::iterator I = yyvsp[-3].ArgList->begin(); - I != yyvsp[-3].ArgList->end(); ++I) + if ((yyvsp[-3].ArgList)) { // If there are arguments... + for (std::vector >::iterator I = (yyvsp[-3].ArgList)->begin(); + I != (yyvsp[-3].ArgList)->end(); ++I) ParamTypeList.push_back(I->first->get()); } bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; if (isVarArg) ParamTypeList.pop_back(); - const FunctionType *FT = FunctionType::get(*yyvsp[-6].TypeVal, ParamTypeList, isVarArg); + const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg); const PointerType *PFT = PointerType::get(FT); - delete yyvsp[-6].TypeVal; + delete (yyvsp[-6].TypeVal); ValID ID; if (!FunctionName.empty()) { @@ -3529,24 +4236,24 @@ case 168: // another function. Fn->setLinkage(CurFun.Linkage); } - Fn->setCallingConv(yyvsp[-7].UIntVal); - Fn->setAlignment(yyvsp[0].UIntVal); - if (yyvsp[-1].StrVal) { - Fn->setSection(yyvsp[-1].StrVal); - free(yyvsp[-1].StrVal); + Fn->setCallingConv((yyvsp[-7].UIntVal)); + Fn->setAlignment((yyvsp[0].UIntVal)); + if ((yyvsp[-1].StrVal)) { + Fn->setSection((yyvsp[-1].StrVal)); + free((yyvsp[-1].StrVal)); } // Add all of the arguments we parsed to the function... - if (yyvsp[-3].ArgList) { // Is null if empty... + if ((yyvsp[-3].ArgList)) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert(yyvsp[-3].ArgList->back().first->get() == Type::VoidTy && yyvsp[-3].ArgList->back().second == 0&& + assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&& "Not a varargs marker!"); - delete yyvsp[-3].ArgList->back().first; - yyvsp[-3].ArgList->pop_back(); // Delete the last entry + delete (yyvsp[-3].ArgList)->back().first; + (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); - for (std::vector >::iterator I = yyvsp[-3].ArgList->begin(); - I != yyvsp[-3].ArgList->end(); ++I, ++ArgIt) { + for (std::vector >::iterator I = (yyvsp[-3].ArgList)->begin(); + I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) { delete I->first; // Delete the typeholder... setValueName(ArgIt, I->second); // Insert arg into symtab... @@ -3554,123 +4261,140 @@ case 168: InsertValue(ArgIt); } - delete yyvsp[-3].ArgList; // We're now done with the argument list + delete (yyvsp[-3].ArgList); // We're now done with the argument list } CHECK_FOR_ERROR -; - break;} -case 171: -#line 2044 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = CurFun.CurrentFunction; +;} + break; + + case 172: +#line 2044 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = CurFun.CurrentFunction; // Make sure that we keep track of the linkage type even if there was a // previous "declare". - yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage); -; - break;} -case 174: -#line 2054 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = yyvsp[-1].FunctionVal; + (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); +;} + break; + + case 175: +#line 2054 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR -; - break;} -case 176: -#line 2060 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ CurFun.Linkage = GlobalValue::DLLImportLinkage ; - break;} -case 177: -#line 2061 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ CurFun.Linkage = GlobalValue::DLLImportLinkage ; - break;} -case 178: -#line 2063 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ CurFun.isDeclare = true; ; - break;} -case 179: -#line 2063 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = CurFun.CurrentFunction; +;} + break; + + case 177: +#line 2060 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} + break; + + case 178: +#line 2061 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} + break; + + case 179: +#line 2063 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { CurFun.isDeclare = true; ;} + break; + + case 180: +#line 2063 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); CHECK_FOR_ERROR - ; - break;} -case 180: -#line 2073 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + ;} + break; + + case 181: +#line 2073 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; CHECK_FOR_ERROR - ; - break;} -case 181: -#line 2077 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; - CHECK_FOR_ERROR - ; - break;} -case 182: -#line 2082 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // A reference to a direct constant - yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); - CHECK_FOR_ERROR - ; - break;} -case 183: -#line 2086 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); - CHECK_FOR_ERROR - ; - break;} -case 184: -#line 2090 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Perhaps it's an FP constant? - yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); - CHECK_FOR_ERROR - ; - break;} -case 185: -#line 2094 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(ConstantBool::getTrue()); + ;} + break; + + case 182: +#line 2077 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; CHECK_FOR_ERROR - ; - break;} -case 186: -#line 2098 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(ConstantBool::getFalse()); + ;} + break; + + case 183: +#line 2082 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // A reference to a direct constant + (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR - ; - break;} -case 187: -#line 2102 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::createNull(); + ;} + break; + + case 184: +#line 2086 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR - ; - break;} -case 188: -#line 2106 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::createUndef(); - CHECK_FOR_ERROR - ; - break;} -case 189: -#line 2110 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // A vector zero constant. - yyval.ValIDVal = ValID::createZeroInit(); - CHECK_FOR_ERROR - ; - break;} -case 190: -#line 2114 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Nonempty unsized packed vector - const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); - int NumElements = yyvsp[-1].ConstVector->size(); + ;} + break; + + case 185: +#line 2090 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Perhaps it's an FP constant? + (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); + CHECK_FOR_ERROR + ;} + break; + + case 186: +#line 2094 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); + CHECK_FOR_ERROR + ;} + break; + + case 187: +#line 2098 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); + CHECK_FOR_ERROR + ;} + break; + + case 188: +#line 2102 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::createNull(); + CHECK_FOR_ERROR + ;} + break; + + case 189: +#line 2106 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::createUndef(); + CHECK_FOR_ERROR + ;} + break; + + case 190: +#line 2110 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // A vector zero constant. + (yyval.ValIDVal) = ValID::createZeroInit(); + CHECK_FOR_ERROR + ;} + break; + + case 191: +#line 2114 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized packed vector + const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); + int NumElements = (yyvsp[-1].ConstVector)->size(); PackedType* pt = PackedType::get(ETy, NumElements); PATypeHolder* PTy = new PATypeHolder( @@ -3682,98 +4406,108 @@ case 190: ); // Verify all elements are correct type! - for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { - if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '" + - (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector)); - delete PTy; delete yyvsp[-1].ConstVector; + (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); + delete PTy; delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 191: -#line 2139 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); + ;} + break; + + case 192: +#line 2139 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 192: -#line 2143 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - char *End = UnEscapeLexed(yyvsp[-2].StrVal, true); - std::string AsmStr = std::string(yyvsp[-2].StrVal, End); - End = UnEscapeLexed(yyvsp[0].StrVal, true); - std::string Constraints = std::string(yyvsp[0].StrVal, End); - yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal); - free(yyvsp[-2].StrVal); - free(yyvsp[0].StrVal); - CHECK_FOR_ERROR - ; - break;} -case 193: -#line 2157 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Is it an integer reference...? - yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); - CHECK_FOR_ERROR - ; - break;} -case 194: -#line 2161 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Is it a named reference...? - yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); - CHECK_FOR_ERROR - ; - break;} -case 197: -#line 2173 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal; + ;} + break; + + case 193: +#line 2143 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); + std::string AsmStr = std::string((yyvsp[-2].StrVal), End); + End = UnEscapeLexed((yyvsp[0].StrVal), true); + std::string Constraints = std::string((yyvsp[0].StrVal), End); + (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); + free((yyvsp[-2].StrVal)); + free((yyvsp[0].StrVal)); + CHECK_FOR_ERROR + ;} + break; + + case 194: +#line 2157 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is it an integer reference...? + (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); CHECK_FOR_ERROR - ; - break;} -case 198: -#line 2178 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = yyvsp[-1].FunctionVal; - CHECK_FOR_ERROR - ; - break;} -case 199: -#line 2182 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Do not allow functions with 0 basic blocks - yyval.FunctionVal = yyvsp[-1].FunctionVal; - CHECK_FOR_ERROR - ; - break;} -case 200: -#line 2191 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); + ;} + break; + + case 195: +#line 2161 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is it a named reference...? + (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); CHECK_FOR_ERROR - InsertValue(yyvsp[0].TermInstVal); + ;} + break; - yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); - InsertValue(yyvsp[-2].BasicBlockVal); - yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; + case 198: +#line 2173 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 201: -#line 2202 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); - yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; + ;} + break; + + case 199: +#line 2178 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR - ; - break;} -case 202: -#line 2207 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); + ;} + break; + + case 200: +#line 2182 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Do not allow functions with 0 basic blocks + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + CHECK_FOR_ERROR + ;} + break; + + case 201: +#line 2191 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); + CHECK_FOR_ERROR + InsertValue((yyvsp[0].TermInstVal)); + + (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); + InsertValue((yyvsp[-2].BasicBlockVal)); + (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); + CHECK_FOR_ERROR + ;} + break; + + case 202: +#line 2202 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); + (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); + CHECK_FOR_ERROR + ;} + break; + + case 203: +#line 2207 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the @@ -3781,105 +4515,113 @@ case 202: // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); + BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); + CHECK_FOR_ERROR + ;} + break; + + case 204: +#line 2219 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); + CHECK_FOR_ERROR + + // Make sure to move the basic block to the correct location in the + // function, instead of leaving it inserted wherever it was first + // referenced. + Function::BasicBlockListType &BBL = + CurFun.CurrentFunction->getBasicBlockList(); + BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); + CHECK_FOR_ERROR + ;} + break; + + case 205: +#line 2232 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Return with a result... + (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); + CHECK_FOR_ERROR + ;} + break; + + case 206: +#line 2236 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Return with no result... + (yyval.TermInstVal) = new ReturnInst(); + CHECK_FOR_ERROR + ;} + break; + + case 207: +#line 2240 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Unconditional Branch... + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - ; - break;} -case 203: -#line 2219 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true); + (yyval.TermInstVal) = new BranchInst(tmpBB); + ;} + break; + + case 208: +#line 2245 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR + BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); + CHECK_FOR_ERROR + Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)); + CHECK_FOR_ERROR + (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); + ;} + break; - // Make sure to move the basic block to the correct location in the - // function, instead of leaving it inserted wherever it was first - // referenced. - Function::BasicBlockListType &BBL = - CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); - CHECK_FOR_ERROR - ; - break;} -case 204: -#line 2232 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Return with a result... - yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); - CHECK_FOR_ERROR - ; - break;} -case 205: -#line 2236 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Return with no result... - yyval.TermInstVal = new ReturnInst(); - CHECK_FOR_ERROR - ; - break;} -case 206: -#line 2240 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Unconditional Branch... - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); - CHECK_FOR_ERROR - yyval.TermInstVal = new BranchInst(tmpBB); - ; - break;} -case 207: -#line 2245 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); - CHECK_FOR_ERROR - BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal); - CHECK_FOR_ERROR - Value* tmpVal = getVal(Type::BoolTy, yyvsp[-6].ValIDVal); - CHECK_FOR_ERROR - yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal); - ; - break;} -case 208: -#line 2254 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); + case 209: +#line 2254 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR - SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size()); - yyval.TermInstVal = S; + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); + (yyval.TermInstVal) = S; - std::vector >::iterator I = yyvsp[-1].JumpTable->begin(), - E = yyvsp[-1].JumpTable->end(); + std::vector >::iterator I = (yyvsp[-1].JumpTable)->begin(), + E = (yyvsp[-1].JumpTable)->end(); for (; I != E; ++I) { if (ConstantInt *CI = dyn_cast(I->first)) S->addCase(CI, I->second); else GEN_ERROR("Switch case is constant, but not a simple integer!"); } - delete yyvsp[-1].JumpTable; + delete (yyvsp[-1].JumpTable); CHECK_FOR_ERROR - ; - break;} -case 209: -#line 2273 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); + ;} + break; + + case 210: +#line 2273 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); - yyval.TermInstVal = S; + (yyval.TermInstVal) = S; CHECK_FOR_ERROR - ; - break;} -case 210: -#line 2283 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 211: +#line 2283 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { const PointerType *PFTy; const FunctionType *Ty; - if (!(PFTy = dyn_cast(yyvsp[-10].TypeVal->get())) || + if (!(PFTy = dyn_cast((yyvsp[-10].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - if (yyvsp[-7].ValueList) { - for (std::vector::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end(); + if ((yyvsp[-7].ValueList)) { + for (std::vector::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end(); I != E; ++I) ParamTypes.push_back((*I)->getType()); } @@ -3887,27 +4629,27 @@ case 210: bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg); + Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } - Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR - BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR - BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal); + BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR // Create the call node... - if (!yyvsp[-7].ValueList) { // Has no arguments? - yyval.TermInstVal = new InvokeInst(V, Normal, Except, std::vector()); + if (!(yyvsp[-7].ValueList)) { // Has no arguments? + (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector()); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified // correctly! // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end(); + std::vector::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -3917,242 +4659,263 @@ case 210: if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList); + (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList)); } - cast(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal); + cast((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal)); - delete yyvsp[-10].TypeVal; - delete yyvsp[-7].ValueList; + delete (yyvsp[-10].TypeVal); + delete (yyvsp[-7].ValueList); CHECK_FOR_ERROR - ; - break;} -case 211: -#line 2338 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TermInstVal = new UnwindInst(); + ;} + break; + + case 212: +#line 2338 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR - ; - break;} -case 212: -#line 2342 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TermInstVal = new UnreachableInst(); + ;} + break; + + case 213: +#line 2342 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR - ; - break;} -case 213: -#line 2349 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.JumpTable = yyvsp[-5].JumpTable; - Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + ;} + break; + + case 214: +#line 2349 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.JumpTable) = (yyvsp[-5].JumpTable); + Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); - ; - break;} -case 214: -#line 2360 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.JumpTable = new std::vector >(); - Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); + ;} + break; + + case 215: +#line 2360 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.JumpTable) = new std::vector >(); + Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); - ; - break;} -case 215: -#line 2373 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); + ;} + break; + + case 216: +#line 2373 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is this definition named?? if so, assign the name... - setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); + setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); CHECK_FOR_ERROR - InsertValue(yyvsp[0].InstVal); - yyval.InstVal = yyvsp[0].InstVal; + InsertValue((yyvsp[0].InstVal)); + (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR -; - break;} -case 216: -#line 2382 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Used for PHI nodes - yyval.PHIList = new std::list >(); - Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal); - CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); - CHECK_FOR_ERROR - yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB)); - delete yyvsp[-5].TypeVal; - ; - break;} -case 217: -#line 2391 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.PHIList = yyvsp[-6].PHIList; - Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); - CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); - CHECK_FOR_ERROR - yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB)); - ; - break;} -case 218: -#line 2401 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Used for call statements, and memory insts... - yyval.ValueList = new std::vector(); - yyval.ValueList->push_back(yyvsp[0].ValueVal); - ; - break;} -case 219: -#line 2405 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueList = yyvsp[-2].ValueList; - yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal); - CHECK_FOR_ERROR - ; - break;} -case 221: -#line 2412 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ValueList = 0; ; - break;} -case 222: -#line 2414 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; +;} + break; + + case 217: +#line 2382 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Used for PHI nodes + (yyval.PHIList) = new std::list >(); + Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR - ; - break;} -case 223: -#line 2418 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR - ; - break;} -case 224: -#line 2423 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && - !isa((*yyvsp[-3].TypeVal).get())) + (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); + delete (yyvsp[-5].TypeVal); + ;} + break; + + case 218: +#line 2391 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.PHIList) = (yyvsp[-6].PHIList); + Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); + CHECK_FOR_ERROR + (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); + ;} + break; + + case 219: +#line 2401 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { // Used for call statements, and memory insts... + (yyval.ValueList) = new std::vector(); + (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); + ;} + break; + + case 220: +#line 2405 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueList) = (yyvsp[-2].ValueList); + (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); + CHECK_FOR_ERROR + ;} + break; + + case 222: +#line 2412 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.ValueList) = 0; ;} + break; + + case 223: +#line 2414 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; + CHECK_FOR_ERROR + ;} + break; + + case 224: +#line 2418 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; + CHECK_FOR_ERROR + ;} + break; + + case 225: +#line 2423 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && + !isa((*(yyvsp[-3].TypeVal)).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*yyvsp[-3].TypeVal).get()) && yyvsp[-4].BinaryOpVal == Instruction::Rem) + if (isa((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal) == Instruction::Rem) GEN_ERROR("Rem not supported on packed types!"); - Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR - Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 225: -#line 2439 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!(*yyvsp[-3].TypeVal)->isIntegral()) { - if (!isa(yyvsp[-3].TypeVal->get()) || - !cast(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral()) + delete (yyvsp[-3].TypeVal); + ;} + break; + + case 226: +#line 2439 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { + if (!isa((yyvsp[-3].TypeVal)->get()) || + !cast((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 226: -#line 2454 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if(isa((*yyvsp[-3].TypeVal).get())) { + delete (yyvsp[-3].TypeVal); + ;} + break; + + case 227: +#line 2454 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if(isa((*(yyvsp[-3].TypeVal)).get())) { GEN_ERROR( "PackedTypes currently not supported in setcc instructions!"); } - Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); + Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 227: -#line 2468 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[-3].TypeVal); + ;} + break; + + case 228: +#line 2468 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { std::cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; - Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType()); + Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType()); if (Ones == 0) GEN_ERROR("Expected integral type for not instruction!"); - yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones); + if ((yyval.InstVal) == 0) GEN_ERROR("Could not create a xor instruction!"); CHECK_FOR_ERROR - ; - break;} -case 228: -#line 2481 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].ValueVal->getType() != Type::UByteTy) + ;} + break; + + case 229: +#line 2481 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); - if (!yyvsp[-2].ValueVal->getType()->isInteger()) + if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 229: -#line 2489 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!yyvsp[0].TypeVal->get()->isFirstClassType()) + ;} + break; + + case 230: +#line 2489 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) GEN_ERROR("cast instruction to a non-primitive type: '" + - yyvsp[0].TypeVal->get()->getDescription() + "'!"); - yyval.InstVal = new CastInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); - delete yyvsp[0].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 230: -#line 2497 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-4].ValueVal->getType() != Type::BoolTy) + (yyvsp[0].TypeVal)->get()->getDescription() + "'!"); + (yyval.InstVal) = new CastInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); + delete (yyvsp[0].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 231: +#line 2497 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); - if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType()) + if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) GEN_ERROR("select value types should match!"); - yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 231: -#line 2505 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 232: +#line 2505 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { NewVarArgs = true; - yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); - delete yyvsp[0].TypeVal; + (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 232: -#line 2511 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 233: +#line 2511 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { ObsoleteVarArgs = true; - const Type* ArgTy = yyvsp[-2].ValueVal->getType(); + const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); Function* NF = CurModule.CurrentModule-> getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); @@ -4163,19 +4926,20 @@ case 232: //b = vaarg foo, t AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal); + CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal)); CurBB->getInstList().push_back(bar); CurBB->getInstList().push_back(new StoreInst(bar, foo)); - yyval.InstVal = new VAArgInst(foo, *yyvsp[0].TypeVal); - delete yyvsp[0].TypeVal; + (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal)); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 233: -#line 2531 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 234: +#line 2531 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { ObsoleteVarArgs = true; - const Type* ArgTy = yyvsp[-2].ValueVal->getType(); + const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); Function* NF = CurModule.CurrentModule-> getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); @@ -4187,73 +4951,78 @@ case 233: //b = load foo AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal); + CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal)); CurBB->getInstList().push_back(bar); CurBB->getInstList().push_back(new StoreInst(bar, foo)); - Instruction* tmp = new VAArgInst(foo, *yyvsp[0].TypeVal); + Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal)); CurBB->getInstList().push_back(tmp); - yyval.InstVal = new LoadInst(foo); - delete yyvsp[0].TypeVal; + (yyval.InstVal) = new LoadInst(foo); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 234: -#line 2554 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + ;} + break; + + case 235: +#line 2554 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid extractelement operands!"); - yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 235: -#line 2560 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + ;} + break; + + case 236: +#line 2560 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid insertelement operands!"); - yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 236: -#line 2566 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + ;} + break; + + case 237: +#line 2566 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid shufflevector operands!"); - yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 237: -#line 2572 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const Type *Ty = yyvsp[0].PHIList->front().first->getType(); + ;} + break; + + case 238: +#line 2572 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) GEN_ERROR("PHI node operands must be of first class type!"); - yyval.InstVal = new PHINode(Ty); - ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size()); - while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) { - if (yyvsp[0].PHIList->front().first->getType() != Ty) + (yyval.InstVal) = new PHINode(Ty); + ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); + while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { + if ((yyvsp[0].PHIList)->front().first->getType() != Ty) GEN_ERROR("All elements of a PHI node must be of the same type!"); - cast(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second); - yyvsp[0].PHIList->pop_front(); + cast((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); + (yyvsp[0].PHIList)->pop_front(); } - delete yyvsp[0].PHIList; // Free the list... + delete (yyvsp[0].PHIList); // Free the list... CHECK_FOR_ERROR - ; - break;} -case 238: -#line 2587 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 239: +#line 2587 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { const PointerType *PFTy; const FunctionType *Ty; - if (!(PFTy = dyn_cast(yyvsp[-4].TypeVal->get())) || + if (!(PFTy = dyn_cast((yyvsp[-4].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - if (yyvsp[-1].ValueList) { - for (std::vector::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end(); + if ((yyvsp[-1].ValueList)) { + for (std::vector::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end(); I != E; ++I) ParamTypes.push_back((*I)->getType()); } @@ -4261,31 +5030,31 @@ case 238: bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy) + if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); - Ty = FunctionType::get(yyvsp[-4].TypeVal->get(), ParamTypes, isVarArg); + Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } - Value *V = getVal(PFTy, yyvsp[-3].ValIDVal); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR // Create the call node... - if (!yyvsp[-1].ValueList) { // Has no arguments? + if (!(yyvsp[-1].ValueList)) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " "expects arguments!"); - yyval.InstVal = new CallInst(V, std::vector()); + (yyval.InstVal) = new CallInst(V, std::vector()); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified // correctly! // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end(); + std::vector::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -4295,377 +5064,442 @@ case 238: if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - yyval.InstVal = new CallInst(V, *yyvsp[-1].ValueList); + (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList)); } - cast(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal); - cast(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal); - delete yyvsp[-4].TypeVal; - delete yyvsp[-1].ValueList; - CHECK_FOR_ERROR - ; - break;} -case 239: -#line 2646 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.InstVal = yyvsp[0].InstVal; - CHECK_FOR_ERROR - ; - break;} -case 240: -#line 2653 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueList = yyvsp[0].ValueList; - CHECK_FOR_ERROR - ; - break;} -case 241: -#line 2656 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueList = new std::vector(); - CHECK_FOR_ERROR - ; - break;} -case 242: -#line 2661 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; + cast((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal)); + cast((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal)); + delete (yyvsp[-4].TypeVal); + delete (yyvsp[-1].ValueList); CHECK_FOR_ERROR - ; - break;} -case 243: -#line 2665 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + ;} + break; + + case 240: +#line 2646 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR - ; - break;} -case 244: -#line 2672 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); - delete yyvsp[-1].TypeVal; + ;} + break; + + case 241: +#line 2653 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueList) = (yyvsp[0].ValueList); CHECK_FOR_ERROR - ; - break;} -case 245: -#line 2677 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); - CHECK_FOR_ERROR - yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); - delete yyvsp[-4].TypeVal; - ; - break;} -case 246: -#line 2683 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); - delete yyvsp[-1].TypeVal; + ;} + break; + + case 242: +#line 2656 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR - ; - break;} -case 247: -#line 2688 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); - CHECK_FOR_ERROR - yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); - delete yyvsp[-4].TypeVal; - ; - break;} -case 248: -#line 2694 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!isa(yyvsp[0].ValueVal->getType())) + ;} + break; + + case 243: +#line 2661 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; + CHECK_FOR_ERROR + ;} + break; + + case 244: +#line 2665 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; + CHECK_FOR_ERROR + ;} + break; + + case 245: +#line 2672 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); + delete (yyvsp[-1].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 246: +#line 2677 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + CHECK_FOR_ERROR + (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); + delete (yyvsp[-4].TypeVal); + ;} + break; + + case 247: +#line 2683 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); + delete (yyvsp[-1].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 248: +#line 2688 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + CHECK_FOR_ERROR + (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); + delete (yyvsp[-4].TypeVal); + ;} + break; + + case 249: +#line 2694 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa((yyvsp[0].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + - yyvsp[0].ValueVal->getType()->getDescription() + "!"); - yyval.InstVal = new FreeInst(yyvsp[0].ValueVal); + (yyvsp[0].ValueVal)->getType()->getDescription() + "!"); + (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 249: -#line 2702 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!isa(yyvsp[-1].TypeVal->get())) + ;} + break; + + case 250: +#line 2702 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa((yyvsp[-1].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + - (*yyvsp[-1].TypeVal)->getDescription()); - if (!cast(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType()) + (*(yyvsp[-1].TypeVal))->getDescription()); + if (!cast((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) GEN_ERROR("Can't load from pointer of non-first-class type: " + - (*yyvsp[-1].TypeVal)->getDescription()); - Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); - CHECK_FOR_ERROR - yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-3].BoolVal); - delete yyvsp[-1].TypeVal; - ; - break;} -case 250: -#line 2714 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const PointerType *PT = dyn_cast(yyvsp[-1].TypeVal->get()); + (*(yyvsp[-1].TypeVal))->getDescription()); + Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); + CHECK_FOR_ERROR + (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); + delete (yyvsp[-1].TypeVal); + ;} + break; + + case 251: +#line 2714 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); if (!PT) GEN_ERROR("Can't store to a nonpointer type: " + - (*yyvsp[-1].TypeVal)->getDescription()); + (*(yyvsp[-1].TypeVal))->getDescription()); const Type *ElTy = PT->getElementType(); - if (ElTy != yyvsp[-3].ValueVal->getType()) - GEN_ERROR("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() + + if (ElTy != (yyvsp[-3].ValueVal)->getType()) + GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + "' into space of type '" + ElTy->getDescription() + "'!"); - Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); + Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR - yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, tmpVal, yyvsp[-5].BoolVal); - delete yyvsp[-1].TypeVal; - ; - break;} -case 251: -#line 2729 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!isa(yyvsp[-2].TypeVal->get())) + (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); + delete (yyvsp[-1].TypeVal); + ;} + break; + + case 252: +#line 2729 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa((yyvsp[-2].TypeVal)->get())) GEN_ERROR("getelementptr insn requires pointer operand!"); // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct // indices to uint struct indices for compatibility. generic_gep_type_iterator::iterator> - GTI = gep_type_begin(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()), - GTE = gep_type_end(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()); - for (unsigned i = 0, e = yyvsp[0].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI) + GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()), + GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()); + for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI) if (isa(*GTI)) // Only change struct indices - if (ConstantUInt *CUI = dyn_cast((*yyvsp[0].ValueList)[i])) + if (ConstantInt *CUI = dyn_cast((*(yyvsp[0].ValueList))[i])) if (CUI->getType() == Type::UByteTy) - (*yyvsp[0].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); - if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true)) + if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) GEN_ERROR("Invalid getelementptr indices for type '" + - (*yyvsp[-2].TypeVal)->getDescription()+ "'!"); - Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal); - CHECK_FOR_ERROR - yyval.InstVal = new GetElementPtrInst(tmpVal, *yyvsp[0].ValueList); - delete yyvsp[-2].TypeVal; - delete yyvsp[0].ValueList; - ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/share/bison.simple" + (*(yyvsp[-2].TypeVal))->getDescription()+ "'!"); + Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); + CHECK_FOR_ERROR + (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); + delete (yyvsp[-2].TypeVal); + delete (yyvsp[0].ValueList); + ;} + break; + + + default: break; + } + +/* Line 1126 of yacc.c. */ +#line 5235 "llvmAsmParser.tab.c" yyvsp -= yylen; yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif + + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { ++yynerrs; - -#ifdef YYERROR_VERBOSE +#if YYERROR_VERBOSE yyn = yypact[yystate]; - if (yyn > YYFLAG && yyn < YYLAST) + if (YYPACT_NINF < yyn && yyn < YYLAST) { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; - if (count < 5) +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } - yyerror(msg); - free(msg); + yyerror (yymsg); + YYSTACK_FREE (yymsg); } else - yyerror ("parse error; also virtual memory exceeded"); + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } } else #endif /* YYERROR_VERBOSE */ - yyerror("parse error"); + yyerror (YY_("syntax error")); } - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ + if (yyerrstatus == 3) { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token - after shifting the error token. */ + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; - yyerrstatus = 3; /* Each real token shifted decrements this */ - goto yyerrhandle; +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: -yyerrdefault: /* current state does not do anything special for the error token. */ + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (0) + goto yyerrorlab; -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif +yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; -yyerrpop: /* pop the current state because it cannot handle the error token */ - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ -#if YYDEBUG != 0 - if (yydebug) + for (;;) { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); } - else if (yyn == 0) - goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ #endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) +yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + while (yyssp != yyss) { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK; } - return 1; +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; } -#line 2755 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y" + + +#line 2755 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { @@ -4688,3 +5522,4 @@ int yyerror(const char *ErrorMsg) { GenerateError(errMsg); return 0; } + diff --git a/lib/AsmParser/llvmAsmParser.h.cvs b/lib/AsmParser/llvmAsmParser.h.cvs index 6bfcf02ad3..83f40e181f 100644 --- a/lib/AsmParser/llvmAsmParser.h.cvs +++ b/lib/AsmParser/llvmAsmParser.h.cvs @@ -1,4 +1,256 @@ -typedef union { +/* A Bison parser, made by GNU Bison 2.1. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ESINT64VAL = 258, + EUINT64VAL = 259, + SINTVAL = 260, + UINTVAL = 261, + FPVAL = 262, + VOID = 263, + BOOL = 264, + SBYTE = 265, + UBYTE = 266, + SHORT = 267, + USHORT = 268, + INT = 269, + UINT = 270, + LONG = 271, + ULONG = 272, + FLOAT = 273, + DOUBLE = 274, + TYPE = 275, + LABEL = 276, + VAR_ID = 277, + LABELSTR = 278, + STRINGCONSTANT = 279, + IMPLEMENTATION = 280, + ZEROINITIALIZER = 281, + TRUETOK = 282, + FALSETOK = 283, + BEGINTOK = 284, + ENDTOK = 285, + DECLARE = 286, + GLOBAL = 287, + CONSTANT = 288, + SECTION = 289, + VOLATILE = 290, + TO = 291, + DOTDOTDOT = 292, + NULL_TOK = 293, + UNDEF = 294, + CONST = 295, + INTERNAL = 296, + LINKONCE = 297, + WEAK = 298, + APPENDING = 299, + DLLIMPORT = 300, + DLLEXPORT = 301, + EXTERN_WEAK = 302, + OPAQUE = 303, + NOT = 304, + EXTERNAL = 305, + TARGET = 306, + TRIPLE = 307, + ENDIAN = 308, + POINTERSIZE = 309, + LITTLE = 310, + BIG = 311, + ALIGN = 312, + DEPLIBS = 313, + CALL = 314, + TAIL = 315, + ASM_TOK = 316, + MODULE = 317, + SIDEEFFECT = 318, + CC_TOK = 319, + CCC_TOK = 320, + CSRETCC_TOK = 321, + FASTCC_TOK = 322, + COLDCC_TOK = 323, + X86_STDCALLCC_TOK = 324, + X86_FASTCALLCC_TOK = 325, + DATA = 326, + RET = 327, + BR = 328, + SWITCH = 329, + INVOKE = 330, + UNWIND = 331, + UNREACHABLE = 332, + ADD = 333, + SUB = 334, + MUL = 335, + DIV = 336, + REM = 337, + AND = 338, + OR = 339, + XOR = 340, + SETLE = 341, + SETGE = 342, + SETLT = 343, + SETGT = 344, + SETEQ = 345, + SETNE = 346, + MALLOC = 347, + ALLOCA = 348, + FREE = 349, + LOAD = 350, + STORE = 351, + GETELEMENTPTR = 352, + PHI_TOK = 353, + CAST = 354, + SELECT = 355, + SHL = 356, + SHR = 357, + VAARG = 358, + EXTRACTELEMENT = 359, + INSERTELEMENT = 360, + SHUFFLEVECTOR = 361, + VAARG_old = 362, + VANEXT_old = 363 + }; +#endif +/* Tokens. */ +#define ESINT64VAL 258 +#define EUINT64VAL 259 +#define SINTVAL 260 +#define UINTVAL 261 +#define FPVAL 262 +#define VOID 263 +#define BOOL 264 +#define SBYTE 265 +#define UBYTE 266 +#define SHORT 267 +#define USHORT 268 +#define INT 269 +#define UINT 270 +#define LONG 271 +#define ULONG 272 +#define FLOAT 273 +#define DOUBLE 274 +#define TYPE 275 +#define LABEL 276 +#define VAR_ID 277 +#define LABELSTR 278 +#define STRINGCONSTANT 279 +#define IMPLEMENTATION 280 +#define ZEROINITIALIZER 281 +#define TRUETOK 282 +#define FALSETOK 283 +#define BEGINTOK 284 +#define ENDTOK 285 +#define DECLARE 286 +#define GLOBAL 287 +#define CONSTANT 288 +#define SECTION 289 +#define VOLATILE 290 +#define TO 291 +#define DOTDOTDOT 292 +#define NULL_TOK 293 +#define UNDEF 294 +#define CONST 295 +#define INTERNAL 296 +#define LINKONCE 297 +#define WEAK 298 +#define APPENDING 299 +#define DLLIMPORT 300 +#define DLLEXPORT 301 +#define EXTERN_WEAK 302 +#define OPAQUE 303 +#define NOT 304 +#define EXTERNAL 305 +#define TARGET 306 +#define TRIPLE 307 +#define ENDIAN 308 +#define POINTERSIZE 309 +#define LITTLE 310 +#define BIG 311 +#define ALIGN 312 +#define DEPLIBS 313 +#define CALL 314 +#define TAIL 315 +#define ASM_TOK 316 +#define MODULE 317 +#define SIDEEFFECT 318 +#define CC_TOK 319 +#define CCC_TOK 320 +#define CSRETCC_TOK 321 +#define FASTCC_TOK 322 +#define COLDCC_TOK 323 +#define X86_STDCALLCC_TOK 324 +#define X86_FASTCALLCC_TOK 325 +#define DATA 326 +#define RET 327 +#define BR 328 +#define SWITCH 329 +#define INVOKE 330 +#define UNWIND 331 +#define UNREACHABLE 332 +#define ADD 333 +#define SUB 334 +#define MUL 335 +#define DIV 336 +#define REM 337 +#define AND 338 +#define OR 339 +#define XOR 340 +#define SETLE 341 +#define SETGE 342 +#define SETLT 343 +#define SETGT 344 +#define SETEQ 345 +#define SETNE 346 +#define MALLOC 347 +#define ALLOCA 348 +#define FREE 349 +#define LOAD 350 +#define STORE 351 +#define GETELEMENTPTR 352 +#define PHI_TOK 353 +#define CAST 354 +#define SELECT 355 +#define SHL 356 +#define SHR 357 +#define VAARG 358 +#define EXTRACTELEMENT 359 +#define INSERTELEMENT 360 +#define SHUFFLEVECTOR 361 +#define VAARG_old 362 +#define VANEXT_old 363 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 974 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -37,112 +289,14 @@ typedef union { llvm::Instruction::OtherOps OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -#define ESINT64VAL 257 -#define EUINT64VAL 258 -#define SINTVAL 259 -#define UINTVAL 260 -#define FPVAL 261 -#define VOID 262 -#define BOOL 263 -#define SBYTE 264 -#define UBYTE 265 -#define SHORT 266 -#define USHORT 267 -#define INT 268 -#define UINT 269 -#define LONG 270 -#define ULONG 271 -#define FLOAT 272 -#define DOUBLE 273 -#define TYPE 274 -#define LABEL 275 -#define VAR_ID 276 -#define LABELSTR 277 -#define STRINGCONSTANT 278 -#define IMPLEMENTATION 279 -#define ZEROINITIALIZER 280 -#define TRUETOK 281 -#define FALSETOK 282 -#define BEGINTOK 283 -#define ENDTOK 284 -#define DECLARE 285 -#define GLOBAL 286 -#define CONSTANT 287 -#define SECTION 288 -#define VOLATILE 289 -#define TO 290 -#define DOTDOTDOT 291 -#define NULL_TOK 292 -#define UNDEF 293 -#define CONST 294 -#define INTERNAL 295 -#define LINKONCE 296 -#define WEAK 297 -#define APPENDING 298 -#define DLLIMPORT 299 -#define DLLEXPORT 300 -#define EXTERN_WEAK 301 -#define OPAQUE 302 -#define NOT 303 -#define EXTERNAL 304 -#define TARGET 305 -#define TRIPLE 306 -#define ENDIAN 307 -#define POINTERSIZE 308 -#define LITTLE 309 -#define BIG 310 -#define ALIGN 311 -#define DEPLIBS 312 -#define CALL 313 -#define TAIL 314 -#define ASM_TOK 315 -#define MODULE 316 -#define SIDEEFFECT 317 -#define CC_TOK 318 -#define CCC_TOK 319 -#define CSRETCC_TOK 320 -#define FASTCC_TOK 321 -#define COLDCC_TOK 322 -#define X86_STDCALLCC_TOK 323 -#define X86_FASTCALLCC_TOK 324 -#define DATA 325 -#define RET 326 -#define BR 327 -#define SWITCH 328 -#define INVOKE 329 -#define UNWIND 330 -#define UNREACHABLE 331 -#define ADD 332 -#define SUB 333 -#define MUL 334 -#define DIV 335 -#define REM 336 -#define AND 337 -#define OR 338 -#define XOR 339 -#define SETLE 340 -#define SETGE 341 -#define SETLT 342 -#define SETGT 343 -#define SETEQ 344 -#define SETNE 345 -#define MALLOC 346 -#define ALLOCA 347 -#define FREE 348 -#define LOAD 349 -#define STORE 350 -#define GETELEMENTPTR 351 -#define PHI_TOK 352 -#define CAST 353 -#define SELECT 354 -#define SHL 355 -#define SHR 356 -#define VAARG 357 -#define EXTRACTELEMENT 358 -#define INSERTELEMENT 359 -#define SHUFFLEVECTOR 360 -#define VAARG_old 361 -#define VANEXT_old 362 - +/* Line 1447 of yacc.c. */ +#line 294 "llvmAsmParser.tab.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif extern YYSTYPE llvmAsmlval; + + + diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 2842f27f1b..25c8c2fff4 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -307,25 +307,25 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { // Check to make sure that "Ty" is an integral type, and that our // value will fit into the specified type... case ValID::ConstSIntVal: // Is it a constant pool reference?? - if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Signed integral constant '" + itostr(D.ConstPool64) + "' is invalid for type '" + Ty->getDescription() + "'!"); return 0; } - return ConstantSInt::get(Ty, D.ConstPool64); + return ConstantInt::get(Ty, D.ConstPool64); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? - if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) { - if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Integral constant '" + utostr(D.UConstPool64) + "' is invalid or out of range!"); return 0; } else { // This is really a signed reference. Transmogrify. - return ConstantSInt::get(Ty, D.ConstPool64); + return ConstantInt::get(Ty, D.ConstPool64); } } else { - return ConstantUInt::get(Ty, D.UConstPool64); + return ConstantInt::get(Ty, D.UConstPool64); } case ValID::ConstFPVal: // Is it a floating point const pool reference? @@ -1394,11 +1394,11 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr std::vector Vals; if (ETy == Type::SByteTy) { for (signed char *C = (signed char *)$3; C != (signed char *)EndStr; ++C) - Vals.push_back(ConstantSInt::get(ETy, *C)); + Vals.push_back(ConstantInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { for (unsigned char *C = (unsigned char *)$3; C != (unsigned char*)EndStr; ++C) - Vals.push_back(ConstantUInt::get(ETy, *C)); + Vals.push_back(ConstantInt::get(ETy, *C)); } else { free($3); GEN_ERROR("Cannot build string arrays of non byte sized elements!"); @@ -1561,15 +1561,15 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr }; ConstVal : SIntType EINT64VAL { // integral constants - if (!ConstantSInt::isValueValidForType($1, $2)) + if (!ConstantInt::isValueValidForType($1, $2)) GEN_ERROR("Constant value doesn't fit in type!"); - $$ = ConstantSInt::get($1, $2); + $$ = ConstantInt::get($1, $2); CHECK_FOR_ERROR } | UIntType EUINT64VAL { // integral constants - if (!ConstantUInt::isValueValidForType($1, $2)) + if (!ConstantInt::isValueValidForType($1, $2)) GEN_ERROR("Constant value doesn't fit in type!"); - $$ = ConstantUInt::get($1, $2); + $$ = ConstantInt::get($1, $2); CHECK_FOR_ERROR } | BOOL TRUETOK { // Boolean constants @@ -1610,7 +1610,7 @@ ConstExpr: CAST '(' ConstVal TO Types ')' { GTE = gep_type_end($3->getType(), $4->begin(), $4->end()); for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) if (isa(*GTI)) // Only change struct indices - if (ConstantUInt *CUI = dyn_cast((*$4)[i])) + if (ConstantInt *CUI = dyn_cast((*$4)[i])) if (CUI->getType() == Type::UByteTy) (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); @@ -2737,7 +2737,7 @@ MemoryInst : MALLOC Types OptCAlign { GTE = gep_type_end($2->get(), $4->begin(), $4->end()); for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) if (isa(*GTI)) // Only change struct indices - if (ConstantUInt *CUI = dyn_cast((*$4)[i])) + if (ConstantInt *CUI = dyn_cast((*$4)[i])) if (CUI->getType() == Type::UByteTy) (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); diff --git a/lib/AsmParser/llvmAsmParser.y.cvs b/lib/AsmParser/llvmAsmParser.y.cvs index 2842f27f1b..25c8c2fff4 100644 --- a/lib/AsmParser/llvmAsmParser.y.cvs +++ b/lib/AsmParser/llvmAsmParser.y.cvs @@ -307,25 +307,25 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { // Check to make sure that "Ty" is an integral type, and that our // value will fit into the specified type... case ValID::ConstSIntVal: // Is it a constant pool reference?? - if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Signed integral constant '" + itostr(D.ConstPool64) + "' is invalid for type '" + Ty->getDescription() + "'!"); return 0; } - return ConstantSInt::get(Ty, D.ConstPool64); + return ConstantInt::get(Ty, D.ConstPool64); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? - if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) { - if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { + if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Integral constant '" + utostr(D.UConstPool64) + "' is invalid or out of range!"); return 0; } else { // This is really a signed reference. Transmogrify. - return ConstantSInt::get(Ty, D.ConstPool64); + return ConstantInt::get(Ty, D.ConstPool64); } } else { - return ConstantUInt::get(Ty, D.UConstPool64); + return ConstantInt::get(Ty, D.UConstPool64); } case ValID::ConstFPVal: // Is it a floating point const pool reference? @@ -1394,11 +1394,11 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr std::vector Vals; if (ETy == Type::SByteTy) { for (signed char *C = (signed char *)$3; C != (signed char *)EndStr; ++C) - Vals.push_back(ConstantSInt::get(ETy, *C)); + Vals.push_back(ConstantInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { for (unsigned char *C = (unsigned char *)$3; C != (unsigned char*)EndStr; ++C) - Vals.push_back(ConstantUInt::get(ETy, *C)); + Vals.push_back(ConstantInt::get(ETy, *C)); } else { free($3); GEN_ERROR("Cannot build string arrays of non byte sized elements!"); @@ -1561,15 +1561,15 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr }; ConstVal : SIntType EINT64VAL { // integral constants - if (!ConstantSInt::isValueValidForType($1, $2)) + if (!ConstantInt::isValueValidForType($1, $2)) GEN_ERROR("Constant value doesn't fit in type!"); - $$ = ConstantSInt::get($1, $2); + $$ = ConstantInt::get($1, $2); CHECK_FOR_ERROR } | UIntType EUINT64VAL { // integral constants - if (!ConstantUInt::isValueValidForType($1, $2)) + if (!ConstantInt::isValueValidForType($1, $2)) GEN_ERROR("Constant value doesn't fit in type!"); - $$ = ConstantUInt::get($1, $2); + $$ = ConstantInt::get($1, $2); CHECK_FOR_ERROR } | BOOL TRUETOK { // Boolean constants @@ -1610,7 +1610,7 @@ ConstExpr: CAST '(' ConstVal TO Types ')' { GTE = gep_type_end($3->getType(), $4->begin(), $4->end()); for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) if (isa(*GTI)) // Only change struct indices - if (ConstantUInt *CUI = dyn_cast((*$4)[i])) + if (ConstantInt *CUI = dyn_cast((*$4)[i])) if (CUI->getType() == Type::UByteTy) (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); @@ -2737,7 +2737,7 @@ MemoryInst : MALLOC Types OptCAlign { GTE = gep_type_end($2->get(), $4->begin(), $4->end()); for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) if (isa(*GTI)) // Only change struct indices - if (ConstantUInt *CUI = dyn_cast((*$4)[i])) + if (ConstantInt *CUI = dyn_cast((*$4)[i])) if (CUI->getType() == Type::UByteTy) (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index ac6418d7a7..c7e99d0c94 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -1010,8 +1010,9 @@ void BytecodeReader::ParseInstruction(std::vector &Oprnds, // Convert ubyte struct indices into uint struct indices. if (isa(TopTy) && hasRestrictedGEPTypes) - if (ConstantUInt *C = dyn_cast(Idx.back())) - Idx[Idx.size()-1] = ConstantExpr::getCast(C, Type::UIntTy); + if (ConstantInt *C = dyn_cast(Idx.back())) + if (C->getType() == Type::UByteTy) + Idx[Idx.size()-1] = ConstantExpr::getCast(C, Type::UIntTy); NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); } @@ -1549,15 +1550,15 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) { case Type::UShortTyID: case Type::UIntTyID: { unsigned Val = read_vbr_uint(); - if (!ConstantUInt::isValueValidForType(Ty, Val)) + if (!ConstantInt::isValueValidForType(Ty, uint64_t(Val))) error("Invalid unsigned byte/short/int read."); - Result = ConstantUInt::get(Ty, Val); + Result = ConstantInt::get(Ty, Val); if (Handler) Handler->handleConstantValue(Result); break; } case Type::ULongTyID: - Result = ConstantUInt::get(Ty, read_vbr_uint64()); + Result = ConstantInt::get(Ty, read_vbr_uint64()); if (Handler) Handler->handleConstantValue(Result); break; @@ -1566,9 +1567,9 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) { case Type::IntTyID: case Type::LongTyID: { int64_t Val = read_vbr_int64(); - if (!ConstantSInt::isValueValidForType(Ty, Val)) + if (!ConstantInt::isValueValidForType(Ty, Val)) error("Invalid signed byte/short/int/long read."); - Result = ConstantSInt::get(Ty, Val); + Result = ConstantInt::get(Ty, Val); if (Handler) Handler->handleConstantValue(Result); break; } @@ -1699,12 +1700,9 @@ void BytecodeReader::ParseStringConstants(unsigned NumEntries, ValueTable &Tab){ read_data(Data, Data+ATy->getNumElements()); std::vector Elements(ATy->getNumElements()); - if (ATy->getElementType() == Type::SByteTy) - for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) - Elements[i] = ConstantSInt::get(Type::SByteTy, (signed char)Data[i]); - else - for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) - Elements[i] = ConstantUInt::get(Type::UByteTy, (unsigned char)Data[i]); + const Type* ElemType = ATy->getElementType(); + for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) + Elements[i] = ConstantInt::get(ElemType, (unsigned char)Data[i]); // Create the constant, inserting it as needed. Constant *C = ConstantArray::get(ATy, Elements); diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index 48cccda8f4..d5c4840c00 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -293,7 +293,7 @@ void BytecodeWriter::outputConstant(const Constant *CPV) { assert(CE->getNumOperands() > 0 && "ConstantExpr with 0 operands"); assert(CE->getNumOperands() != 1 || CE->getOpcode() == Instruction::Cast); output_vbr(1+CE->getNumOperands()); // flags as an expr - output_vbr(CE->getOpcode()); // flags as an expr + output_vbr(CE->getOpcode()); // Put out the CE op code for (User::const_op_iterator OI = CE->op_begin(); OI != CE->op_end(); ++OI){ int Slot = Table.getSlot(*OI); @@ -307,7 +307,7 @@ void BytecodeWriter::outputConstant(const Constant *CPV) { output_vbr(1U); // 1 -> UndefValue constant. return; } else { - output_vbr(0U); // flag as not a ConstantExpr + output_vbr(0U); // flag as not a ConstantExpr (i.e. 0 operands) } switch (CPV->getType()->getTypeID()) { @@ -322,14 +322,14 @@ void BytecodeWriter::outputConstant(const Constant *CPV) { case Type::UShortTyID: case Type::UIntTyID: case Type::ULongTyID: - output_vbr(cast(CPV)->getValue()); + output_vbr(cast(CPV)->getZExtValue()); break; case Type::SByteTyID: // Signed integer types... case Type::ShortTyID: case Type::IntTyID: case Type::LongTyID: - output_vbr(cast(CPV)->getValue()); + output_vbr(cast(CPV)->getSExtValue()); break; case Type::ArrayTyID: { @@ -881,11 +881,11 @@ void BytecodeWriter::outputConstantsInPlane(const std::vector // FIXME: Most slabs only have 1 or 2 entries! We should encode this much // more compactly. - // Output type header: [num entries][type id number] + // Put out type header: [num entries][type id number] // output_vbr(NC); - // Output the Type ID Number... + // Put out the Type ID Number... int Slot = Table.getSlot(Plane.front()->getType()); assert (Slot != -1 && "Type in constant pool but not in function!!"); output_typeid((unsigned)Slot); diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 90d77adfb3..09978344a7 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -393,14 +393,15 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) { else if (const ConstantBool *CB = dyn_cast(CV)) { assert(CB->getValue()); O << "1"; - } else if (const ConstantSInt *CI = dyn_cast(CV)) - if (((CI->getValue() << 32) >> 32) == CI->getValue()) - O << CI->getValue(); - else - O << (uint64_t)CI->getValue(); - else if (const ConstantUInt *CI = dyn_cast(CV)) - O << CI->getValue(); - else if (const GlobalValue *GV = dyn_cast(CV)) { + } else if (const ConstantInt *CI = dyn_cast(CV)) { + if (CI->getType()->isSigned()) { + if (((CI->getSExtValue() << 32) >> 32) == CI->getSExtValue()) + O << CI->getSExtValue(); + else + O << (uint64_t)CI->getSExtValue(); + } else + O << CI->getZExtValue(); + } else if (const GlobalValue *GV = dyn_cast(CV)) { // This is a constant address for a global variable or function. Use the // name of the variable or function as the address value, possibly // decorating it with GlobalVarAddrPrefix/Suffix or @@ -492,7 +493,7 @@ static void printAsCString(std::ostream &O, const ConstantArray *CVA, O << "\""; for (unsigned i = 0; i != LastElt; ++i) { unsigned char C = - (unsigned char)cast(CVA->getOperand(i))->getRawValue(); + (unsigned char)cast(CVA->getOperand(i))->getZExtValue(); if (C == '"') { O << "\\\""; @@ -524,7 +525,7 @@ static void printAsCString(std::ostream &O, const ConstantArray *CVA, void AsmPrinter::EmitString(const ConstantArray *CVA) const { unsigned NumElts = CVA->getNumOperands(); if (TAI->getAscizDirective() && NumElts && - cast(CVA->getOperand(NumElts-1))->getRawValue() == 0) { + cast(CVA->getOperand(NumElts-1))->getZExtValue() == 0) { O << TAI->getAscizDirective(); printAsCString(O, CVA, NumElts-1); } else { @@ -604,7 +605,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) { } } else if (CV->getType() == Type::ULongTy || CV->getType() == Type::LongTy) { if (const ConstantInt *CI = dyn_cast(CV)) { - uint64_t Val = CI->getRawValue(); + uint64_t Val = CI->getZExtValue(); if (TAI->getData64bitsDirective()) O << TAI->getData64bitsDirective() << Val << "\n"; diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index 515752e6b7..b5a03fc54d 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -166,10 +166,10 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) { Value *Tmp1 = new ShiftInst(Instruction::Shr, V, ConstantInt::get(Type::UByteTy,24),"bswap.1", IP); Tmp3 = BinaryOperator::createAnd(Tmp3, - ConstantUInt::get(Type::UIntTy, 0xFF0000), + ConstantInt::get(Type::UIntTy, 0xFF0000), "bswap.and3", IP); Tmp2 = BinaryOperator::createAnd(Tmp2, - ConstantUInt::get(Type::UIntTy, 0xFF00), + ConstantInt::get(Type::UIntTy, 0xFF00), "bswap.and2", IP); Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or1", IP); Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, "bswap.or2", IP); @@ -194,23 +194,24 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) { Value *Tmp1 = new ShiftInst(Instruction::Shr, V, ConstantInt::get(Type::UByteTy,56),"bswap.1", IP); Tmp7 = BinaryOperator::createAnd(Tmp7, - ConstantUInt::get(Type::ULongTy, 0xFF000000000000ULL), - "bswap.and7", IP); + ConstantInt::get(Type::ULongTy, + 0xFF000000000000ULL), + "bswap.and7", IP); Tmp6 = BinaryOperator::createAnd(Tmp6, - ConstantUInt::get(Type::ULongTy, 0xFF0000000000ULL), - "bswap.and6", IP); + ConstantInt::get(Type::ULongTy, 0xFF0000000000ULL), + "bswap.and6", IP); Tmp5 = BinaryOperator::createAnd(Tmp5, - ConstantUInt::get(Type::ULongTy, 0xFF00000000ULL), - "bswap.and5", IP); + ConstantInt::get(Type::ULongTy, 0xFF00000000ULL), + "bswap.and5", IP); Tmp4 = BinaryOperator::createAnd(Tmp4, - ConstantUInt::get(Type::ULongTy, 0xFF000000ULL), - "bswap.and4", IP); + ConstantInt::get(Type::ULongTy, 0xFF000000ULL), + "bswap.and4", IP); Tmp3 = BinaryOperator::createAnd(Tmp3, - ConstantUInt::get(Type::ULongTy, 0xFF0000ULL), - "bswap.and3", IP); + ConstantInt::get(Type::ULongTy, 0xFF0000ULL), + "bswap.and3", IP); Tmp2 = BinaryOperator::createAnd(Tmp2, - ConstantUInt::get(Type::ULongTy, 0xFF00ULL), - "bswap.and2", IP); + ConstantInt::get(Type::ULongTy, 0xFF00ULL), + "bswap.and2", IP); Tmp8 = BinaryOperator::createOr(Tmp8, Tmp7, "bswap.or1", IP); Tmp6 = BinaryOperator::createOr(Tmp6, Tmp5, "bswap.or2", IP); Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, "bswap.or3", IP); @@ -247,8 +248,8 @@ static Value *LowerCTPOP(Value *V, Instruction *IP) { unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) { Value *MaskCst = - ConstantExpr::getCast(ConstantUInt::get(Type::ULongTy, - MaskValues[ct]), V->getType()); + ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), + V->getType()); Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP); Value *VShift = new ShiftInst(Instruction::Shr, V, ConstantInt::get(Type::UByteTy, i), "ctpop.sh", IP); @@ -395,7 +396,7 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { case Intrinsic::readcyclecounter: { std::cerr << "WARNING: this target does not support the llvm.readcyclecoun" << "ter intrinsic. It is being lowered to a constant 0\n"; - CI->replaceAllUsesWith(ConstantUInt::get(Type::ULongTy, 0)); + CI->replaceAllUsesWith(ConstantInt::get(Type::ULongTy, 0)); break; } diff --git a/lib/CodeGen/MachineDebugInfo.cpp b/lib/CodeGen/MachineDebugInfo.cpp index 7ca63b0ba4..a1f4f1338b 100644 --- a/lib/CodeGen/MachineDebugInfo.cpp +++ b/lib/CodeGen/MachineDebugInfo.cpp @@ -120,7 +120,7 @@ static bool isGlobalVariable(Value *V) { /// getUIntOperand - Return ith operand if it is an unsigned integer. /// -static ConstantUInt *getUIntOperand(GlobalVariable *GV, unsigned i) { +static ConstantInt *getUIntOperand(GlobalVariable *GV, unsigned i) { // Make sure the GlobalVariable has an initializer. if (!GV->hasInitializer()) return NULL; @@ -133,8 +133,9 @@ static ConstantUInt *getUIntOperand(GlobalVariable *GV, unsigned i) { if (i >= N) return NULL; // Check constant. - return dyn_cast(CI->getOperand(i)); + return dyn_cast(CI->getOperand(i)); } + //===----------------------------------------------------------------------===// /// ApplyToFields - Target the visitor to each field of the debug information @@ -192,19 +193,19 @@ public: /// virtual void Apply(int &Field) { Constant *C = CI->getOperand(I++); - Field = cast(C)->getValue(); + Field = cast(C)->getSExtValue(); } virtual void Apply(unsigned &Field) { Constant *C = CI->getOperand(I++); - Field = cast(C)->getValue(); + Field = cast(C)->getZExtValue(); } virtual void Apply(int64_t &Field) { Constant *C = CI->getOperand(I++); - Field = cast(C)->getValue(); + Field = cast(C)->getSExtValue(); } virtual void Apply(uint64_t &Field) { Constant *C = CI->getOperand(I++); - Field = cast(C)->getValue(); + Field = cast(C)->getZExtValue(); } virtual void Apply(bool &Field) { Constant *C = CI->getOperand(I++); @@ -261,16 +262,16 @@ public: /// Apply - Set the value of each of the fields. /// virtual void Apply(int &Field) { - Elements.push_back(ConstantSInt::get(Type::IntTy, Field)); + Elements.push_back(ConstantInt::get(Type::IntTy, int32_t(Field))); } virtual void Apply(unsigned &Field) { - Elements.push_back(ConstantUInt::get(Type::UIntTy, Field)); + Elements.push_back(ConstantInt::get(Type::UIntTy, uint32_t(Field))); } virtual void Apply(int64_t &Field) { - Elements.push_back(ConstantSInt::get(Type::LongTy, Field)); + Elements.push_back(ConstantInt::get(Type::LongTy, int64_t(Field))); } virtual void Apply(uint64_t &Field) { - Elements.push_back(ConstantUInt::get(Type::ULongTy, Field)); + Elements.push_back(ConstantInt::get(Type::ULongTy, uint64_t(Field))); } virtual void Apply(bool &Field) { Elements.push_back(ConstantBool::get(Field)); @@ -467,8 +468,8 @@ public: /// TagFromGlobal - Returns the tag number from a debug info descriptor /// GlobalVariable. Return DIIValid if operand is not an unsigned int. unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { - ConstantUInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getValue() & ~LLVMDebugVersionMask) : + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & ~LLVMDebugVersionMask) : (unsigned)DW_TAG_invalid; } @@ -476,8 +477,8 @@ unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { /// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned /// int. unsigned DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) { - ConstantUInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getValue() & LLVMDebugVersionMask) : + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & LLVMDebugVersionMask) : (unsigned)DW_TAG_invalid; } diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 723177f97d..125e46c0ca 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -3562,7 +3562,7 @@ SDOperand SelectionDAGLegalize::ExpandBUILD_VECTOR(SDNode *Node) { CV.push_back(ConstantFP::get(OpNTy, V->getValue())); } else if (ConstantSDNode *V = dyn_cast(Node->getOperand(i))) { - CV.push_back(ConstantUInt::get(OpNTy, V->getValue())); + CV.push_back(ConstantInt::get(OpNTy, V->getValue())); } else { assert(Node->getOperand(i).getOpcode() == ISD::UNDEF); CV.push_back(UndefValue::get(OpNTy)); @@ -3915,7 +3915,7 @@ ExpandIntToFP(bool isSigned, MVT::ValueType DestTy, SDOperand Source) { SignSet, Four, Zero); uint64_t FF = 0x5f800000ULL; if (TLI.isLittleEndian()) FF <<= 32; - static Constant *FudgeFactor = ConstantUInt::get(Type::ULongTy, FF); + static Constant *FudgeFactor = ConstantInt::get(Type::ULongTy, FF); SDOperand CPIdx = DAG.getConstantPool(FudgeFactor, TLI.getPointerTy()); CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset); @@ -4046,7 +4046,7 @@ SDOperand SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned, case MVT::i64: FF = 0x5F800000ULL; break; // 2^64 (as a float) } if (TLI.isLittleEndian()) FF <<= 32; - static Constant *FudgeFactor = ConstantUInt::get(Type::ULongTy, FF); + static Constant *FudgeFactor = ConstantInt::get(Type::ULongTy, FF); SDOperand CPIdx = DAG.getConstantPool(FudgeFactor, TLI.getPointerTy()); CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 7cf3f5cb0d..238ed97843 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -236,21 +236,22 @@ FunctionLoweringInfo::FunctionLoweringInfo(TargetLowering &tli, Function::iterator BB = Fn.begin(), EB = Fn.end(); for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (AllocaInst *AI = dyn_cast(I)) - if (ConstantUInt *CUI = dyn_cast(AI->getArraySize())) { + if (ConstantInt *CUI = dyn_cast(AI->getArraySize())) { const Type *Ty = AI->getAllocatedType(); uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty); unsigned Align = std::max((unsigned)TLI.getTargetData()->getTypeAlignment(Ty), AI->getAlignment()); - // If the alignment of the value is smaller than the size of the value, - // and if the size of the value is particularly small (<= 8 bytes), - // round up to the size of the value for potentially better performance. + // If the alignment of the value is smaller than the size of the + // value, and if the size of the value is particularly small + // (<= 8 bytes), round up to the size of the value for potentially + // better performance. // // FIXME: This could be made better with a preferred alignment hook in // TargetData. It serves primarily to 8-byte align doubles for X86. if (Align < TySize && TySize <= 8) Align = TySize; - TySize *= CUI->getValue(); // Get total allocated size. + TySize *= CUI->getZExtValue(); // Get total allocated size. if (TySize == 0) TySize = 1; // Don't create zero-sized stack objects. StaticAllocaMap[AI] = MF.getFrameInfo()->CreateStackObject((unsigned)TySize, Align); @@ -393,11 +394,13 @@ class SelectionDAGLowering { /// The comparison function for sorting Case values. struct CaseCmp { bool operator () (const Case& C1, const Case& C2) { - if (const ConstantUInt* U1 = dyn_cast(C1.first)) - return U1->getValue() < cast(C2.first)->getValue(); + if (const ConstantInt* I1 = dyn_cast(C1.first)) + if (I1->getType()->isUnsigned()) + return I1->getZExtValue() < + cast(C2.first)->getZExtValue(); - const ConstantSInt* S1 = dyn_cast(C1.first); - return S1->getValue() < cast(C2.first)->getValue(); + return cast(C1.first)->getSExtValue() < + cast(C2.first)->getSExtValue(); } }; @@ -637,7 +640,7 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { return N = DAG.getNode(ISD::VBUILD_VECTOR,MVT::Vector,&Ops[0],Ops.size()); } else { // Canonicalize all constant ints to be unsigned. - return N = DAG.getConstant(cast(C)->getRawValue(),VT); + return N = DAG.getConstant(cast(C)->getZExtValue(),VT); } } @@ -930,8 +933,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // lowering the switch to a binary tree of conditional branches. if (TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) && Cases.size() > 5) { - uint64_t First = cast(Cases.front().first)->getRawValue(); - uint64_t Last = cast(Cases.back().first)->getRawValue(); + uint64_t First =cast(Cases.front().first)->getZExtValue(); + uint64_t Last = cast(Cases.back().first)->getZExtValue(); double Density = (double)Cases.size() / (double)((Last - First) + 1ULL); if (Density >= 0.3125) { @@ -979,9 +982,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // the default BB. std::vector DestBBs; uint64_t TEI = First; - for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) - if (cast(ii->first)->getRawValue() == TEI) { + if (cast(ii->first)->getZExtValue() == TEI) { DestBBs.push_back(ii->second); ++ii; } else { @@ -1055,8 +1057,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // rather than creating a leaf node for it. if ((LHSR.second - LHSR.first) == 1 && LHSR.first->first == CR.GE && - cast(C)->getRawValue() == - (cast(CR.GE)->getRawValue() + 1ULL)) { + cast(C)->getZExtValue() == + (cast(CR.GE)->getZExtValue() + 1ULL)) { LHSBB = LHSR.first->second; } else { LHSBB = new MachineBasicBlock(LLVMBB); @@ -1069,8 +1071,8 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) { // is CR.LT - 1, then we can branch directly to the target block for // the current Case Value, rather than emitting a RHS leaf node for it. if ((RHSR.second - RHSR.first) == 1 && CR.LT && - cast(RHSR.first->first)->getRawValue() == - (cast(CR.LT)->getRawValue() - 1ULL)) { + cast(RHSR.first->first)->getZExtValue() == + (cast(CR.LT)->getZExtValue() - 1ULL)) { RHSBB = RHSR.first->second; } else { RHSBB = new MachineBasicBlock(LLVMBB); @@ -1259,7 +1261,7 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) { OI != E; ++OI) { Value *Idx = *OI; if (const StructType *StTy = dyn_cast(Ty)) { - unsigned Field = cast(Idx)->getValue(); + unsigned Field = cast(Idx)->getZExtValue(); if (Field) { // N = N + Offset uint64_t Offset = TD->getStructLayout(StTy)->MemberOffsets[Field]; @@ -1272,13 +1274,14 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) { // If this is a constant subscript, handle it quickly. if (ConstantInt *CI = dyn_cast(Idx)) { - if (CI->getRawValue() == 0) continue; - + if (CI->getZExtValue() == 0) continue; uint64_t Offs; - if (ConstantSInt *CSI = dyn_cast(CI)) - Offs = (int64_t)TD->getTypeSize(Ty)*CSI->getValue(); + if (CI->getType()->isSigned()) + Offs = (int64_t) + TD->getTypeSize(Ty)*cast(CI)->getSExtValue(); else - Offs = TD->getTypeSize(Ty)*cast(CI)->getValue(); + Offs = + TD->getTypeSize(Ty)*cast(CI)->getZExtValue(); N = DAG.getNode(ISD::ADD, N.getValueType(), N, getIntPtrConstant(Offs)); continue; } @@ -2732,7 +2735,7 @@ SDOperand TargetLowering::CustomPromoteOperation(SDOperand Op, } void SelectionDAGLowering::visitFrameReturnAddress(CallInst &I, bool isFrame) { - unsigned Depth = (unsigned)cast(I.getOperand(1))->getValue(); + unsigned Depth = (unsigned)cast(I.getOperand(1))->getZExtValue(); std::pair Result = TLI.LowerFrameReturnAddress(isFrame, getRoot(), Depth, DAG); setValue(&I, Result.first); @@ -3126,7 +3129,7 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, for (GetElementPtrInst::op_iterator OI = GEPI->op_begin()+1, E = GEPI->op_end(); OI != E; ++OI) { if (ConstantInt *CI = dyn_cast(*OI)) { - if (CI->getRawValue()) { + if (CI->getZExtValue()) { hasConstantIndex = true; break; } @@ -3159,7 +3162,7 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, E = GEPI->op_end(); OI != E; ++OI) { Value *Idx = *OI; if (const StructType *StTy = dyn_cast(Ty)) { - unsigned Field = cast(Idx)->getValue(); + unsigned Field = cast(Idx)->getZExtValue(); if (Field) ConstantOffset += TD->getStructLayout(StTy)->MemberOffsets[Field]; Ty = StTy->getElementType(Field); @@ -3168,12 +3171,11 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, // Handle constant subscripts. if (ConstantInt *CI = dyn_cast(Idx)) { - if (CI->getRawValue() == 0) continue; - - if (ConstantSInt *CSI = dyn_cast(CI)) - ConstantOffset += (int64_t)TD->getTypeSize(Ty)*CSI->getValue(); + if (CI->getZExtValue() == 0) continue; + if (CI->getType()->isSigned()) + ConstantOffset += (int64_t)TD->getTypeSize(Ty)*CI->getSExtValue(); else - ConstantOffset+=TD->getTypeSize(Ty)*cast(CI)->getValue(); + ConstantOffset += TD->getTypeSize(Ty)*CI->getZExtValue(); continue; } @@ -3185,7 +3187,7 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, uint64_t ElementSize = TD->getTypeSize(Ty); // Mask off bits that should not be set. ElementSize &= ~0ULL >> (64-UIntPtrTy->getPrimitiveSizeInBits()); - Constant *SizeCst = ConstantUInt::get(UIntPtrTy, ElementSize); + Constant *SizeCst = ConstantInt::get(UIntPtrTy, ElementSize); // Multiply by the element size and add to the base. Idx = BinaryOperator::createMul(Idx, SizeCst, "", GEPI); @@ -3195,7 +3197,7 @@ static bool OptimizeGEPExpression(GetElementPtrInst *GEPI, // Make sure that the offset fits in uintptr_t. ConstantOffset &= ~0ULL >> (64-UIntPtrTy->getPrimitiveSizeInBits()); - Constant *PtrOffset = ConstantUInt::get(UIntPtrTy, ConstantOffset); + Constant *PtrOffset = ConstantInt::get(UIntPtrTy, ConstantOffset); // Okay, we have now emitted all of the variable index parts to the BB that // the GEP is defined in. Loop over all of the using instructions, inserting diff --git a/lib/Debugger/ProgramInfo.cpp b/lib/Debugger/ProgramInfo.cpp index b60f5fc4bc..7e12cf80d6 100644 --- a/lib/Debugger/ProgramInfo.cpp +++ b/lib/Debugger/ProgramInfo.cpp @@ -114,8 +114,8 @@ SourceFileInfo::SourceFileInfo(const GlobalVariable *Desc, if (Desc && Desc->hasInitializer()) if (ConstantStruct *CS = dyn_cast(Desc->getInitializer())) if (CS->getNumOperands() > 4) { - if (ConstantUInt *CUI = dyn_cast(CS->getOperand(1))) - Version = CUI->getValue(); + if (ConstantInt *CUI = dyn_cast(CS->getOperand(1))) + Version = CUI->getZExtValue(); BaseName = CS->getOperand(3)->getStringValue(); Directory = CS->getOperand(4)->getStringValue(); @@ -237,8 +237,8 @@ ProgramInfo::getSourceFile(const GlobalVariable *Desc) { if (Desc && Desc->hasInitializer()) if (ConstantStruct *CS = dyn_cast(Desc->getInitializer())) if (CS->getNumOperands() > 2) - if (ConstantUInt *CUI = dyn_cast(CS->getOperand(2))) - LangID = CUI->getValue(); + if (ConstantInt *CUI = dyn_cast(CS->getOperand(2))) + LangID = CUI->getZExtValue(); const SourceLanguage &Lang = SourceLanguage::get(LangID); SourceFileInfo *New = Lang.createSourceFileInfo(Desc, *this); diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 067f24de8b..f61369cd50 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -390,19 +390,19 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { } switch (C->getType()->getTypeID()) { -#define GET_CONST_VAL(TY, CTY, CLASS) \ - case Type::TY##TyID: Result.TY##Val = (CTY)cast(C)->getValue(); break - GET_CONST_VAL(Bool , bool , ConstantBool); - GET_CONST_VAL(UByte , unsigned char , ConstantUInt); - GET_CONST_VAL(SByte , signed char , ConstantSInt); - GET_CONST_VAL(UShort , unsigned short, ConstantUInt); - GET_CONST_VAL(Short , signed short , ConstantSInt); - GET_CONST_VAL(UInt , unsigned int , ConstantUInt); - GET_CONST_VAL(Int , signed int , ConstantSInt); - GET_CONST_VAL(ULong , uint64_t , ConstantUInt); - GET_CONST_VAL(Long , int64_t , ConstantSInt); - GET_CONST_VAL(Float , float , ConstantFP); - GET_CONST_VAL(Double , double , ConstantFP); +#define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \ + case Type::TY##TyID: Result.TY##Val = (CTY)cast(C)->GETMETH(); break + GET_CONST_VAL(Bool , bool , ConstantBool, getValue); + GET_CONST_VAL(UByte , unsigned char , ConstantInt, getZExtValue); + GET_CONST_VAL(SByte , signed char , ConstantInt, getSExtValue); + GET_CONST_VAL(UShort , unsigned short, ConstantInt, getZExtValue); + GET_CONST_VAL(Short , signed short , ConstantInt, getSExtValue); + GET_CONST_VAL(UInt , unsigned int , ConstantInt, getZExtValue); + GET_CONST_VAL(Int , signed int , ConstantInt, getSExtValue); + GET_CONST_VAL(ULong , uint64_t , ConstantInt, getZExtValue); + GET_CONST_VAL(Long , int64_t , ConstantInt, getSExtValue); + GET_CONST_VAL(Float , float , ConstantFP, getValue); + GET_CONST_VAL(Double , double , ConstantFP, getValue); #undef GET_CONST_VAL case Type::PointerTyID: if (isa(C)) diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index 4104ff3636..8c812f82d4 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -735,8 +735,8 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I, if (const StructType *STy = dyn_cast(*I)) { const StructLayout *SLO = TD.getStructLayout(STy); - const ConstantUInt *CPU = cast(I.getOperand()); - unsigned Index = unsigned(CPU->getValue()); + const ConstantInt *CPU = cast(I.getOperand()); + unsigned Index = unsigned(CPU->getZExtValue()); Total += (PointerTy)SLO->MemberOffsets[Index]; } else { diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 0a5423ef9d..9795eb7935 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -196,22 +196,22 @@ GenericValue JIT::runFunction(Function *F, switch (ArgTy->getTypeID()) { default: assert(0 && "Unknown argument type for function call!"); case Type::BoolTyID: C = ConstantBool::get(AV.BoolVal); break; - case Type::SByteTyID: C = ConstantSInt::get(ArgTy, AV.SByteVal); break; - case Type::UByteTyID: C = ConstantUInt::get(ArgTy, AV.UByteVal); break; - case Type::ShortTyID: C = ConstantSInt::get(ArgTy, AV.ShortVal); break; - case Type::UShortTyID: C = ConstantUInt::get(ArgTy, AV.UShortVal); break; - case Type::IntTyID: C = ConstantSInt::get(ArgTy, AV.IntVal); break; - case Type::UIntTyID: C = ConstantUInt::get(ArgTy, AV.UIntVal); break; - case Type::LongTyID: C = ConstantSInt::get(ArgTy, AV.LongVal); break; - case Type::ULongTyID: C = ConstantUInt::get(ArgTy, AV.ULongVal); break; - case Type::FloatTyID: C = ConstantFP ::get(ArgTy, AV.FloatVal); break; - case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, AV.DoubleVal); break; + case Type::SByteTyID: C = ConstantInt::get(ArgTy, AV.SByteVal); break; + case Type::UByteTyID: C = ConstantInt::get(ArgTy, AV.UByteVal); break; + case Type::ShortTyID: C = ConstantInt::get(ArgTy, AV.ShortVal); break; + case Type::UShortTyID: C = ConstantInt::get(ArgTy, AV.UShortVal); break; + case Type::IntTyID: C = ConstantInt::get(ArgTy, AV.IntVal); break; + case Type::UIntTyID: C = ConstantInt::get(ArgTy, AV.UIntVal); break; + case Type::LongTyID: C = ConstantInt::get(ArgTy, AV.LongVal); break; + case Type::ULongTyID: C = ConstantInt::get(ArgTy, AV.ULongVal); break; + case Type::FloatTyID: C = ConstantFP ::get(ArgTy, AV.FloatVal); break; + case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, AV.DoubleVal); break; case Type::PointerTyID: void *ArgPtr = GVTOP(AV); if (sizeof(void*) == 4) { - C = ConstantSInt::get(Type::IntTy, (int)(intptr_t)ArgPtr); + C = ConstantInt::get(Type::IntTy, (int)(intptr_t)ArgPtr); } else { - C = ConstantSInt::get(Type::LongTy, (intptr_t)ArgPtr); + C = ConstantInt::get(Type::LongTy, (intptr_t)ArgPtr); } C = ConstantExpr::getCast(C, ArgTy); // Cast the integer to pointer break; diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index beb61754fc..9e12c9343d 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -161,7 +161,7 @@ uint64_t ConstantRange::getSetSize() const { // Simply subtract the bounds... Constant *Result = ConstantExpr::getSub(Upper, Lower); - return cast(Result)->getRawValue(); + return cast(Result)->getZExtValue(); } /// contains - Return true if the specified value is in the set. @@ -288,7 +288,7 @@ ConstantRange ConstantRange::zeroExtend(const Type *Ty) const { // Change a source full set into [0, 1 << 8*numbytes) unsigned SrcTySize = getLower()->getType()->getPrimitiveSize(); return ConstantRange(Constant::getNullValue(Ty), - ConstantUInt::get(Ty, 1ULL << SrcTySize*8)); + ConstantInt::get(Ty, 1ULL << SrcTySize*8)); } Constant *Lower = getLower(); diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp index 4b197db407..cd49271e43 100644 --- a/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -810,8 +810,7 @@ bool ARMDAGToDAGISel::SelectAddrMode1(SDOperand N, case ISD::Constant: { uint32_t val = cast(N)->getValue(); if(!isRotInt8Immediate(val)) { - const Type *t = MVT::getTypeForValueType(MVT::i32); - Constant *C = ConstantUInt::get(t, val); + Constant *C = ConstantInt::get(Type::UIntTy, val); int alignment = 2; SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment); SDOperand Z = CurDAG->getTargetConstant(0, MVT::i32); diff --git a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp index b3b2461eaf..15ee143172 100644 --- a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp +++ b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp @@ -317,8 +317,7 @@ SDNode *AlphaDAGToDAGISel::Select(SDOperand Op) { break; //(zext (LDAH (LDA))) //Else use the constant pool MachineConstantPool *CP = BB->getParent()->getConstantPool(); - ConstantUInt *C = - ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , uval); + ConstantInt *C = ConstantInt::get(Type::ULongTy, uval); SDOperand CPI = CurDAG->getTargetConstantPool(C, MVT::i64); SDNode *Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI, getGlobalBaseReg()); diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 88113a0347..f31f92018b 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -460,7 +460,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) { // Do not include the last character, which we know is null for (unsigned i = 0, e = CPA->getNumOperands()-1; i != e; ++i) { - unsigned char C = cast(CPA->getOperand(i))->getRawValue(); + unsigned char C = cast(CPA->getOperand(i))->getZExtValue(); // Print it out literally if it is a printable character. The only thing // to be careful about is when the last letter output was a hex escape @@ -642,31 +642,31 @@ void CWriter::printConstant(Constant *CPV) { break; case Type::SByteTyID: case Type::ShortTyID: - Out << cast(CPV)->getValue(); + Out << cast(CPV)->getSExtValue(); break; case Type::IntTyID: - if ((int)cast(CPV)->getValue() == (int)0x80000000) + if ((int)cast(CPV)->getSExtValue() == (int)0x80000000) Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning else - Out << cast(CPV)->getValue(); + Out << cast(CPV)->getSExtValue(); break; case Type::LongTyID: - if (cast(CPV)->isMinValue()) + if (cast(CPV)->isMinValue()) Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)"; else - Out << cast(CPV)->getValue() << "ll"; + Out << cast(CPV)->getSExtValue() << "ll"; break; case Type::UByteTyID: case Type::UShortTyID: - Out << cast(CPV)->getValue(); + Out << cast(CPV)->getZExtValue(); break; case Type::UIntTyID: - Out << cast(CPV)->getValue() << 'u'; + Out << cast(CPV)->getZExtValue() << 'u'; break; case Type::ULongTyID: - Out << cast(CPV)->getValue() << "ull"; + Out << cast(CPV)->getZExtValue() << "ull"; break; case Type::FloatTyID: @@ -2002,14 +2002,14 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I, // Print out the -> operator if possible... if (TmpI != E && isa(*TmpI)) { Out << (HasImplicitAddress ? "." : "->"); - Out << "field" << cast(TmpI.getOperand())->getValue(); + Out << "field" << cast(TmpI.getOperand())->getZExtValue(); I = ++TmpI; } } for (; I != E; ++I) if (isa(*I)) { - Out << ".field" << cast(I.getOperand())->getValue(); + Out << ".field" << cast(I.getOperand())->getZExtValue(); } else { Out << '['; writeOperand(I.getOperand()); diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 88113a0347..f31f92018b 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -460,7 +460,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) { // Do not include the last character, which we know is null for (unsigned i = 0, e = CPA->getNumOperands()-1; i != e; ++i) { - unsigned char C = cast(CPA->getOperand(i))->getRawValue(); + unsigned char C = cast(CPA->getOperand(i))->getZExtValue(); // Print it out literally if it is a printable character. The only thing // to be careful about is when the last letter output was a hex escape @@ -642,31 +642,31 @@ void CWriter::printConstant(Constant *CPV) { break; case Type::SByteTyID: case Type::ShortTyID: - Out << cast(CPV)->getValue(); + Out << cast(CPV)->getSExtValue(); break; case Type::IntTyID: - if ((int)cast(CPV)->getValue() == (int)0x80000000) + if ((int)cast(CPV)->getSExtValue() == (int)0x80000000) Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning else - Out << cast(CPV)->getValue(); + Out << cast(CPV)->getSExtValue(); break; case Type::LongTyID: - if (cast(CPV)->isMinValue()) + if (cast(CPV)->isMinValue()) Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)"; else - Out << cast(CPV)->getValue() << "ll"; + Out << cast(CPV)->getSExtValue() << "ll"; break; case Type::UByteTyID: case Type::UShortTyID: - Out << cast(CPV)->getValue(); + Out << cast(CPV)->getZExtValue(); break; case Type::UIntTyID: - Out << cast(CPV)->getValue() << 'u'; + Out << cast(CPV)->getZExtValue() << 'u'; break; case Type::ULongTyID: - Out << cast(CPV)->getValue() << "ull"; + Out << cast(CPV)->getZExtValue() << "ull"; break; case Type::FloatTyID: @@ -2002,14 +2002,14 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I, // Print out the -> operator if possible... if (TmpI != E && isa(*TmpI)) { Out << (HasImplicitAddress ? "." : "->"); - Out << "field" << cast(TmpI.getOperand())->getValue(); + Out << "field" << cast(TmpI.getOperand())->getZExtValue(); I = ++TmpI; } } for (; I != E; ++I) if (isa(*I)) { - Out << ".field" << cast(I.getOperand())->getValue(); + Out << ".field" << cast(I.getOperand())->getZExtValue(); } else { Out << '['; writeOperand(I.getOperand()); diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index cb602a6352..834177420f 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -330,7 +330,7 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy, for (unsigned CurIDX = 0; CurIDX != Idx.size(); ++CurIDX, ++TI) { if (const StructType *STy = dyn_cast(*TI)) { assert(Idx[CurIDX]->getType() == Type::UIntTy && "Illegal struct idx"); - unsigned FieldNo = cast(Idx[CurIDX])->getValue(); + unsigned FieldNo = cast(Idx[CurIDX])->getZExtValue(); // Get structure layout information... const StructLayout *Layout = getStructLayout(STy); @@ -346,7 +346,7 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy, Ty = cast(Ty)->getElementType(); // Get the array index and the size of each array element. - int64_t arrayIdx = cast(Idx[CurIDX])->getRawValue(); + int64_t arrayIdx = cast(Idx[CurIDX])->getSExtValue(); Result += arrayIdx * (int64_t)getTypeSize(Ty); } } diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp index a7d1351e7a..7a420d894e 100755 --- a/lib/Target/X86/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/X86IntelAsmPrinter.cpp @@ -474,7 +474,7 @@ void X86IntelAsmPrinter::EmitString(const ConstantArray *CVA) const { unsigned len = 0; bool inString = false; for (unsigned i = 0; i < NumElts; i++) { - int n = cast(CVA->getOperand(i))->getRawValue() & 255; + int n = cast(CVA->getOperand(i))->getZExtValue() & 255; if (len == 0) O << "\tdb "; diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp index 5183d43bc7..79f21b5c02 100644 --- a/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -307,8 +307,8 @@ namespace { unsigned idx = 0; for (; idx < LHS.size() && idx < RHS.size(); ++idx) { if (LHS[idx] != RHS[idx]) { - return cast(LHS[idx])->getRawValue() < - cast(RHS[idx])->getRawValue(); + return cast(LHS[idx])->getZExtValue() < + cast(RHS[idx])->getZExtValue(); } } @@ -518,7 +518,7 @@ Function *ArgPromotion::DoPromotion(Function *F, std::string NewName = I->getName(); for (unsigned i = 0, e = Operands.size(); i != e; ++i) if (ConstantInt *CI = dyn_cast(Operands[i])) - NewName += "."+itostr((int64_t)CI->getRawValue()); + NewName += "."+itostr((int64_t)CI->getZExtValue()); else NewName += ".x"; TheArg->setName(NewName+".val"); diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 5abd290527..fc39fe8ad5 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -270,7 +270,7 @@ static bool AnalyzeGlobal(Value *V, GlobalStatus &GS, static Constant *getAggregateConstantElement(Constant *Agg, Constant *Idx) { ConstantInt *CI = dyn_cast(Idx); if (!CI) return 0; - unsigned IdxV = (unsigned)CI->getRawValue(); + unsigned IdxV = CI->getZExtValue(); if (ConstantStruct *CS = dyn_cast(Agg)) { if (IdxV < CS->getNumOperands()) return CS->getOperand(IdxV); @@ -384,7 +384,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) { NewGlobals.reserve(STy->getNumElements()); for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { Constant *In = getAggregateConstantElement(Init, - ConstantUInt::get(Type::UIntTy, i)); + ConstantInt::get(Type::UIntTy, i)); assert(In && "Couldn't get element of initializer?"); GlobalVariable *NGV = new GlobalVariable(STy->getElementType(i), false, GlobalVariable::InternalLinkage, @@ -406,7 +406,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) { NewGlobals.reserve(NumElements); for (unsigned i = 0, e = NumElements; i != e; ++i) { Constant *In = getAggregateConstantElement(Init, - ConstantUInt::get(Type::UIntTy, i)); + ConstantInt::get(Type::UIntTy, i)); assert(In && "Couldn't get element of initializer?"); GlobalVariable *NGV = new GlobalVariable(STy->getElementType(), false, @@ -435,8 +435,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) { // Ignore the 1th operand, which has to be zero or else the program is quite // broken (undefined). Get the 2nd operand, which is the structure or array // index. - unsigned Val = - (unsigned)cast(GEP->getOperand(2))->getRawValue(); + unsigned Val = cast(GEP->getOperand(2))->getZExtValue(); if (Val >= NewGlobals.size()) Val = 0; // Out of bound array access. Value *NewPtr = NewGlobals[Val]; @@ -673,11 +672,11 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV, DEBUG(std::cerr << "PROMOTING MALLOC GLOBAL: " << *GV << " MALLOC = " <<*MI); ConstantInt *NElements = cast(MI->getArraySize()); - if (NElements->getRawValue() != 1) { + if (NElements->getZExtValue() != 1) { // If we have an array allocation, transform it to a single element // allocation to make the code below simpler. Type *NewTy = ArrayType::get(MI->getAllocatedType(), - (unsigned)NElements->getRawValue()); + NElements->getZExtValue()); MallocInst *NewMI = new MallocInst(NewTy, Constant::getNullValue(Type::UIntTy), MI->getAlignment(), MI->getName(), MI); @@ -886,11 +885,12 @@ static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Ptr, // Otherwise, this should be: 'getelementptr Ptr, Idx, uint FieldNo ...' GetElementPtrInst *GEPI = cast(User); - assert(GEPI->getNumOperands() >= 3 && isa(GEPI->getOperand(2)) + assert(GEPI->getNumOperands() >= 3 && isa(GEPI->getOperand(2)) + && GEPI->getOperand(2)->getType()->isUnsigned() && "Unexpected GEPI!"); // Load the pointer for this field. - unsigned FieldNo = cast(GEPI->getOperand(2))->getValue(); + unsigned FieldNo = cast(GEPI->getOperand(2))->getZExtValue(); if (InsertedLoadsForPtr.size() <= FieldNo) InsertedLoadsForPtr.resize(FieldNo+1); if (InsertedLoadsForPtr[FieldNo] == 0) @@ -1088,7 +1088,7 @@ static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal, // Restrict this transformation to only working on small allocations // (2048 bytes currently), as we don't want to introduce a 16M global or // something. - if (NElements->getRawValue()* + if (NElements->getZExtValue()* TD.getTypeSize(MI->getAllocatedType()) < 2048) { GVI = OptimizeGlobalAddressOfMalloc(GV, MI); return true; @@ -1431,7 +1431,7 @@ GlobalVariable *GlobalOpt::FindGlobalCtors(Module &M) { // Init priority must be standard. ConstantInt *CI = dyn_cast(CS->getOperand(0)); - if (!CI || CI->getRawValue() != 65535) + if (!CI || CI->getZExtValue() != 65535) return 0; } else { return 0; @@ -1461,7 +1461,7 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL, const std::vector &Ctors) { // If we made a change, reassemble the initializer list. std::vector CSVals; - CSVals.push_back(ConstantSInt::get(Type::IntTy, 65535)); + CSVals.push_back(ConstantInt::get(Type::IntTy, 65535)); CSVals.push_back(0); // Create the new init list. @@ -1474,7 +1474,7 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL, std::vector(), false); const PointerType *PFTy = PointerType::get(FTy); CSVals[1] = Constant::getNullValue(PFTy); - CSVals[0] = ConstantSInt::get(Type::IntTy, 2147483647); + CSVals[0] = ConstantInt::get(Type::IntTy, 2147483647); } CAList.push_back(ConstantStruct::get(CSVals)); } @@ -1575,10 +1575,9 @@ static Constant *EvaluateStoreInto(Constant *Init, Constant *Val, } // Replace the element that we are supposed to. - ConstantUInt *CU = cast(Addr->getOperand(OpNo)); - assert(CU->getValue() < STy->getNumElements() && - "Struct index out of range!"); - unsigned Idx = (unsigned)CU->getValue(); + ConstantInt *CU = cast(Addr->getOperand(OpNo)); + unsigned Idx = CU->getZExtValue(); + assert(Idx < STy->getNumElements() && "Struct index out of range!"); Elts[Idx] = EvaluateStoreInto(Elts[Idx], Val, Addr, OpNo+1); // Return the modified struct. @@ -1603,9 +1602,9 @@ static Constant *EvaluateStoreInto(Constant *Init, Constant *Val, " ConstantFoldLoadThroughGEPConstantExpr"); } - assert((uint64_t)CI->getRawValue() < ATy->getNumElements()); - Elts[(uint64_t)CI->getRawValue()] = - EvaluateStoreInto(Elts[(uint64_t)CI->getRawValue()], Val, Addr, OpNo+1); + assert(CI->getZExtValue() < ATy->getNumElements()); + Elts[CI->getZExtValue()] = + EvaluateStoreInto(Elts[CI->getZExtValue()], Val, Addr, OpNo+1); return ConstantArray::get(ATy, Elts); } } diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index 8018553e4f..cd46718ba6 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -378,7 +378,7 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst) CastInst* BufPtr = new CastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst); new CallInst(AddSJToMap, make_vector(GetSetJmpMap(Func), BufPtr, - ConstantUInt::get(Type::UIntTy, + ConstantInt::get(Type::UIntTy, SetJmpIDMap[Func]++), 0), "", Inst); @@ -429,7 +429,7 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst) // Add the case for this setjmp's number... SwitchValuePair SVP = GetSJSwitch(Func, GetRethrowBB(Func)); - SVP.first->addCase(ConstantUInt::get(Type::UIntTy, SetJmpIDMap[Func] - 1), + SVP.first->addCase(ConstantInt::get(Type::UIntTy, SetJmpIDMap[Func] - 1), SetJmpContBlock); // Value coming from the handling of the exception. diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp index 9f9c52788b..23f3352ced 100644 --- a/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -517,8 +517,8 @@ public: std::vector vals; vals.push_back(gep); // destination vals.push_back(ci->getOperand(2)); // source - vals.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); // length - vals.push_back(ConstantUInt::get(Type::UIntTy,1)); // alignment + vals.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); // length + vals.push_back(ConstantInt::get(Type::UIntTy,1)); // alignment new CallInst(SLC.get_memcpy(), vals, "", ci); // Finally, substitute the first operand of the strcat call for the @@ -556,38 +556,38 @@ public: // Check that the first argument to strchr is a constant array of sbyte. // If it is, get the length and data, otherwise return false. uint64_t len = 0; - ConstantArray* CA; + ConstantArray* CA = 0; if (!getConstantStringLength(ci->getOperand(1),len,&CA)) return false; - // Check that the second argument to strchr is a constant int, return false - // if it isn't - ConstantSInt* CSI = dyn_cast(ci->getOperand(2)); - if (!CSI) { - // Just lower this to memchr since we know the length of the string as - // it is constant. + // Check that the second argument to strchr is a constant int. If it isn't + // a constant signed integer, we can try an alternate optimization + ConstantInt* CSI = dyn_cast(ci->getOperand(2)); + if (!CSI || CSI->getType()->isUnsigned() ) { + // The second operand is not constant, or not signed. Just lower this to + // memchr since we know the length of the string since it is constant. Function* f = SLC.get_memchr(); std::vector args; args.push_back(ci->getOperand(1)); args.push_back(ci->getOperand(2)); - args.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); + args.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); ci->replaceAllUsesWith( new CallInst(f,args,ci->getName(),ci)); ci->eraseFromParent(); return true; } // Get the character we're looking for - int64_t chr = CSI->getValue(); + int64_t chr = CSI->getSExtValue(); // Compute the offset uint64_t offset = 0; bool char_found = false; for (uint64_t i = 0; i < len; ++i) { - if (ConstantSInt* CI = dyn_cast(CA->getOperand(i))) { + if (ConstantInt* CI = dyn_cast(CA->getOperand(i))) { // Check for the null terminator if (CI->isNullValue()) break; // we found end of string - else if (CI->getValue() == chr) { + else if (CI->getSExtValue() == chr) { char_found = true; offset = i; break; @@ -599,7 +599,7 @@ public: // (if c is a constant integer and s is a constant string) if (char_found) { std::vector indices; - indices.push_back(ConstantUInt::get(Type::ULongTy,offset)); + indices.push_back(ConstantInt::get(Type::ULongTy,offset)); GetElementPtrInst* GEP = new GetElementPtrInst(ci->getOperand(1),indices, ci->getOperand(1)->getName()+".strchr",ci); ci->replaceAllUsesWith(GEP); @@ -679,7 +679,7 @@ public: std::string str1 = A1->getAsString(); std::string str2 = A2->getAsString(); int result = strcmp(str1.c_str(), str2.c_str()); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,result)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,result)); ci->eraseFromParent(); return true; } @@ -723,7 +723,7 @@ public: bool len_arg_is_const = false; if (ConstantInt* len_CI = dyn_cast(ci->getOperand(3))) { len_arg_is_const = true; - len_arg = len_CI->getRawValue(); + len_arg = len_CI->getZExtValue(); if (len_arg == 0) { // strncmp(x,y,0) -> 0 ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,0)); @@ -769,7 +769,7 @@ public: std::string str1 = A1->getAsString(); std::string str2 = A2->getAsString(); int result = strncmp(str1.c_str(), str2.c_str(), len_arg); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,result)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,result)); ci->eraseFromParent(); return true; } @@ -843,8 +843,8 @@ public: std::vector vals; vals.push_back(dest); // destination vals.push_back(src); // source - vals.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); // length - vals.push_back(ConstantUInt::get(Type::UIntTy,1)); // alignment + vals.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); // length + vals.push_back(ConstantInt::get(Type::UIntTy,1)); // alignment new CallInst(SLC.get_memcpy(), vals, "", ci); // Finally, substitute the first operand of the strcat call for the @@ -891,7 +891,7 @@ struct StrLenOptimization : public LibCallOptimization { if (ConstantInt* CI = dyn_cast(bop->getOperand(1))) { // Get the value the strlen result is compared to - uint64_t val = CI->getRawValue(); + uint64_t val = CI->getZExtValue(); // If its compared against length 0 with == or != if (val == 0 && @@ -902,7 +902,7 @@ struct StrLenOptimization : public LibCallOptimization { // strlen(x) == 0 -> *x == 0 LoadInst* load = new LoadInst(str,str->getName()+".first",ci); BinaryOperator* rbop = BinaryOperator::create(bop->getOpcode(), - load, ConstantSInt::get(Type::SByteTy,0), + load, ConstantInt::get(Type::SByteTy,0), bop->getName()+".strlen", ci); bop->replaceAllUsesWith(rbop); bop->eraseFromParent(); @@ -919,9 +919,9 @@ struct StrLenOptimization : public LibCallOptimization { // strlen("xyz") -> 3 (for example) const Type *Ty = SLC.getTargetData()->getIntPtrType(); if (Ty->isSigned()) - ci->replaceAllUsesWith(ConstantSInt::get(Ty, len)); + ci->replaceAllUsesWith(ConstantInt::get(Ty, len)); else - ci->replaceAllUsesWith(ConstantUInt::get(Ty, len)); + ci->replaceAllUsesWith(ConstantInt::get(Ty, len)); ci->eraseFromParent(); return true; @@ -985,7 +985,7 @@ struct memcmpOptimization : public LibCallOptimization { // Make sure we have a constant length. ConstantInt *LenC = dyn_cast(CI->getOperand(3)); if (!LenC) return false; - uint64_t Len = LenC->getRawValue(); + uint64_t Len = LenC->getZExtValue(); // If the length is zero, this returns 0. switch (Len) { @@ -1075,8 +1075,8 @@ struct LLVMMemCpyMoveOptzn : public LibCallOptimization { return false; // If the length is larger than the alignment, we can't optimize - uint64_t len = LEN->getRawValue(); - uint64_t alignment = ALIGN->getRawValue(); + uint64_t len = LEN->getZExtValue(); + uint64_t alignment = ALIGN->getZExtValue(); if (alignment == 0) alignment = 1; // Alignment 0 is identity for alignment 1 if (len > alignment) @@ -1154,8 +1154,8 @@ struct LLVMMemSetOptimization : public LibCallOptimization { return false; // Extract the length and alignment - uint64_t len = LEN->getRawValue(); - uint64_t alignment = ALIGN->getRawValue(); + uint64_t len = LEN->getZExtValue(); + uint64_t alignment = ALIGN->getZExtValue(); // Alignment 0 is identity for alignment 1 if (alignment == 0) @@ -1174,7 +1174,7 @@ struct LLVMMemSetOptimization : public LibCallOptimization { // Make sure we have a constant ubyte to work with so we can extract // the value to be filled. - ConstantUInt* FILL = dyn_cast(ci->getOperand(2)); + ConstantInt* FILL = dyn_cast(ci->getOperand(2)); if (!FILL) return false; if (FILL->getType() != Type::UByteTy) @@ -1183,7 +1183,7 @@ struct LLVMMemSetOptimization : public LibCallOptimization { // memset(s,c,n) -> store s, c (for n=1,2,4,8) // Extract the fill character - uint64_t fill_char = FILL->getValue(); + uint64_t fill_char = FILL->getZExtValue(); uint64_t fill_value = fill_char; // Get the type we will cast to, based on size of memory area to fill, and @@ -1215,7 +1215,7 @@ struct LLVMMemSetOptimization : public LibCallOptimization { // Cast dest to the right sized primitive and then load/store CastInst* DestCast = new CastInst(dest,PointerType::get(castType),dest->getName()+".cast",ci); - new StoreInst(ConstantUInt::get(castType,fill_value),DestCast, ci); + new StoreInst(ConstantInt::get(castType,fill_value),DestCast, ci); ci->eraseFromParent(); return true; } @@ -1325,16 +1325,16 @@ public: // The first character has to be a % if (ConstantInt* CI = dyn_cast(CA->getOperand(0))) - if (CI->getRawValue() != '%') + if (CI->getZExtValue() != '%') return false; // Get the second character and switch on its value ConstantInt* CI = dyn_cast(CA->getOperand(1)); - switch (CI->getRawValue()) { + switch (CI->getZExtValue()) { case 's': { if (len != 3 || - dyn_cast(CA->getOperand(2))->getRawValue() != '\n') + dyn_cast(CA->getOperand(2))->getZExtValue() != '\n') return false; // printf("%s\n",str) -> puts(str) @@ -1344,7 +1344,7 @@ public: std::vector args; args.push_back(CastToCStr(ci->getOperand(2), *ci)); new CallInst(puts_func,args,ci->getName(),ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,len)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len)); break; } case 'c': @@ -1359,7 +1359,7 @@ public: CastInst* cast = new CastInst(ci->getOperand(2), Type::IntTy, CI->getName()+".int", ci); new CallInst(putchar_func, cast, "", ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy, 1)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy, 1)); break; } default: @@ -1409,7 +1409,7 @@ public: for (unsigned i = 0; i < len; ++i) { if (ConstantInt* CI = dyn_cast(CA->getOperand(i))) { // Check for the null terminator - if (CI->getRawValue() == '%') + if (CI->getZExtValue() == '%') return false; // we found end of string } else { return false; @@ -1430,11 +1430,11 @@ public: std::vector args; args.push_back(ci->getOperand(2)); - args.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); - args.push_back(ConstantUInt::get(SLC.getIntPtrType(),1)); + args.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); + args.push_back(ConstantInt::get(SLC.getIntPtrType(),1)); args.push_back(ci->getOperand(1)); new CallInst(fwrite_func,args,ci->getName(),ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,len)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len)); ci->eraseFromParent(); return true; } @@ -1446,12 +1446,12 @@ public: // The first character has to be a % if (ConstantInt* CI = dyn_cast(CA->getOperand(0))) - if (CI->getRawValue() != '%') + if (CI->getZExtValue() != '%') return false; // Get the second character and switch on its value ConstantInt* CI = dyn_cast(CA->getOperand(1)); - switch (CI->getRawValue()) { + switch (CI->getZExtValue()) { case 's': { uint64_t len = 0; @@ -1464,11 +1464,11 @@ public: return false; std::vector args; args.push_back(CastToCStr(ci->getOperand(3), *ci)); - args.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); - args.push_back(ConstantUInt::get(SLC.getIntPtrType(),1)); + args.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); + args.push_back(ConstantInt::get(SLC.getIntPtrType(),1)); args.push_back(ci->getOperand(1)); new CallInst(fwrite_func,args,ci->getName(),ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,len)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len)); } else { // fprintf(file,"%s",str) -> fputs(str,file) const Type* FILEptr_type = ci->getOperand(1)->getType(); @@ -1479,7 +1479,7 @@ public: args.push_back(CastToCStr(ci->getOperand(3), *ci)); args.push_back(ci->getOperand(1)); new CallInst(fputs_func,args,ci->getName(),ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,len)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len)); } break; } @@ -1493,7 +1493,7 @@ public: CastInst* cast = new CastInst(ci->getOperand(3), Type::IntTy, CI->getName()+".int", ci); new CallInst(fputc_func,cast,ci->getOperand(1),"",ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,1)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,1)); break; } default: @@ -1537,7 +1537,7 @@ public: if (len == 0) { // If the length is 0, we just need to store a null byte new StoreInst(ConstantInt::get(Type::SByteTy,0),ci->getOperand(1),ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,0)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,0)); ci->eraseFromParent(); return true; } @@ -1546,7 +1546,7 @@ public: for (unsigned i = 0; i < len; ++i) { if (ConstantInt* CI = dyn_cast(CA->getOperand(i))) { // Check for the null terminator - if (CI->getRawValue() == '%') + if (CI->getZExtValue() == '%') return false; // we found a %, can't optimize } else { return false; // initializer is not constant int, can't optimize @@ -1563,10 +1563,10 @@ public: std::vector args; args.push_back(ci->getOperand(1)); args.push_back(ci->getOperand(2)); - args.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); - args.push_back(ConstantUInt::get(Type::UIntTy,1)); + args.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); + args.push_back(ConstantInt::get(Type::UIntTy,1)); new CallInst(memcpy_func,args,"",ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,len)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,len)); ci->eraseFromParent(); return true; } @@ -1578,12 +1578,12 @@ public: // The first character has to be a % if (ConstantInt* CI = dyn_cast(CA->getOperand(0))) - if (CI->getRawValue() != '%') + if (CI->getZExtValue() != '%') return false; // Get the second character and switch on its value ConstantInt* CI = dyn_cast(CA->getOperand(1)); - switch (CI->getRawValue()) { + switch (CI->getZExtValue()) { case 's': { // sprintf(dest,"%s",str) -> llvm.memcpy(dest, str, strlen(str)+1, 1) Function* strlen_func = SLC.get_strlen(); @@ -1602,7 +1602,7 @@ public: args.push_back(CastToCStr(ci->getOperand(1), *ci)); args.push_back(CastToCStr(ci->getOperand(3), *ci)); args.push_back(Len1); - args.push_back(ConstantUInt::get(Type::UIntTy,1)); + args.push_back(ConstantInt::get(Type::UIntTy,1)); new CallInst(memcpy_func, args, "", ci); // The strlen result is the unincremented number of bytes in the string. @@ -1619,10 +1619,10 @@ public: CastInst* cast = new CastInst(ci->getOperand(3),Type::SByteTy,"char",ci); new StoreInst(cast, ci->getOperand(1), ci); GetElementPtrInst* gep = new GetElementPtrInst(ci->getOperand(1), - ConstantUInt::get(Type::UIntTy,1),ci->getOperand(1)->getName()+".end", + ConstantInt::get(Type::UIntTy,1),ci->getOperand(1)->getName()+".end", ci); new StoreInst(ConstantInt::get(Type::SByteTy,0),gep,ci); - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,1)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,1)); ci->eraseFromParent(); return true; } @@ -1686,8 +1686,8 @@ public: return false; std::vector parms; parms.push_back(ci->getOperand(1)); - parms.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); - parms.push_back(ConstantUInt::get(SLC.getIntPtrType(),1)); + parms.push_back(ConstantInt::get(SLC.getIntPtrType(),len)); + parms.push_back(ConstantInt::get(SLC.getIntPtrType(),1)); parms.push_back(ci->getOperand(2)); new CallInst(fwrite_func,parms,"",ci); break; @@ -1716,11 +1716,11 @@ public: virtual bool OptimizeCall(CallInst *ci, SimplifyLibCalls &SLC) { if (ConstantInt* CI = dyn_cast(ci->getOperand(1))) { // isdigit(c) -> 0 or 1, if 'c' is constant - uint64_t val = CI->getRawValue(); + uint64_t val = CI->getZExtValue(); if (val >= '0' && val <='9') - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,1)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,1)); else - ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,0)); + ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,0)); ci->eraseFromParent(); return true; } @@ -1730,10 +1730,10 @@ public: new CastInst(ci->getOperand(1),Type::UIntTy, ci->getOperand(1)->getName()+".uint",ci); BinaryOperator* sub_inst = BinaryOperator::createSub(cast, - ConstantUInt::get(Type::UIntTy,0x30), + ConstantInt::get(Type::UIntTy,0x30), ci->getOperand(1)->getName()+".sub",ci); SetCondInst* setcond_inst = new SetCondInst(Instruction::SetLE,sub_inst, - ConstantUInt::get(Type::UIntTy,9), + ConstantInt::get(Type::UIntTy,9), ci->getOperand(1)->getName()+".cmp",ci); CastInst* c2 = new CastInst(setcond_inst,Type::IntTy, @@ -1760,7 +1760,7 @@ public: Value *V = CI->getOperand(1); if (V->getType()->isSigned()) V = new CastInst(V, V->getType()->getUnsignedVersion(), V->getName(), CI); - Value *Cmp = BinaryOperator::createSetLT(V, ConstantUInt::get(V->getType(), + Value *Cmp = BinaryOperator::createSetLT(V, ConstantInt::get(V->getType(), 128), V->getName()+".isascii", CI); if (Cmp->getType() != CI->getType()) @@ -1828,7 +1828,7 @@ public: // ffs(cnst) -> bit# // ffsl(cnst) -> bit# // ffsll(cnst) -> bit# - uint64_t val = CI->getRawValue(); + uint64_t val = CI->getZExtValue(); int result = 0; if (val) { ++result; @@ -1837,7 +1837,7 @@ public: val >>= 1; } } - TheCall->replaceAllUsesWith(ConstantSInt::get(Type::IntTy, result)); + TheCall->replaceAllUsesWith(ConstantInt::get(Type::IntTy, result)); TheCall->eraseFromParent(); return true; } @@ -1861,7 +1861,7 @@ public: Value *V = new CastInst(TheCall->getOperand(1), ArgType, "tmp", TheCall); Value *V2 = new CallInst(F, V, "tmp", TheCall); V2 = new CastInst(V2, Type::IntTy, "tmp", TheCall); - V2 = BinaryOperator::createAdd(V2, ConstantSInt::get(Type::IntTy, 1), + V2 = BinaryOperator::createAdd(V2, ConstantInt::get(Type::IntTy, 1), "tmp", TheCall); Value *Cond = BinaryOperator::createSetEQ(V, Constant::getNullValue(V->getType()), @@ -2048,7 +2048,7 @@ bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA) { // value. We'll need this later for indexing the ConstantArray. uint64_t start_idx = 0; if (ConstantInt* CI = dyn_cast(GEP->getOperand(2))) - start_idx = CI->getRawValue(); + start_idx = CI->getZExtValue(); else return false; diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp index 05c3419e29..b4523257af 100644 --- a/lib/Transforms/Instrumentation/EmitFunctions.cpp +++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp @@ -110,7 +110,7 @@ bool EmitFunctionTable::runOnModule(Module &M){ M.getGlobalList().push_back(funcArray); - ConstantInt *cnst = ConstantSInt::get(Type::IntTy, counter); + ConstantInt *cnst = ConstantInt::get(Type::IntTy, counter); GlobalVariable *fnCount = new GlobalVariable(Type::IntTy, true, GlobalValue::ExternalLinkage, cnst, "llvmFunctionCount"); diff --git a/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/lib/Transforms/Instrumentation/ProfilingUtils.cpp index 82e7ae7ba1..4c31793f42 100644 --- a/lib/Transforms/Instrumentation/ProfilingUtils.cpp +++ b/lib/Transforms/Instrumentation/ProfilingUtils.cpp @@ -51,7 +51,7 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName, // pass null. Args[2] = ConstantPointerNull::get(UIntPtr); } - Args[3] = ConstantUInt::get(Type::UIntTy, NumElements); + Args[3] = ConstantInt::get(Type::UIntTy, NumElements); Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos); @@ -96,7 +96,7 @@ void llvm::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum, // Create the getelementptr constant expression std::vector Indices(2); Indices[0] = Constant::getNullValue(Type::IntTy); - Indices[1] = ConstantSInt::get(Type::IntTy, CounterNum); + Indices[1] = ConstantInt::get(Type::IntTy, CounterNum); Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices); // Load, increment and store the value back. diff --git a/lib/Transforms/Instrumentation/RSProfiling.cpp b/lib/Transforms/Instrumentation/RSProfiling.cpp index 54a9ef7003..5d6654d504 100644 --- a/lib/Transforms/Instrumentation/RSProfiling.cpp +++ b/lib/Transforms/Instrumentation/RSProfiling.cpp @@ -188,10 +188,10 @@ static void getBackEdges(Function& F, T& BackEdges); GlobalRandomCounter::GlobalRandomCounter(Module& M, const Type* t, uint64_t resetval) : T(t) { + ConstantInt* Init = ConstantInt::get(T, resetval); + ResetValue = Init; Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage, - ConstantUInt::get(T, resetval), - "RandomSteeringCounter", &M); - ResetValue = ConstantUInt::get(T, resetval); + Init, "RandomSteeringCounter", &M); } GlobalRandomCounter::~GlobalRandomCounter() {} @@ -205,7 +205,7 @@ void GlobalRandomCounter::ProcessChoicePoint(BasicBlock* bb) { LoadInst* l = new LoadInst(Counter, "counter", t); SetCondInst* s = new SetCondInst(Instruction::SetEQ, l, - ConstantUInt::get(T, 0), + ConstantInt::get(T, 0), "countercc", t); Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1), "counternew", t); @@ -225,10 +225,10 @@ void GlobalRandomCounter::ProcessChoicePoint(BasicBlock* bb) { GlobalRandomCounterOpt::GlobalRandomCounterOpt(Module& M, const Type* t, uint64_t resetval) : AI(0), T(t) { + ConstantInt* Init = ConstantInt::get(T, resetval); + ResetValue = Init; Counter = new GlobalVariable(T, false, GlobalValue::InternalLinkage, - ConstantUInt::get(T, resetval), - "RandomSteeringCounter", &M); - ResetValue = ConstantUInt::get(T, resetval); + Init, "RandomSteeringCounter", &M); } GlobalRandomCounterOpt::~GlobalRandomCounterOpt() {} @@ -278,7 +278,7 @@ void GlobalRandomCounterOpt::ProcessChoicePoint(BasicBlock* bb) { LoadInst* l = new LoadInst(AI, "counter", t); SetCondInst* s = new SetCondInst(Instruction::SetEQ, l, - ConstantUInt::get(T, 0), + ConstantInt::get(T, 0), "countercc", t); Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1), "counternew", t); @@ -309,11 +309,11 @@ void CycleCounter::ProcessChoicePoint(BasicBlock* bb) { CallInst* c = new CallInst(F, "rdcc", t); BinaryOperator* b = - BinaryOperator::createAnd(c, ConstantUInt::get(Type::ULongTy, rm), + BinaryOperator::createAnd(c, ConstantInt::get(Type::ULongTy, rm), "mrdcc", t); SetCondInst* s = new SetCondInst(Instruction::SetEQ, b, - ConstantUInt::get(Type::ULongTy, 0), + ConstantInt::get(Type::ULongTy, 0), "mrdccc", t); t->setCondition(s); } @@ -339,7 +339,7 @@ void RSProfilers_std::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNu // Create the getelementptr constant expression std::vector Indices(2); Indices[0] = Constant::getNullValue(Type::IntTy); - Indices[1] = ConstantSInt::get(Type::IntTy, CounterNum); + Indices[1] = ConstantInt::get(Type::IntTy, CounterNum); Constant *ElementPtr = ConstantExpr::getGetElementPtr(CounterArray, Indices); // Load, increment and store the value back. diff --git a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp index d3af056ffc..8bf6001053 100644 --- a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp +++ b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp @@ -49,7 +49,7 @@ static void InsertInstrumentationCall (BasicBlock *BB, Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy, Type::UIntTy, (Type *)0); std::vector Args (1); - Args[0] = ConstantUInt::get (Type::UIntTy, BBNumber); + Args[0] = ConstantInt::get (Type::UIntTy, BBNumber); // Insert the call after any alloca or PHI instructions... BasicBlock::iterator InsertPos = BB->begin(); diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 4a7edbafed..c30c0c924f 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -142,7 +142,7 @@ namespace { Instruction *FoldGEPSetCC(User *GEPLHS, Value *RHS, Instruction::BinaryOps Cond, Instruction &I); Instruction *visitShiftInst(ShiftInst &I); - Instruction *FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, + Instruction *FoldShiftByConstant(Value *Op0, ConstantInt *Op1, ShiftInst &I); Instruction *visitCastInst(CastInst &CI); Instruction *FoldSelectOpOp(SelectInst &SI, Instruction *TI, @@ -576,14 +576,14 @@ static ConstantInt *SubOne(ConstantInt *C) { /// GetConstantInType - Return a ConstantInt with the specified type and value. /// static ConstantIntegral *GetConstantInType(const Type *Ty, uint64_t Val) { - if (Ty->isUnsigned()) - return ConstantUInt::get(Ty, Val); + if (Ty->isUnsigned()) + return ConstantInt::get(Ty, Val); else if (Ty->getTypeID() == Type::BoolTyID) return ConstantBool::get(Val); int64_t SVal = Val; SVal <<= 64-Ty->getPrimitiveSizeInBits(); SVal >>= 64-Ty->getPrimitiveSizeInBits(); - return ConstantSInt::get(Ty, SVal); + return ConstantInt::get(Ty, SVal); } @@ -712,40 +712,42 @@ static void ComputeMaskedBits(Value *V, uint64_t Mask, uint64_t &KnownZero, } case Instruction::Shl: // (shl X, C1) & C2 == 0 iff (X & C2 >>u C1) == 0 - if (ConstantUInt *SA = dyn_cast(I->getOperand(1))) { - Mask >>= SA->getValue(); + if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { + uint64_t ShiftAmt = SA->getZExtValue(); + Mask >>= ShiftAmt; ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, Depth+1); assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); - KnownZero <<= SA->getValue(); - KnownOne <<= SA->getValue(); - KnownZero |= (1ULL << SA->getValue())-1; // low bits known zero. + KnownZero <<= ShiftAmt; + KnownOne <<= ShiftAmt; + KnownZero |= (1ULL << ShiftAmt)-1; // low bits known zero. return; } break; case Instruction::Shr: // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 - if (ConstantUInt *SA = dyn_cast(I->getOperand(1))) { + if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { // Compute the new bits that are at the top now. - uint64_t HighBits = (1ULL << SA->getValue())-1; - HighBits <<= I->getType()->getPrimitiveSizeInBits()-SA->getValue(); + uint64_t ShiftAmt = SA->getZExtValue(); + uint64_t HighBits = (1ULL << ShiftAmt)-1; + HighBits <<= I->getType()->getPrimitiveSizeInBits()-ShiftAmt; if (I->getType()->isUnsigned()) { // Unsigned shift right. - Mask <<= SA->getValue(); + Mask <<= ShiftAmt; ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1); assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); - KnownZero >>= SA->getValue(); - KnownOne >>= SA->getValue(); + KnownZero >>= ShiftAmt; + KnownOne >>= ShiftAmt; KnownZero |= HighBits; // high bits known zero. } else { - Mask <<= SA->getValue(); + Mask <<= ShiftAmt; ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1); assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); - KnownZero >>= SA->getValue(); - KnownOne >>= SA->getValue(); + KnownZero >>= ShiftAmt; + KnownOne >>= ShiftAmt; // Handle the sign bits. uint64_t SignBit = 1ULL << (I->getType()->getPrimitiveSizeInBits()-1); - SignBit >>= SA->getValue(); // Adjust to where it is now in the mask. + SignBit >>= ShiftAmt; // Adjust to where it is now in the mask. if (KnownZero & SignBit) { // New bits are known zero. KnownZero |= HighBits; @@ -1100,14 +1102,15 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask, break; } case Instruction::Shl: - if (ConstantUInt *SA = dyn_cast(I->getOperand(1))) { - if (SimplifyDemandedBits(I->getOperand(0), DemandedMask >> SA->getValue(), + if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { + uint64_t ShiftAmt = SA->getZExtValue(); + if (SimplifyDemandedBits(I->getOperand(0), DemandedMask >> ShiftAmt, KnownZero, KnownOne, Depth+1)) return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); - KnownZero <<= SA->getValue(); - KnownOne <<= SA->getValue(); - KnownZero |= (1ULL << SA->getValue())-1; // low bits known zero. + KnownZero <<= ShiftAmt; + KnownOne <<= ShiftAmt; + KnownZero |= (1ULL << ShiftAmt) - 1; // low bits known zero. } break; case Instruction::Shr: @@ -1131,38 +1134,38 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask, return UpdateValueUsesWith(I, NewVal); } - if (ConstantUInt *SA = dyn_cast(I->getOperand(1))) { - unsigned ShAmt = SA->getValue(); + if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { + unsigned ShiftAmt = SA->getZExtValue(); // Compute the new bits that are at the top now. - uint64_t HighBits = (1ULL << ShAmt)-1; - HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShAmt; + uint64_t HighBits = (1ULL << ShiftAmt)-1; + HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShiftAmt; uint64_t TypeMask = I->getType()->getIntegralTypeMask(); if (I->getType()->isUnsigned()) { // Unsigned shift right. if (SimplifyDemandedBits(I->getOperand(0), - (DemandedMask << ShAmt) & TypeMask, + (DemandedMask << ShiftAmt) & TypeMask, KnownZero, KnownOne, Depth+1)) return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); KnownZero &= TypeMask; KnownOne &= TypeMask; - KnownZero >>= ShAmt; - KnownOne >>= ShAmt; + KnownZero >>= ShiftAmt; + KnownOne >>= ShiftAmt; KnownZero |= HighBits; // high bits known zero. } else { // Signed shift right. if (SimplifyDemandedBits(I->getOperand(0), - (DemandedMask << ShAmt) & TypeMask, + (DemandedMask << ShiftAmt) & TypeMask, KnownZero, KnownOne, Depth+1)) return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); KnownZero &= TypeMask; KnownOne &= TypeMask; - KnownZero >>= SA->getValue(); - KnownOne >>= SA->getValue(); + KnownZero >>= ShiftAmt; + KnownOne >>= ShiftAmt; // Handle the sign bits. uint64_t SignBit = 1ULL << (I->getType()->getPrimitiveSizeInBits()-1); - SignBit >>= SA->getValue(); // Adjust to where it is now in the mask. + SignBit >>= ShiftAmt; // Adjust to where it is now in the mask. // If the input sign bit is known to be zero, or if none of the top bits // are demanded, turn this into an unsigned shift right. @@ -1277,7 +1280,7 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts, case Instruction::InsertElement: { // If this is a variable index, we don't know which element it overwrites. // demand exactly the same input as we produce. - ConstantUInt *Idx = dyn_cast(I->getOperand(2)); + ConstantInt *Idx = dyn_cast(I->getOperand(2)); if (Idx == 0) { // Note that we can't propagate undef elt info, because we don't know // which elt is getting updated. @@ -1289,7 +1292,7 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts, // If this is inserting an element that isn't demanded, remove this // insertelement. - unsigned IdxNo = Idx->getValue(); + unsigned IdxNo = Idx->getZExtValue(); if (IdxNo >= VWidth || (DemandedElts & (1ULL << IdxNo)) == 0) return AddSoonDeadInstToWorklist(*I, 0); @@ -1795,14 +1798,14 @@ FoundSExt: if (Anded == CRHS) { // See if all bits from the first bit set in the Add RHS up are included // in the mask. First, get the rightmost bit. - uint64_t AddRHSV = CRHS->getRawValue(); + uint64_t AddRHSV = CRHS->getZExtValue(); // Form a mask of all bits from the lowest bit added through the top. uint64_t AddRHSHighBits = ~((AddRHSV & -AddRHSV)-1); AddRHSHighBits &= C2->getType()->getIntegralTypeMask(); // See if the and mask includes all of these bits. - uint64_t AddRHSHighBitsAnd = AddRHSHighBits & C2->getRawValue(); + uint64_t AddRHSHighBitsAnd = AddRHSHighBits & C2->getZExtValue(); if (AddRHSHighBits == AddRHSHighBitsAnd) { // Okay, the xform is safe. Insert the new add pronto. @@ -1845,7 +1848,7 @@ FoundSExt: // highest order bit set. static bool isSignBit(ConstantInt *CI) { unsigned NumBits = CI->getType()->getPrimitiveSizeInBits(); - return (CI->getRawValue() & (~0ULL >> (64-NumBits))) == (1ULL << (NumBits-1)); + return (CI->getZExtValue() & (~0ULL >> (64-NumBits))) == (1ULL << (NumBits-1)); } /// RemoveNoopCast - Strip off nonconverting casts from the value. @@ -1894,14 +1897,15 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) { Value *NoopCastedRHS = RemoveNoopCast(Op1); if (ShiftInst *SI = dyn_cast(NoopCastedRHS)) if (SI->getOpcode() == Instruction::Shr) - if (ConstantUInt *CU = dyn_cast(SI->getOperand(1))) { + if (ConstantInt *CU = dyn_cast(SI->getOperand(1))) { const Type *NewTy; if (SI->getType()->isSigned()) NewTy = SI->getType()->getUnsignedVersion(); else NewTy = SI->getType()->getSignedVersion(); // Check to see if we are shifting out everything but the sign bit. - if (CU->getValue() == SI->getType()->getPrimitiveSizeInBits()-1) { + if (CU->getZExtValue() == + SI->getType()->getPrimitiveSizeInBits()-1) { // Ok, the transformation is safe. Insert a cast of the incoming // value, then the new shift, then the new cast. Instruction *FirstCast = new CastInst(SI->getOperand(0), NewTy, @@ -1972,8 +1976,8 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) { // 0 - (X sdiv C) -> (X sdiv -C) if (Op1I->getOpcode() == Instruction::Div) - if (ConstantSInt *CSI = dyn_cast(Op0)) - if (CSI->isNullValue()) + if (ConstantInt *CSI = dyn_cast(Op0)) + if (CSI->getType()->isSigned() && CSI->isNullValue()) if (Constant *DivRHS = dyn_cast(Op1I->getOperand(1))) return BinaryOperator::createDiv(Op1I->getOperand(0), ConstantExpr::getNeg(DivRHS)); @@ -2022,14 +2026,14 @@ static bool isSignBitCheck(unsigned Opcode, Value *LHS, ConstantInt *RHS) { return Opcode == Instruction::SetLT && RHS->isNullValue() || Opcode == Instruction::SetLE && RHS->isAllOnesValue(); } else { - ConstantUInt *RHSC = cast(RHS); + ConstantInt *RHSC = cast(RHS); // True if source is LHS > 127 or LHS >= 128, where the constants depend on // the size of the integer type. if (Opcode == Instruction::SetGE) - return RHSC->getValue() == + return RHSC->getZExtValue() == 1ULL << (RHS->getType()->getPrimitiveSizeInBits()-1); if (Opcode == Instruction::SetGT) - return RHSC->getValue() == + return RHSC->getZExtValue() == (1ULL << (RHS->getType()->getPrimitiveSizeInBits()-1))-1; } return false; @@ -2060,11 +2064,11 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { if (CI->isAllOnesValue()) // X * -1 == 0 - X return BinaryOperator::createNeg(Op0, I.getName()); - int64_t Val = (int64_t)cast(CI)->getRawValue(); + int64_t Val = (int64_t)cast(CI)->getZExtValue(); if (isPowerOf2_64(Val)) { // Replace X*(2^C) with X << C uint64_t C = Log2_64(Val); return new ShiftInst(Instruction::Shl, Op0, - ConstantUInt::get(Type::UByteTy, C)); + ConstantInt::get(Type::UByteTy, C)); } } else if (ConstantFP *Op1F = dyn_cast(Op1)) { if (Op1F->isNullValue()) @@ -2125,7 +2129,7 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { if (isa(SCIOp1) && isSignBitCheck(SCI->getOpcode(), SCIOp0, cast(SCIOp1))) { // Shift the X value right to turn it into "all signbits". - Constant *Amt = ConstantUInt::get(Type::UByteTy, + Constant *Amt = ConstantInt::get(Type::UByteTy, SCOpTy->getPrimitiveSizeInBits()-1); if (SCIOp0->getType()->isUnsigned()) { const Type *NewTy = SCIOp0->getType()->getSignedVersion(); @@ -2179,13 +2183,14 @@ Instruction *InstCombiner::visitDiv(BinaryOperator &I) { // Check to see if this is an unsigned division with an exact power of 2, // if so, convert to a right shift. - if (ConstantUInt *C = dyn_cast(RHS)) - if (uint64_t Val = C->getValue()) // Don't break X / 0 - if (isPowerOf2_64(Val)) { - uint64_t C = Log2_64(Val); - return new ShiftInst(Instruction::Shr, Op0, - ConstantUInt::get(Type::UByteTy, C)); - } + if (ConstantInt *C = dyn_cast(RHS)) + if (C->getType()->isUnsigned()) + if (uint64_t Val = C->getZExtValue()) // Don't break X / 0 + if (isPowerOf2_64(Val)) { + uint64_t C = Log2_64(Val); + return new ShiftInst(Instruction::Shr, Op0, + ConstantInt::get(Type::UByteTy, C)); + } // -X/C -> X/-C if (RHS->getType()->isSigned()) @@ -2235,24 +2240,25 @@ Instruction *InstCombiner::visitDiv(BinaryOperator &I) { // If this is 'udiv X, (Cond ? C1, C2)' where C1&C2 are powers of two, // transform this into: '(Cond ? (udiv X, C1) : (udiv X, C2))'. - if (ConstantUInt *STO = dyn_cast(SI->getOperand(1))) - if (ConstantUInt *SFO = dyn_cast(SI->getOperand(2))) { - // STO == 0 and SFO == 0 handled above. - uint64_t TVA = STO->getValue(), FVA = SFO->getValue(); - if (isPowerOf2_64(TVA) && isPowerOf2_64(FVA)) { - unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA); - Constant *TC = ConstantUInt::get(Type::UByteTy, TSA); - Instruction *TSI = new ShiftInst(Instruction::Shr, Op0, - TC, SI->getName()+".t"); - TSI = InsertNewInstBefore(TSI, I); - - Constant *FC = ConstantUInt::get(Type::UByteTy, FSA); - Instruction *FSI = new ShiftInst(Instruction::Shr, Op0, - FC, SI->getName()+".f"); - FSI = InsertNewInstBefore(FSI, I); - return new SelectInst(SI->getOperand(0), TSI, FSI); + if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) + if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) + if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) { + // STO == 0 and SFO == 0 handled above. + uint64_t TVA = STO->getZExtValue(), FVA = SFO->getZExtValue(); + if (isPowerOf2_64(TVA) && isPowerOf2_64(FVA)) { + unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA); + Constant *TC = ConstantInt::get(Type::UByteTy, TSA); + Instruction *TSI = new ShiftInst(Instruction::Shr, Op0, + TC, SI->getName()+".t"); + TSI = InsertNewInstBefore(TSI, I); + + Constant *FC = ConstantInt::get(Type::UByteTy, FSA); + Instruction *FSI = new ShiftInst(Instruction::Shr, Op0, + FC, SI->getName()+".f"); + FSI = InsertNewInstBefore(FSI, I); + return new SelectInst(SI->getOperand(0), TSI, FSI); + } } - } } // 0 / X == 0, we don't need to preserve faults! @@ -2282,13 +2288,14 @@ Instruction *InstCombiner::visitDiv(BinaryOperator &I) { if (Instruction *RHSI = dyn_cast(I.getOperand(1))) { // Turn A / (C1 << N), where C1 is "1<> (N+C2) [udiv only]. if (RHSI->getOpcode() == Instruction::Shl && - isa(RHSI->getOperand(0))) { - unsigned C1 = cast(RHSI->getOperand(0))->getRawValue(); + isa(RHSI->getOperand(0)) && + RHSI->getOperand(0)->getType()->isUnsigned()) { + uint64_t C1 = cast(RHSI->getOperand(0))->getZExtValue(); if (isPowerOf2_64(C1)) { - unsigned C2 = Log2_64(C1); + uint64_t C2 = Log2_64(C1); Value *Add = RHSI->getOperand(1); if (C2) { - Constant *C2V = ConstantUInt::get(Add->getType(), C2); + Constant *C2V = ConstantInt::get(Add->getType(), C2); Add = InsertNewInstBefore(BinaryOperator::createAdd(Add, C2V, "tmp"), I); } @@ -2330,7 +2337,7 @@ static Constant *GetFactor(Value *V) { unsigned Zeros = CountTrailingZeros_64(RHS->getZExtValue()); if (Zeros != V->getType()->getPrimitiveSizeInBits()) return ConstantExpr::getShl(Result, - ConstantUInt::get(Type::UByteTy, Zeros)); + ConstantInt::get(Type::UByteTy, Zeros)); } } else if (I->getOpcode() == Instruction::Cast) { Value *Op = I->getOperand(0); @@ -2356,8 +2363,8 @@ Instruction *InstCombiner::visitRem(BinaryOperator &I) { if (I.getType()->isSigned()) { if (Value *RHSNeg = dyn_castNegVal(Op1)) - if (!isa(RHSNeg) || - cast(RHSNeg)->getValue() > 0) { + if (!isa(RHSNeg) || !RHSNeg->getType()->isSigned() || + cast(RHSNeg)->getSExtValue() > 0) { // X % -Y -> X % Y AddUsesToWorkList(I); I.setOperand(1, RHSNeg); @@ -2392,9 +2399,10 @@ Instruction *InstCombiner::visitRem(BinaryOperator &I) { // Check to see if this is an unsigned remainder with an exact power of 2, // if so, convert to a bitwise and. - if (ConstantUInt *C = dyn_cast(RHS)) - if (isPowerOf2_64(C->getValue())) - return BinaryOperator::createAnd(Op0, SubOne(C)); + if (ConstantInt *C = dyn_cast(RHS)) + if (RHS->getType()->isUnsigned()) + if (isPowerOf2_64(C->getZExtValue())) + return BinaryOperator::createAnd(Op0, SubOne(C)); if (Instruction *Op0I = dyn_cast(Op0)) { if (SelectInst *SI = dyn_cast(Op0I)) { @@ -2415,8 +2423,9 @@ Instruction *InstCombiner::visitRem(BinaryOperator &I) { // Turn A % (C << N), where C is 2^k, into A & ((C << N)-1) [urem only]. if (I.getType()->isUnsigned() && RHSI->getOpcode() == Instruction::Shl && - isa(RHSI->getOperand(0))) { - unsigned C1 = cast(RHSI->getOperand(0))->getRawValue(); + isa(RHSI->getOperand(0)) && + RHSI->getOperand(0)->getType()->isUnsigned()) { + unsigned C1 = cast(RHSI->getOperand(0))->getZExtValue(); if (isPowerOf2_64(C1)) { Constant *N1 = ConstantInt::getAllOnesValue(I.getType()); Value *Add = InsertNewInstBefore(BinaryOperator::createAdd(RHSI, N1, @@ -2458,18 +2467,21 @@ Instruction *InstCombiner::visitRem(BinaryOperator &I) { } - if (ConstantUInt *STO = dyn_cast(SI->getOperand(1))) - if (ConstantUInt *SFO = dyn_cast(SI->getOperand(2))) { - // STO == 0 and SFO == 0 handled above. - - if (isPowerOf2_64(STO->getValue()) && isPowerOf2_64(SFO->getValue())){ - Value *TrueAnd = InsertNewInstBefore(BinaryOperator::createAnd(Op0, - SubOne(STO), SI->getName()+".t"), I); - Value *FalseAnd = InsertNewInstBefore(BinaryOperator::createAnd(Op0, - SubOne(SFO), SI->getName()+".f"), I); - return new SelectInst(SI->getOperand(0), TrueAnd, FalseAnd); + if (ConstantInt *STO = dyn_cast(SI->getOperand(1))) + if (ConstantInt *SFO = dyn_cast(SI->getOperand(2))) + if (STO->getType()->isUnsigned() && SFO->getType()->isUnsigned()) { + // STO == 0 and SFO == 0 handled above. + if (isPowerOf2_64(STO->getZExtValue()) && + isPowerOf2_64(SFO->getZExtValue())) { + Value *TrueAnd = InsertNewInstBefore( + BinaryOperator::createAnd(Op0, SubOne(STO), SI->getName()+".t"), + I); + Value *FalseAnd = InsertNewInstBefore( + BinaryOperator::createAnd(Op0, SubOne(SFO), SI->getName()+".f"), + I); + return new SelectInst(SI->getOperand(0), TrueAnd, FalseAnd); + } } - } } } @@ -2478,46 +2490,42 @@ Instruction *InstCombiner::visitRem(BinaryOperator &I) { // isMaxValueMinusOne - return true if this is Max-1 static bool isMaxValueMinusOne(const ConstantInt *C) { - if (const ConstantUInt *CU = dyn_cast(C)) - return CU->getValue() == C->getType()->getIntegralTypeMask()-1; - - const ConstantSInt *CS = cast(C); + if (C->getType()->isUnsigned()) + return C->getZExtValue() == C->getType()->getIntegralTypeMask()-1; // Calculate 0111111111..11111 unsigned TypeBits = C->getType()->getPrimitiveSizeInBits(); int64_t Val = INT64_MAX; // All ones Val >>= 64-TypeBits; // Shift out unwanted 1 bits... - return CS->getValue() == Val-1; + return C->getSExtValue() == Val-1; } // isMinValuePlusOne - return true if this is Min+1 static bool isMinValuePlusOne(const ConstantInt *C) { - if (const ConstantUInt *CU = dyn_cast(C)) - return CU->getValue() == 1; - - const ConstantSInt *CS = cast(C); + if (C->getType()->isUnsigned()) + return C->getZExtValue() == 1; // Calculate 1111111111000000000000 unsigned TypeBits = C->getType()->getPrimitiveSizeInBits(); int64_t Val = -1; // All ones Val <<= TypeBits-1; // Shift over to the right spot - return CS->getValue() == Val+1; + return C->getSExtValue() == Val+1; } // isOneBitSet - Return true if there is exactly one bit set in the specified // constant. static bool isOneBitSet(const ConstantInt *CI) { - uint64_t V = CI->getRawValue(); + uint64_t V = CI->getZExtValue(); return V && (V & (V-1)) == 0; } #if 0 // Currently unused // isLowOnes - Return true if the constant is of the form 0+1+. static bool isLowOnes(const ConstantInt *CI) { - uint64_t V = CI->getRawValue(); + uint64_t V = CI->getZExtValue(); // There won't be bits set in parts that the type doesn't contain. - V &= ConstantInt::getAllOnesValue(CI->getType())->getRawValue(); + V &= ConstantInt::getAllOnesValue(CI->getType())->getZExtValue(); uint64_t U = V+1; // If it is low ones, this should be a power of two. return U && V && (U & V) == 0; @@ -2527,11 +2535,11 @@ static bool isLowOnes(const ConstantInt *CI) { // isHighOnes - Return true if the constant is of the form 1+0+. // This is the same as lowones(~X). static bool isHighOnes(const ConstantInt *CI) { - uint64_t V = ~CI->getRawValue(); + uint64_t V = ~CI->getZExtValue(); if (~V == 0) return false; // 0's does not match "1+" // There won't be bits set in parts that the type doesn't contain. - V &= ConstantInt::getAllOnesValue(CI->getType())->getRawValue(); + V &= ConstantInt::getAllOnesValue(CI->getType())->getZExtValue(); uint64_t U = V+1; // If it is low ones, this should be a power of two. return U && V && (U & V) == 0; @@ -2656,7 +2664,7 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op, // Adding a one to a single bit bit-field should be turned into an XOR // of the bit. First thing to check is to see if this AND is with a // single bit constant. - uint64_t AndRHSV = cast(AndRHS)->getRawValue(); + uint64_t AndRHSV = cast(AndRHS)->getZExtValue(); // Clear bits that are not part of the constant. AndRHSV &= AndRHS->getType()->getIntegralTypeMask(); @@ -2666,7 +2674,7 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op, // Ok, at this point, we know that we are masking the result of the // ADD down to exactly one bit. If the constant we are adding has // no bits set below this bit, then we can eliminate the ADD. - uint64_t AddRHS = cast(OpRHS)->getRawValue(); + uint64_t AddRHS = cast(OpRHS)->getZExtValue(); // Check to see if any bits below the one bit set in AndRHSV are set. if ((AddRHS & (AndRHSV-1)) == 0) { @@ -2780,7 +2788,9 @@ Instruction *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi, return new SetCondInst(Instruction::SetEQ, V, V); Hi = SubOne(cast(Hi)); - if (cast(Lo)->isMinValue()) // V < 0 || V >= Hi ->'V > Hi-1' + + // V < 0 || V >= Hi ->'V > Hi-1' + if (cast(Lo)->isMinValue()) return new SetCondInst(Instruction::SetGT, V, Hi); // Emit X-Lo > Hi-Lo-1 @@ -2800,7 +2810,7 @@ Instruction *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi, // MSB, so 0x000FFF0, 0x0000FFFF, and 0xFF0000FF are all runs. 0x0F0F0000 is // not, since all 1s are not contiguous. static bool isRunOfOnes(ConstantIntegral *Val, unsigned &MB, unsigned &ME) { - uint64_t V = Val->getRawValue(); + uint64_t V = Val->getZExtValue(); if (!isShiftedMask_64(V)) return false; // look for the first zero bit after the run of ones @@ -2836,7 +2846,7 @@ Value *InstCombiner::FoldLogicalPlusAnd(Value *LHS, Value *RHS, case Instruction::And: if (ConstantExpr::getAnd(N, Mask) == Mask) { // If the AndRHS is a power of two minus one (0+1+), this is simple. - if ((Mask->getRawValue() & Mask->getRawValue()+1) == 0) + if ((Mask->getZExtValue() & Mask->getZExtValue()+1) == 0) break; // Otherwise, if Mask is 0+1+0+, and if B is known to have the low 0+ @@ -2854,7 +2864,7 @@ Value *InstCombiner::FoldLogicalPlusAnd(Value *LHS, Value *RHS, case Instruction::Or: case Instruction::Xor: // If the AndRHS is a power of two minus one (0+1+), and N&Mask == 0 - if ((Mask->getRawValue() & Mask->getRawValue()+1) == 0 && + if ((Mask->getZExtValue() & Mask->getZExtValue()+1) == 0 && ConstantExpr::getAnd(N, Mask)->isNullValue()) break; return 0; @@ -3168,7 +3178,7 @@ static bool CollectBSwapParts(Value *V, std::vector &ByteValues) { // defines a byte. We only handle unsigned types here. if (isa(I) && isa(I->getOperand(1))) { // Not shifting the entire input by N-1 bytes? - if (cast(I->getOperand(1))->getRawValue() != + if (cast(I->getOperand(1))->getZExtValue() != 8*(ByteValues.size()-1)) return true; @@ -3199,19 +3209,19 @@ static bool CollectBSwapParts(Value *V, std::vector &ByteValues) { Instruction *SI = cast(Shift); // Make sure that the shift amount is by a multiple of 8 and isn't too big. - if (ShiftAmt->getRawValue() & 7 || - ShiftAmt->getRawValue() > 8*ByteValues.size()) + if (ShiftAmt->getZExtValue() & 7 || + ShiftAmt->getZExtValue() > 8*ByteValues.size()) return true; // Turn 0xFF -> 0, 0xFF00 -> 1, 0xFF0000 -> 2, etc. unsigned DestByte; for (DestByte = 0; DestByte != ByteValues.size(); ++DestByte) - if (AndAmt->getRawValue() == uint64_t(0xFF) << 8*DestByte) + if (AndAmt->getZExtValue() == uint64_t(0xFF) << 8*DestByte) break; // Unknown mask for bswap. if (DestByte == ByteValues.size()) return true; - unsigned ShiftBytes = ShiftAmt->getRawValue()/8; + unsigned ShiftBytes = ShiftAmt->getZExtValue()/8; unsigned SrcByte; if (SI->getOpcode() == Instruction::Shl) SrcByte = DestByte - ShiftBytes; @@ -3372,7 +3382,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { // replace with V+N. if (C1 == ConstantExpr::getNot(C2)) { Value *V1 = 0, *V2 = 0; - if ((C2->getRawValue() & (C2->getRawValue()+1)) == 0 && // C2 == 0+1+ + if ((C2->getZExtValue() & (C2->getZExtValue()+1)) == 0 && // C2 == 0+1+ match(A, m_Add(m_Value(V1), m_Value(V2)))) { // Add commutes, try both ways. if (V1 == B && MaskedValueIsZero(V2, C2->getZExtValue())) @@ -3381,7 +3391,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { return ReplaceInstUsesWith(I, A); } // Or commutes, try both ways. - if ((C1->getRawValue() & (C1->getRawValue()+1)) == 0 && + if ((C1->getZExtValue() & (C1->getZExtValue()+1)) == 0 && match(B, m_Add(m_Value(V1), m_Value(V2)))) { // Add commutes, try both ways. if (V1 == A && MaskedValueIsZero(V2, C1->getZExtValue())) @@ -3716,7 +3726,7 @@ static bool MulWithOverflow(ConstantInt *&Result, ConstantInt *In1, } static bool isPositive(ConstantInt *C) { - return cast(C)->getValue() >= 0; + return C->getSExtValue() >= 0; } /// AddWithOverflow - Compute Result = In1+In2, returning true if the result @@ -3726,15 +3736,15 @@ static bool AddWithOverflow(ConstantInt *&Result, ConstantInt *In1, Result = cast(ConstantExpr::getAdd(In1, In2)); if (In1->getType()->isUnsigned()) - return cast(Result)->getValue() < - cast(In1)->getValue(); + return cast(Result)->getZExtValue() < + cast(In1)->getZExtValue(); if (isPositive(In1) != isPositive(In2)) return false; if (isPositive(In1)) - return cast(Result)->getValue() < - cast(In1)->getValue(); - return cast(Result)->getValue() > - cast(In1)->getValue(); + return cast(Result)->getSExtValue() < + cast(In1)->getSExtValue(); + return cast(Result)->getSExtValue() > + cast(In1)->getSExtValue(); } /// EmitGEPOffset - Given a getelementptr instruction/constantexpr, emit the @@ -3753,7 +3763,7 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) { for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) { Value *Op = GEP->getOperand(i); uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & PtrSizeMask; - Constant *Scale = ConstantExpr::getCast(ConstantUInt::get(UIntPtrTy, Size), + Constant *Scale = ConstantExpr::getCast(ConstantInt::get(UIntPtrTy, Size), SIntPtrTy); if (Constant *OpC = dyn_cast(Op)) { if (!OpC->isNullValue()) { @@ -4139,14 +4149,14 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { ConstantInt *NewCST; ConstantInt *NewCI; if (Cast->getOperand(0)->getType()->isSigned()) { - NewCST = ConstantSInt::get(Cast->getOperand(0)->getType(), + NewCST = ConstantInt::get(Cast->getOperand(0)->getType(), AndCST->getZExtValue()); - NewCI = ConstantSInt::get(Cast->getOperand(0)->getType(), + NewCI = ConstantInt::get(Cast->getOperand(0)->getType(), CI->getZExtValue()); } else { - NewCST = ConstantUInt::get(Cast->getOperand(0)->getType(), + NewCST = ConstantInt::get(Cast->getOperand(0)->getType(), AndCST->getZExtValue()); - NewCI = ConstantUInt::get(Cast->getOperand(0)->getType(), + NewCI = ConstantInt::get(Cast->getOperand(0)->getType(), CI->getZExtValue()); } Instruction *NewAnd = @@ -4172,8 +4182,8 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { Shift = dyn_cast(CI->getOperand(0)); } - ConstantUInt *ShAmt; - ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; + ConstantInt *ShAmt; + ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; const Type *Ty = Shift ? Shift->getType() : 0; // Type of the shift. const Type *AndTy = AndCST->getType(); // Type of the and. @@ -4185,10 +4195,10 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { if (!CanFold) { // To test for the bad case of the signed shr, see if any // of the bits shifted in could be tested after the mask. - int ShAmtVal = Ty->getPrimitiveSizeInBits()-ShAmt->getValue(); + int ShAmtVal = Ty->getPrimitiveSizeInBits()-ShAmt->getZExtValue(); if (ShAmtVal < 0) ShAmtVal = 0; // Out of range shift. - Constant *OShAmt = ConstantUInt::get(Type::UByteTy, ShAmtVal); + Constant *OShAmt = ConstantInt::get(Type::UByteTy, ShAmtVal); Constant *ShVal = ConstantExpr::getShl(ConstantInt::getAllOnesValue(AndTy), OShAmt); @@ -4277,14 +4287,14 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { break; case Instruction::Shl: // (setcc (shl X, ShAmt), CI) - if (ConstantUInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { + if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { if (I.isEquality()) { unsigned TypeBits = CI->getType()->getPrimitiveSizeInBits(); // Check that the shift amount is in range. If not, don't perform // undefined shifts. When the shift is visited it will be // simplified. - if (ShAmt->getValue() >= TypeBits) + if (ShAmt->getZExtValue() >= TypeBits) break; // If we are comparing against bits always shifted out, the @@ -4299,14 +4309,14 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { if (LHSI->hasOneUse()) { // Otherwise strength reduce the shift into an and. - unsigned ShAmtVal = (unsigned)ShAmt->getValue(); + unsigned ShAmtVal = (unsigned)ShAmt->getZExtValue(); uint64_t Val = (1ULL << (TypeBits-ShAmtVal))-1; Constant *Mask; if (CI->getType()->isUnsigned()) { - Mask = ConstantUInt::get(CI->getType(), Val); + Mask = ConstantInt::get(CI->getType(), Val); } else if (ShAmtVal != 0) { - Mask = ConstantSInt::get(CI->getType(), Val); + Mask = ConstantInt::get(CI->getType(), Val); } else { Mask = ConstantInt::getAllOnesValue(CI->getType()); } @@ -4323,13 +4333,13 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { break; case Instruction::Shr: // (setcc (shr X, ShAmt), CI) - if (ConstantUInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { + if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { if (I.isEquality()) { // Check that the shift amount is in range. If not, don't perform // undefined shifts. When the shift is visited it will be // simplified. unsigned TypeBits = CI->getType()->getPrimitiveSizeInBits(); - if (ShAmt->getValue() >= TypeBits) + if (ShAmt->getZExtValue() >= TypeBits) break; // If we are comparing against bits always shifted out, the @@ -4344,7 +4354,7 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { } if (LHSI->hasOneUse() || CI->isNullValue()) { - unsigned ShAmtVal = (unsigned)ShAmt->getValue(); + unsigned ShAmtVal = (unsigned)ShAmt->getZExtValue(); // Otherwise strength reduce the shift into an and. uint64_t Val = ~0ULL; // All ones. @@ -4353,9 +4363,9 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { Constant *Mask; if (CI->getType()->isUnsigned()) { Val &= ~0ULL >> (64-TypeBits); - Mask = ConstantUInt::get(CI->getType(), Val); + Mask = ConstantInt::get(CI->getType(), Val); } else { - Mask = ConstantSInt::get(CI->getType(), Val); + Mask = ConstantInt::get(CI->getType(), Val); } Instruction *AndI = @@ -4466,22 +4476,40 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { if (I.isEquality()) { bool isSetNE = I.getOpcode() == Instruction::SetNE; - // If the first operand is (and|or|xor) with a constant, and the second - // operand is a constant, simplify a bit. + // If the first operand is (add|sub|and|or|xor|rem) with a constant, and + // the second operand is a constant, simplify a bit. if (BinaryOperator *BO = dyn_cast(Op0)) { switch (BO->getOpcode()) { +#if 0 + case Instruction::SRem: + // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. + if (CI->isNullValue() && isa(BO->getOperand(1)) && + BO->hasOneUse()) { + int64_t V = cast(BO->getOperand(1))->getSExtValue(); + if (V > 1 && isPowerOf2_64(V)) { + Value *NewRem = InsertNewInstBefore( + BinaryOperator::createURem(BO->getOperand(0), + BO->getOperand(1), + BO->getName()), I); + return BinaryOperator::create( + I.getOpcode(), NewRem, + Constant::getNullValue(NewRem->getType())); + } + } + break; +#endif + case Instruction::Rem: // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. - if (CI->isNullValue() && isa(BO->getOperand(1)) && - BO->hasOneUse() && - cast(BO->getOperand(1))->getValue() > 1) { - int64_t V = cast(BO->getOperand(1))->getValue(); - if (isPowerOf2_64(V)) { + if (CI->isNullValue() && isa(BO->getOperand(1)) && + BO->hasOneUse() && BO->getOperand(1)->getType()->isSigned()) { + int64_t V = cast(BO->getOperand(1))->getSExtValue(); + if (V > 1 && isPowerOf2_64(V)) { unsigned L2 = Log2_64(V); const Type *UTy = BO->getType()->getUnsignedVersion(); Value *NewX = InsertNewInstBefore(new CastInst(BO->getOperand(0), UTy, "tmp"), I); - Constant *RHSCst = ConstantUInt::get(UTy, 1ULL << L2); + Constant *RHSCst = ConstantInt::get(UTy, 1ULL << L2); Value *NewRem =InsertNewInstBefore(BinaryOperator::createRem(NewX, RHSCst, BO->getName()), I); return BinaryOperator::create(I.getOpcode(), NewRem, @@ -4489,7 +4517,6 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { } } break; - case Instruction::Add: // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { @@ -4602,21 +4629,21 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) { if (I.getOpcode() == Instruction::SetLT && CI->isNullValue()) // X < 0 => x > 127 return BinaryOperator::createSetGT(CastOp, - ConstantUInt::get(SrcTy, (1ULL << (SrcTySize-1))-1)); + ConstantInt::get(SrcTy, (1ULL << (SrcTySize-1))-1)); else if (I.getOpcode() == Instruction::SetGT && - cast(CI)->getValue() == -1) + cast(CI)->getSExtValue() == -1) // X > -1 => x < 128 return BinaryOperator::createSetLT(CastOp, - ConstantUInt::get(SrcTy, 1ULL << (SrcTySize-1))); + ConstantInt::get(SrcTy, 1ULL << (SrcTySize-1))); } else { - ConstantUInt *CUI = cast(CI); + ConstantInt *CUI = cast(CI); if (I.getOpcode() == Instruction::SetLT && - CUI->getValue() == 1ULL << (SrcTySize-1)) + CUI->getZExtValue() == 1ULL << (SrcTySize-1)) // X < 128 => X > -1 return BinaryOperator::createSetGT(CastOp, - ConstantSInt::get(SrcTy, -1)); + ConstantInt::get(SrcTy, -1)); else if (I.getOpcode() == Instruction::SetGT && - CUI->getValue() == (1ULL << (SrcTySize-1))-1) + CUI->getZExtValue() == (1ULL << (SrcTySize-1))-1) // X > 127 => X < 0 return BinaryOperator::createSetLT(CastOp, Constant::getNullValue(SrcTy)); @@ -4815,13 +4842,13 @@ Instruction *InstCombiner::visitSetCondInstWithCastAndCast(SetCondInst &SCI) { // We're performing a signed comparison. if (isSignSrc) { // Signed extend and signed comparison. - if (cast(CI)->getValue() < 0) // X < (small) --> false + if (cast(CI)->getSExtValue() < 0)// X < (small) --> false Result = ConstantBool::getFalse(); else - Result = ConstantBool::getTrue(); // X < (large) --> true + Result = ConstantBool::getTrue(); // X < (large) --> true } else { // Unsigned extend and signed comparison. - if (cast(CI)->getValue() < 0) + if (cast(CI)->getSExtValue() < 0) Result = ConstantBool::getFalse(); else Result = ConstantBool::getTrue(); @@ -4885,7 +4912,7 @@ Instruction *InstCombiner::visitShiftInst(ShiftInst &I) { // shr int -1, X = -1 (for any arithmetic shift rights of ~0) if (!isLeftShift) - if (ConstantSInt *CSI = dyn_cast(Op0)) + if (ConstantInt *CSI = dyn_cast(Op0)) if (CSI->isAllOnesValue()) return ReplaceInstUsesWith(I, CSI); @@ -4906,13 +4933,14 @@ Instruction *InstCombiner::visitShiftInst(ShiftInst &I) { } } - if (ConstantUInt *CUI = dyn_cast(Op1)) - if (Instruction *Res = FoldShiftByConstant(Op0, CUI, I)) - return Res; + if (ConstantInt *CUI = dyn_cast(Op1)) + if (CUI->getType()->isUnsigned()) + if (Instruction *Res = FoldShiftByConstant(Op0, CUI, I)) + return Res; return 0; } -Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, +Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, ShiftInst &I) { bool isLeftShift = I.getOpcode() == Instruction::Shl; bool isSignedShift = Op0->getType()->isSigned(); @@ -4929,11 +4957,11 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, // of a signed value. // unsigned TypeBits = Op0->getType()->getPrimitiveSizeInBits(); - if (Op1->getValue() >= TypeBits) { + if (Op1->getZExtValue() >= TypeBits) { if (isUnsignedShift || isLeftShift) return ReplaceInstUsesWith(I, Constant::getNullValue(Op0->getType())); else { - I.setOperand(1, ConstantUInt::get(Type::UByteTy, TypeBits-1)); + I.setOperand(1, ConstantInt::get(Type::UByteTy, TypeBits-1)); return &I; } } @@ -5069,7 +5097,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, // operation. // if (isValid && !isLeftShift && isSignedShift) { - uint64_t Val = Op0C->getRawValue(); + uint64_t Val = Op0C->getZExtValue(); isValid = ((Val & (1 << (TypeBits-1))) != 0) == highBitSet; } @@ -5103,7 +5131,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, } } - if (ShiftOp && isa(ShiftOp->getOperand(1))) { + if (ShiftOp && isa(ShiftOp->getOperand(1))) { // Find the operands and properties of the input shift. Note that the // signedness of the input shift may differ from the current shift if there // is a noop cast between the two. @@ -5111,10 +5139,10 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, bool isShiftOfSignedShift = ShiftOp->getType()->isSigned(); bool isShiftOfUnsignedShift = !isShiftOfSignedShift; - ConstantUInt *ShiftAmt1C = cast(ShiftOp->getOperand(1)); + ConstantInt *ShiftAmt1C = cast(ShiftOp->getOperand(1)); - unsigned ShiftAmt1 = (unsigned)ShiftAmt1C->getValue(); - unsigned ShiftAmt2 = (unsigned)Op1->getValue(); + unsigned ShiftAmt1 = (unsigned)ShiftAmt1C->getZExtValue(); + unsigned ShiftAmt2 = (unsigned)Op1->getZExtValue(); // Check for (A << c1) << c2 and (A >> c1) >> c2. if (isLeftShift == isShiftOfLeftShift) { @@ -5132,7 +5160,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, if (isShiftOfSignedShift != isSignedShift) Op = InsertNewInstBefore(new CastInst(Op, I.getType(), "tmp"), I); return new ShiftInst(I.getOpcode(), Op, - ConstantUInt::get(Type::UByteTy, Amt)); + ConstantInt::get(Type::UByteTy, Amt)); } // Check for (A << c1) >> c2 or (A >> c1) << c2. If we are dealing with @@ -5159,7 +5187,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, return ReplaceInstUsesWith(I, Mask); // (A << c) >> c === A & c2 } else if (ShiftAmt1 < ShiftAmt2) { return new ShiftInst(I.getOpcode(), Mask, - ConstantUInt::get(Type::UByteTy, ShiftAmt2-ShiftAmt1)); + ConstantInt::get(Type::UByteTy, ShiftAmt2-ShiftAmt1)); } else if (isShiftOfUnsignedShift || isShiftOfLeftShift) { if (isShiftOfUnsignedShift && !isShiftOfLeftShift && isSignedShift) { // Make sure to emit an unsigned shift right, not a signed one. @@ -5167,12 +5195,12 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, Mask->getType()->getUnsignedVersion(), Op->getName()), I); Mask = new ShiftInst(Instruction::Shr, Mask, - ConstantUInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); + ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); InsertNewInstBefore(Mask, I); return new CastInst(Mask, I.getType()); } else { return new ShiftInst(ShiftOp->getOpcode(), Mask, - ConstantUInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); + ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); } } else { // (X >>s C1) << C2 where C1 > C2 === (X >>s (C1-C2)) & mask @@ -5181,7 +5209,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, Mask->getName()), I); Instruction *Shift = new ShiftInst(ShiftOp->getOpcode(), Op, - ConstantUInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); + ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); InsertNewInstBefore(Shift, I); C = ConstantIntegral::getAllOnesValue(Shift->getType()); @@ -5221,33 +5249,37 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantUInt *Op1, static Value *DecomposeSimpleLinearExpr(Value *Val, unsigned &Scale, unsigned &Offset) { assert(Val->getType() == Type::UIntTy && "Unexpected allocation size type!"); - if (ConstantUInt *CI = dyn_cast(Val)) { - Offset = CI->getValue(); - Scale = 1; - return ConstantUInt::get(Type::UIntTy, 0); + if (ConstantInt *CI = dyn_cast(Val)) { + if (CI->getType()->isUnsigned()) { + Offset = CI->getZExtValue(); + Scale = 1; + return ConstantInt::get(Type::UIntTy, 0); + } } else if (Instruction *I = dyn_cast(Val)) { if (I->getNumOperands() == 2) { - if (ConstantUInt *CUI = dyn_cast(I->getOperand(1))) { - if (I->getOpcode() == Instruction::Shl) { - // This is a value scaled by '1 << the shift amt'. - Scale = 1U << CUI->getValue(); - Offset = 0; - return I->getOperand(0); - } else if (I->getOpcode() == Instruction::Mul) { - // This value is scaled by 'CUI'. - Scale = CUI->getValue(); - Offset = 0; - return I->getOperand(0); - } else if (I->getOpcode() == Instruction::Add) { - // We have X+C. Check to see if we really have (X*C2)+C1, where C1 is - // divisible by C2. - unsigned SubScale; - Value *SubVal = DecomposeSimpleLinearExpr(I->getOperand(0), SubScale, - Offset); - Offset += CUI->getValue(); - if (SubScale > 1 && (Offset % SubScale == 0)) { - Scale = SubScale; - return SubVal; + if (ConstantInt *CUI = dyn_cast(I->getOperand(1))) { + if (CUI->getType()->isUnsigned()) { + if (I->getOpcode() == Instruction::Shl) { + // This is a value scaled by '1 << the shift amt'. + Scale = 1U << CUI->getZExtValue(); + Offset = 0; + return I->getOperand(0); + } else if (I->getOpcode() == Instruction::Mul) { + // This value is scaled by 'CUI'. + Scale = CUI->getZExtValue(); + Offset = 0; + return I->getOperand(0); + } else if (I->getOpcode() == Instruction::Add) { + // We have X+C. Check to see if we really have (X*C2)+C1, + // where C1 is divisible by C2. + unsigned SubScale; + Value *SubVal = + DecomposeSimpleLinearExpr(I->getOperand(0), SubScale, Offset); + Offset += CUI->getZExtValue(); + if (SubScale > 1 && (Offset % SubScale == 0)) { + Scale = SubScale; + return SubVal; + } } } } @@ -5321,9 +5353,12 @@ Instruction *InstCombiner::PromoteCastOfAllocation(CastInst &CI, if (Scale == 1) { Amt = NumElements; } else { - Amt = ConstantUInt::get(Type::UIntTy, Scale); - if (ConstantUInt *CI = dyn_cast(NumElements)) - Amt = ConstantExpr::getMul(CI, cast(Amt)); + // If the allocation size is constant, form a constant mul expression + Amt = ConstantInt::get(Type::UIntTy, Scale); + if (isa(NumElements) && NumElements->getType()->isUnsigned()) + Amt = ConstantExpr::getMul( + cast(NumElements), cast(Amt)); + // otherwise multiply the amount and the number of elements else if (Scale != 1) { Instruction *Tmp = BinaryOperator::createMul(Amt, NumElements, "tmp"); Amt = InsertNewInstBefore(Tmp, AI); @@ -5331,7 +5366,7 @@ Instruction *InstCombiner::PromoteCastOfAllocation(CastInst &CI, } if (unsigned Offset = (AllocElTySize*ArrayOffset)/CastElTySize) { - Value *Off = ConstantUInt::get(Type::UIntTy, Offset); + Value *Off = ConstantInt::get(Type::UIntTy, Offset); Instruction *Tmp = BinaryOperator::createAdd(Amt, Off, "tmp"); Amt = InsertNewInstBefore(Tmp, AI); } @@ -5467,7 +5502,7 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) { assert(CSrc->getType() != Type::ULongTy && "Cannot have type bigger than ulong!"); uint64_t AndValue = CSrc->getType()->getIntegralTypeMask(); - Constant *AndOp = ConstantUInt::get(A->getType()->getUnsignedVersion(), + Constant *AndOp = ConstantInt::get(A->getType()->getUnsignedVersion(), AndValue); AndOp = ConstantExpr::getCast(AndOp, A->getType()); Instruction *And = BinaryOperator::createAnd(CSrc->getOperand(0), AndOp); @@ -5595,7 +5630,8 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) { unsigned SrcBitSize = Src->getType()->getPrimitiveSizeInBits(); unsigned DestBitSize = CI.getType()->getPrimitiveSizeInBits(); assert(SrcBitSize < DestBitSize && "Not a zext?"); - Constant *C = ConstantUInt::get(Type::ULongTy, (1ULL << SrcBitSize)-1); + Constant *C = + ConstantInt::get(Type::ULongTy, (1ULL << SrcBitSize)-1); C = ConstantExpr::getCast(C, CI.getType()); return BinaryOperator::createAnd(Res, C); } @@ -5660,7 +5696,7 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) { // simplifications. if (DestBitSize < SrcBitSize && Src->getType()->isSigned() && isa(Op1)) { - unsigned ShiftAmt = cast(Op1)->getValue(); + unsigned ShiftAmt = cast(Op1)->getZExtValue(); if (SrcBitSize > ShiftAmt && SrcBitSize-ShiftAmt >= DestBitSize) { // Convert to unsigned. Value *N1 = InsertOperandCastBefore(Op0, @@ -5941,9 +5977,9 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { if (ConstantInt *TrueValC = dyn_cast(TrueVal)) if (ConstantInt *FalseValC = dyn_cast(FalseVal)) { // select C, 1, 0 -> cast C to int - if (FalseValC->isNullValue() && TrueValC->getRawValue() == 1) { + if (FalseValC->isNullValue() && TrueValC->getZExtValue() == 1) { return new CastInst(CondVal, SI.getType()); - } else if (TrueValC->isNullValue() && FalseValC->getRawValue() == 1) { + } else if (TrueValC->isNullValue() && FalseValC->getZExtValue() == 1) { // select C, 0, 1 -> cast !C to int Value *NotCond = InsertNewInstBefore(BinaryOperator::createNot(CondVal, @@ -5963,7 +5999,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { IC->getOpcode() == Instruction::SetLT; else { unsigned Bits = CmpCst->getType()->getPrimitiveSizeInBits(); - CanXForm = (CmpCst->getRawValue() == ~0ULL >> (64-Bits+1)) && + CanXForm = (CmpCst->getZExtValue() == ~0ULL >> (64-Bits+1)) && IC->getOpcode() == Instruction::SetGT; } @@ -5978,7 +6014,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { // Now that X is signed, we have to make the all ones value. Do // this by inserting a new SRA. unsigned Bits = X->getType()->getPrimitiveSizeInBits(); - Constant *ShAmt = ConstantUInt::get(Type::UByteTy, Bits-1); + Constant *ShAmt = ConstantInt::get(Type::UByteTy, Bits-1); Instruction *SRA = new ShiftInst(Instruction::Shr, X, ShAmt, "ones"); InsertNewInstBefore(SRA, SI); @@ -6245,7 +6281,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { if (NumBytes->isNullValue()) return EraseInstFromFunction(CI); if (ConstantInt *CI = dyn_cast(NumBytes)) - if (CI->getRawValue() == 1) { + if (CI->getZExtValue() == 1) { // Replace the instruction with just byte operations. We would // transform other cases to loads/stores, but we don't know if // alignment is sufficient. @@ -6278,14 +6314,14 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { unsigned Alignment1 = GetKnownAlignment(MI->getOperand(1), TD); unsigned Alignment2 = GetKnownAlignment(MI->getOperand(2), TD); unsigned Align = std::min(Alignment1, Alignment2); - if (MI->getAlignment()->getRawValue() < Align) { - MI->setAlignment(ConstantUInt::get(Type::UIntTy, Align)); + if (MI->getAlignment()->getZExtValue() < Align) { + MI->setAlignment(ConstantInt::get(Type::UIntTy, Align)); Changed = true; } } else if (isa(MI)) { unsigned Alignment = GetKnownAlignment(MI->getDest(), TD); - if (MI->getAlignment()->getRawValue() < Alignment) { - MI->setAlignment(ConstantUInt::get(Type::UIntTy, Alignment)); + if (MI->getAlignment()->getZExtValue() < Alignment) { + MI->setAlignment(ConstantInt::get(Type::UIntTy, Alignment)); Changed = true; } } @@ -6368,7 +6404,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { for (unsigned i = 0; i != 16; ++i) { if (isa(Mask->getOperand(i))) continue; - unsigned Idx =cast(Mask->getOperand(i))->getRawValue(); + unsigned Idx =cast(Mask->getOperand(i))->getZExtValue(); Idx &= 31; // Match the hardware behavior. if (ExtractedElts[Idx] == 0) { @@ -6542,14 +6578,14 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { for (unsigned i = 0, e = NumCommonArgs; i != e; ++i, ++AI) { const Type *ParamTy = FT->getParamType(i); const Type *ActTy = (*AI)->getType(); - ConstantSInt* c = dyn_cast(*AI); + ConstantInt* c = dyn_cast(*AI); //Either we can cast directly, or we can upconvert the argument bool isConvertible = ActTy->isLosslesslyConvertibleTo(ParamTy) || (ParamTy->isIntegral() && ActTy->isIntegral() && ParamTy->isSigned() == ActTy->isSigned() && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize()) || (c && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize() && - c->getValue() > 0); + c->getSExtValue() > 0); if (Callee->isExternal() && !isConvertible) return false; } @@ -6874,11 +6910,12 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { // If this is a constant idx, make sure to canonicalize it to be a signed // operand, otherwise CSE and other optimizations are pessimized. - if (ConstantUInt *CUI = dyn_cast(Op)) { - GEP.setOperand(i, ConstantExpr::getCast(CUI, - CUI->getType()->getSignedVersion())); - MadeChange = true; - } + if (ConstantInt *CUI = dyn_cast(Op)) + if (CUI->getType()->isUnsigned()) { + GEP.setOperand(i, + ConstantExpr::getCast(CUI, CUI->getType()->getSignedVersion())); + MadeChange = true; + } } if (MadeChange) return &GEP; @@ -7049,11 +7086,12 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { } else if (Instruction *Inst =dyn_cast(GEP.getOperand(1))){ if (Inst->getOpcode() == Instruction::Shl && isa(Inst->getOperand(1))) { - unsigned ShAmt =cast(Inst->getOperand(1))->getValue(); + unsigned ShAmt = + cast(Inst->getOperand(1))->getZExtValue(); if (Inst->getType()->isSigned()) - Scale = ConstantSInt::get(Inst->getType(), 1ULL << ShAmt); + Scale = ConstantInt::get(Inst->getType(), 1ULL << ShAmt); else - Scale = ConstantUInt::get(Inst->getType(), 1ULL << ShAmt); + Scale = ConstantInt::get(Inst->getType(), 1ULL << ShAmt); NewIdx = Inst->getOperand(0); } else if (Inst->getOpcode() == Instruction::Mul && isa(Inst->getOperand(1))) { @@ -7064,15 +7102,11 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { // If the index will be to exactly the right offset with the scale taken // out, perform the transformation. - if (Scale && Scale->getRawValue() % ArrayEltSize == 0) { - if (ConstantSInt *C = dyn_cast(Scale)) - Scale = ConstantSInt::get(C->getType(), - (int64_t)C->getRawValue() / - (int64_t)ArrayEltSize); - else - Scale = ConstantUInt::get(Scale->getType(), - Scale->getRawValue() / ArrayEltSize); - if (Scale->getRawValue() != 1) { + if (Scale && Scale->getZExtValue() % ArrayEltSize == 0) { + if (ConstantInt *C = dyn_cast(Scale)) + Scale = ConstantInt::get(Scale->getType(), + Scale->getZExtValue() / ArrayEltSize); + if (Scale->getZExtValue() != 1) { Constant *C = ConstantExpr::getCast(Scale, NewIdx->getType()); Instruction *Sc = BinaryOperator::createMul(NewIdx, C, "idxscale"); NewIdx = InsertNewInstBefore(Sc, GEP); @@ -7095,8 +7129,9 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) { // Convert: malloc Ty, C - where C is a constant != 1 into: malloc [C x Ty], 1 if (AI.isArrayAllocation()) // Check C != 1 - if (const ConstantUInt *C = dyn_cast(AI.getArraySize())) { - const Type *NewTy = ArrayType::get(AI.getAllocatedType(), C->getValue()); + if (const ConstantInt *C = dyn_cast(AI.getArraySize())) { + const Type *NewTy = + ArrayType::get(AI.getAllocatedType(), C->getZExtValue()); AllocationInst *New = 0; // Create and insert the replacement instruction... @@ -7688,7 +7723,7 @@ static std::vector getShuffleMask(const ShuffleVectorInst *SVI) { if (isa(CP->getOperand(i))) Result.push_back(NElts*2); // undef -> 8 else - Result.push_back(cast(CP->getOperand(i))->getValue()); + Result.push_back(cast(CP->getOperand(i))->getZExtValue()); return Result; } @@ -7710,12 +7745,14 @@ static Value *FindScalarElement(Value *V, unsigned EltNo) { return CP->getOperand(EltNo); else if (InsertElementInst *III = dyn_cast(V)) { // If this is an insert to a variable element, we don't know what it is. - if (!isa(III->getOperand(2))) return 0; - unsigned IIElt = cast(III->getOperand(2))->getValue(); + if (!isa(III->getOperand(2))) + return 0; + unsigned IIElt = cast(III->getOperand(2))->getZExtValue(); // If this is an insert to the element we are looking for, return the // inserted value. - if (EltNo == IIElt) return III->getOperand(1); + if (EltNo == IIElt) + return III->getOperand(1); // Otherwise, the insertelement doesn't modify the value, recurse on its // vector input. @@ -7759,21 +7796,22 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) { // If extracting a specified index from the vector, see if we can recursively // find a previously computed scalar that was inserted into the vector. - if (ConstantUInt *IdxC = dyn_cast(EI.getOperand(1))) { + if (ConstantInt *IdxC = dyn_cast(EI.getOperand(1))) { // This instruction only demands the single element from the input vector. // If the input vector has a single use, simplify it based on this use // property. + uint64_t IndexVal = IdxC->getZExtValue(); if (EI.getOperand(0)->hasOneUse()) { uint64_t UndefElts; if (Value *V = SimplifyDemandedVectorElts(EI.getOperand(0), - 1 << IdxC->getValue(), + 1 << IndexVal, UndefElts)) { EI.setOperand(0, V); return &EI; } } - if (Value *Elt = FindScalarElement(EI.getOperand(0), IdxC->getValue())) + if (Value *Elt = FindScalarElement(EI.getOperand(0), IndexVal)) return ReplaceInstUsesWith(EI, Elt); } @@ -7819,8 +7857,8 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) { } else if (ShuffleVectorInst *SVI = dyn_cast(I)) { // If this is extracting an element from a shufflevector, figure out where // it came from and extract from the appropriate input element instead. - if (ConstantUInt *Elt = dyn_cast(EI.getOperand(1))) { - unsigned SrcIdx = getShuffleMask(SVI)[Elt->getValue()]; + if (ConstantInt *Elt = dyn_cast(EI.getOperand(1))) { + unsigned SrcIdx = getShuffleMask(SVI)[Elt->getZExtValue()]; Value *Src; if (SrcIdx < SVI->getType()->getNumElements()) Src = SVI->getOperand(0); @@ -7851,11 +7889,11 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS, return true; } else if (V == LHS) { for (unsigned i = 0; i != NumElts; ++i) - Mask.push_back(ConstantUInt::get(Type::UIntTy, i)); + Mask.push_back(ConstantInt::get(Type::UIntTy, i)); return true; } else if (V == RHS) { for (unsigned i = 0; i != NumElts; ++i) - Mask.push_back(ConstantUInt::get(Type::UIntTy, i+NumElts)); + Mask.push_back(ConstantInt::get(Type::UIntTy, i+NumElts)); return true; } else if (InsertElementInst *IEI = dyn_cast(V)) { // If this is an insert of an extract from some other vector, include it. @@ -7865,7 +7903,7 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS, if (!isa(IdxOp)) return false; - unsigned InsertedIdx = cast(IdxOp)->getRawValue(); + unsigned InsertedIdx = cast(IdxOp)->getZExtValue(); if (isa(ScalarOp)) { // inserting undef into vector. // Okay, we can handle this if the vector we are insertinting into is @@ -7879,7 +7917,7 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS, if (isa(EI->getOperand(1)) && EI->getOperand(0)->getType() == V->getType()) { unsigned ExtractedIdx = - cast(EI->getOperand(1))->getRawValue(); + cast(EI->getOperand(1))->getZExtValue(); // This must be extracting from either LHS or RHS. if (EI->getOperand(0) == LHS || EI->getOperand(0) == RHS) { @@ -7889,11 +7927,11 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS, // If so, update the mask to reflect the inserted value. if (EI->getOperand(0) == LHS) { Mask[InsertedIdx & (NumElts-1)] = - ConstantUInt::get(Type::UIntTy, ExtractedIdx); + ConstantInt::get(Type::UIntTy, ExtractedIdx); } else { assert(EI->getOperand(0) == RHS); Mask[InsertedIdx & (NumElts-1)] = - ConstantUInt::get(Type::UIntTy, ExtractedIdx+NumElts); + ConstantInt::get(Type::UIntTy, ExtractedIdx+NumElts); } return true; @@ -7921,7 +7959,7 @@ static Value *CollectShuffleElements(Value *V, std::vector &Mask, Mask.assign(NumElts, UndefValue::get(Type::UIntTy)); return V; } else if (isa(V)) { - Mask.assign(NumElts, ConstantUInt::get(Type::UIntTy, 0)); + Mask.assign(NumElts, ConstantInt::get(Type::UIntTy, 0)); return V; } else if (InsertElementInst *IEI = dyn_cast(V)) { // If this is an insert of an extract from some other vector, include it. @@ -7933,8 +7971,8 @@ static Value *CollectShuffleElements(Value *V, std::vector &Mask, if (isa(EI->getOperand(1)) && isa(IdxOp) && EI->getOperand(0)->getType() == V->getType()) { unsigned ExtractedIdx = - cast(EI->getOperand(1))->getRawValue(); - unsigned InsertedIdx = cast(IdxOp)->getRawValue(); + cast(EI->getOperand(1))->getZExtValue(); + unsigned InsertedIdx = cast(IdxOp)->getZExtValue(); // Either the extracted from or inserted into vector must be RHSVec, // otherwise we'd end up with a shuffle of three inputs. @@ -7942,7 +7980,7 @@ static Value *CollectShuffleElements(Value *V, std::vector &Mask, RHS = EI->getOperand(0); Value *V = CollectShuffleElements(VecOp, Mask, RHS); Mask[InsertedIdx & (NumElts-1)] = - ConstantUInt::get(Type::UIntTy, NumElts+ExtractedIdx); + ConstantInt::get(Type::UIntTy, NumElts+ExtractedIdx); return V; } @@ -7951,7 +7989,7 @@ static Value *CollectShuffleElements(Value *V, std::vector &Mask, // Everything but the extracted element is replaced with the RHS. for (unsigned i = 0; i != NumElts; ++i) { if (i != InsertedIdx) - Mask[i] = ConstantUInt::get(Type::UIntTy, NumElts+i); + Mask[i] = ConstantInt::get(Type::UIntTy, NumElts+i); } return V; } @@ -7968,7 +8006,7 @@ static Value *CollectShuffleElements(Value *V, std::vector &Mask, // Otherwise, can't do anything fancy. Return an identity vector. for (unsigned i = 0; i != NumElts; ++i) - Mask.push_back(ConstantUInt::get(Type::UIntTy, i)); + Mask.push_back(ConstantInt::get(Type::UIntTy, i)); return V; } @@ -7983,8 +8021,8 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) { if (isa(EI->getOperand(1)) && isa(IdxOp) && EI->getOperand(0)->getType() == IE.getType()) { unsigned NumVectorElts = IE.getType()->getNumElements(); - unsigned ExtractedIdx=cast(EI->getOperand(1))->getRawValue(); - unsigned InsertedIdx = cast(IdxOp)->getRawValue(); + unsigned ExtractedIdx=cast(EI->getOperand(1))->getZExtValue(); + unsigned InsertedIdx = cast(IdxOp)->getZExtValue(); if (ExtractedIdx >= NumVectorElts) // Out of range extract. return ReplaceInstUsesWith(IE, VecOp); @@ -8010,10 +8048,10 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) { Mask.assign(NumVectorElts, UndefValue::get(Type::UIntTy)); else { assert(isa(VecOp) && "Unknown thing"); - Mask.assign(NumVectorElts, ConstantUInt::get(Type::UIntTy, + Mask.assign(NumVectorElts, ConstantInt::get(Type::UIntTy, NumVectorElts)); } - Mask[InsertedIdx] = ConstantUInt::get(Type::UIntTy, ExtractedIdx); + Mask[InsertedIdx] = ConstantInt::get(Type::UIntTy, ExtractedIdx); return new ShuffleVectorInst(EI->getOperand(0), VecOp, ConstantPacked::get(Mask)); } @@ -8068,7 +8106,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { Mask[i] = 2*e; // Turn into undef. else Mask[i] &= (e-1); // Force to LHS. - Elts.push_back(ConstantUInt::get(Type::UIntTy, Mask[i])); + Elts.push_back(ConstantInt::get(Type::UIntTy, Mask[i])); } } SVI.setOperand(0, SVI.getOperand(1)); @@ -8123,7 +8161,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { if (NewMask[i] >= e*2) { Elts.push_back(UndefValue::get(Type::UIntTy)); } else { - Elts.push_back(ConstantUInt::get(Type::UIntTy, NewMask[i])); + Elts.push_back(ConstantInt::get(Type::UIntTy, NewMask[i])); } } return new ShuffleVectorInst(LHSSVI->getOperand(0), @@ -8193,7 +8231,7 @@ static Constant *OptimizeConstantExpr(ConstantExpr *CE, const TargetData *TD) { if (isFoldableGEP) { std::vector Ops(CE->op_begin()+1, CE->op_end()); uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), Ops); - Constant *C = ConstantUInt::get(Type::ULongTy, Offset); + Constant *C = ConstantInt::get(Type::ULongTy, Offset); C = ConstantExpr::getCast(C, TD->getIntPtrType()); return ConstantExpr::getCast(C, CE->getType()); } diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 7f0248845d..e498860b5e 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -264,7 +264,7 @@ SCEVHandle LoopStrengthReduce::GetExpressionSCEV(Instruction *Exp, Loop *L) { // operand. if (const StructType *STy = dyn_cast(*GTI)) { const StructLayout *SL = TD->getStructLayout(STy); - unsigned Idx = cast(GEP->getOperand(i))->getValue(); + unsigned Idx = cast(GEP->getOperand(i))->getZExtValue(); uint64_t Offset = SL->MemberOffsets[Idx]; GEPVal = SCEVAddExpr::get(GEPVal, SCEVUnknown::getIntegerSCEV(Offset, UIntPtrTy)); @@ -275,7 +275,7 @@ SCEVHandle LoopStrengthReduce::GetExpressionSCEV(Instruction *Exp, Loop *L) { uint64_t TypeSize = TD->getTypeSize(GTI.getIndexedType()); if (TypeSize != 1) Idx = SCEVMulExpr::get(Idx, - SCEVConstant::get(ConstantUInt::get(UIntPtrTy, + SCEVConstant::get(ConstantInt::get(UIntPtrTy, TypeSize))); GEPVal = SCEVAddExpr::get(GEPVal, Idx); } @@ -861,7 +861,7 @@ RemoveCommonExpressionsFromUseBases(std::vector &Uses) { /// static bool isZero(SCEVHandle &V) { if (SCEVConstant *SC = dyn_cast(V)) - return SC->getValue()->getRawValue() == 0; + return SC->getValue()->getZExtValue() == 0; return false; } diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp index f1a826e127..9c59dd3de0 100644 --- a/lib/Transforms/Scalar/LoopUnroll.cpp +++ b/lib/Transforms/Scalar/LoopUnroll.cpp @@ -190,8 +190,8 @@ bool LoopUnroll::visitLoop(Loop *L) { ConstantInt *TripCountC = dyn_cast_or_null(L->getTripCount()); if (!TripCountC) return Changed; // Must have constant trip count! - uint64_t TripCountFull = TripCountC->getRawValue(); - if (TripCountFull != TripCountC->getRawValue() || TripCountFull == 0) + uint64_t TripCountFull = TripCountC->getZExtValue(); + if (TripCountFull != TripCountC->getZExtValue() || TripCountFull == 0) return Changed; // More than 2^32 iterations??? unsigned LoopSize = ApproximateLoopSize(L); diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp index 851009c7d6..6a07691adb 100644 --- a/lib/Transforms/Scalar/LowerGC.cpp +++ b/lib/Transforms/Scalar/LowerGC.cpp @@ -222,8 +222,8 @@ bool LowerGC::runOnFunction(Function &F) { BasicBlock::iterator IP = AI; while (isa(IP)) ++IP; - Constant *Zero = ConstantUInt::get(Type::UIntTy, 0); - Constant *One = ConstantUInt::get(Type::UIntTy, 1); + Constant *Zero = ConstantInt::get(Type::UIntTy, 0); + Constant *One = ConstantInt::get(Type::UIntTy, 1); // Get a pointer to the prev pointer. std::vector Par; @@ -237,11 +237,11 @@ bool LowerGC::runOnFunction(Function &F) { new StoreInst(PrevPtr, PrevPtrPtr, IP); // Set the number of elements in this record. - Par[1] = ConstantUInt::get(Type::UIntTy, 1); + Par[1] = ConstantInt::get(Type::UIntTy, 1); Value *NumEltsPtr = new GetElementPtrInst(AI, Par, "numeltsptr", IP); - new StoreInst(ConstantUInt::get(Type::UIntTy, GCRoots.size()), NumEltsPtr,IP); + new StoreInst(ConstantInt::get(Type::UIntTy, GCRoots.size()), NumEltsPtr,IP); - Par[1] = ConstantUInt::get(Type::UIntTy, 2); + Par[1] = ConstantInt::get(Type::UIntTy, 2); Par.resize(4); const PointerType *PtrLocTy = @@ -251,7 +251,7 @@ bool LowerGC::runOnFunction(Function &F) { // Initialize all of the gcroot records now, and eliminate them as we go. for (unsigned i = 0, e = GCRoots.size(); i != e; ++i) { // Initialize the meta-data pointer. - Par[2] = ConstantUInt::get(Type::UIntTy, i); + Par[2] = ConstantInt::get(Type::UIntTy, i); Par[3] = One; Value *MetaDataPtr = new GetElementPtrInst(AI, Par, "MetaDataPtr", IP); assert(isa(GCRoots[i]->getOperand(2)) && "Must be a constant"); diff --git a/lib/Transforms/Scalar/LowerPacked.cpp b/lib/Transforms/Scalar/LowerPacked.cpp index 79a55ee876..5eb89115b0 100644 --- a/lib/Transforms/Scalar/LowerPacked.cpp +++ b/lib/Transforms/Scalar/LowerPacked.cpp @@ -209,7 +209,7 @@ void LowerPacked::visitLoadInst(LoadInst& LI) if (const PackedType* PKT = dyn_cast(LI.getType())) { // Initialization, Idx is needed for getelementptr needed later std::vector Idx(2); - Idx[0] = ConstantUInt::get(Type::UIntTy,0); + Idx[0] = ConstantInt::get(Type::UIntTy,0); ArrayType* AT = ArrayType::get(PKT->getContainedType(0), PKT->getNumElements()); @@ -227,7 +227,7 @@ void LowerPacked::visitLoadInst(LoadInst& LI) for (unsigned i = 0, e = PKT->getNumElements(); i != e; ++i) { // Calculate the second index we will need - Idx[1] = ConstantUInt::get(Type::UIntTy,i); + Idx[1] = ConstantInt::get(Type::UIntTy,i); // Get the pointer Value* val = new GetElementPtrInst(array, @@ -283,7 +283,7 @@ void LowerPacked::visitStoreInst(StoreInst& SI) dyn_cast(SI.getOperand(0)->getType())) { // We will need this for getelementptr std::vector Idx(2); - Idx[0] = ConstantUInt::get(Type::UIntTy,0); + Idx[0] = ConstantInt::get(Type::UIntTy,0); ArrayType* AT = ArrayType::get(PKT->getContainedType(0), PKT->getNumElements()); @@ -301,7 +301,7 @@ void LowerPacked::visitStoreInst(StoreInst& SI) for (unsigned i = 0, e = PKT->getNumElements(); i != e; ++i) { // Generate the indices for getelementptr - Idx[1] = ConstantUInt::get(Type::UIntTy,i); + Idx[1] = ConstantInt::get(Type::UIntTy,i); Value* val = new GetElementPtrInst(array, Idx, "store.ge." + @@ -346,17 +346,17 @@ void LowerPacked::visitExtractElementInst(ExtractElementInst& EI) const PackedType *PTy = cast(EI.getOperand(0)->getType()); Value *op1 = EI.getOperand(1); - if (ConstantUInt *C = dyn_cast(op1)) { - EI.replaceAllUsesWith(op0Vals[C->getValue()]); + if (ConstantInt *C = dyn_cast(op1)) { + EI.replaceAllUsesWith(op0Vals[C->getZExtValue()]); } else { AllocaInst *alloca = new AllocaInst(PTy->getElementType(), - ConstantUInt::get(Type::UIntTy, PTy->getNumElements()), + ConstantInt::get(Type::UIntTy, PTy->getNumElements()), EI.getName() + ".alloca", EI.getParent()->getParent()->getEntryBlock().begin()); for (unsigned i = 0; i < PTy->getNumElements(); ++i) { GetElementPtrInst *GEP = - new GetElementPtrInst(alloca, ConstantUInt::get(Type::UIntTy, i), + new GetElementPtrInst(alloca, ConstantInt::get(Type::UIntTy, i), "store.ge", &EI); new StoreInst(op0Vals[i], GEP, &EI); } @@ -378,8 +378,8 @@ void LowerPacked::visitInsertElementInst(InsertElementInst& IE) std::vector result; result.reserve(Vals.size()); - if (ConstantUInt *C = dyn_cast(Idx)) { - unsigned idxVal = C->getValue(); + if (ConstantInt *C = dyn_cast(Idx)) { + unsigned idxVal = C->getZExtValue(); for (unsigned i = 0; i != Vals.size(); ++i) { result.push_back(i == idxVal ? Elt : Vals[i]); } @@ -387,7 +387,7 @@ void LowerPacked::visitInsertElementInst(InsertElementInst& IE) for (unsigned i = 0; i != Vals.size(); ++i) { SetCondInst *setcc = new SetCondInst(Instruction::SetEQ, Idx, - ConstantUInt::get(Type::UIntTy, i), + ConstantInt::get(Type::UIntTy, i), "setcc", &IE); SelectInst *select = new SelectInst(setcc, Elt, Vals[i], "select", &IE); diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index 250d62b126..64b7b12a5e 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -549,7 +549,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I, if (CstVal->isNullValue()) { // ... * 0 -> 0 ++NumAnnihil; return CstVal; - } else if (cast(CstVal)->getRawValue() == 1) { + } else if (cast(CstVal)->getZExtValue() == 1) { Ops.pop_back(); // ... * 1 -> ... } break; diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 87952bef5e..496449f494 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -203,7 +203,7 @@ bool SROA::performScalarRepl(Function &F) { GetElementPtrInst *GEPI = cast(User); // We now know that the GEP is of the form: GEP , 0, unsigned Idx = - (unsigned)cast(GEPI->getOperand(2))->getRawValue(); + (unsigned)cast(GEPI->getOperand(2))->getZExtValue(); assert(Idx < ElementAllocas.size() && "Index out of range?"); AllocaInst *AllocaToUse = ElementAllocas[Idx]; @@ -306,7 +306,7 @@ int SROA::isSafeUseOfAllocation(Instruction *User) { // Check to make sure that index falls within the array. If not, // something funny is going on, so we won't do the optimization. // - if (cast(GEPI->getOperand(2))->getRawValue() >= NumElements) + if (cast(GEPI->getOperand(2))->getZExtValue() >= NumElements) return 0; // We cannot scalar repl this level of the array unless any array @@ -320,7 +320,7 @@ int SROA::isSafeUseOfAllocation(Instruction *User) { const ArrayType *SubArrayTy = cast(*I); uint64_t NumElements = SubArrayTy->getNumElements(); if (!isa(I.getOperand())) return 0; - if (cast(I.getOperand())->getRawValue() >= NumElements) + if (cast(I.getOperand())->getZExtValue() >= NumElements) return 0; } @@ -499,7 +499,7 @@ const Type *SROA::CanConvertToScalar(Value *V, bool &IsNotTrivial) { } else if (GetElementPtrInst *GEP = dyn_cast(User)) { // Check to see if this is stepping over an element: GEP Ptr, int C if (GEP->getNumOperands() == 2 && isa(GEP->getOperand(1))) { - unsigned Idx = cast(GEP->getOperand(1))->getRawValue(); + unsigned Idx = cast(GEP->getOperand(1))->getZExtValue(); unsigned ElSize = TD.getTypeSize(PTy->getElementType()); unsigned BitOffset = Idx*ElSize*8; if (BitOffset > 64 || !isPowerOf2_32(ElSize)) return 0; @@ -520,7 +520,7 @@ const Type *SROA::CanConvertToScalar(Value *V, bool &IsNotTrivial) { // We are stepping into an element, e.g. a structure or an array: // GEP Ptr, int 0, uint C const Type *AggTy = PTy->getElementType(); - unsigned Idx = cast(GEP->getOperand(2))->getRawValue(); + unsigned Idx = cast(GEP->getOperand(2))->getZExtValue(); if (const ArrayType *ATy = dyn_cast(AggTy)) { if (Idx >= ATy->getNumElements()) return 0; // Out of range. @@ -608,13 +608,13 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { if (const PackedType *PTy = dyn_cast(NV->getType())) { // Must be an element access. unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); - NV = new ExtractElementInst(NV, ConstantUInt::get(Type::UIntTy, Elt), + NV = new ExtractElementInst(NV, ConstantInt::get(Type::UIntTy, Elt), "tmp", LI); } else { assert(NV->getType()->isInteger() && "Unknown promotion!"); if (Offset && Offset < TD.getTypeSize(NV->getType())*8) NV = new ShiftInst(Instruction::Shr, NV, - ConstantUInt::get(Type::UByteTy, Offset), + ConstantInt::get(Type::UByteTy, Offset), LI->getName(), LI); NV = new CastInst(NV, LI->getType(), LI->getName(), LI); } @@ -635,7 +635,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { // Must be an element insertion. unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); SV = new InsertElementInst(Old, SV, - ConstantUInt::get(Type::UIntTy, Elt), + ConstantInt::get(Type::UIntTy, Elt), "tmp", SI); } else { // If SV is signed, convert it to unsigned, so that the next cast zero @@ -646,7 +646,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { SV = new CastInst(SV, Old->getType(), SV->getName(), SI); if (Offset && Offset < TD.getTypeSize(SV->getType())*8) SV = new ShiftInst(Instruction::Shl, SV, - ConstantUInt::get(Type::UByteTy, Offset), + ConstantInt::get(Type::UByteTy, Offset), SV->getName()+".adj", SI); // Mask out the bits we are about to insert from the old value. unsigned TotalBits = TD.getTypeSize(SV->getType())*8; @@ -657,7 +657,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { if (TotalBits != 64) Mask = Mask & ((1ULL << TotalBits)-1); Old = BinaryOperator::createAnd(Old, - ConstantUInt::get(Old->getType(), Mask), + ConstantInt::get(Old->getType(), Mask), Old->getName()+".mask", SI); SV = BinaryOperator::createOr(Old, SV, SV->getName()+".ins", SI); } @@ -688,7 +688,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { // Check to see if this is stepping over an element: GEP Ptr, int C unsigned NewOffset = Offset; if (GEP->getNumOperands() == 2) { - unsigned Idx = cast(GEP->getOperand(1))->getRawValue(); + unsigned Idx = cast(GEP->getOperand(1))->getZExtValue(); unsigned BitOffset = Idx*AggSizeInBits; if (TD.isLittleEndian() || isVectorInsert) @@ -698,7 +698,7 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { } else if (GEP->getNumOperands() == 3) { // We know that operand #2 is zero. - unsigned Idx = cast(GEP->getOperand(2))->getRawValue(); + unsigned Idx = cast(GEP->getOperand(2))->getZExtValue(); const Type *AggTy = AggPtrTy->getElementType(); if (const SequentialType *SeqTy = dyn_cast(AggTy)) { unsigned ElSizeBits = TD.getTypeSize(SeqTy->getElementType())*8; diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp index 8cd2511e7c..b6739f40b2 100644 --- a/lib/Transforms/TransformInternals.cpp +++ b/lib/Transforms/TransformInternals.cpp @@ -34,7 +34,7 @@ static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset, (i == SL->MemberOffsets.size()-1 || Offset < SL->MemberOffsets[i+1])); // Make sure to save the current index... - Indices.push_back(ConstantUInt::get(Type::UIntTy, i)); + Indices.push_back(ConstantInt::get(Type::UIntTy, i)); Offset = SL->MemberOffsets[i]; return STy->getContainedType(i); } @@ -73,10 +73,11 @@ const Type *llvm::getStructOffsetType(const Type *Ty, unsigned &Offset, NextType = ATy->getElementType(); unsigned ChildSize = (unsigned)TD.getTypeSize(NextType); - if (ConstantSInt::isValueValidForType(Type::IntTy, Offset/ChildSize)) - Indices.push_back(ConstantSInt::get(Type::IntTy, Offset/ChildSize)); + if (ConstantInt::isValueValidForType(Type::IntTy, + uint64_t(Offset/ChildSize))) + Indices.push_back(ConstantInt::get(Type::IntTy, Offset/ChildSize)); else - Indices.push_back(ConstantSInt::get(Type::LongTy, Offset/ChildSize)); + Indices.push_back(ConstantInt::get(Type::LongTy, Offset/ChildSize)); ThisOffset = (Offset/ChildSize)*ChildSize; } else { Offset = 0; // Return the offset that we were able to achieve diff --git a/lib/Transforms/TransformInternals.h b/lib/Transforms/TransformInternals.h index 51e32c81e6..4e28904833 100644 --- a/lib/Transforms/TransformInternals.h +++ b/lib/Transforms/TransformInternals.h @@ -25,7 +25,7 @@ namespace llvm { static inline int64_t getConstantValue(const ConstantInt *CPI) { - return (int64_t)cast(CPI)->getRawValue(); + return (int64_t)cast(CPI)->getZExtValue(); } diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index f264cff472..ba403450a7 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -305,7 +305,7 @@ Function *CodeExtractor::constructFunction(const Values &inputs, if (AggregateArgs) { std::vector Indices; Indices.push_back(Constant::getNullValue(Type::UIntTy)); - Indices.push_back(ConstantUInt::get(Type::UIntTy, i)); + Indices.push_back(ConstantInt::get(Type::UIntTy, i)); std::string GEPname = "gep_" + inputs[i]->getName(); TerminatorInst *TI = newFunction->begin()->getTerminator(); GetElementPtrInst *GEP = new GetElementPtrInst(AI, Indices, GEPname, TI); @@ -392,7 +392,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, for (unsigned i = 0, e = inputs.size(); i != e; ++i) { std::vector Indices; Indices.push_back(Constant::getNullValue(Type::UIntTy)); - Indices.push_back(ConstantUInt::get(Type::UIntTy, i)); + Indices.push_back(ConstantInt::get(Type::UIntTy, i)); GetElementPtrInst *GEP = new GetElementPtrInst(Struct, Indices, "gep_" + StructValues[i]->getName()); @@ -418,7 +418,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, if (AggregateArgs) { std::vector Indices; Indices.push_back(Constant::getNullValue(Type::UIntTy)); - Indices.push_back(ConstantUInt::get(Type::UIntTy, FirstOut + i)); + Indices.push_back(ConstantInt::get(Type::UIntTy, FirstOut + i)); GetElementPtrInst *GEP = new GetElementPtrInst(Struct, Indices, "gep_reload_" + outputs[i]->getName()); @@ -439,7 +439,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, // Now we can emit a switch statement using the call as a value. SwitchInst *TheSwitch = - new SwitchInst(ConstantUInt::getNullValue(Type::UShortTy), + new SwitchInst(ConstantInt::getNullValue(Type::UShortTy), codeReplacer, 0, codeReplacer); // Since there may be multiple exits from the original region, make the new @@ -473,14 +473,14 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, brVal = ConstantBool::get(!SuccNum); break; default: - brVal = ConstantUInt::get(Type::UShortTy, SuccNum); + brVal = ConstantInt::get(Type::UShortTy, SuccNum); break; } ReturnInst *NTRet = new ReturnInst(brVal, NewTarget); // Update the switch instruction. - TheSwitch->addCase(ConstantUInt::get(Type::UShortTy, SuccNum), + TheSwitch->addCase(ConstantInt::get(Type::UShortTy, SuccNum), OldTarget); // Restore values just before we exit @@ -519,7 +519,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, if (AggregateArgs) { std::vector Indices; Indices.push_back(Constant::getNullValue(Type::UIntTy)); - Indices.push_back(ConstantUInt::get(Type::UIntTy,FirstOut+out)); + Indices.push_back(ConstantInt::get(Type::UIntTy,FirstOut+out)); GetElementPtrInst *GEP = new GetElementPtrInst(OAI, Indices, "gep_" + outputs[out]->getName(), diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 3d1faff018..28864fd613 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -272,10 +272,10 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, gep_type_iterator I = gep_type_begin(CE), E = gep_type_end(CE); for (++I; I != E; ++I) if (const StructType *STy = dyn_cast(*I)) { - ConstantUInt *CU = cast(I.getOperand()); - assert(CU->getValue() < STy->getNumElements() && + ConstantInt *CU = cast(I.getOperand()); + assert(CU->getZExtValue() < STy->getNumElements() && "Struct index out of range!"); - unsigned El = (unsigned)CU->getValue(); + unsigned El = (unsigned)CU->getZExtValue(); if (ConstantStruct *CS = dyn_cast(C)) { C = CS->getOperand(El); } else if (isa(C)) { @@ -287,10 +287,10 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, } } else if (ConstantInt *CI = dyn_cast(I.getOperand())) { if (const ArrayType *ATy = dyn_cast(*I)) { - if ((uint64_t)CI->getRawValue() >= ATy->getNumElements()) + if (CI->getZExtValue() >= ATy->getNumElements()) return 0; if (ConstantArray *CA = dyn_cast(C)) - C = CA->getOperand((unsigned)CI->getRawValue()); + C = CA->getOperand(CI->getZExtValue()); else if (isa(C)) C = Constant::getNullValue(ATy->getElementType()); else if (isa(C)) @@ -298,10 +298,10 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, else return 0; } else if (const PackedType *PTy = dyn_cast(*I)) { - if ((uint64_t)CI->getRawValue() >= PTy->getNumElements()) + if (CI->getZExtValue() >= PTy->getNumElements()) return 0; if (ConstantPacked *CP = dyn_cast(C)) - C = CP->getOperand((unsigned)CI->getRawValue()); + C = CP->getOperand(CI->getZExtValue()); else if (isa(C)) C = Constant::getNullValue(PTy->getElementType()); else if (isa(C)) diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index 451df70fef..d08235cd9d 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -119,14 +119,14 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { // malloc(type) becomes sbyte *malloc(size) Value *MallocArg; if (LowerMallocArgToInteger) - MallocArg = ConstantUInt::get(Type::ULongTy, TD.getTypeSize(AllocTy)); + MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize(AllocTy)); else MallocArg = ConstantExpr::getSizeOf(AllocTy); MallocArg = ConstantExpr::getCast(cast(MallocArg), IntPtrTy); if (MI->isArrayAllocation()) { if (isa(MallocArg) && - cast(MallocArg)->getRawValue() == 1) { + cast(MallocArg)->getZExtValue() == 1) { MallocArg = MI->getOperand(0); // Operand * 1 = Operand } else if (Constant *CO = dyn_cast(MI->getOperand(0))) { CO = ConstantExpr::getCast(CO, IntPtrTy); diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index 918055722d..1816144fff 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -269,7 +269,7 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) { void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo, AllocaInst *InvokeNum, SwitchInst *CatchSwitch) { - ConstantUInt *InvokeNoC = ConstantUInt::get(Type::UIntTy, InvokeNo); + ConstantInt *InvokeNoC = ConstantInt::get(Type::UIntTy, InvokeNo); // Insert a store of the invoke num before the invoke and store zero into the // location afterward. @@ -461,7 +461,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { std::vector Idx; Idx.push_back(Constant::getNullValue(Type::IntTy)); - Idx.push_back(ConstantUInt::get(Type::UIntTy, 1)); + Idx.push_back(ConstantInt::get(Type::UIntTy, 1)); OldJmpBufPtr = new GetElementPtrInst(JmpBuf, Idx, "OldBuf", EntryBB->getTerminator()); @@ -500,7 +500,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { BasicBlock *ContBlock = EntryBB->splitBasicBlock(EntryBB->getTerminator(), "setjmp.cont"); - Idx[1] = ConstantUInt::get(Type::UIntTy, 0); + Idx[1] = ConstantInt::get(Type::UIntTy, 0); Value *JmpBufPtr = new GetElementPtrInst(JmpBuf, Idx, "TheJmpBuf", EntryBB->getTerminator()); Value *SJRet = new CallInst(SetJmpFn, JmpBufPtr, "sjret", @@ -550,7 +550,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { // Get a pointer to the jmpbuf and longjmp. std::vector Idx; Idx.push_back(Constant::getNullValue(Type::IntTy)); - Idx.push_back(ConstantUInt::get(Type::UIntTy, 0)); + Idx.push_back(ConstantInt::get(Type::UIntTy, 0)); Idx[0] = new GetElementPtrInst(BufPtr, Idx, "JmpBuf", UnwindBlock); Idx[1] = ConstantInt::get(Type::IntTy, 1); new CallInst(LongJmpFn, Idx, "", UnwindBlock); diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index 12a32f19cb..724499d1ba 100644 --- a/lib/Transforms/Utils/LowerSwitch.cpp +++ b/lib/Transforms/Utils/LowerSwitch.cpp @@ -60,11 +60,12 @@ namespace { struct CaseCmp { bool operator () (const LowerSwitch::Case& C1, const LowerSwitch::Case& C2) { - if (const ConstantUInt* U1 = dyn_cast(C1.first)) - return U1->getValue() < cast(C2.first)->getValue(); - const ConstantSInt* S1 = dyn_cast(C1.first); - return S1->getValue() < cast(C2.first)->getValue(); + const ConstantInt* CI1 = cast(C1.first); + const ConstantInt* CI2 = cast(C2.first); + if (CI1->getType()->isUnsigned()) + return CI1->getZExtValue() < CI2->getZExtValue(); + return CI1->getSExtValue() < CI2->getSExtValue(); } }; @@ -129,7 +130,7 @@ BasicBlock* LowerSwitch::switchConvert(CaseItr Begin, CaseItr End, Case& Pivot = *(Begin + Mid); DEBUG(std::cerr << "Pivot ==> " - << (int64_t)cast(Pivot.first)->getRawValue() + << cast(Pivot.first)->getSExtValue() << "\n"); BasicBlock* LBranch = switchConvert(LHS.begin(), LHS.end(), Val, diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 867455e3e7..de2ab0645c 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1160,7 +1160,7 @@ namespace { /// applications that sort ConstantInt's to ensure uniqueness. struct ConstantIntOrdering { bool operator()(const ConstantInt *LHS, const ConstantInt *RHS) const { - return LHS->getRawValue() < RHS->getRawValue(); + return LHS->getZExtValue() < RHS->getZExtValue(); } }; } diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index aedb2c4040..d4a43ce96c 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -422,10 +422,11 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV, static std::string Indent = "\n"; if (const ConstantBool *CB = dyn_cast(CV)) { Out << (CB->getValue() ? "true" : "false"); - } else if (const ConstantSInt *CI = dyn_cast(CV)) { - Out << CI->getValue(); - } else if (const ConstantUInt *CI = dyn_cast(CV)) { - Out << CI->getValue(); + } else if (const ConstantInt *CI = dyn_cast(CV)) { + if (CI->getType()->isSigned()) + Out << CI->getSExtValue(); + else + Out << CI->getZExtValue(); } else if (const ConstantFP *CFP = dyn_cast(CV)) { // We would like to output the FP constant value in exponential notation, // but we cannot do this if doing so will lose precision. Check here to diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index ffc5ccaedc..ad9a33f845 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -271,14 +271,14 @@ struct VISIBILITY_HIDDEN BoolRules } DEF_CAST(Bool , ConstantBool, bool) - DEF_CAST(SByte , ConstantSInt, signed char) - DEF_CAST(UByte , ConstantUInt, unsigned char) - DEF_CAST(Short , ConstantSInt, signed short) - DEF_CAST(UShort, ConstantUInt, unsigned short) - DEF_CAST(Int , ConstantSInt, signed int) - DEF_CAST(UInt , ConstantUInt, unsigned int) - DEF_CAST(Long , ConstantSInt, int64_t) - DEF_CAST(ULong , ConstantUInt, uint64_t) + DEF_CAST(SByte , ConstantInt, signed char) + DEF_CAST(UByte , ConstantInt, unsigned char) + DEF_CAST(Short , ConstantInt, signed short) + DEF_CAST(UShort, ConstantInt, unsigned short) + DEF_CAST(Int , ConstantInt, signed int) + DEF_CAST(UInt , ConstantInt, unsigned int) + DEF_CAST(Long , ConstantInt, int64_t) + DEF_CAST(ULong , ConstantInt, uint64_t) DEF_CAST(Float , ConstantFP , float) DEF_CAST(Double, ConstantFP , double) #undef DEF_CAST @@ -303,28 +303,28 @@ struct VISIBILITY_HIDDEN NullPointerRules return ConstantBool::getFalse(); } static Constant *CastToSByte (const Constant *V) { - return ConstantSInt::get(Type::SByteTy, 0); + return ConstantInt::get(Type::SByteTy, 0); } static Constant *CastToUByte (const Constant *V) { - return ConstantUInt::get(Type::UByteTy, 0); + return ConstantInt::get(Type::UByteTy, 0); } static Constant *CastToShort (const Constant *V) { - return ConstantSInt::get(Type::ShortTy, 0); + return ConstantInt::get(Type::ShortTy, 0); } static Constant *CastToUShort(const Constant *V) { - return ConstantUInt::get(Type::UShortTy, 0); + return ConstantInt::get(Type::UShortTy, 0); } static Constant *CastToInt (const Constant *V) { - return ConstantSInt::get(Type::IntTy, 0); + return ConstantInt::get(Type::IntTy, 0); } static Constant *CastToUInt (const Constant *V) { - return ConstantUInt::get(Type::UIntTy, 0); + return ConstantInt::get(Type::UIntTy, 0); } static Constant *CastToLong (const Constant *V) { - return ConstantSInt::get(Type::LongTy, 0); + return ConstantInt::get(Type::LongTy, 0); } static Constant *CastToULong (const Constant *V) { - return ConstantUInt::get(Type::ULongTy, 0); + return ConstantInt::get(Type::ULongTy, 0); } static Constant *CastToFloat (const Constant *V) { return ConstantFP::get(Type::FloatTy, 0); @@ -428,49 +428,46 @@ struct VISIBILITY_HIDDEN GeneralPackedRules //===----------------------------------------------------------------------===// -// DirectRules Class +// DirectIntRules Class //===----------------------------------------------------------------------===// // -// DirectRules provides a concrete base classes of ConstRules for a variety of -// different types. This allows the C++ compiler to automatically generate our -// constant handling operations in a typesafe and accurate manner. +// DirectIntRules provides implementations of functions that are valid on +// integer types, but not all types in general. // namespace { -template -struct VISIBILITY_HIDDEN DirectRules - : public TemplateRules { - static Constant *Add(const ConstantClass *V1, const ConstantClass *V2) { - BuiltinType R = (BuiltinType)V1->getValue() + (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); - } +template +struct VISIBILITY_HIDDEN DirectIntRules + : public TemplateRules > { - static Constant *Sub(const ConstantClass *V1, const ConstantClass *V2) { - BuiltinType R = (BuiltinType)V1->getValue() - (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + static Constant *Add(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = (BuiltinType)V1->getZExtValue() + + (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *Mul(const ConstantClass *V1, const ConstantClass *V2) { - BuiltinType R = (BuiltinType)V1->getValue() * (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + static Constant *Sub(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = (BuiltinType)V1->getZExtValue() - + (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *Div(const ConstantClass *V1, const ConstantClass *V2) { - if (V2->isNullValue()) return 0; - BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + static Constant *Mul(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = (BuiltinType)V1->getZExtValue() * + (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *LessThan(const ConstantClass *V1, const ConstantClass *V2) { - bool R = (BuiltinType)V1->getValue() < (BuiltinType)V2->getValue(); + static Constant *LessThan(const ConstantInt *V1, const ConstantInt *V2) { + bool R = (BuiltinType)V1->getZExtValue() < (BuiltinType)V2->getZExtValue(); return ConstantBool::get(R); } - static Constant *EqualTo(const ConstantClass *V1, const ConstantClass *V2) { - bool R = (BuiltinType)V1->getValue() == (BuiltinType)V2->getValue(); + static Constant *EqualTo(const ConstantInt *V1, const ConstantInt *V2) { + bool R = (BuiltinType)V1->getZExtValue() == (BuiltinType)V2->getZExtValue(); return ConstantBool::get(R); } - static Constant *CastToPointer(const ConstantClass *V, + static Constant *CastToPointer(const ConstantInt *V, const PointerType *PTy) { if (V->isNullValue()) // Is it a FP or Integral null value? return ConstantPointerNull::get(PTy); @@ -479,79 +476,70 @@ struct VISIBILITY_HIDDEN DirectRules // Casting operators. ick #define DEF_CAST(TYPE, CLASS, CTYPE) \ - static Constant *CastTo##TYPE (const ConstantClass *V) { \ - return CLASS::get(Type::TYPE##Ty, (CTYPE)(BuiltinType)V->getValue()); \ + static Constant *CastTo##TYPE (const ConstantInt *V) { \ + return CLASS::get(Type::TYPE##Ty, (CTYPE)(BuiltinType)V->getZExtValue()); \ } DEF_CAST(Bool , ConstantBool, bool) - DEF_CAST(SByte , ConstantSInt, signed char) - DEF_CAST(UByte , ConstantUInt, unsigned char) - DEF_CAST(Short , ConstantSInt, signed short) - DEF_CAST(UShort, ConstantUInt, unsigned short) - DEF_CAST(Int , ConstantSInt, signed int) - DEF_CAST(UInt , ConstantUInt, unsigned int) - DEF_CAST(Long , ConstantSInt, int64_t) - DEF_CAST(ULong , ConstantUInt, uint64_t) - DEF_CAST(Float , ConstantFP , float) - DEF_CAST(Double, ConstantFP , double) + DEF_CAST(SByte , ConstantInt, signed char) + DEF_CAST(UByte , ConstantInt, unsigned char) + DEF_CAST(Short , ConstantInt, signed short) + DEF_CAST(UShort, ConstantInt, unsigned short) + DEF_CAST(Int , ConstantInt, signed int) + DEF_CAST(UInt , ConstantInt, unsigned int) + DEF_CAST(Long , ConstantInt, int64_t) + DEF_CAST(ULong , ConstantInt, uint64_t) + DEF_CAST(Float , ConstantFP , float) + DEF_CAST(Double, ConstantFP , double) #undef DEF_CAST -}; -} // end anonymous namespace - -//===----------------------------------------------------------------------===// -// DirectIntRules Class -//===----------------------------------------------------------------------===// -// -// DirectIntRules provides implementations of functions that are valid on -// integer types, but not all types in general. -// -namespace { -template -struct VISIBILITY_HIDDEN DirectIntRules - : public DirectRules > { - - static Constant *Div(const ConstantClass *V1, const ConstantClass *V2) { + static Constant *Div(const ConstantInt *V1, const ConstantInt *V2) { if (V2->isNullValue()) return 0; if (V2->isAllOnesValue() && // MIN_INT / -1 - (BuiltinType)V1->getValue() == -(BuiltinType)V1->getValue()) + (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) return 0; - BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + BuiltinType R = + (BuiltinType)V1->getZExtValue() / (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *Rem(const ConstantClass *V1, - const ConstantClass *V2) { + static Constant *Rem(const ConstantInt *V1, + const ConstantInt *V2) { if (V2->isNullValue()) return 0; // X / 0 if (V2->isAllOnesValue() && // MIN_INT / -1 - (BuiltinType)V1->getValue() == -(BuiltinType)V1->getValue()) + (BuiltinType)V1->getZExtValue() == -(BuiltinType)V1->getZExtValue()) return 0; - BuiltinType R = (BuiltinType)V1->getValue() % (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + BuiltinType R = + (BuiltinType)V1->getZExtValue() % (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *And(const ConstantClass *V1, const ConstantClass *V2) { - BuiltinType R = (BuiltinType)V1->getValue() & (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + static Constant *And(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = + (BuiltinType)V1->getZExtValue() & (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *Or(const ConstantClass *V1, const ConstantClass *V2) { - BuiltinType R = (BuiltinType)V1->getValue() | (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + static Constant *Or(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = + (BuiltinType)V1->getZExtValue() | (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *Xor(const ConstantClass *V1, const ConstantClass *V2) { - BuiltinType R = (BuiltinType)V1->getValue() ^ (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + static Constant *Xor(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = + (BuiltinType)V1->getZExtValue() ^ (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *Shl(const ConstantClass *V1, const ConstantClass *V2) { - BuiltinType R = (BuiltinType)V1->getValue() << (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + static Constant *Shl(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = + (BuiltinType)V1->getZExtValue() << (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } - static Constant *Shr(const ConstantClass *V1, const ConstantClass *V2) { - BuiltinType R = (BuiltinType)V1->getValue() >> (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + static Constant *Shr(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = + (BuiltinType)V1->getZExtValue() >> (BuiltinType)V2->getZExtValue(); + return ConstantInt::get(*Ty, R); } }; } // end anonymous namespace @@ -565,22 +553,74 @@ struct VISIBILITY_HIDDEN DirectIntRules /// floating point types, but not all types in general. /// namespace { -template +template struct VISIBILITY_HIDDEN DirectFPRules - : public DirectRules > { - static Constant *Rem(const ConstantClass *V1, const ConstantClass *V2) { + : public TemplateRules > { + + static Constant *Add(const ConstantFP *V1, const ConstantFP *V2) { + BuiltinType R = (BuiltinType)V1->getValue() + + (BuiltinType)V2->getValue(); + return ConstantFP::get(*Ty, R); + } + + static Constant *Sub(const ConstantFP *V1, const ConstantFP *V2) { + BuiltinType R = (BuiltinType)V1->getValue() - (BuiltinType)V2->getValue(); + return ConstantFP::get(*Ty, R); + } + + static Constant *Mul(const ConstantFP *V1, const ConstantFP *V2) { + BuiltinType R = (BuiltinType)V1->getValue() * (BuiltinType)V2->getValue(); + return ConstantFP::get(*Ty, R); + } + + static Constant *LessThan(const ConstantFP *V1, const ConstantFP *V2) { + bool R = (BuiltinType)V1->getValue() < (BuiltinType)V2->getValue(); + return ConstantBool::get(R); + } + + static Constant *EqualTo(const ConstantFP *V1, const ConstantFP *V2) { + bool R = (BuiltinType)V1->getValue() == (BuiltinType)V2->getValue(); + return ConstantBool::get(R); + } + + static Constant *CastToPointer(const ConstantFP *V, + const PointerType *PTy) { + if (V->isNullValue()) // Is it a FP or Integral null value? + return ConstantPointerNull::get(PTy); + return 0; // Can't const prop other types of pointers + } + + // Casting operators. ick +#define DEF_CAST(TYPE, CLASS, CTYPE) \ + static Constant *CastTo##TYPE (const ConstantFP *V) { \ + return CLASS::get(Type::TYPE##Ty, (CTYPE)(BuiltinType)V->getValue()); \ + } + + DEF_CAST(Bool , ConstantBool, bool) + DEF_CAST(SByte , ConstantInt, signed char) + DEF_CAST(UByte , ConstantInt, unsigned char) + DEF_CAST(Short , ConstantInt, signed short) + DEF_CAST(UShort, ConstantInt, unsigned short) + DEF_CAST(Int , ConstantInt, signed int) + DEF_CAST(UInt , ConstantInt, unsigned int) + DEF_CAST(Long , ConstantInt, int64_t) + DEF_CAST(ULong , ConstantInt, uint64_t) + DEF_CAST(Float , ConstantFP , float) + DEF_CAST(Double, ConstantFP , double) +#undef DEF_CAST + + static Constant *Rem(const ConstantFP *V1, const ConstantFP *V2) { if (V2->isNullValue()) return 0; BuiltinType Result = std::fmod((BuiltinType)V1->getValue(), (BuiltinType)V2->getValue()); - return ConstantClass::get(*Ty, Result); + return ConstantFP::get(*Ty, Result); } - static Constant *Div(const ConstantClass *V1, const ConstantClass *V2) { + static Constant *Div(const ConstantFP *V1, const ConstantFP *V2) { BuiltinType inf = std::numeric_limits::infinity(); - if (V2->isExactlyValue(0.0)) return ConstantClass::get(*Ty, inf); - if (V2->isExactlyValue(-0.0)) return ConstantClass::get(*Ty, -inf); + if (V2->isExactlyValue(0.0)) return ConstantFP::get(*Ty, inf); + if (V2->isExactlyValue(-0.0)) return ConstantFP::get(*Ty, -inf); BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue(); - return ConstantClass::get(*Ty, R); + return ConstantFP::get(*Ty, R); } }; } // end anonymous namespace @@ -590,26 +630,16 @@ static ManagedStatic BoolR; static ManagedStatic NullPointerR; static ManagedStatic ConstantPackedR; static ManagedStatic GeneralPackedR; -static ManagedStatic > SByteR; -static ManagedStatic > UByteR; -static ManagedStatic > ShortR; -static ManagedStatic > UShortR; -static ManagedStatic > IntR; -static ManagedStatic > UIntR; -static ManagedStatic > LongR; -static ManagedStatic > ULongR; -static ManagedStatic > FloatR; -static ManagedStatic > DoubleR; +static ManagedStatic > SByteR; +static ManagedStatic > UByteR; +static ManagedStatic > ShortR; +static ManagedStatic > UShortR; +static ManagedStatic > IntR; +static ManagedStatic > UIntR; +static ManagedStatic > LongR; +static ManagedStatic > ULongR; +static ManagedStatic > FloatR; +static ManagedStatic > DoubleR; /// ConstRules::get - This method returns the constant rules implementation that /// implements the semantics of the two specified constants. @@ -684,7 +714,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP, if (DstEltTy->getTypeID() == Type::DoubleTyID) { for (unsigned i = 0; i != SrcNumElts; ++i) { double V = - BitsToDouble(cast(CP->getOperand(i))->getRawValue()); + BitsToDouble(cast(CP->getOperand(i))->getZExtValue()); Result.push_back(ConstantFP::get(Type::DoubleTy, V)); } return ConstantPacked::get(Result); @@ -692,7 +722,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP, assert(DstEltTy == Type::FloatTy && "Unknown fp type!"); for (unsigned i = 0; i != SrcNumElts; ++i) { float V = - BitsToFloat(cast(CP->getOperand(i))->getRawValue()); + BitsToFloat(cast(CP->getOperand(i))->getZExtValue()); Result.push_back(ConstantFP::get(Type::FloatTy, V)); } return ConstantPacked::get(Result); @@ -705,7 +735,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP, for (unsigned i = 0; i != SrcNumElts; ++i) { uint64_t V = DoubleToBits(cast(CP->getOperand(i))->getValue()); - Constant *C = ConstantUInt::get(Type::ULongTy, V); + Constant *C = ConstantInt::get(Type::ULongTy, V); Result.push_back(ConstantExpr::getCast(C, DstEltTy)); } return ConstantPacked::get(Result); @@ -713,8 +743,8 @@ static Constant *CastConstantPacked(ConstantPacked *CP, assert(SrcEltTy->getTypeID() == Type::FloatTyID); for (unsigned i = 0; i != SrcNumElts; ++i) { - unsigned V = FloatToBits(cast(CP->getOperand(i))->getValue()); - Constant *C = ConstantUInt::get(Type::UIntTy, V); + uint32_t V = FloatToBits(cast(CP->getOperand(i))->getValue()); + Constant *C = ConstantInt::get(Type::UIntTy, V); Result.push_back(ConstantExpr::getCast(C, DstEltTy)); } return ConstantPacked::get(Result); @@ -871,8 +901,8 @@ Constant *llvm::ConstantFoldExtractElementInstruction(const Constant *Val, cast(Val->getType())->getElementType()); if (const ConstantPacked *CVal = dyn_cast(Val)) { - if (const ConstantUInt *CIdx = dyn_cast(Idx)) { - return const_cast(CVal->getOperand(CIdx->getValue())); + if (const ConstantInt *CIdx = dyn_cast(Idx)) { + return const_cast(CVal->getOperand(CIdx->getZExtValue())); } else if (isa(Idx)) { // ee({w,x,y,z}, undef) -> w (an arbitrary value). return const_cast(CVal->getOperand(0)); @@ -884,9 +914,9 @@ Constant *llvm::ConstantFoldExtractElementInstruction(const Constant *Val, Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val, const Constant *Elt, const Constant *Idx) { - const ConstantUInt *CIdx = dyn_cast(Idx); + const ConstantInt *CIdx = dyn_cast(Idx); if (!CIdx) return 0; - unsigned idxVal = CIdx->getValue(); + uint64_t idxVal = CIdx->getZExtValue(); if (const UndefValue *UVal = dyn_cast(Val)) { // Insertion of scalar constant into packed undef // Optimize away insertion of undef @@ -991,7 +1021,8 @@ static int IdxCompare(Constant *C1, Constant *C2, const Type *ElTy) { // If they are really different, now that they are the same type, then we // found a difference! - if (cast(C1)->getValue() < cast(C2)->getValue()) + if (cast(C1)->getSExtValue() < + cast(C2)->getSExtValue()) return -1; else return 1; @@ -1324,17 +1355,17 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, case Instruction::Mul: if (V2->isNullValue()) return const_cast(V2); // X * 0 == 0 if (const ConstantInt *CI = dyn_cast(V2)) - if (CI->getRawValue() == 1) + if (CI->getZExtValue() == 1) return const_cast(V1); // X * 1 == X break; case Instruction::Div: if (const ConstantInt *CI = dyn_cast(V2)) - if (CI->getRawValue() == 1) + if (CI->getZExtValue() == 1) return const_cast(V1); // X / 1 == X break; case Instruction::Rem: if (const ConstantInt *CI = dyn_cast(V2)) - if (CI->getRawValue() == 1) + if (CI->getZExtValue() == 1) return Constant::getNullValue(CI->getType()); // X % 1 == 0 break; case Instruction::And: @@ -1348,7 +1379,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, // Functions are at least 4-byte aligned. If and'ing the address of a // function with a constant < 4, fold it to zero. if (const ConstantInt *CI = dyn_cast(V2)) - if (CI->getRawValue() < 4 && isa(CPR)) + if (CI->getZExtValue() < 4 && isa(CPR)) return Constant::getNullValue(CI->getType()); } break; @@ -1427,10 +1458,10 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C, if (IdxList.size() == 1) { const Type *ElTy = cast(C->getType())->getElementType(); - if (unsigned ElSize = ElTy->getPrimitiveSize()) { + if (uint32_t ElSize = ElTy->getPrimitiveSize()) { // gep null, C is equal to C*sizeof(nullty). If nullty is a known llvm // type, we can statically fold this. - Constant *R = ConstantUInt::get(Type::UIntTy, ElSize); + Constant *R = ConstantInt::get(Type::UIntTy, ElSize); R = ConstantExpr::getCast(R, Idx0->getType()); R = ConstantExpr::getMul(R, Idx0); return ConstantExpr::getCast(R, C->getType()); diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index cf8f79e96d..05b444573e 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -93,35 +93,35 @@ Constant *Constant::getNullValue(const Type *Ty) { return NullBool; } case Type::SByteTyID: { - static Constant *NullSByte = ConstantSInt::get(Type::SByteTy, 0); + static Constant *NullSByte = ConstantInt::get(Type::SByteTy, 0); return NullSByte; } case Type::UByteTyID: { - static Constant *NullUByte = ConstantUInt::get(Type::UByteTy, 0); + static Constant *NullUByte = ConstantInt::get(Type::UByteTy, 0); return NullUByte; } case Type::ShortTyID: { - static Constant *NullShort = ConstantSInt::get(Type::ShortTy, 0); + static Constant *NullShort = ConstantInt::get(Type::ShortTy, 0); return NullShort; } case Type::UShortTyID: { - static Constant *NullUShort = ConstantUInt::get(Type::UShortTy, 0); + static Constant *NullUShort = ConstantInt::get(Type::UShortTy, 0); return NullUShort; } case Type::IntTyID: { - static Constant *NullInt = ConstantSInt::get(Type::IntTy, 0); + static Constant *NullInt = ConstantInt::get(Type::IntTy, 0); return NullInt; } case Type::UIntTyID: { - static Constant *NullUInt = ConstantUInt::get(Type::UIntTy, 0); + static Constant *NullUInt = ConstantInt::get(Type::UIntTy, 0); return NullUInt; } case Type::LongTyID: { - static Constant *NullLong = ConstantSInt::get(Type::LongTy, 0); + static Constant *NullLong = ConstantInt::get(Type::LongTy, 0); return NullLong; } case Type::ULongTyID: { - static Constant *NullULong = ConstantUInt::get(Type::ULongTy, 0); + static Constant *NullULong = ConstantInt::get(Type::ULongTy, 0); return NullULong; } @@ -160,7 +160,7 @@ ConstantIntegral *ConstantIntegral::getMaxValue(const Type *Ty) { unsigned TypeBits = Ty->getPrimitiveSize()*8; int64_t Val = INT64_MAX; // All ones Val >>= 64-TypeBits; // Shift out unwanted 1 bits... - return ConstantSInt::get(Ty, Val); + return ConstantInt::get(Ty, Val); } case Type::UByteTyID: @@ -184,13 +184,13 @@ ConstantIntegral *ConstantIntegral::getMinValue(const Type *Ty) { unsigned TypeBits = Ty->getPrimitiveSize()*8; int64_t Val = -1; // All ones Val <<= TypeBits-1; // Shift over to the right spot - return ConstantSInt::get(Ty, Val); + return ConstantInt::get(Ty, Val); } case Type::UByteTyID: case Type::UShortTyID: case Type::UIntTyID: - case Type::ULongTyID: return ConstantUInt::get(Ty, 0); + case Type::ULongTyID: return ConstantInt::get(Ty, 0); default: return 0; } @@ -203,7 +203,7 @@ ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) { case Type::SByteTyID: case Type::ShortTyID: case Type::IntTyID: - case Type::LongTyID: return ConstantSInt::get(Ty, -1); + case Type::LongTyID: return ConstantInt::get(Ty, -1); case Type::UByteTyID: case Type::UShortTyID: @@ -213,20 +213,12 @@ ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) { unsigned TypeBits = Ty->getPrimitiveSize()*8; uint64_t Val = ~0ULL; // All ones Val >>= 64-TypeBits; // Shift out unwanted 1 bits... - return ConstantUInt::get(Ty, Val); + return ConstantInt::get(Ty, Val); } default: return 0; } } -bool ConstantUInt::isAllOnesValue() const { - unsigned TypeBits = getType()->getPrimitiveSize()*8; - uint64_t Val = ~0ULL; // All ones - Val >>= 64-TypeBits; // Shift out inappropriate bits - return getValue() == Val; -} - - //===----------------------------------------------------------------------===// // ConstantXXX Classes //===----------------------------------------------------------------------===// @@ -235,30 +227,15 @@ bool ConstantUInt::isAllOnesValue() const { // Normal Constructors ConstantIntegral::ConstantIntegral(const Type *Ty, ValueTy VT, uint64_t V) - : Constant(Ty, VT, 0, 0) { - Val.Unsigned = V; + : Constant(Ty, VT, 0, 0), Val(V) { } ConstantBool::ConstantBool(bool V) - : ConstantIntegral(Type::BoolTy, ConstantBoolVal, V) { -} - -ConstantInt::ConstantInt(const Type *Ty, ValueTy VT, uint64_t V) - : ConstantIntegral(Ty, VT, V) { -} - -ConstantSInt::ConstantSInt(const Type *Ty, int64_t V) - : ConstantInt(Ty, ConstantSIntVal, V) { - assert(Ty->isInteger() && Ty->isSigned() && - "Illegal type for signed integer constant!"); - assert(isValueValidForType(Ty, V) && "Value too large for type!"); + : ConstantIntegral(Type::BoolTy, ConstantBoolVal, uint64_t(V)) { } -ConstantUInt::ConstantUInt(const Type *Ty, uint64_t V) - : ConstantInt(Ty, ConstantUIntVal, V) { - assert(Ty->isInteger() && Ty->isUnsigned() && - "Illegal type for unsigned integer constant!"); - assert(isValueValidForType(Ty, V) && "Value too large for type!"); +ConstantInt::ConstantInt(const Type *Ty, uint64_t V) + : ConstantIntegral(Ty, ConstantIntVal, V) { } ConstantFP::ConstantFP(const Type *Ty, double V) @@ -611,36 +588,26 @@ getWithOperands(const std::vector &Ops) const { //===----------------------------------------------------------------------===// // isValueValidForType implementations -bool ConstantSInt::isValueValidForType(const Type *Ty, int64_t Val) { +bool ConstantInt::isValueValidForType(const Type *Ty, int64_t Val) { switch (Ty->getTypeID()) { default: return false; // These can't be represented as integers!!! // Signed types... case Type::SByteTyID: return (Val <= INT8_MAX && Val >= INT8_MIN); + case Type::UByteTyID: + return (Val >= 0) && (Val <= UINT8_MAX); case Type::ShortTyID: return (Val <= INT16_MAX && Val >= INT16_MIN); + case Type::UShortTyID: + return (Val >= 0) && (Val <= UINT16_MAX); case Type::IntTyID: return (Val <= int(INT32_MAX) && Val >= int(INT32_MIN)); - case Type::LongTyID: - return true; // This is the largest type... - } -} - -bool ConstantUInt::isValueValidForType(const Type *Ty, uint64_t Val) { - switch (Ty->getTypeID()) { - default: - return false; // These can't be represented as integers!!! - - // Unsigned types... - case Type::UByteTyID: - return (Val <= UINT8_MAX); - case Type::UShortTyID: - return (Val <= UINT16_MAX); case Type::UIntTyID: - return (Val <= UINT32_MAX); + return (Val >= 0) && (Val <= UINT32_MAX); + case Type::LongTyID: case Type::ULongTyID: - return true; // This is the largest type... + return true; // always true, has to fit in largest type } } @@ -756,8 +723,9 @@ public: ConstantClass *getOrCreate(const TypeClass *Ty, const ValType &V) { MapKey Lookup(Ty, V); typename MapTy::iterator I = Map.lower_bound(Lookup); + // Is it in the map? if (I != Map.end() && I->first == Lookup) - return static_cast(I->second); // Is it in the map? + return static_cast(I->second); // If no preexisting value, create one now... ConstantClass *Result = @@ -914,23 +882,19 @@ ConstantBool *ConstantBool::getFalse() { return F = new ConstantBool(false); } -//---- ConstantUInt::get() and ConstantSInt::get() implementations... +//---- ConstantInt::get() implementations... // -static ManagedStatic > SIntConstants; -static ManagedStatic > UIntConstants; - -ConstantSInt *ConstantSInt::get(const Type *Ty, int64_t V) { - return SIntConstants->getOrCreate(Ty, V); -} - -ConstantUInt *ConstantUInt::get(const Type *Ty, uint64_t V) { - return UIntConstants->getOrCreate(Ty, V); -} +static ManagedStatic > IntConstants; -ConstantInt *ConstantInt::get(const Type *Ty, unsigned char V) { - assert(V <= 127 && "Can only be used with very small positive constants!"); - if (Ty->isSigned()) return ConstantSInt::get(Ty, V); - return ConstantUInt::get(Ty, V); +// Get a ConstantInt from an int64_t. Note here that we canoncialize the value +// to a uint64_t value that has been zero extended down to the size of the +// integer type of the ConstantInt. This allows the getZExtValue method to +// just return the stored value while getSExtValue has to convert back to sign +// extended. getZExtValue is more common in LLVM than getSExtValue(). +ConstantInt *ConstantInt::get(const Type *Ty, int64_t V) { + unsigned Size = Ty->getPrimitiveSizeInBits(); + uint64_t ZeroExtendedCanonicalization = V & (~uint64_t(0UL) >> (64-Size)); + return IntConstants->getOrCreate(Ty, ZeroExtendedCanonicalization ); } //---- ConstantFP::get() implementation... @@ -1075,11 +1039,11 @@ void ConstantArray::destroyConstant() { Constant *ConstantArray::get(const std::string &Str, bool AddNull) { std::vector ElementVals; for (unsigned i = 0; i < Str.length(); ++i) - ElementVals.push_back(ConstantSInt::get(Type::SByteTy, Str[i])); + ElementVals.push_back(ConstantInt::get(Type::SByteTy, Str[i])); // Add a null terminator to the string... if (AddNull) { - ElementVals.push_back(ConstantSInt::get(Type::SByteTy, 0)); + ElementVals.push_back(ConstantInt::get(Type::SByteTy, 0)); } ArrayType *ATy = ArrayType::get(Type::SByteTy, ElementVals.size()); @@ -1109,7 +1073,7 @@ std::string ConstantArray::getAsString() const { assert(isString() && "Not a string!"); std::string Result; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) - Result += (char)cast(getOperand(i))->getRawValue(); + Result += (char)cast(getOperand(i))->getZExtValue(); return Result; } @@ -1443,7 +1407,7 @@ Constant *ConstantExpr::getSizeOf(const Type *Ty) { Constant *ConstantExpr::getPtrPtrFromArrayPtr(Constant *C) { // pointer from array is implemented as: getelementptr arr ptr, 0, 0 - static std::vector Indices(2, ConstantUInt::get(Type::UIntTy, 0)); + static std::vector Indices(2, ConstantInt::get(Type::UIntTy, 0)); return ConstantExpr::getGetElementPtr(C, Indices); } @@ -1920,7 +1884,7 @@ std::string Constant::getStringValue(bool Chop, unsigned Offset) { if (CE->getNumOperands() == 3 && cast(CE->getOperand(1))->isNullValue() && isa(CE->getOperand(2))) { - Offset += cast(CE->getOperand(2))->getRawValue(); + Offset += cast(CE->getOperand(2))->getZExtValue(); return CE->getOperand(0)->getStringValue(Chop, Offset); } } diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 60fce0e492..800eb9cd1d 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -513,7 +513,7 @@ void BranchInst::setSuccessorV(unsigned idx, BasicBlock *B) { static Value *getAISize(Value *Amt) { if (!Amt) - Amt = ConstantUInt::get(Type::UIntTy, 1); + Amt = ConstantInt::get(Type::UIntTy, 1); else { assert(!isa(Amt) && "Passed basic block into allocation size parameter! Ue other ctor"); @@ -546,8 +546,8 @@ AllocationInst::~AllocationInst() { } bool AllocationInst::isArrayAllocation() const { - if (ConstantUInt *CUI = dyn_cast(getOperand(0))) - return CUI->getValue() != 1; + if (ConstantInt *CUI = dyn_cast(getOperand(0))) + return CUI->getZExtValue() != 1; return true; } @@ -849,7 +849,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV, Instruction *InsertBef) : Instruction(cast(Val->getType())->getElementType(), ExtractElement, Ops, 2, Name, InsertBef) { - Constant *Index = ConstantUInt::get(Type::UIntTy, IndexV); + Constant *Index = ConstantInt::get(Type::UIntTy, IndexV); assert(isValidOperands(Val, Index) && "Invalid extractelement instruction operands!"); Ops[0].init(Val, this); @@ -874,7 +874,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV, BasicBlock *InsertAE) : Instruction(cast(Val->getType())->getElementType(), ExtractElement, Ops, 2, Name, InsertAE) { - Constant *Index = ConstantUInt::get(Type::UIntTy, IndexV); + Constant *Index = ConstantInt::get(Type::UIntTy, IndexV); assert(isValidOperands(Val, Index) && "Invalid extractelement instruction operands!"); @@ -915,7 +915,7 @@ InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, unsigned IndexV, const std::string &Name, Instruction *InsertBef) : Instruction(Vec->getType(), InsertElement, Ops, 3, Name, InsertBef) { - Constant *Index = ConstantUInt::get(Type::UIntTy, IndexV); + Constant *Index = ConstantInt::get(Type::UIntTy, IndexV); assert(isValidOperands(Vec, Elt, Index) && "Invalid insertelement instruction operands!"); Ops[0].init(Vec, this); @@ -940,7 +940,7 @@ InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, unsigned IndexV, const std::string &Name, BasicBlock *InsertAE) : Instruction(Vec->getType(), InsertElement, Ops, 3, Name, InsertAE) { - Constant *Index = ConstantUInt::get(Type::UIntTy, IndexV); + Constant *Index = ConstantInt::get(Type::UIntTy, IndexV); assert(isValidOperands(Vec, Elt, Index) && "Invalid insertelement instruction operands!"); diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index e87da1d6e0..fb8cf033e0 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -366,8 +366,8 @@ const std::string &Type::getDescription() const { bool StructType::indexValid(const Value *V) const { // Structure indexes require unsigned integer constants. if (V->getType() == Type::UIntTy) - if (const ConstantUInt *CU = dyn_cast(V)) - return CU->getValue() < ContainedTys.size(); + if (const ConstantInt *CU = dyn_cast(V)) + return CU->getZExtValue() < ContainedTys.size(); return false; } @@ -376,7 +376,7 @@ bool StructType::indexValid(const Value *V) const { // const Type *StructType::getTypeAtIndex(const Value *V) const { assert(indexValid(V) && "Invalid structure index!"); - unsigned Idx = (unsigned)cast(V)->getValue(); + unsigned Idx = (unsigned)cast(V)->getZExtValue(); return ContainedTys[Idx]; } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 57c09bb8c4..868fc67d51 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -586,7 +586,7 @@ void Verifier::visitShuffleVectorInst(ShuffleVectorInst &SV) { // Check to see if Mask is valid. if (const ConstantPacked *MV = dyn_cast(SV.getOperand(2))) { for (unsigned i = 0, e = MV->getNumOperands(); i != e; ++i) { - Assert1(isa(MV->getOperand(i)) || + Assert1(isa(MV->getOperand(i)) || isa(MV->getOperand(i)), "Invalid shufflevector shuffle mask!", &SV); } diff --git a/projects/Stacker/lib/compiler/StackerCompiler.cpp b/projects/Stacker/lib/compiler/StackerCompiler.cpp index a6d3995045..bae7c34c34 100644 --- a/projects/Stacker/lib/compiler/StackerCompiler.cpp +++ b/projects/Stacker/lib/compiler/StackerCompiler.cpp @@ -463,7 +463,7 @@ Instruction* StackerCompiler::push_integer(BasicBlock* bb, int64_t value ) { // Just push a constant integer value - return push_value( bb, ConstantSInt::get( Type::LongTy, value ) ); + return push_value( bb, ConstantInt::get( Type::LongTy, value ) ); } Instruction* @@ -721,7 +721,7 @@ StackerCompiler::handle_if( char* ifTrue, char* ifFalse ) // Compare the condition against 0 SetCondInst* cond_inst = new SetCondInst( Instruction::SetNE, cond, - ConstantSInt::get( Type::LongTy, 0) ); + ConstantInt::get( Type::LongTy, 0) ); bb->getInstList().push_back( cond_inst ); // Create an exit block @@ -805,7 +805,7 @@ StackerCompiler::handle_while( char* todo ) // Compare the condition against 0 SetCondInst* cond_inst = new SetCondInst( - Instruction::SetNE, cond, ConstantSInt::get( Type::LongTy, 0) ); + Instruction::SetNE, cond, ConstantInt::get( Type::LongTy, 0)); test->getInstList().push_back( cond_inst ); // Add the branch instruction @@ -1019,7 +1019,7 @@ StackerCompiler::handle_word( int tkn ) if (echo) bb->setName("DECR"); LoadInst* op1 = cast(pop_integer(bb)); BinaryOperator* subop = BinaryOperator::create( Instruction::Sub, op1, - ConstantSInt::get( Type::LongTy, 1 ) ); + ConstantInt::get( Type::LongTy, 1 ) ); bb->getInstList().push_back( subop ); push_value( bb, subop ); break; @@ -1089,7 +1089,7 @@ StackerCompiler::handle_word( int tkn ) // bb->getInstList().push_back( negop ); // So we'll multiply by -1 (ugh) BinaryOperator* multop = BinaryOperator::create( Instruction::Mul, op1, - ConstantSInt::get( Type::LongTy, -1 ) ); + ConstantInt::get( Type::LongTy, -1 ) ); bb->getInstList().push_back( multop ); push_value( bb, multop ); break; @@ -1601,7 +1601,7 @@ StackerCompiler::handle_word( int tkn ) bb->getInstList().push_back( format_gep ); // Get the character to print (a tab) - ConstantSInt* newline = ConstantSInt::get(Type::IntTy, + ConstantInt* newline = ConstantInt::get(Type::IntTy, static_cast('\t')); // Call printf @@ -1623,7 +1623,7 @@ StackerCompiler::handle_word( int tkn ) bb->getInstList().push_back( format_gep ); // Get the character to print (a space) - ConstantSInt* newline = ConstantSInt::get(Type::IntTy, + ConstantInt* newline = ConstantInt::get(Type::IntTy, static_cast(' ')); // Call printf @@ -1645,7 +1645,7 @@ StackerCompiler::handle_word( int tkn ) bb->getInstList().push_back( format_gep ); // Get the character to print (a newline) - ConstantSInt* newline = ConstantSInt::get(Type::IntTy, + ConstantInt* newline = ConstantInt::get(Type::IntTy, static_cast('\n')); // Call printf diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index 756ef8b50d..c642dd0765 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -181,7 +181,7 @@ static Constant *GetTorInit(std::vector > &TorList) { std::vector ArrayElts; for (unsigned i = 0, e = TorList.size(); i != e; ++i) { std::vector Elts; - Elts.push_back(ConstantSInt::get(Type::IntTy, TorList[i].second)); + Elts.push_back(ConstantInt::get(Type::IntTy, TorList[i].second)); Elts.push_back(TorList[i].first); ArrayElts.push_back(ConstantStruct::get(Elts)); } @@ -210,8 +210,8 @@ static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2){ if (CS->getOperand(1)->isNullValue()) break; // Found a null terminator, stop here. - ConstantSInt *CI = dyn_cast(CS->getOperand(0)); - int Priority = CI ? CI->getValue() : 0; + ConstantInt *CI = dyn_cast(CS->getOperand(0)); + int Priority = CI ? CI->getSExtValue() : 0; Constant *FP = CS->getOperand(1); if (ConstantExpr *CE = dyn_cast(FP)) diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp index 85c1ec7853..e69c722027 100644 --- a/tools/llvm2cpp/CppWriter.cpp +++ b/tools/llvm2cpp/CppWriter.cpp @@ -678,12 +678,11 @@ void CppWriter::printConstant(const Constant *CV) { if (const ConstantBool *CB = dyn_cast(CV)) { Out << "ConstantBool* " << constName << " = ConstantBool::get(" << (CB->getValue() ? "true" : "false") << ");"; - } else if (const ConstantSInt *CI = dyn_cast(CV)) { - Out << "ConstantSInt* " << constName << " = ConstantSInt::get(" - << typeName << ", " << CI->getValue() << ");"; - } else if (const ConstantUInt *CI = dyn_cast(CV)) { - Out << "ConstantUInt* " << constName << " = ConstantUInt::get(" - << typeName << ", " << CI->getValue() << ");"; + } else if (const ConstantInt *CI = dyn_cast(CV)) { + Out << "ConstantInt* " << constName << " = ConstantInt::get(" + << typeName << ", " + << (CV->getType()->isSigned() ? CI->getSExtValue() : CI->getZExtValue()) + << ");"; } else if (isa(CV)) { Out << "ConstantAggregateZero* " << constName << " = ConstantAggregateZero::get(" << typeName << ");"; -- cgit v1.2.3-70-g09d2 From 68fe61d6a165ea6090008e281330895a21607daf Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 29 Nov 2006 00:19:40 +0000 Subject: Replacing std::iostreams with llvm iostreams. Some of these changes involve adding a temporary wrapper around the ostream to make it friendly to functions expecting an LLVM stream. This should be fixed in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31990 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/ModuleMaker.cpp | 5 ++- include/llvm/Analysis/CallGraph.h | 6 ++++ include/llvm/Bytecode/WriteBytecodePass.h | 9 +++--- include/llvm/Bytecode/Writer.h | 5 ++- include/llvm/CodeGen/Passes.h | 5 +++ include/llvm/Support/Streams.h | 1 + lib/Analysis/DataStructure/Local.cpp | 5 ++- lib/Analysis/DataStructure/Printer.cpp | 5 +-- lib/Analysis/DataStructure/Steensgaard.cpp | 7 +++-- lib/Analysis/IPA/Andersens.cpp | 49 +++++++++++++++--------------- lib/Analysis/IPA/CallGraph.cpp | 13 +++++--- lib/Analysis/ScalarEvolutionExpander.cpp | 2 +- lib/Bytecode/Writer/SlotCalculator.cpp | 6 ++-- lib/Bytecode/Writer/Writer.cpp | 17 ++++++----- projects/Stacker/tools/stkrc/stkrc.cpp | 11 ++++--- tools/bugpoint/OptimizerDriver.cpp | 46 +++++++++++++++------------- tools/gccas/gccas.cpp | 14 +++++---- tools/gccld/GenerateCode.cpp | 11 ++++--- tools/gccld/gccld.cpp | 35 ++++++++++----------- tools/llvm-as/llvm-as.cpp | 23 +++++++------- tools/llvm-extract/llvm-extract.cpp | 15 +++++---- tools/llvm-ld/llvm-ld.cpp | 42 ++++++++++++------------- tools/llvm-link/llvm-link.cpp | 39 ++++++++++++------------ tools/lto/lto.cpp | 18 ++++++----- tools/opt/opt.cpp | 7 +++-- 25 files changed, 217 insertions(+), 179 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 2ec5437c36..30f63bb8f4 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -18,8 +18,7 @@ #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Bytecode/Writer.h" -#include - +#include "llvm/Support/Streams.h" using namespace llvm; int main() { @@ -54,7 +53,7 @@ int main() { BB->getInstList().push_back(new ReturnInst(Add)); // Output the bytecode file to stdout - WriteBytecodeToFile(M, std::cout); + WriteBytecodeToFile(M, llvm_cout); // Delete the module and all of its contents. delete M; diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index b567bab474..f29aef3a22 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -152,6 +152,9 @@ public: /// void initialize(Module &M); + void print(llvm_ostream &o, const Module *M) const { + if (o.stream()) print(*o.stream(), M); + } virtual void print(std::ostream &o, const Module *M) const; void dump() const; @@ -198,6 +201,9 @@ public: /// dump - Print out this call graph node. /// void dump() const; + void print(llvm_ostream &OS) const { + if (OS.stream()) print(*OS.stream()); + } void print(std::ostream &OS) const; //===--------------------------------------------------------------------- diff --git a/include/llvm/Bytecode/WriteBytecodePass.h b/include/llvm/Bytecode/WriteBytecodePass.h index 198cc02629..a634812498 100644 --- a/include/llvm/Bytecode/WriteBytecodePass.h +++ b/include/llvm/Bytecode/WriteBytecodePass.h @@ -17,18 +17,19 @@ #include "llvm/Pass.h" #include "llvm/Bytecode/Writer.h" -#include namespace llvm { +class llvm_ostream; + class WriteBytecodePass : public ModulePass { - std::ostream *Out; // ostream to print on + llvm_ostream *Out; // ostream to print on bool DeleteStream; bool CompressFile; public: WriteBytecodePass() - : Out(&std::cout), DeleteStream(false), CompressFile(true) {} - WriteBytecodePass(std::ostream *o, bool DS = false, bool CF = true) + : Out(&llvm_cout), DeleteStream(false), CompressFile(true) {} + WriteBytecodePass(llvm_ostream *o, bool DS = false, bool CF = true) : Out(o), DeleteStream(DS), CompressFile(CF) {} inline ~WriteBytecodePass() { diff --git a/include/llvm/Bytecode/Writer.h b/include/llvm/Bytecode/Writer.h index 8b89226fa5..374e5df482 100644 --- a/include/llvm/Bytecode/Writer.h +++ b/include/llvm/Bytecode/Writer.h @@ -15,14 +15,13 @@ #ifndef LLVM_BYTECODE_WRITER_H #define LLVM_BYTECODE_WRITER_H -#include - namespace llvm { + class llvm_ostream; class Module; /// WriteBytecodeToFile - Write the specified module to the specified output /// stream. If compress is set to true, try to use compression when writing /// out the file. This can never fail if M is a well-formed module. - void WriteBytecodeToFile(const Module *M, std::ostream &Out, + void WriteBytecodeToFile(const Module *M, llvm_ostream &Out, bool compress = true); } // End llvm namespace diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h index adccf531eb..4d27e541d7 100644 --- a/include/llvm/CodeGen/Passes.h +++ b/include/llvm/CodeGen/Passes.h @@ -70,6 +70,11 @@ namespace llvm { /// FunctionPass *createLinearScanRegisterAllocator(); + /// PriorityBasedGraphColoringRegisterAllocator Pass - This pass implements + /// the priority-based graph coloring register allocator by Chow & Hennessey, + /// a global register allocator. + FunctionPass *createGraphColoringRegisterAllocator(); + /// PrologEpilogCodeInserter Pass - This pass inserts prolog and epilog code, /// and eliminates abstract frame references. /// diff --git a/include/llvm/Support/Streams.h b/include/llvm/Support/Streams.h index 8048d56e70..a422756c63 100644 --- a/include/llvm/Support/Streams.h +++ b/include/llvm/Support/Streams.h @@ -43,6 +43,7 @@ namespace llvm { } bool operator == (const std::ostream &OS) { return &OS == Stream; } + bool operator == (const llvm_ostream &OS) { return OS.Stream == Stream; } }; extern llvm_ostream llvm_null; diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 34947371c6..436218be9e 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -24,7 +24,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Timer.h" -#include // FIXME: This should eventually be a FunctionPass that is automatically // aggregated into a Pass. @@ -435,7 +434,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { // Variable index into a node. We must merge all of the elements of the // sequential type here. if (isa(STy)) - std::cerr << "Pointer indexing not handled yet!\n"; + llvm_cerr << "Pointer indexing not handled yet!\n"; else { const ArrayType *ATy = cast(STy); unsigned ElSize = TD.getTypeSize(CurTy); @@ -1062,7 +1061,7 @@ void GraphBuilder::visitCallSite(CallSite CS) { if (DisableDirectCallOpt || !isa(Callee)) { CalleeNode = getValueDest(*Callee).getNode(); if (CalleeNode == 0) { - std::cerr << "WARNING: Program is calling through a null pointer?\n"<< *I; + llvm_cerr << "WARNING: Program is calling through a null pointer?\n"<< *I; return; // Calling a null pointer? } } diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index b425e4e472..ef3ed75555 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -19,9 +19,10 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/GraphWriter.h" +#include "llvm/Support/Streams.h" #include "llvm/ADT/Statistic.h" #include "llvm/Config/config.h" -#include +#include #include #include using namespace llvm; @@ -36,7 +37,7 @@ namespace { Statistic<> NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)"); } -void DSNode::dump() const { print(std::cerr, 0); } +void DSNode::dump() const { print(llvm_cerr, 0); } static std::string getCaption(const DSNode *N, const DSGraph *G) { std::stringstream OS; diff --git a/lib/Analysis/DataStructure/Steensgaard.cpp b/lib/Analysis/DataStructure/Steensgaard.cpp index eb5b74ca02..292dfffa0d 100644 --- a/lib/Analysis/DataStructure/Steensgaard.cpp +++ b/lib/Analysis/DataStructure/Steensgaard.cpp @@ -20,7 +20,7 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Module.h" #include "llvm/Support/Debug.h" -#include +#include using namespace llvm; namespace { @@ -53,6 +53,9 @@ namespace { } // print - Implement the Pass::print method... + void print(llvm_ostream O, const Module *M) const { + if (O.stream()) print(*O.stream(), M); + } void print(std::ostream &O, const Module *M) const { assert(ResultGraph && "Result graph has not yet been computed!"); ResultGraph->writeGraphToFile(O, "steensgaards"); @@ -188,7 +191,7 @@ bool Steens::runOnModule(Module &M) { // FIXME: We should be able to disable the globals graph for steens! //ResultGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals); - DEBUG(print(std::cerr, &M)); + print(DOUT, &M); return false; } diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index 73aa231e21..54e2944b95 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -62,7 +62,6 @@ #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" #include -#include using namespace llvm; namespace { @@ -534,7 +533,7 @@ Andersens::Node *Andersens::getNodeForConstantPointer(Constant *C) { case Instruction::BitCast: return getNodeForConstantPointer(CE->getOperand(0)); default: - std::cerr << "Constant Expr not yet handled: " << *CE << "\n"; + llvm_cerr << "Constant Expr not yet handled: " << *CE << "\n"; assert(0); } } else { @@ -561,7 +560,7 @@ Andersens::Node *Andersens::getNodeForConstantPointerTarget(Constant *C) { case Instruction::BitCast: return getNodeForConstantPointerTarget(CE->getOperand(0)); default: - std::cerr << "Constant Expr not yet handled: " << *CE << "\n"; + llvm_cerr << "Constant Expr not yet handled: " << *CE << "\n"; assert(0); } } else { @@ -787,7 +786,7 @@ void Andersens::visitInstruction(Instruction &I) { return; default: // Is this something we aren't handling yet? - std::cerr << "Unknown instruction: " << I; + llvm_cerr << "Unknown instruction: " << I; abort(); } } @@ -1105,13 +1104,13 @@ void Andersens::SolveConstraints() { void Andersens::PrintNode(Node *N) { if (N == &GraphNodes[UniversalSet]) { - std::cerr << ""; + llvm_cerr << ""; return; } else if (N == &GraphNodes[NullPtr]) { - std::cerr << ""; + llvm_cerr << ""; return; } else if (N == &GraphNodes[NullObject]) { - std::cerr << ""; + llvm_cerr << ""; return; } @@ -1120,56 +1119,56 @@ void Andersens::PrintNode(Node *N) { if (Function *F = dyn_cast(V)) { if (isa(F->getFunctionType()->getReturnType()) && N == getReturnNode(F)) { - std::cerr << F->getName() << ":retval"; + llvm_cerr << F->getName() << ":retval"; return; } else if (F->getFunctionType()->isVarArg() && N == getVarargNode(F)) { - std::cerr << F->getName() << ":vararg"; + llvm_cerr << F->getName() << ":vararg"; return; } } if (Instruction *I = dyn_cast(V)) - std::cerr << I->getParent()->getParent()->getName() << ":"; + llvm_cerr << I->getParent()->getParent()->getName() << ":"; else if (Argument *Arg = dyn_cast(V)) - std::cerr << Arg->getParent()->getName() << ":"; + llvm_cerr << Arg->getParent()->getName() << ":"; if (V->hasName()) - std::cerr << V->getName(); + llvm_cerr << V->getName(); else - std::cerr << "(unnamed)"; + llvm_cerr << "(unnamed)"; if (isa(V) || isa(V)) if (N == getObject(V)) - std::cerr << ""; + llvm_cerr << ""; } void Andersens::PrintConstraints() { - std::cerr << "Constraints:\n"; + llvm_cerr << "Constraints:\n"; for (unsigned i = 0, e = Constraints.size(); i != e; ++i) { - std::cerr << " #" << i << ": "; + llvm_cerr << " #" << i << ": "; Constraint &C = Constraints[i]; if (C.Type == Constraint::Store) - std::cerr << "*"; + llvm_cerr << "*"; PrintNode(C.Dest); - std::cerr << " = "; + llvm_cerr << " = "; if (C.Type == Constraint::Load) - std::cerr << "*"; + llvm_cerr << "*"; PrintNode(C.Src); - std::cerr << "\n"; + llvm_cerr << "\n"; } } void Andersens::PrintPointsToGraph() { - std::cerr << "Points-to graph:\n"; + llvm_cerr << "Points-to graph:\n"; for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) { Node *N = &GraphNodes[i]; - std::cerr << "[" << (N->end() - N->begin()) << "] "; + llvm_cerr << "[" << (N->end() - N->begin()) << "] "; PrintNode(N); - std::cerr << "\t--> "; + llvm_cerr << "\t--> "; for (Node::iterator I = N->begin(), E = N->end(); I != E; ++I) { - if (I != N->begin()) std::cerr << ", "; + if (I != N->begin()) llvm_cerr << ", "; PrintNode(*I); } - std::cerr << "\n"; + llvm_cerr << "\n"; } } diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index d9e7242695..9c22b7cc5e 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -16,7 +16,8 @@ #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/Support/CallSite.h" -#include +#include "llvm/Support/Streams.h" +#include using namespace llvm; static bool isOnlyADirectCall(Function *F, CallSite CS) { @@ -72,6 +73,10 @@ public: AU.setPreservesAll(); } + void print(llvm_ostream &o, const Module *M) const { + if (o.stream()) print(*o.stream(), M); + } + virtual void print(std::ostream &o, const Module *M) const { o << "CallGraph Root is: "; if (Function *F = getRoot()->getFunction()) @@ -89,7 +94,7 @@ public: /// dump - Print out this call graph. /// inline void dump() const { - print(std::cerr, Mod); + print(llvm_cerr, Mod); } CallGraphNode* getExternalCallingNode() const { return ExternalCallingNode; } @@ -207,7 +212,7 @@ void CallGraph::print(std::ostream &OS, const Module *M) const { } void CallGraph::dump() const { - print(std::cerr, 0); + print(llvm_cerr, 0); } //===----------------------------------------------------------------------===// @@ -270,7 +275,7 @@ void CallGraphNode::print(std::ostream &OS) const { OS << "\n"; } -void CallGraphNode::dump() const { print(std::cerr); } +void CallGraphNode::dump() const { print(llvm_cerr); } void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) { for (unsigned i = CalledFunctions.size(); ; --i) { diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index b6d77b93ae..3865d5f7af 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -174,7 +174,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) { SCEVHandle IH = SCEVUnknown::get(I); // Get I as a "symbolic" SCEV. SCEVHandle V = S->evaluateAtIteration(IH); - //std::cerr << "Evaluated: " << *this << "\n to: " << *V << "\n"; + //llvm_cerr << "Evaluated: " << *this << "\n to: " << *V << "\n"; return expandInTy(V, Ty); } diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index 6ac295ca1c..efb6c436cd 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -31,8 +31,8 @@ using namespace llvm; #if 0 -#include -#define SC_DEBUG(X) std::cerr << X +#include "llvm/Support/Streams.h" +#define SC_DEBUG(X) llvm_cerr << X #else #define SC_DEBUG(X) #endif @@ -800,7 +800,7 @@ int SlotCalculator::doInsertValue(const Value *D) { // Used for debugging DefSlot=-1 assertion... //if (Typ == Type::TypeTy) - // cerr << "Inserting type '" << cast(D)->getDescription() << "'!\n"; + // llvm_cerr << "Inserting type '"<(D)->getDescription() <<"'!\n"; if (Typ->isDerivedType()) { int ValSlot; diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index f2ded65b07..d8bcce8208 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -29,6 +29,7 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/Compressor.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Program.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Statistic.h" @@ -275,7 +276,7 @@ void BytecodeWriter::outputType(const Type *T) { break; default: - std::cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize" + llvm_cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize" << " Type '" << T->getDescription() << "'\n"; break; } @@ -384,7 +385,7 @@ void BytecodeWriter::outputConstant(const Constant *CPV) { case Type::VoidTyID: case Type::LabelTyID: default: - std::cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize" + llvm_cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize" << " type '" << *CPV->getType() << "'\n"; break; } @@ -1225,13 +1226,13 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { } } -void llvm::WriteBytecodeToFile(const Module *M, std::ostream &Out, +void llvm::WriteBytecodeToFile(const Module *M, llvm_ostream &Out, bool compress) { assert(M && "You can't write a null module!!"); // Make sure that std::cout is put into binary mode for systems // that care. - if (&Out == std::cout) + if (Out == llvm_cout) sys::Program::ChangeStdoutToBinary(); // Create a vector of unsigned char for the bytecode output. We @@ -1264,21 +1265,21 @@ void llvm::WriteBytecodeToFile(const Module *M, std::ostream &Out, compressed_magic[2] = 'v'; compressed_magic[3] = 'c'; - Out.write(compressed_magic,4); + Out.stream()->write(compressed_magic,4); // Compress everything after the magic number (which we altered) Compressor::compressToStream( (char*)(FirstByte+4), // Skip the magic number Buffer.size()-4, // Skip the magic number - Out // Where to write compressed data + *Out.stream() // Where to write compressed data ); } else { // We're not compressing, so just write the entire block. - Out.write((char*)FirstByte, Buffer.size()); + Out.stream()->write((char*)FirstByte, Buffer.size()); } // make sure it hits disk now - Out.flush(); + Out.stream()->flush(); } diff --git a/projects/Stacker/tools/stkrc/stkrc.cpp b/projects/Stacker/tools/stkrc/stkrc.cpp index 727b044c20..f468330e62 100644 --- a/projects/Stacker/tools/stkrc/stkrc.cpp +++ b/projects/Stacker/tools/stkrc/stkrc.cpp @@ -22,11 +22,11 @@ #include "llvm/Bytecode/Writer.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" #include #include #include - using namespace llvm; static cl::opt @@ -115,7 +115,7 @@ int main(int argc, char **argv) } if (DumpAsm) - std::cerr << "Here's the assembly:" << M.get(); + llvm_cerr << "Here's the assembly:" << M.get(); if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "-") { // Not stdout? @@ -163,14 +163,15 @@ int main(int argc, char **argv) throw std::string("error opening ") + OutputFilename + "!"; } - WriteBytecodeToFile(M.get(), *Out); + llvm_ostream L(*Out); + WriteBytecodeToFile(M.get(), L); } catch (const ParseError &E) { - std::cerr << argv[0] << ": " << E.getMessage() << "\n"; + llvm_cerr << argv[0] << ": " << E.getMessage() << "\n"; return 1; } } catch (const std::string& msg ) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; return 1; } diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index dddf7ceb61..0ec66baddf 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -27,6 +27,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Support/FileUtilities.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Path.h" #include "llvm/System/Program.h" #include "llvm/Config/alloca.h" @@ -55,7 +56,8 @@ bool BugDriver::writeProgramToFile(const std::string &Filename, std::ofstream Out(Filename.c_str(), io_mode); if (!Out.good()) return true; try { - WriteBytecodeToFile(M ? M : Program, Out, /*compression=*/true); + llvm_ostream L(Out); + WriteBytecodeToFile(M ? M : Program, L, /*compression=*/true); } catch (...) { return true; } @@ -72,15 +74,15 @@ void BugDriver::EmitProgressBytecode(const std::string &ID, bool NoFlyer) { // std::string Filename = "bugpoint-" + ID + ".bc"; if (writeProgramToFile(Filename)) { - std::cerr << "Error opening file '" << Filename << "' for writing!\n"; + llvm_cerr << "Error opening file '" << Filename << "' for writing!\n"; return; } - std::cout << "Emitted bytecode to '" << Filename << "'\n"; + llvm_cout << "Emitted bytecode to '" << Filename << "'\n"; if (NoFlyer || PassesToRun.empty()) return; - std::cout << "\n*** You can reproduce the problem with: "; - std::cout << "opt " << Filename << " "; - std::cout << getPassesString(PassesToRun) << "\n"; + llvm_cout << "\n*** You can reproduce the problem with: "; + llvm_cout << "opt " << Filename << " "; + llvm_cout << getPassesString(PassesToRun) << "\n"; } int BugDriver::runPassesAsChild(const std::vector &Passes) { @@ -89,7 +91,7 @@ int BugDriver::runPassesAsChild(const std::vector &Passes) { std::ios::binary; std::ofstream OutFile(ChildOutput.c_str(), io_mode); if (!OutFile.good()) { - std::cerr << "Error opening bytecode file: " << ChildOutput << "\n"; + llvm_cerr << "Error opening bytecode file: " << ChildOutput << "\n"; return 1; } @@ -101,14 +103,15 @@ int BugDriver::runPassesAsChild(const std::vector &Passes) { if (Passes[i]->getNormalCtor()) PM.add(Passes[i]->getNormalCtor()()); else - std::cerr << "Cannot create pass yet: " << Passes[i]->getPassName() + llvm_cerr << "Cannot create pass yet: " << Passes[i]->getPassName() << "\n"; } // Check that the module is well formed on completion of optimization PM.add(createVerifierPass()); // Write bytecode out to disk as the last step... - PM.add(new WriteBytecodePass(&OutFile)); + llvm_ostream L(OutFile); + PM.add(new WriteBytecodePass(&L)); // Run all queued passes. PM.run(*Program); @@ -128,11 +131,11 @@ bool BugDriver::runPasses(const std::vector &Passes, std::string &OutputFilename, bool DeleteOutput, bool Quiet) const { // setup the output file name - std::cout << std::flush; + llvm_cout << std::flush; sys::Path uniqueFilename("bugpoint-output.bc"); std::string ErrMsg; if (uniqueFilename.makeUnique(true, &ErrMsg)) { - std::cerr << getToolName() << ": Error making unique filename: " + llvm_cerr << getToolName() << ": Error making unique filename: " << ErrMsg << "\n"; return(1); } @@ -141,7 +144,7 @@ bool BugDriver::runPasses(const std::vector &Passes, // set up the input file name sys::Path inputFilename("bugpoint-input.bc"); if (inputFilename.makeUnique(true, &ErrMsg)) { - std::cerr << getToolName() << ": Error making unique filename: " + llvm_cerr << getToolName() << ": Error making unique filename: " << ErrMsg << "\n"; return(1); } @@ -149,10 +152,11 @@ bool BugDriver::runPasses(const std::vector &Passes, std::ios::binary; std::ofstream InFile(inputFilename.c_str(), io_mode); if (!InFile.good()) { - std::cerr << "Error opening bytecode file: " << inputFilename << "\n"; + llvm_cerr << "Error opening bytecode file: " << inputFilename << "\n"; return(1); } - WriteBytecodeToFile(Program,InFile,false); + llvm_ostream L(InFile); + WriteBytecodeToFile(Program,L,false); InFile.close(); // setup the child process' arguments @@ -203,17 +207,17 @@ bool BugDriver::runPasses(const std::vector &Passes, if (!Quiet) { if (result == 0) - std::cout << "Success!\n"; + llvm_cout << "Success!\n"; else if (result > 0) - std::cout << "Exited with error code '" << result << "'\n"; + llvm_cout << "Exited with error code '" << result << "'\n"; else if (result < 0) { if (result == -1) - std::cout << "Execute failed: " << ErrMsg << "\n"; + llvm_cout << "Execute failed: " << ErrMsg << "\n"; else - std::cout << "Crashed with signal #" << abs(result) << "\n"; + llvm_cout << "Crashed with signal #" << abs(result) << "\n"; } if (result & 0x01000000) - std::cout << "Dumped core\n"; + llvm_cout << "Dumped core\n"; } // Was the child successful? @@ -231,7 +235,7 @@ Module *BugDriver::runPassesOn(Module *M, std::string BytecodeResult; if (runPasses(Passes, BytecodeResult, false/*delete*/, true/*quiet*/)) { if (AutoDebugCrashes) { - std::cerr << " Error running this sequence of passes" + llvm_cerr << " Error running this sequence of passes" << " on the input program!\n"; delete OldProgram; EmitProgressBytecode("pass-error", false); @@ -246,7 +250,7 @@ Module *BugDriver::runPassesOn(Module *M, Module *Ret = ParseInputFile(BytecodeResult); if (Ret == 0) { - std::cerr << getToolName() << ": Error reading bytecode file '" + llvm_cerr << getToolName() << ": Error reading bytecode file '" << BytecodeResult << "'!\n"; exit(1); } diff --git a/tools/gccas/gccas.cpp b/tools/gccas/gccas.cpp index c46b29608a..eda7d9b5b5 100644 --- a/tools/gccas/gccas.cpp +++ b/tools/gccas/gccas.cpp @@ -23,10 +23,11 @@ #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" +#include #include #include - using namespace llvm; namespace { @@ -140,7 +141,7 @@ int main(int argc, char **argv) { ParseError Err; std::auto_ptr M(ParseAssemblyFile(InputFilename,&Err)); if (M.get() == 0) { - std::cerr << argv[0] << ": " << Err.getMessage() << "\n"; + llvm_cerr << argv[0] << ": " << Err.getMessage() << "\n"; return 1; } @@ -175,7 +176,7 @@ int main(int argc, char **argv) { if (!Out->good()) { - std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + llvm_cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } @@ -194,7 +195,8 @@ int main(int argc, char **argv) { Passes.add(createVerifierPass()); // Write bytecode to file... - Passes.add(new WriteBytecodePass(Out,false,!NoCompress)); + llvm_ostream L(*Out); + Passes.add(new WriteBytecodePass(&L,false,!NoCompress)); // Run our queue of passes all at once now, efficiently. Passes.run(*M.get()); @@ -202,9 +204,9 @@ int main(int argc, char **argv) { if (Out != &std::cout) delete Out; return 0; } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp index e28f4c9fcb..c84c7d3640 100644 --- a/tools/gccld/GenerateCode.cpp +++ b/tools/gccld/GenerateCode.cpp @@ -27,7 +27,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Support/SystemUtils.h" #include "llvm/Support/CommandLine.h" - +#include "llvm/Support/Streams.h" using namespace llvm; namespace { @@ -123,10 +123,10 @@ static void RemoveEnv(const char * name, char ** const envp) { } static void dumpArgs(const char **args) { - std::cerr << *args++; + llvm_cerr << *args++; while (*args) - std::cerr << ' ' << *args++; - std::cerr << '\n' << std::flush; + llvm_cerr << ' ' << *args++; + llvm_cerr << '\n' << std::flush; } static inline void addPass(PassManager &PM, Pass *P) { @@ -283,7 +283,8 @@ int llvm::GenerateBytecode(Module *M, int StripLevel, bool Internalize, Passes.add(createVerifierPass()); // Add the pass that writes bytecode to the output file... - addPass(Passes, new WriteBytecodePass(Out, false, !NoCompress)); + llvm_ostream L(*Out); + addPass(Passes, new WriteBytecodePass(&L, false, !NoCompress)); // Run our queue of passes all at once now, efficiently. Passes.run(*M); diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp index 9401a8acbf..5376425b52 100644 --- a/tools/gccld/gccld.cpp +++ b/tools/gccld/gccld.cpp @@ -31,6 +31,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" #include "llvm/Support/SystemUtils.h" #include @@ -126,7 +127,7 @@ namespace { /// Message - The message to print to standard error. /// static int PrintAndReturn(const char *progname, const std::string &Message) { - std::cerr << progname << ": " << Message << "\n"; + llvm_cerr << progname << ": " << Message << "\n"; return 1; } @@ -140,11 +141,11 @@ static void EmitShellScript(char **argv) { std::string ErrMsg; sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]); if (llvmstub.isEmpty()) { - std::cerr << "Could not find llvm-stub.exe executable!\n"; + llvm_cerr << "Could not find llvm-stub.exe executable!\n"; exit(1); } if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; exit(1); } @@ -324,18 +325,18 @@ int main(int argc, char **argv, char **envp ) { return PrintAndReturn(argv[0], "Failed to find gcc"); // Generate an assembly language file for the bytecode. - if (Verbose) std::cout << "Generating Assembly Code\n"; + if (Verbose) llvm_cout << "Generating Assembly Code\n"; std::string ErrMsg; if (0 != GenerateAssembly( AssemblyFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } - if (Verbose) std::cout << "Generating Native Code\n"; + if (Verbose) llvm_cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(), LibPaths, Libraries, gcc, envp, LinkAsLibrary, NoInternalize, RPath, SOName, ErrMsg, Verbose) ) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } @@ -364,18 +365,18 @@ int main(int argc, char **argv, char **envp ) { return PrintAndReturn(argv[0], "Failed to find gcc"); // Generate an assembly language file for the bytecode. - if (Verbose) std::cout << "Generating C Source Code\n"; + if (Verbose) llvm_cout << "Generating C Source Code\n"; std::string ErrMsg; if (0 != GenerateCFile( CFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } - if (Verbose) std::cout << "Generating Native Code\n"; + if (Verbose) llvm_cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, CFile.toString(), LibPaths, Libraries, gcc, envp, LinkAsLibrary, NoInternalize, RPath, SOName, ErrMsg, Verbose)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } @@ -392,11 +393,11 @@ int main(int argc, char **argv, char **envp ) { // Make the bytecode file readable and directly executable in LLEE std::string ErrMsg; if (sys::Path(RealBytecodeOutput).makeExecutableOnDisk(&ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } if (sys::Path(RealBytecodeOutput).makeReadableOnDisk(&ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } } @@ -404,18 +405,18 @@ int main(int argc, char **argv, char **envp ) { // Make the output, whether native or script, executable as well... std::string ErrMsg; if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } } catch (const char*msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; exitCode = 1; } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; exitCode = 2; } catch (...) { // This really shouldn't happen, but just in case .... - std::cerr << argv[0] << ": An unexpected unknown exception occurred.\n"; + llvm_cerr << argv[0] << ": An unexpected unknown exception occurred.\n"; exitCode = 3; } diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 4a1b9adb00..d8f487ee9d 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -20,12 +20,12 @@ #include "llvm/Bytecode/Writer.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/Support/SystemUtils.h" #include "llvm/System/Signals.h" #include #include #include - using namespace llvm; static cl::opt @@ -60,27 +60,27 @@ int main(int argc, char **argv) { ParseError Err; std::auto_ptr M(ParseAssemblyFile(InputFilename,&Err)); if (M.get() == 0) { - std::cerr << argv[0] << ": " << Err.getMessage() << "\n"; + llvm_cerr << argv[0] << ": " << Err.getMessage() << "\n"; return 1; } if (!DisableVerify) { std::string Err; if (verifyModule(*M.get(), ReturnStatusAction, &Err)) { - std::cerr << argv[0] + llvm_cerr << argv[0] << ": assembly parsed, but does not verify as correct!\n"; - std::cerr << Err; + llvm_cerr << Err; return 1; } } - if (DumpAsm) std::cerr << "Here's the assembly:\n" << *M.get(); + if (DumpAsm) llvm_cerr << "Here's the assembly:\n" << *M.get(); if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "-") { // Not stdout? if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename + llvm_cerr << argv[0] << ": error opening '" << OutputFilename << "': file exists!\n" << "Use -f command line argument to force output\n"; return 1; @@ -108,7 +108,7 @@ int main(int argc, char **argv) { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename + llvm_cerr << argv[0] << ": error opening '" << OutputFilename << "': file exists!\n" << "Use -f command line argument to force output\n"; return 1; @@ -123,18 +123,19 @@ int main(int argc, char **argv) { } if (!Out->good()) { - std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + llvm_cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } if (Force || !CheckBytecodeOutputToConsole(Out,true)) { - WriteBytecodeToFile(M.get(), *Out, !NoCompress); + llvm_ostream L(*Out); + WriteBytecodeToFile(M.get(), L, !NoCompress); } } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; exitCode = 1; } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; exitCode = 1; } diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index c675e47c03..4f3236f802 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -19,7 +19,9 @@ #include "llvm/Transforms/IPO.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" +#include #include #include using namespace llvm; @@ -51,14 +53,14 @@ int main(int argc, char **argv) { std::auto_ptr M(ParseBytecodeFile(InputFilename)); if (M.get() == 0) { - std::cerr << argv[0] << ": bytecode didn't read correctly.\n"; + llvm_cerr << argv[0] << ": bytecode didn't read correctly.\n"; return 1; } // Figure out which function we should extract Function *F = M.get()->getNamedFunction(ExtractFunc); if (F == 0) { - std::cerr << argv[0] << ": program doesn't contain function named '" + llvm_cerr << argv[0] << ": program doesn't contain function named '" << ExtractFunc << "'!\n"; return 1; } @@ -78,7 +80,7 @@ int main(int argc, char **argv) { if (OutputFilename != "-") { // Not stdout? if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename + llvm_cerr << argv[0] << ": error opening '" << OutputFilename << "': file exists!\n" << "Use -f command line argument to force output\n"; return 1; @@ -91,16 +93,17 @@ int main(int argc, char **argv) { Out = &std::cout; } - Passes.add(new WriteBytecodePass(Out)); // Write bytecode to file... + llvm_ostream L(*Out); + Passes.add(new WriteBytecodePass(&L)); // Write bytecode to file... Passes.run(*M.get()); if (Out != &std::cout) delete Out; return 0; } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 82cf674724..fe825f9fed 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -32,12 +32,11 @@ #include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileUtilities.h" +#include "llvm/Support/Streams.h" #include "llvm/Support/SystemUtils.h" #include "llvm/System/Signals.h" #include -#include #include - using namespace llvm; // Input/Output Options @@ -109,7 +108,7 @@ static std::string progname; /// Message - The message to print to standard error. /// static int PrintAndReturn(const std::string &Message) { - std::cerr << progname << ": " << Message << "\n"; + llvm_cerr << progname << ": " << Message << "\n"; return 1; } @@ -208,7 +207,8 @@ void GenerateBytecode(Module* M, const std::string& FileName) { sys::RemoveFileOnSignal(sys::Path(FileName)); // Write it out - WriteBytecodeToFile(M, Out, !DisableCompression); + llvm_ostream L(Out); + WriteBytecodeToFile(M, L, !DisableCompression); // Close the bytecode file. Out.close(); @@ -351,12 +351,12 @@ static void EmitShellScript(char **argv) { std::string ErrMsg; sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]); if (llvmstub.isEmpty()) { - std::cerr << "Could not find llvm-stub.exe executable!\n"; + llvm_cerr << "Could not find llvm-stub.exe executable!\n"; exit(1); } if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; exit(1); } @@ -518,14 +518,14 @@ int main(int argc, char **argv, char **envp) { sys::Path target(RealBytecodeOutput); target.eraseFromDisk(); if (tmp_output.renamePathOnDisk(target, &ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } } else return PrintAndReturn( "Post-link optimization output is not bytecode"); } else { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } } @@ -554,18 +554,18 @@ int main(int argc, char **argv, char **envp) { return PrintAndReturn("Failed to find gcc"); // Generate an assembly language file for the bytecode. - if (Verbose) std::cout << "Generating Assembly Code\n"; + if (Verbose) llvm_cout << "Generating Assembly Code\n"; std::string ErrMsg; if (0 != GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc, ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } - if (Verbose) std::cout << "Generating Native Code\n"; + if (Verbose) llvm_cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(), LinkItems,gcc,envp,ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } @@ -589,18 +589,18 @@ int main(int argc, char **argv, char **envp) { return PrintAndReturn("Failed to find gcc"); // Generate an assembly language file for the bytecode. - if (Verbose) std::cout << "Generating Assembly Code\n"; + if (Verbose) llvm_cout << "Generating Assembly Code\n"; std::string ErrMsg; if (0 != GenerateCFile( CFile.toString(), RealBytecodeOutput, llc, ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } - if (Verbose) std::cout << "Generating Native Code\n"; + if (Verbose) llvm_cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, CFile.toString(), LinkItems, gcc, envp, ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } @@ -614,26 +614,26 @@ int main(int argc, char **argv, char **envp) { // Make the script executable... std::string ErrMsg; if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } // Make the bytecode file readable and directly executable in LLEE as well if (sys::Path(RealBytecodeOutput).makeExecutableOnDisk(&ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } if (sys::Path(RealBytecodeOutput).makeReadableOnDisk(&ErrMsg)) { - std::cerr << argv[0] << ": " << ErrMsg << "\n"; + llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } } return 0; } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index eb14c1762e..4214a4a260 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -18,12 +18,12 @@ #include "llvm/Bytecode/Reader.h" #include "llvm/Bytecode/Writer.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" #include "llvm/System/Path.h" #include #include #include - using namespace llvm; static cl::list @@ -51,23 +51,23 @@ static cl::opt NoCompress("disable-compression", cl::init(false), static inline std::auto_ptr LoadFile(const std::string &FN) { sys::Path Filename; if (!Filename.set(FN)) { - std::cerr << "Invalid file name: '" << FN << "'\n"; + llvm_cerr << "Invalid file name: '" << FN << "'\n"; return std::auto_ptr(); } std::string ErrorMessage; if (Filename.exists()) { - if (Verbose) std::cerr << "Loading '" << Filename.c_str() << "'\n"; + if (Verbose) llvm_cerr << "Loading '" << Filename.c_str() << "'\n"; Module* Result = ParseBytecodeFile(Filename.toString(), &ErrorMessage); if (Result) return std::auto_ptr(Result); // Load successful! if (Verbose) { - std::cerr << "Error opening bytecode file: '" << Filename.c_str() << "'"; - if (ErrorMessage.size()) std::cerr << ": " << ErrorMessage; - std::cerr << "\n"; + llvm_cerr << "Error opening bytecode file: '" << Filename.c_str() << "'"; + if (ErrorMessage.size()) llvm_cerr << ": " << ErrorMessage; + llvm_cerr << "\n"; } } else { - std::cerr << "Bytecode file: '" << Filename.c_str() + llvm_cerr << "Bytecode file: '" << Filename.c_str() << "' does not exist.\n"; } @@ -85,7 +85,7 @@ int main(int argc, char **argv) { std::auto_ptr Composite(LoadFile(InputFilenames[BaseArg])); if (Composite.get() == 0) { - std::cerr << argv[0] << ": error loading file '" + llvm_cerr << argv[0] << ": error loading file '" << InputFilenames[BaseArg] << "'\n"; return 1; } @@ -93,15 +93,15 @@ int main(int argc, char **argv) { for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) { std::auto_ptr M(LoadFile(InputFilenames[i])); if (M.get() == 0) { - std::cerr << argv[0] << ": error loading file '" + llvm_cerr << argv[0] << ": error loading file '" << InputFilenames[i] << "'\n"; return 1; } - if (Verbose) std::cerr << "Linking in '" << InputFilenames[i] << "'\n"; + if (Verbose) llvm_cerr << "Linking in '" << InputFilenames[i] << "'\n"; if (Linker::LinkModules(Composite.get(), M.get(), &ErrorMessage)) { - std::cerr << argv[0] << ": link error in '" << InputFilenames[i] + llvm_cerr << argv[0] << ": link error in '" << InputFilenames[i] << "': " << ErrorMessage << "\n"; return 1; } @@ -110,14 +110,14 @@ int main(int argc, char **argv) { // TODO: Iterate over the -l list and link in any modules containing // global symbols that have not been resolved so far. - if (DumpAsm) std::cerr << "Here's the assembly:\n" << *Composite.get(); + if (DumpAsm) llvm_cerr << "Here's the assembly:\n" << *Composite.get(); // FIXME: cout is not binary! std::ostream *Out = &std::cout; // Default to printing to stdout... if (OutputFilename != "-") { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename + llvm_cerr << argv[0] << ": error opening '" << OutputFilename << "': file exists!\n" << "Use -f command line argument to force output\n"; return 1; @@ -126,7 +126,7 @@ int main(int argc, char **argv) { std::ios::binary; Out = new std::ofstream(OutputFilename.c_str(), io_mode); if (!Out->good()) { - std::cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n"; + llvm_cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n"; return 1; } @@ -136,19 +136,20 @@ int main(int argc, char **argv) { } if (verifyModule(*Composite.get())) { - std::cerr << argv[0] << ": linked module is broken!\n"; + llvm_cerr << argv[0] << ": linked module is broken!\n"; return 1; } - if (Verbose) std::cerr << "Writing bytecode...\n"; - WriteBytecodeToFile(Composite.get(), *Out, !NoCompress); + if (Verbose) llvm_cerr << "Writing bytecode...\n"; + llvm_ostream L(*Out); + WriteBytecodeToFile(Composite.get(), L, !NoCompress); if (Out != &std::cout) delete Out; return 0; } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 6a7677244e..65fcef62d0 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -37,10 +37,10 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Analysis/LoadValueNumbering.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/Streams.h" #include "llvm/LinkTimeOptimizer.h" #include -#include - +#include using namespace llvm; extern "C" @@ -361,7 +361,8 @@ LTO::optimizeModules(const std::string &OutputFilename, std::string tempFileName(FinalOutputPath.c_str()); tempFileName += "0.bc"; std::ofstream Out(tempFileName.c_str(), io_mode); - WriteBytecodeToFile(bigOne, Out, true); + llvm_ostream L(Out); + WriteBytecodeToFile(bigOne, L, true); } // Strip leading underscore because it was added to match names @@ -377,17 +378,17 @@ LTO::optimizeModules(const std::string &OutputFilename, std::string ErrMsg; sys::Path TempDir = sys::Path::GetTemporaryDirectory(&ErrMsg); if (TempDir.isEmpty()) { - std::cerr << "lto: " << ErrMsg << "\n"; + llvm_cerr << "lto: " << ErrMsg << "\n"; return LTO_WRITE_FAILURE; } sys::Path tmpAsmFilePath(TempDir); if (!tmpAsmFilePath.appendComponent("lto")) { - std::cerr << "lto: " << ErrMsg << "\n"; + llvm_cerr << "lto: " << ErrMsg << "\n"; TempDir.eraseFromDisk(true); return LTO_WRITE_FAILURE; } if (tmpAsmFilePath.createTemporaryFileOnDisk(&ErrMsg)) { - std::cerr << "lto: " << ErrMsg << "\n"; + llvm_cerr << "lto: " << ErrMsg << "\n"; TempDir.eraseFromDisk(true); return LTO_WRITE_FAILURE; } @@ -414,7 +415,8 @@ LTO::optimizeModules(const std::string &OutputFilename, std::string tempFileName(FinalOutputPath.c_str()); tempFileName += "1.bc"; std::ofstream Out(tempFileName.c_str(), io_mode); - WriteBytecodeToFile(bigOne, Out, true); + llvm_ostream L(Out); + WriteBytecodeToFile(bigOne, L, true); } targetTriple = bigOne->getTargetTriple(); @@ -443,7 +445,7 @@ LTO::optimizeModules(const std::string &OutputFilename, args.push_back(0); if (sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 1, &ErrMsg)) { - std::cerr << "lto: " << ErrMsg << "\n"; + llvm_cerr << "lto: " << ErrMsg << "\n"; return LTO_ASM_FAILURE; } diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 502118e658..e43b76ff95 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -28,6 +28,7 @@ #include "llvm/Support/Timer.h" #include "llvm/LinkAllPasses.h" #include "llvm/LinkAllVMCore.h" +#include #include #include #include @@ -251,8 +252,10 @@ int main(int argc, char **argv) { Passes.add(createVerifierPass()); // Write bytecode out to disk or cout as the last step... - if (!NoOutput && !AnalyzeOnly) - Passes.add(new WriteBytecodePass(Out, Out != &std::cout, !NoCompress)); + if (!NoOutput && !AnalyzeOnly) { + llvm_ostream L(*Out); + Passes.add(new WriteBytecodePass(&L, Out != &std::cout, !NoCompress)); + } // Now that we have all of the passes ready, run them. Passes.run(*M.get()); -- cgit v1.2.3-70-g09d2 From e81561909d128c6e2d8033cb5465a49b2596b26a Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 7 Dec 2006 01:30:32 +0000 Subject: Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are now cerr, cout, and NullStream resp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/ModuleMaker.cpp | 2 +- include/llvm/ADT/BitSetVector.h | 10 +- include/llvm/ADT/EquivalenceClasses.h | 4 +- include/llvm/Analysis/AliasSetTracker.h | 8 +- include/llvm/Analysis/CallGraph.h | 4 +- include/llvm/Analysis/DataStructure/DSGraph.h | 4 +- include/llvm/Analysis/DataStructure/DSNode.h | 2 +- include/llvm/Analysis/LoopInfo.h | 4 +- include/llvm/Analysis/ScalarEvolution.h | 8 +- include/llvm/Analysis/Trace.h | 4 +- include/llvm/Assembly/PrintModulePass.h | 18 +- include/llvm/Bytecode/WriteBytecodePass.h | 9 +- include/llvm/Bytecode/Writer.h | 5 +- include/llvm/CodeGen/LiveInterval.h | 8 +- include/llvm/CodeGen/MachineBasicBlock.h | 4 +- include/llvm/CodeGen/MachineConstantPool.h | 8 +- include/llvm/CodeGen/MachineInstr.h | 6 +- include/llvm/CodeGen/SchedGraphCommon.h | 10 +- include/llvm/Module.h | 4 +- include/llvm/Pass.h | 2 +- include/llvm/Support/Casting.h | 4 +- include/llvm/Support/ConstantRange.h | 2 +- include/llvm/Support/Debug.h | 4 +- include/llvm/Support/GraphWriter.h | 10 +- include/llvm/Support/PassNameParser.h | 4 +- include/llvm/Support/Streams.h | 54 +- include/llvm/Type.h | 2 +- include/llvm/Value.h | 2 +- lib/Analysis/AliasAnalysisCounter.cpp | 38 +- lib/Analysis/AliasAnalysisEvaluator.cpp | 52 +- lib/Analysis/AliasSetTracker.cpp | 6 +- lib/Analysis/BasicAliasAnalysis.cpp | 4 +- lib/Analysis/CFGPrinter.cpp | 6 +- lib/Analysis/ConstantRange.cpp | 2 +- lib/Analysis/DataStructure/BottomUpClosure.cpp | 24 +- lib/Analysis/DataStructure/CallTargets.cpp | 14 +- lib/Analysis/DataStructure/DataStructure.cpp | 3 +- lib/Analysis/DataStructure/DataStructureStats.cpp | 12 +- lib/Analysis/DataStructure/EquivClassGraphs.cpp | 2 +- lib/Analysis/DataStructure/GraphChecker.cpp | 32 +- lib/Analysis/DataStructure/Local.cpp | 4 +- lib/Analysis/DataStructure/Printer.cpp | 2 +- lib/Analysis/DataStructure/Steensgaard.cpp | 2 +- lib/Analysis/IPA/Andersens.cpp | 48 +- lib/Analysis/IPA/CallGraph.cpp | 8 +- lib/Analysis/InstCount.cpp | 2 +- lib/Analysis/LoopInfo.cpp | 2 +- lib/Analysis/ProfileInfoLoader.cpp | 29 +- lib/Analysis/ProfileInfoLoaderPass.cpp | 4 +- lib/Analysis/ScalarEvolution.cpp | 34 +- lib/Analysis/ScalarEvolutionExpander.cpp | 5 +- lib/Analysis/Trace.cpp | 5 +- lib/AsmParser/llvmAsmParser.cpp.cvs | 2048 +++++++++++--------- lib/AsmParser/llvmAsmParser.h.cvs | 40 +- lib/AsmParser/llvmAsmParser.y | 6 +- lib/AsmParser/llvmAsmParser.y.cvs | 6 +- lib/Bytecode/Writer/SlotCalculator.cpp | 2 +- lib/Bytecode/Writer/Writer.cpp | 12 +- lib/CodeGen/AsmPrinter.cpp | 37 +- lib/CodeGen/DwarfWriter.cpp | 16 +- lib/CodeGen/ELFWriter.cpp | 7 +- lib/CodeGen/IntrinsicLowering.cpp | 24 +- lib/CodeGen/LiveInterval.cpp | 7 +- lib/CodeGen/LiveIntervalAnalysis.cpp | 4 +- lib/CodeGen/MachineInstr.cpp | 3 +- lib/CodeGen/VirtRegMap.cpp | 6 +- lib/CodeGen/VirtRegMap.h | 4 +- lib/ExecutionEngine/ExecutionEngine.cpp | 18 +- lib/ExecutionEngine/Interpreter/Execution.cpp | 57 +- .../Interpreter/ExternalFunctions.cpp | 14 +- lib/Linker/LinkModules.cpp | 17 +- lib/Linker/Linker.cpp | 6 +- lib/Support/Allocator.cpp | 4 +- lib/Support/CommandLine.cpp | 94 +- lib/Support/ConstantRange.cpp | 2 +- lib/Support/Debug.cpp | 6 +- lib/Support/GraphWriter.cpp | 16 +- lib/Support/PluginLoader.cpp | 4 +- lib/Support/SlowOperationInformer.cpp | 8 +- lib/Support/Streams.cpp | 7 +- lib/Support/SystemUtils.cpp | 8 +- lib/Transforms/ExprTypeConvert.cpp | 4 +- lib/Transforms/Hello/Hello.cpp | 4 +- lib/Transforms/IPO/GlobalOpt.cpp | 36 +- lib/Transforms/IPO/Internalize.cpp | 3 +- lib/Transforms/Instrumentation/BlockProfiling.cpp | 8 +- lib/Transforms/Instrumentation/EdgeProfiling.cpp | 6 +- .../Instrumentation/TraceBasicBlocks.cpp | 6 +- lib/Transforms/Scalar/InstructionCombining.cpp | 4 +- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 8 +- lib/Transforms/Scalar/LowerPacked.cpp | 3 +- lib/Transforms/Scalar/SCCP.cpp | 6 +- lib/Transforms/Utils/CodeExtractor.cpp | 4 +- lib/Transforms/Utils/LowerSwitch.cpp | 3 +- lib/VMCore/AsmWriter.cpp | 10 +- lib/VMCore/LeakDetector.cpp | 19 +- lib/VMCore/PassManager.cpp | 2 +- lib/VMCore/TypeSymbolTable.cpp | 20 +- lib/VMCore/Verifier.cpp | 5 +- projects/Stacker/tools/stkrc/stkrc.cpp | 8 +- tools/bugpoint/OptimizerDriver.cpp | 51 +- tools/gccas/gccas.cpp | 10 +- tools/gccld/GenerateCode.cpp | 8 +- tools/gccld/gccld.cpp | 34 +- tools/llvm-as/llvm-as.cpp | 30 +- tools/llvm-dis/llvm-dis.cpp | 24 +- tools/llvm-extract/llvm-extract.cpp | 18 +- tools/llvm-ld/llvm-ld.cpp | 38 +- tools/llvm-link/llvm-link.cpp | 46 +- tools/llvm-upgrade/llvm-upgrade.cpp | 20 +- tools/lto/lto.cpp | 12 +- tools/opt/opt.cpp | 44 +- 112 files changed, 1844 insertions(+), 1679 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 30f63bb8f4..0c9a61853e 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -53,7 +53,7 @@ int main() { BB->getInstList().push_back(new ReturnInst(Add)); // Output the bytecode file to stdout - WriteBytecodeToFile(M, llvm_cout); + WriteBytecodeToFile(M, cout); // Delete the module and all of its contents. delete M; diff --git a/include/llvm/ADT/BitSetVector.h b/include/llvm/ADT/BitSetVector.h index 67e3a52d6c..5d1fc86c3a 100644 --- a/include/llvm/ADT/BitSetVector.h +++ b/include/llvm/ADT/BitSetVector.h @@ -29,7 +29,6 @@ #include #include #include -#include namespace llvm { @@ -174,11 +173,11 @@ public: /// /// Printing and debugging support /// - void print(llvm_ostream &O) const { + void print(OStream &O) const { if (O.stream()) print(*O.stream()); } void print(std::ostream &O) const; - void dump() const { print(llvm_cerr); } + void dump() const { print(cerr); } public: // @@ -235,6 +234,9 @@ public: return (I.bitvec == bitvec && I.currentWord == currentWord && I.currentBit == currentBit); } + bool operator!=(const iterator& I) { + return !(*this == I); + } protected: static iterator begin(BitSetVector& _bitvec) { return iterator(_bitvec); } @@ -252,7 +254,7 @@ inline void BitSetVector::print(std::ostream& O) const O << "<" << (*I) << ">" << (I+1 == E? "\n" : ", "); } -inline llvm_ostream& operator<< (llvm_ostream& O, const BitSetVector& bset) { +inline OStream& operator<< (OStream& O, const BitSetVector& bset) { bset.print(O); return O; } diff --git a/include/llvm/ADT/EquivalenceClasses.h b/include/llvm/ADT/EquivalenceClasses.h index b915c2aeae..7d305cb744 100644 --- a/include/llvm/ADT/EquivalenceClasses.h +++ b/include/llvm/ADT/EquivalenceClasses.h @@ -43,8 +43,8 @@ namespace llvm { /// if (!I->isLeader()) continue; // Ignore non-leader sets. /// for (EquivalenceClasses::member_iterator MI = EC.member_begin(I); /// MI != EC.member_end(); ++MI) // Loop over members in this set. -/// llvm_cerr << *MI << " "; // Print member. -/// llvm_cerr << "\n"; // Finish set. +/// cerr << *MI << " "; // Print member. +/// cerr << "\n"; // Finish set. /// } /// /// This example prints: diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h index c4273ac37d..5fcda16270 100644 --- a/include/llvm/Analysis/AliasSetTracker.h +++ b/include/llvm/Analysis/AliasSetTracker.h @@ -156,7 +156,7 @@ public: iterator end() const { return iterator(); } bool empty() const { return PtrList == 0; } - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream()); } void print(std::ostream &OS) const; @@ -248,7 +248,7 @@ private: bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const; }; -inline llvm_ostream& operator<<(llvm_ostream &OS, const AliasSet &AS) { +inline OStream& operator<<(OStream &OS, const AliasSet &AS) { AS.print(OS); return OS; } @@ -361,7 +361,7 @@ public: iterator begin() { return AliasSets.begin(); } iterator end() { return AliasSets.end(); } - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream()); } void print(std::ostream &OS) const; @@ -390,7 +390,7 @@ private: AliasSet *findAliasSetForCallSite(CallSite CS); }; -inline llvm_ostream& operator<<(llvm_ostream &OS, const AliasSetTracker &AST) { +inline OStream& operator<<(OStream &OS, const AliasSetTracker &AST) { AST.print(OS); return OS; } diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index f29aef3a22..1f737da53c 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -152,7 +152,7 @@ public: /// void initialize(Module &M); - void print(llvm_ostream &o, const Module *M) const { + void print(OStream &o, const Module *M) const { if (o.stream()) print(*o.stream(), M); } virtual void print(std::ostream &o, const Module *M) const; @@ -201,7 +201,7 @@ public: /// dump - Print out this call graph node. /// void dump() const; - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream()); } void print(std::ostream &OS) const; diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index 61853587d7..1063efad13 100644 --- a/include/llvm/Analysis/DataStructure/DSGraph.h +++ b/include/llvm/Analysis/DataStructure/DSGraph.h @@ -378,12 +378,12 @@ public: /// print - Print a dot graph to the specified ostream... /// - void print(llvm_ostream &O) const { + void print(OStream &O) const { if (O.stream()) print(*O.stream()); } void print(std::ostream &O) const; - /// dump - call print(llvm_cerr), for use from the debugger... + /// dump - call print(cerr), for use from the debugger... /// void dump() const; diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h index 5eb927b90e..abcca352a6 100644 --- a/include/llvm/Analysis/DataStructure/DSNode.h +++ b/include/llvm/Analysis/DataStructure/DSNode.h @@ -362,7 +362,7 @@ public: /// void forwardNode(DSNode *To, unsigned Offset); - void print(llvm_ostream &O, const DSGraph *G) const { + void print(OStream &O, const DSGraph *G) const { if (O.stream()) print(*O.stream(), G); } void print(std::ostream &O, const DSGraph *G) const; diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 2e6d2471fc..238a0f627d 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -217,7 +217,7 @@ public: /// the mapping in the LoopInfo class. void removeBlockFromLoop(BasicBlock *BB); - void print(llvm_ostream &O, unsigned Depth = 0) const { + void print(OStream &O, unsigned Depth = 0) const { if (O.stream()) print(*O.stream(), Depth); } void print(std::ostream &O, unsigned Depth = 0) const; @@ -283,7 +283,7 @@ public: virtual bool runOnFunction(Function &F); virtual void releaseMemory(); - void print(llvm_ostream &O, const Module* = 0) const { + void print(OStream &O, const Module* = 0) const { if (O.stream()) print(*O.stream()); } void print(std::ostream &O, const Module* = 0) const; diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index f1497cdeda..4eb0bb33b2 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -97,7 +97,7 @@ namespace llvm { /// print - Print out the internal representation of this scalar to the /// specified stream. This should really only be used for debugging /// purposes. - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream()); } virtual void print(std::ostream &OS) const = 0; @@ -107,7 +107,7 @@ namespace llvm { void dump() const; }; - inline llvm_ostream &operator<<(llvm_ostream &OS, const SCEV &S) { + inline OStream &operator<<(OStream &OS, const SCEV &S) { S.print(OS); return OS; } @@ -128,7 +128,7 @@ namespace llvm { virtual bool isLoopInvariant(const Loop *L) const; virtual const Type *getType() const; virtual bool hasComputableLoopEvolution(const Loop *L) const; - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream()); } virtual void print(std::ostream &OS) const; @@ -242,7 +242,7 @@ namespace llvm { virtual bool runOnFunction(Function &F); virtual void releaseMemory(); virtual void getAnalysisUsage(AnalysisUsage &AU) const; - void print(llvm_ostream &OS, const Module* = 0) const { + void print(OStream &OS, const Module* = 0) const { if (OS.stream()) print(*OS.stream()); } virtual void print(std::ostream &OS, const Module* = 0) const; diff --git a/include/llvm/Analysis/Trace.h b/include/llvm/Analysis/Trace.h index ad4f37ce4d..b26101d15c 100644 --- a/include/llvm/Analysis/Trace.h +++ b/include/llvm/Analysis/Trace.h @@ -18,11 +18,11 @@ #ifndef LLVM_ANALYSIS_TRACE_H #define LLVM_ANALYSIS_TRACE_H +#include "llvm/Support/Streams.h" #include #include namespace llvm { - class llvm_ostream; class BasicBlock; class Function; class Module; @@ -106,7 +106,7 @@ public: /// print - Write trace to output stream. /// - void print (llvm_ostream &O) const; + void print (OStream &O) const; /// dump - Debugger convenience method; writes trace to standard error /// output stream. diff --git a/include/llvm/Assembly/PrintModulePass.h b/include/llvm/Assembly/PrintModulePass.h index 770682d256..cc9bca9288 100644 --- a/include/llvm/Assembly/PrintModulePass.h +++ b/include/llvm/Assembly/PrintModulePass.h @@ -25,13 +25,12 @@ namespace llvm { class PrintModulePass : public ModulePass { - llvm_ostream *Out; // ostream to print on + OStream *Out; // ostream to print on bool DeleteStream; // Delete the ostream in our dtor? public: - PrintModulePass() : Out(&llvm_cerr), DeleteStream(false) {} - PrintModulePass(llvm_ostream *o, bool DS = false) - : Out(o), DeleteStream(DS) { - } + PrintModulePass() : Out(&cerr), DeleteStream(false) {} + PrintModulePass(OStream *o, bool DS = false) + : Out(o), DeleteStream(DS) {} ~PrintModulePass() { if (DeleteStream) delete Out; @@ -49,14 +48,13 @@ public: class PrintFunctionPass : public FunctionPass { std::string Banner; // String to print before each function - llvm_ostream *Out; // ostream to print on + OStream *Out; // ostream to print on bool DeleteStream; // Delete the ostream in our dtor? public: - PrintFunctionPass() : Banner(""), Out(&llvm_cerr), DeleteStream(false) {} - PrintFunctionPass(const std::string &B, llvm_ostream *o = &llvm_cout, + PrintFunctionPass() : Banner(""), Out(&cerr), DeleteStream(false) {} + PrintFunctionPass(const std::string &B, OStream *o = &cout, bool DS = false) - : Banner(B), Out(o), DeleteStream(DS) { - } + : Banner(B), Out(o), DeleteStream(DS) {} inline ~PrintFunctionPass() { if (DeleteStream) delete Out; diff --git a/include/llvm/Bytecode/WriteBytecodePass.h b/include/llvm/Bytecode/WriteBytecodePass.h index a634812498..c4e2c5d5d5 100644 --- a/include/llvm/Bytecode/WriteBytecodePass.h +++ b/include/llvm/Bytecode/WriteBytecodePass.h @@ -17,19 +17,18 @@ #include "llvm/Pass.h" #include "llvm/Bytecode/Writer.h" +#include "llvm/Support/Streams.h" namespace llvm { -class llvm_ostream; - class WriteBytecodePass : public ModulePass { - llvm_ostream *Out; // ostream to print on + OStream *Out; // ostream to print on bool DeleteStream; bool CompressFile; public: WriteBytecodePass() - : Out(&llvm_cout), DeleteStream(false), CompressFile(true) {} - WriteBytecodePass(llvm_ostream *o, bool DS = false, bool CF = true) + : Out(&cout), DeleteStream(false), CompressFile(true) {} + WriteBytecodePass(OStream *o, bool DS = false, bool CF = true) : Out(o), DeleteStream(DS), CompressFile(CF) {} inline ~WriteBytecodePass() { diff --git a/include/llvm/Bytecode/Writer.h b/include/llvm/Bytecode/Writer.h index 374e5df482..c87cc92848 100644 --- a/include/llvm/Bytecode/Writer.h +++ b/include/llvm/Bytecode/Writer.h @@ -15,13 +15,14 @@ #ifndef LLVM_BYTECODE_WRITER_H #define LLVM_BYTECODE_WRITER_H +#include "llvm/Support/Streams.h" + namespace llvm { - class llvm_ostream; class Module; /// WriteBytecodeToFile - Write the specified module to the specified output /// stream. If compress is set to true, try to use compression when writing /// out the file. This can never fail if M is a well-formed module. - void WriteBytecodeToFile(const Module *M, llvm_ostream &Out, + void WriteBytecodeToFile(const Module *M, OStream &Out, bool compress = true); } // End llvm namespace diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index 16fcd1260e..03a0f579be 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -62,7 +62,7 @@ namespace llvm { }; std::ostream& operator<<(std::ostream& os, const LiveRange &LR); - inline llvm_ostream& operator<<(llvm_ostream& os, const LiveRange &LR) { + inline OStream& operator<<(OStream& os, const LiveRange &LR) { if (os.stream()) *os.stream() << LR; return os; } @@ -258,9 +258,9 @@ namespace llvm { return beginNumber() < other.beginNumber(); } - void print(llvm_ostream OS, const MRegisterInfo *MRI = 0) const; + void print(OStream OS, const MRegisterInfo *MRI = 0) const; void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const { - print(llvm_ostream(OS), MRI); + print(OStream(OS), MRI); } void dump() const; @@ -271,7 +271,7 @@ namespace llvm { LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT }; - inline llvm_ostream &operator<<(llvm_ostream &OS, const LiveInterval &LI) { + inline OStream &operator<<(OStream &OS, const LiveInterval &LI) { LI.print(OS); return OS; } diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index f714c735f3..c848b065b4 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -189,7 +189,7 @@ public: // Debugging methods. void dump() const; - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream()); } void print(std::ostream &OS) const; @@ -226,7 +226,7 @@ private: // Methods used to maintain doubly linked list of blocks... }; std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB); -inline llvm_ostream& operator<<(llvm_ostream &OS, const MachineBasicBlock &MBB){ +inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB){ if (OS.stream()) *OS.stream() << MBB; return OS; } diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h index 6bb2665985..bc701f6b86 100644 --- a/include/llvm/CodeGen/MachineConstantPool.h +++ b/include/llvm/CodeGen/MachineConstantPool.h @@ -49,14 +49,14 @@ public: /// print - Implement operator<<... /// - void print(llvm_ostream &O) const { + void print(OStream &O) const { if (O.stream()) print(*O.stream()); } virtual void print(std::ostream &O) const = 0; }; -inline llvm_ostream &operator<<(llvm_ostream &OS, - const MachineConstantPoolValue &V) { +inline OStream &operator<<(OStream &OS, + const MachineConstantPoolValue &V) { V.print(OS); return OS; } @@ -143,7 +143,7 @@ public: /// print - Used by the MachineFunction printer to print information about /// constant pool objects. Implemented in MachineFunction.cpp /// - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream()); } void print(std::ostream &OS) const; diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 2185d847ad..daa3974ae4 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -285,7 +285,7 @@ public: IsDead = false; } - friend llvm_ostream& operator<<(llvm_ostream& os, const MachineOperand& mop) { + friend OStream& operator<<(OStream& os, const MachineOperand& mop) { if (os.stream()) *os.stream() << mop; return os; } @@ -397,12 +397,12 @@ public: // // Debugging support // - void print(llvm_ostream &OS, const TargetMachine *TM) const { + void print(OStream &OS, const TargetMachine *TM) const { if (OS.stream()) print(*OS.stream(), TM); } void print(std::ostream &OS, const TargetMachine *TM) const; void dump() const; - friend llvm_ostream& operator<<(llvm_ostream& os, const MachineInstr& minstr){ + friend OStream& operator<<(OStream& os, const MachineInstr& minstr){ if (os.stream()) *os.stream() << minstr; return os; } diff --git a/include/llvm/CodeGen/SchedGraphCommon.h b/include/llvm/CodeGen/SchedGraphCommon.h index b4cee969e1..7da2f732ba 100644 --- a/include/llvm/CodeGen/SchedGraphCommon.h +++ b/include/llvm/CodeGen/SchedGraphCommon.h @@ -70,7 +70,7 @@ public: void dump(int indent=0) const; // Debugging support - void print(llvm_ostream &os) const { + void print(OStream &os) const { if (os.stream()) print(*os.stream()); } virtual void print(std::ostream &os) const = 0; @@ -96,8 +96,8 @@ protected: }; // ostream << operator for SchedGraphNode class -inline llvm_ostream &operator<<(llvm_ostream &os, - const SchedGraphNodeCommon &node) { +inline OStream &operator<<(OStream &os, + const SchedGraphNodeCommon &node) { node.print(os); return os; } @@ -188,7 +188,7 @@ public: public: // Debugging support - void print(llvm_ostream &os) const { + void print(OStream &os) const { if (os.stream()) print(*os.stream()); } void print(std::ostream &os) const; @@ -200,7 +200,7 @@ private: }; // ostream << operator for SchedGraphNode class -inline llvm_ostream &operator<<(llvm_ostream &os, const SchedGraphEdge &edge) { +inline OStream &operator<<(OStream &os, const SchedGraphEdge &edge) { edge.print(os); return os; } diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 4cb6d279f0..35b04b1017 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -295,12 +295,12 @@ public: /// @{ public: /// Print the module to an output stream - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream(), 0); } void print(std::ostream &OS) const { print(OS, 0); } /// Print the module to an output stream with AssemblyAnnotationWriter. - void print(llvm_ostream &OS, AssemblyAnnotationWriter *AAW) const { + void print(OStream &OS, AssemblyAnnotationWriter *AAW) const { if (OS.stream()) print(*OS.stream(), AAW); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 30f1df9669..4a929f0b21 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -101,7 +101,7 @@ public: /// provide the Module* in case the analysis doesn't need it it can just be /// ignored. /// - void print(llvm_ostream &O, const Module *M) const { + void print(OStream &O, const Module *M) const { if (O.stream()) print(*O.stream(), M); } virtual void print(std::ostream &O, const Module *M) const; diff --git a/include/llvm/Support/Casting.h b/include/llvm/Support/Casting.h index fff44f6e64..dc318395cc 100644 --- a/include/llvm/Support/Casting.h +++ b/include/llvm/Support/Casting.h @@ -245,13 +245,13 @@ private: struct foo { void ext() const; /* static bool classof(const bar *X) { - llvm_cerr << "Classof: " << X << "\n"; + cerr << "Classof: " << X << "\n"; return true; }*/ }; template <> inline bool isa_impl(const bar &Val) { - llvm_cerr << "Classof: " << &Val << "\n"; + cerr << "Classof: " << &Val << "\n"; return true; } diff --git a/include/llvm/Support/ConstantRange.h b/include/llvm/Support/ConstantRange.h index 90a29902c3..6866ffeb11 100644 --- a/include/llvm/Support/ConstantRange.h +++ b/include/llvm/Support/ConstantRange.h @@ -141,7 +141,7 @@ class ConstantRange { /// print - Print out the bounds to a stream... /// - void print(llvm_ostream &OS) const { + void print(OStream &OS) const { if (OS.stream()) print(*OS.stream()); } void print(std::ostream &OS) const; diff --git a/include/llvm/Support/Debug.h b/include/llvm/Support/Debug.h index 9f0f1611d7..09878b9d1e 100644 --- a/include/llvm/Support/Debug.h +++ b/include/llvm/Support/Debug.h @@ -65,10 +65,10 @@ bool isCurrentDebugType(const char *Type); /// places the std::c* I/O streams into one .cpp file and relieves the whole /// program from having to have hundreds of static c'tor/d'tors for them. /// -llvm_ostream getErrorOutputStream(const char *DebugType); +OStream getErrorOutputStream(const char *DebugType); #ifdef NDEBUG -#define DOUT llvm_ostream() +#define DOUT NullStream #else #define DOUT getErrorOutputStream(DEBUG_TYPE) #endif diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index 8602e74c14..b9566b84f8 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -247,16 +247,16 @@ sys::Path WriteGraph(const GraphType &G, std::string ErrMsg; sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg); if (Filename.isEmpty()) { - llvm_cerr << "Error: " << ErrMsg << "\n"; + cerr << "Error: " << ErrMsg << "\n"; return Filename; } Filename.appendComponent(Name + ".dot"); if (Filename.makeUnique(true,&ErrMsg)) { - llvm_cerr << "Error: " << ErrMsg << "\n"; + cerr << "Error: " << ErrMsg << "\n"; return sys::Path(); } - llvm_cerr << "Writing '" << Filename << "'... "; + cerr << "Writing '" << Filename << "'... "; std::ofstream O(Filename.c_str()); @@ -275,12 +275,12 @@ sys::Path WriteGraph(const GraphType &G, // Output the end of the graph W.writeFooter(); - llvm_cerr << " done. \n"; + cerr << " done. \n"; O.close(); } else { - llvm_cerr << "error opening file for writing!\n"; + cerr << "error opening file for writing!\n"; Filename.clear(); } diff --git a/include/llvm/Support/PassNameParser.h b/include/llvm/Support/PassNameParser.h index fef63c3032..83653aa745 100644 --- a/include/llvm/Support/PassNameParser.h +++ b/include/llvm/Support/PassNameParser.h @@ -65,8 +65,8 @@ public: virtual void passRegistered(const PassInfo *P) { if (ignorablePass(P) || !Opt) return; if (findOption(P->getPassArgument()) != getNumOptions()) { - llvm_cerr << "Two passes with the same argument (-" - << P->getPassArgument() << ") attempted to be registered!\n"; + cerr << "Two passes with the same argument (-" + << P->getPassArgument() << ") attempted to be registered!\n"; abort(); } addLiteralOption(P->getPassArgument(), P, P->getPassName()); diff --git a/include/llvm/Support/Streams.h b/include/llvm/Support/Streams.h index a422756c63..c4afc86baa 100644 --- a/include/llvm/Support/Streams.h +++ b/include/llvm/Support/Streams.h @@ -7,48 +7,64 @@ // //===----------------------------------------------------------------------===// // -// This file implements a wrapper for the std::cout and std::cerr I/O streams. -// It prevents the need to include to each file just to get I/O. +// This file implements a wrapper for the STL I/O streams. It prevents the need +// to include in a file just to get I/O. // //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_STREAMS_H #define LLVM_SUPPORT_STREAMS_H -#include // Doesn't have static d'tors!! +#include namespace llvm { - /// llvm_ostream - Acts like an ostream. It's a wrapper for the std::cerr and - /// std::cout ostreams. However, it doesn't require #including in - /// every file, which increases static c'tors & d'tors in the object code. + /// BaseStream - Acts like the STL streams. It's a wrapper for the std::cerr, + /// std::cout, std::cin, etc. streams. However, it doesn't require #including + /// in every file (doing so increases static c'tors & d'tors in the + /// object code). /// - class llvm_ostream { - std::ostream* Stream; + template + class BaseStream { + StreamTy *Stream; public: - llvm_ostream() : Stream(0) {} - llvm_ostream(std::ostream &OStream) : Stream(&OStream) {} + BaseStream() : Stream(0) {} + BaseStream(StreamTy &S) : Stream(&S) {} + BaseStream(StreamTy *S) : Stream(S) {} - std::ostream* stream() const { return Stream; } + StreamTy *stream() const { return Stream; } - inline llvm_ostream &operator << (std::ostream& (*Func)(std::ostream&)) { + inline BaseStream &operator << (StreamTy &(*Func)(StreamTy&)) { if (Stream) *Stream << Func; return *this; } - + template - llvm_ostream &operator << (const Ty &Thing) { + BaseStream &operator << (const Ty &Thing) { if (Stream) *Stream << Thing; return *this; } - bool operator == (const std::ostream &OS) { return &OS == Stream; } - bool operator == (const llvm_ostream &OS) { return OS.Stream == Stream; } + template + BaseStream &operator >> (const Ty &Thing) { + if (Stream) *Stream >> Thing; + return *this; + } + + bool operator == (const StreamTy &S) { return &S == Stream; } + bool operator != (const StreamTy &S) { return !(*this == S); } + bool operator == (const BaseStream &S) { return S.Stream == Stream; } + bool operator != (const BaseStream &S) { return !(*this == S); } }; - extern llvm_ostream llvm_null; - extern llvm_ostream llvm_cout; - extern llvm_ostream llvm_cerr; + typedef BaseStream OStream; + typedef BaseStream IStream; + typedef BaseStream StringStream; + + extern OStream NullStream; + extern OStream cout; + extern OStream cerr; + extern IStream cin; } // End llvm namespace diff --git a/include/llvm/Type.h b/include/llvm/Type.h index a69e751f78..4da8feb8a6 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -136,7 +136,7 @@ protected: /// mutable std::vector AbstractTypeUsers; public: - void print(llvm_ostream &O) const { + void print(OStream &O) const { if (O.stream()) print(*O.stream()); } void print(std::ostream &O) const; diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 5dfe63f1b0..e8df7cd096 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -75,7 +75,7 @@ public: /// print - Implement operator<< on Value... /// - void print(llvm_ostream &O) const { + void print(OStream &O) const { if (O.stream()) print(*O.stream()); } virtual void print(std::ostream &O) const = 0; diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index d563c13c10..b2b6739ae1 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -39,37 +39,33 @@ namespace { } void printLine(const char *Desc, unsigned Val, unsigned Sum) { - llvm_cerr << " " << Val << " " << Desc << " responses (" - << Val*100/Sum << "%)\n"; + cerr << " " << Val << " " << Desc << " responses (" + << Val*100/Sum << "%)\n"; } ~AliasAnalysisCounter() { unsigned AASum = No+May+Must; unsigned MRSum = NoMR+JustRef+JustMod+MR; if (AASum + MRSum) { // Print a report if any counted queries occurred... - llvm_cerr - << "\n===== Alias Analysis Counter Report =====\n" - << " Analysis counted: " << Name << "\n" - << " " << AASum << " Total Alias Queries Performed\n"; + cerr << "\n===== Alias Analysis Counter Report =====\n" + << " Analysis counted: " << Name << "\n" + << " " << AASum << " Total Alias Queries Performed\n"; if (AASum) { printLine("no alias", No, AASum); printLine("may alias", May, AASum); printLine("must alias", Must, AASum); - llvm_cerr - << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" - << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n"; + cerr << " Alias Analysis Counter Summary: " << No*100/AASum << "%/" + << May*100/AASum << "%/" << Must*100/AASum<<"%\n\n"; } - llvm_cerr - << " " << MRSum << " Total Mod/Ref Queries Performed\n"; + cerr << " " << MRSum << " Total Mod/Ref Queries Performed\n"; if (MRSum) { printLine("no mod/ref", NoMR, MRSum); printLine("ref", JustRef, MRSum); printLine("mod", JustMod, MRSum); printLine("mod/ref", MR, MRSum); - llvm_cerr - << " Mod/Ref Analysis Counter Summary: " << NoMR*100/MRSum<< "%/" - << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/" - << MR*100/MRSum <<"%\n\n"; + cerr << " Mod/Ref Analysis Counter Summary: " <" << *CS.getInstruction(); + cerr << "\t<->" << *CS.getInstruction(); } return R; } diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index d64394a879..31875f8710 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -79,7 +79,7 @@ FunctionPass *llvm::createAAEvalPass() { return new AAEval(); } static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2, Module *M) { if (P) { - llvm_cerr << " " << Msg << ":\t"; + cerr << " " << Msg << ":\t"; WriteAsOperand(std::cerr, V1, true, M) << ", "; WriteAsOperand(std::cerr, V2, true, M) << "\n"; } @@ -89,9 +89,9 @@ static inline void PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, Module *M) { if (P) { - llvm_cerr << " " << Msg << ": Ptr: "; + cerr << " " << Msg << ": Ptr: "; WriteAsOperand(std::cerr, Ptr, true, M); - llvm_cerr << "\t<->" << *I; + cerr << "\t<->" << *I; } } @@ -125,8 +125,8 @@ bool AAEval::runOnFunction(Function &F) { if (PrintNoAlias || PrintMayAlias || PrintMustAlias || PrintNoModRef || PrintMod || PrintRef || PrintModRef) - llvm_cerr << "Function: " << F.getName() << ": " << Pointers.size() - << " pointers, " << CallSites.size() << " call sites\n"; + cerr << "Function: " << F.getName() << ": " << Pointers.size() + << " pointers, " << CallSites.size() << " call sites\n"; // iterate over the worklist, and run the full (n^2)/2 disambiguations for (std::set::iterator I1 = Pointers.begin(), E = Pointers.end(); @@ -151,7 +151,7 @@ bool AAEval::runOnFunction(Function &F) { PrintResults("MustAlias", PrintMustAlias, *I1, *I2, F.getParent()); ++MustAlias; break; default: - llvm_cerr << "Unknown alias query result!\n"; + cerr << "Unknown alias query result!\n"; } } } @@ -181,7 +181,7 @@ bool AAEval::runOnFunction(Function &F) { PrintModRefResults(" ModRef", PrintModRef, I, *V, F.getParent()); ++ModRef; break; default: - llvm_cerr << "Unknown alias query result!\n"; + cerr << "Unknown alias query result!\n"; } } } @@ -190,45 +190,45 @@ bool AAEval::runOnFunction(Function &F) { } static void PrintPercent(unsigned Num, unsigned Sum) { - llvm_cerr << "(" << Num*100ULL/Sum << "." + cerr << "(" << Num*100ULL/Sum << "." << ((Num*1000ULL/Sum) % 10) << "%)\n"; } bool AAEval::doFinalization(Module &M) { unsigned AliasSum = NoAlias + MayAlias + MustAlias; - llvm_cerr << "===== Alias Analysis Evaluator Report =====\n"; + cerr << "===== Alias Analysis Evaluator Report =====\n"; if (AliasSum == 0) { - llvm_cerr << " Alias Analysis Evaluator Summary: No pointers!\n"; + cerr << " Alias Analysis Evaluator Summary: No pointers!\n"; } else { - llvm_cerr << " " << AliasSum << " Total Alias Queries Performed\n"; - llvm_cerr << " " << NoAlias << " no alias responses "; + cerr << " " << AliasSum << " Total Alias Queries Performed\n"; + cerr << " " << NoAlias << " no alias responses "; PrintPercent(NoAlias, AliasSum); - llvm_cerr << " " << MayAlias << " may alias responses "; + cerr << " " << MayAlias << " may alias responses "; PrintPercent(MayAlias, AliasSum); - llvm_cerr << " " << MustAlias << " must alias responses "; + cerr << " " << MustAlias << " must alias responses "; PrintPercent(MustAlias, AliasSum); - llvm_cerr << " Alias Analysis Evaluator Pointer Alias Summary: " - << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/" - << MustAlias*100/AliasSum << "%\n"; + cerr << " Alias Analysis Evaluator Pointer Alias Summary: " + << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/" + << MustAlias*100/AliasSum << "%\n"; } // Display the summary for mod/ref analysis unsigned ModRefSum = NoModRef + Mod + Ref + ModRef; if (ModRefSum == 0) { - llvm_cerr << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n"; + cerr << " Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!\n"; } else { - llvm_cerr << " " << ModRefSum << " Total ModRef Queries Performed\n"; - llvm_cerr << " " << NoModRef << " no mod/ref responses "; + cerr << " " << ModRefSum << " Total ModRef Queries Performed\n"; + cerr << " " << NoModRef << " no mod/ref responses "; PrintPercent(NoModRef, ModRefSum); - llvm_cerr << " " << Mod << " mod responses "; + cerr << " " << Mod << " mod responses "; PrintPercent(Mod, ModRefSum); - llvm_cerr << " " << Ref << " ref responses "; + cerr << " " << Ref << " ref responses "; PrintPercent(Ref, ModRefSum); - llvm_cerr << " " << ModRef << " mod & ref responses "; + cerr << " " << ModRef << " mod & ref responses "; PrintPercent(ModRef, ModRefSum); - llvm_cerr << " Alias Analysis Evaluator Mod/Ref Summary: " - << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/" - << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n"; + cerr << " Alias Analysis Evaluator Mod/Ref Summary: " + << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/" + << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n"; } return false; diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index f07ff6f867..9ab2b8ad26 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -543,8 +543,8 @@ void AliasSetTracker::print(std::ostream &OS) const { OS << "\n"; } -void AliasSet::dump() const { print (llvm_cerr); } -void AliasSetTracker::dump() const { print(llvm_cerr); } +void AliasSet::dump() const { print (cerr); } +void AliasSetTracker::dump() const { print(cerr); } //===----------------------------------------------------------------------===// // AliasSetPrinter Pass @@ -564,7 +564,7 @@ namespace { for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) Tracker->add(&*I); - Tracker->print(llvm_cerr); + Tracker->print(cerr); delete Tracker; return false; } diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 26bcb438a2..ce55b4de42 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -745,8 +745,8 @@ BasicAliasAnalysis::CheckGEPInstructions( assert(Offset1= SizeMax) { - //llvm_cerr << "Determined that these two GEP's don't alias [" - // << SizeMax << " bytes]: \n" << *GEP1 << *GEP2; + //cerr << "Determined that these two GEP's don't alias [" + // << SizeMax << " bytes]: \n" << *GEP1 << *GEP2; return NoAlias; } } diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index bfc71c6686..f16dca833c 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -92,14 +92,14 @@ namespace { struct CFGPrinter : public FunctionPass { virtual bool runOnFunction(Function &F) { std::string Filename = "cfg." + F.getName() + ".dot"; - llvm_cerr << "Writing '" << Filename << "'..."; + cerr << "Writing '" << Filename << "'..."; std::ofstream File(Filename.c_str()); if (File.good()) WriteGraph(File, (const Function*)&F); else - llvm_cerr << " error opening file for writing!"; - llvm_cerr << "\n"; + cerr << " error opening file for writing!"; + cerr << "\n"; return false; } diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp index 1f1a1b5757..2c215866c6 100644 --- a/lib/Analysis/ConstantRange.cpp +++ b/lib/Analysis/ConstantRange.cpp @@ -370,5 +370,5 @@ void ConstantRange::print(std::ostream &OS) const { /// dump - Allow printing from a debugger easily... /// void ConstantRange::dump() const { - print(llvm_cerr); + print(cerr); } diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp index f5ca5fd6f5..e8592b13b6 100644 --- a/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -501,7 +501,7 @@ DSGraph &BUDataStructures::CreateGraphForExternalFunction(const Function &Fn) { DSG->getNodeForValue(F->arg_begin()).mergeWith(N); } else { - llvm_cerr << "Unrecognized external function: " << F->getName() << "\n"; + cerr << "Unrecognized external function: " << F->getName() << "\n"; abort(); } @@ -588,21 +588,21 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) { ++NumBUInlines; } else { if (!Printed) - llvm_cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; - llvm_cerr << " calls " << CalledFuncs.size() - << " fns from site: " << CS.getCallSite().getInstruction() - << " " << *CS.getCallSite().getInstruction(); - llvm_cerr << " Fns ="; + cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; + cerr << " calls " << CalledFuncs.size() + << " fns from site: " << CS.getCallSite().getInstruction() + << " " << *CS.getCallSite().getInstruction(); + cerr << " Fns ="; unsigned NumPrinted = 0; for (std::vector::iterator I = CalledFuncs.begin(), E = CalledFuncs.end(); I != E; ++I) { - if (NumPrinted++ < 8) llvm_cerr << " " << (*I)->getName(); + if (NumPrinted++ < 8) cerr << " " << (*I)->getName(); // Add the call edges to the call graph. ActualCallees.insert(std::make_pair(TheCall, *I)); } - llvm_cerr << "\n"; + cerr << "\n"; // See if we already computed a graph for this set of callees. std::sort(CalledFuncs.begin(), CalledFuncs.end()); @@ -645,7 +645,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) { // Clean up the final graph! GI->removeDeadNodes(DSGraph::KeepUnreachableGlobals); } else { - llvm_cerr << "***\n*** RECYCLED GRAPH ***\n***\n"; + cerr << "***\n*** RECYCLED GRAPH ***\n***\n"; } GI = IndCallGraph.first; @@ -685,7 +685,7 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) { E = MainSM.global_end(); I != E; ++I) RC.getClonedNH(MainSM[*I]); - //Graph.writeGraphToFile(llvm_cerr, "bu_" + F.getName()); + //Graph.writeGraphToFile(cerr, "bu_" + F.getName()); } static const Function *getFnForValue(const Value *V) { @@ -746,8 +746,8 @@ void BUDataStructures::copyValue(Value *From, Value *To) { return; } - llvm_cerr << *From; - llvm_cerr << *To; + cerr << *From; + cerr << *To; assert(0 && "Do not know how to copy this yet!"); abort(); } diff --git a/lib/Analysis/DataStructure/CallTargets.cpp b/lib/Analysis/DataStructure/CallTargets.cpp index 5ed4457418..bae866fd34 100644 --- a/lib/Analysis/DataStructure/CallTargets.cpp +++ b/lib/Analysis/DataStructure/CallTargets.cpp @@ -17,15 +17,15 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Analysis/DataStructure/CallTargets.h" #include "llvm/Module.h" #include "llvm/Instructions.h" #include "llvm/Analysis/DataStructure/DataStructure.h" #include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Streams.h" -#include #include "llvm/Constants.h" +#include using namespace llvm; namespace { @@ -58,11 +58,11 @@ void CallTargetFinder::findIndTargets(Module &M) } if (N->isComplete() && !IndMap[cs].size()) { ++CompleteEmpty; - llvm_cerr << "Call site empty: '" - << cs.getInstruction()->getName() - << "' In '" - << cs.getInstruction()->getParent()->getParent()->getName() - << "'\n"; + cerr << "Call site empty: '" + << cs.getInstruction()->getName() + << "' In '" + << cs.getInstruction()->getParent()->getParent()->getName() + << "'\n"; } } else { ++DirCall; diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 80237c4f0b..c81fd6ad34 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -25,7 +25,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Support/Streams.h" #include "llvm/Support/Timer.h" #include #include @@ -1263,7 +1262,7 @@ DSGraph::~DSGraph() { } // dump - Allow inspection of graph in a debugger. -void DSGraph::dump() const { print(llvm_cerr); } +void DSGraph::dump() const { print(cerr); } /// remapLinks - Change all of the Links in the current node according to the diff --git a/lib/Analysis/DataStructure/DataStructureStats.cpp b/lib/Analysis/DataStructure/DataStructureStats.cpp index f7fbe3b33c..1357a334eb 100644 --- a/lib/Analysis/DataStructure/DataStructureStats.cpp +++ b/lib/Analysis/DataStructure/DataStructureStats.cpp @@ -92,18 +92,18 @@ void DSGraphStats::countCallees(const Function& F) { totalNumCallees += Callees.size(); ++numIndirectCalls; } else - llvm_cerr << "WARNING: No callee in Function '" << F.getName() - << "' at call: \n" - << *I->getCallSite().getInstruction(); + cerr << "WARNING: No callee in Function '" << F.getName() + << "' at call: \n" + << *I->getCallSite().getInstruction(); } TotalNumCallees += totalNumCallees; NumIndirectCalls += numIndirectCalls; if (numIndirectCalls) - llvm_cout << " In function " << F.getName() << ": " - << (totalNumCallees / (double) numIndirectCalls) - << " average callees per indirect call\n"; + cout << " In function " << F.getName() << ": " + << (totalNumCallees / (double) numIndirectCalls) + << " average callees per indirect call\n"; } DSNode *DSGraphStats::getNodeForValue(Value *V) { diff --git a/lib/Analysis/DataStructure/EquivClassGraphs.cpp b/lib/Analysis/DataStructure/EquivClassGraphs.cpp index 49c93ffc4f..2813b943ad 100644 --- a/lib/Analysis/DataStructure/EquivClassGraphs.cpp +++ b/lib/Analysis/DataStructure/EquivClassGraphs.cpp @@ -90,7 +90,7 @@ bool EquivClassGraphs::runOnModule(Module &M) { if (MainFunc && !MainFunc->isExternal()) { processSCC(getOrCreateGraph(*MainFunc), Stack, NextID, ValMap); } else { - llvm_cerr << "Fold Graphs: No 'main' function found!\n"; + cerr << "Fold Graphs: No 'main' function found!\n"; } for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) diff --git a/lib/Analysis/DataStructure/GraphChecker.cpp b/lib/Analysis/DataStructure/GraphChecker.cpp index cef3efed8f..8e4d3fce87 100644 --- a/lib/Analysis/DataStructure/GraphChecker.cpp +++ b/lib/Analysis/DataStructure/GraphChecker.cpp @@ -84,8 +84,8 @@ FunctionPass *llvm::createDataStructureGraphCheckerPass() { DSGC::DSGC() { if (!AbortIfAnyCollapsed && AbortIfCollapsed.empty() && CheckFlags.empty() && AbortIfMerged.empty()) { - llvm_cerr << "The -datastructure-gc is useless if you don't specify any" - " -dsgc-* options. See the -help-hidden output for a list.\n"; + cerr << "The -datastructure-gc is useless if you don't specify any" + << " -dsgc-* options. See the -help-hidden output for a list.\n"; abort(); } } @@ -123,8 +123,8 @@ void DSGC::verify(const DSGraph &G) { for (DSGraph::node_const_iterator I = G.node_begin(), E = G.node_end(); I != E; ++I) if (I->isNodeCompletelyFolded()) { - llvm_cerr << "Node is collapsed: "; - I->print(llvm_cerr, &G); + cerr << "Node is collapsed: "; + I->print(cerr, &G); abort(); } } @@ -142,8 +142,8 @@ void DSGC::verify(const DSGraph &G) { E = CheckFlags.end(); I != E; ++I) { std::string::size_type ColonPos = I->rfind(':'); if (ColonPos == std::string::npos) { - llvm_cerr << "Error: '" << *I - << "' is an invalid value for the --dsgc-check-flags option!\n"; + cerr << "Error: '" << *I + << "' is an invalid value for the --dsgc-check-flags option!\n"; abort(); } @@ -158,7 +158,7 @@ void DSGC::verify(const DSGraph &G) { case 'M': Flags |= DSNode::Modified; break; case 'R': Flags |= DSNode::Read; break; case 'A': Flags |= DSNode::Array; break; - default: llvm_cerr << "Invalid DSNode flag!\n"; abort(); + default: cerr << "Invalid DSNode flag!\n"; abort(); } CheckFlagsM[std::string(I->begin(), I->begin()+ColonPos)] = Flags; } @@ -176,25 +176,25 @@ void DSGC::verify(const DSGraph &G) { // Verify it is not collapsed if it is not supposed to be... if (N->isNodeCompletelyFolded() && AbortIfCollapsedS.count(Name)) { - llvm_cerr << "Node for value '%" << Name << "' is collapsed: "; - N->print(llvm_cerr, &G); + cerr << "Node for value '%" << Name << "' is collapsed: "; + N->print(cerr, &G); abort(); } if (CheckFlagsM.count(Name) && CheckFlagsM[Name] != N->getNodeFlags()) { - llvm_cerr << "Node flags are not as expected for node: " << Name - << " (" << CheckFlagsM[Name] << ":" <getNodeFlags() - << ")\n"; - N->print(llvm_cerr, &G); + cerr << "Node flags are not as expected for node: " << Name + << " (" << CheckFlagsM[Name] << ":" <getNodeFlags() + << ")\n"; + N->print(cerr, &G); abort(); } // Verify that it is not merged if it is not supposed to be... if (AbortIfMergedS.count(Name)) { if (AbortIfMergedNodes.count(N)) { - llvm_cerr << "Nodes for values '%" << Name << "' and '%" - << AbortIfMergedNodes[N] << "' is merged: "; - N->print(llvm_cerr, &G); + cerr << "Nodes for values '%" << Name << "' and '%" + << AbortIfMergedNodes[N] << "' is merged: "; + N->print(cerr, &G); abort(); } AbortIfMergedNodes[N] = Name; diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index 436218be9e..66ca33d876 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -434,7 +434,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { // Variable index into a node. We must merge all of the elements of the // sequential type here. if (isa(STy)) - llvm_cerr << "Pointer indexing not handled yet!\n"; + cerr << "Pointer indexing not handled yet!\n"; else { const ArrayType *ATy = cast(STy); unsigned ElSize = TD.getTypeSize(CurTy); @@ -1061,7 +1061,7 @@ void GraphBuilder::visitCallSite(CallSite CS) { if (DisableDirectCallOpt || !isa(Callee)) { CalleeNode = getValueDest(*Callee).getNode(); if (CalleeNode == 0) { - llvm_cerr << "WARNING: Program is calling through a null pointer?\n"<< *I; + cerr << "WARNING: Program is calling through a null pointer?\n"<< *I; return; // Calling a null pointer? } } diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp index 2e86bda548..21d75c08bc 100644 --- a/lib/Analysis/DataStructure/Printer.cpp +++ b/lib/Analysis/DataStructure/Printer.cpp @@ -37,7 +37,7 @@ namespace { Statistic NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)"); } -void DSNode::dump() const { print(llvm_cerr, 0); } +void DSNode::dump() const { print(cerr, 0); } static std::string getCaption(const DSNode *N, const DSGraph *G) { std::stringstream OS; diff --git a/lib/Analysis/DataStructure/Steensgaard.cpp b/lib/Analysis/DataStructure/Steensgaard.cpp index 292dfffa0d..5ff3c3f852 100644 --- a/lib/Analysis/DataStructure/Steensgaard.cpp +++ b/lib/Analysis/DataStructure/Steensgaard.cpp @@ -53,7 +53,7 @@ namespace { } // print - Implement the Pass::print method... - void print(llvm_ostream O, const Module *M) const { + void print(OStream O, const Module *M) const { if (O.stream()) print(*O.stream(), M); } void print(std::ostream &O, const Module *M) const { diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index 2887503041..69462279a9 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -533,7 +533,7 @@ Andersens::Node *Andersens::getNodeForConstantPointer(Constant *C) { case Instruction::BitCast: return getNodeForConstantPointer(CE->getOperand(0)); default: - llvm_cerr << "Constant Expr not yet handled: " << *CE << "\n"; + cerr << "Constant Expr not yet handled: " << *CE << "\n"; assert(0); } } else { @@ -560,7 +560,7 @@ Andersens::Node *Andersens::getNodeForConstantPointerTarget(Constant *C) { case Instruction::BitCast: return getNodeForConstantPointerTarget(CE->getOperand(0)); default: - llvm_cerr << "Constant Expr not yet handled: " << *CE << "\n"; + cerr << "Constant Expr not yet handled: " << *CE << "\n"; assert(0); } } else { @@ -786,7 +786,7 @@ void Andersens::visitInstruction(Instruction &I) { return; default: // Is this something we aren't handling yet? - llvm_cerr << "Unknown instruction: " << I; + cerr << "Unknown instruction: " << I; abort(); } } @@ -1104,13 +1104,13 @@ void Andersens::SolveConstraints() { void Andersens::PrintNode(Node *N) { if (N == &GraphNodes[UniversalSet]) { - llvm_cerr << ""; + cerr << ""; return; } else if (N == &GraphNodes[NullPtr]) { - llvm_cerr << ""; + cerr << ""; return; } else if (N == &GraphNodes[NullObject]) { - llvm_cerr << ""; + cerr << ""; return; } @@ -1119,56 +1119,56 @@ void Andersens::PrintNode(Node *N) { if (Function *F = dyn_cast(V)) { if (isa(F->getFunctionType()->getReturnType()) && N == getReturnNode(F)) { - llvm_cerr << F->getName() << ":retval"; + cerr << F->getName() << ":retval"; return; } else if (F->getFunctionType()->isVarArg() && N == getVarargNode(F)) { - llvm_cerr << F->getName() << ":vararg"; + cerr << F->getName() << ":vararg"; return; } } if (Instruction *I = dyn_cast(V)) - llvm_cerr << I->getParent()->getParent()->getName() << ":"; + cerr << I->getParent()->getParent()->getName() << ":"; else if (Argument *Arg = dyn_cast(V)) - llvm_cerr << Arg->getParent()->getName() << ":"; + cerr << Arg->getParent()->getName() << ":"; if (V->hasName()) - llvm_cerr << V->getName(); + cerr << V->getName(); else - llvm_cerr << "(unnamed)"; + cerr << "(unnamed)"; if (isa(V) || isa(V)) if (N == getObject(V)) - llvm_cerr << ""; + cerr << ""; } void Andersens::PrintConstraints() { - llvm_cerr << "Constraints:\n"; + cerr << "Constraints:\n"; for (unsigned i = 0, e = Constraints.size(); i != e; ++i) { - llvm_cerr << " #" << i << ": "; + cerr << " #" << i << ": "; Constraint &C = Constraints[i]; if (C.Type == Constraint::Store) - llvm_cerr << "*"; + cerr << "*"; PrintNode(C.Dest); - llvm_cerr << " = "; + cerr << " = "; if (C.Type == Constraint::Load) - llvm_cerr << "*"; + cerr << "*"; PrintNode(C.Src); - llvm_cerr << "\n"; + cerr << "\n"; } } void Andersens::PrintPointsToGraph() { - llvm_cerr << "Points-to graph:\n"; + cerr << "Points-to graph:\n"; for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) { Node *N = &GraphNodes[i]; - llvm_cerr << "[" << (N->end() - N->begin()) << "] "; + cerr << "[" << (N->end() - N->begin()) << "] "; PrintNode(N); - llvm_cerr << "\t--> "; + cerr << "\t--> "; for (Node::iterator I = N->begin(), E = N->end(); I != E; ++I) { - if (I != N->begin()) llvm_cerr << ", "; + if (I != N->begin()) cerr << ", "; PrintNode(*I); } - llvm_cerr << "\n"; + cerr << "\n"; } } diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index 128e11ebd7..6e8ca184b4 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -74,7 +74,7 @@ public: AU.setPreservesAll(); } - void print(llvm_ostream &o, const Module *M) const { + void print(OStream &o, const Module *M) const { if (o.stream()) print(*o.stream(), M); } @@ -95,7 +95,7 @@ public: /// dump - Print out this call graph. /// inline void dump() const { - print(llvm_cerr, Mod); + print(cerr, Mod); } CallGraphNode* getExternalCallingNode() const { return ExternalCallingNode; } @@ -212,7 +212,7 @@ void CallGraph::print(std::ostream &OS, const Module *M) const { } void CallGraph::dump() const { - print(llvm_cerr, 0); + print(cerr, 0); } //===----------------------------------------------------------------------===// @@ -275,7 +275,7 @@ void CallGraphNode::print(std::ostream &OS) const { OS << "\n"; } -void CallGraphNode::dump() const { print(llvm_cerr); } +void CallGraphNode::dump() const { print(cerr); } void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) { for (unsigned i = CalledFunctions.size(); ; --i) { diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp index 38f0bbaa9a..04dfbf4cf9 100644 --- a/lib/Analysis/InstCount.cpp +++ b/lib/Analysis/InstCount.cpp @@ -43,7 +43,7 @@ namespace { #include "llvm/Instruction.def" void visitInstruction(Instruction &I) { - llvm_cerr << "Instruction Count does not know about " << I; + cerr << "Instruction Count does not know about " << I; abort(); } public: diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index 18957607ff..b33e414bf0 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -80,7 +80,7 @@ void Loop::print(std::ostream &OS, unsigned Depth) const { } void Loop::dump() const { - print(llvm_cerr); + print(cerr); } diff --git a/lib/Analysis/ProfileInfoLoader.cpp b/lib/Analysis/ProfileInfoLoader.cpp index 3c19f5e9b9..b1ed235c10 100644 --- a/lib/Analysis/ProfileInfoLoader.cpp +++ b/lib/Analysis/ProfileInfoLoader.cpp @@ -37,7 +37,7 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F, // Read the number of entries... unsigned NumEntries; if (fread(&NumEntries, sizeof(unsigned), 1, F) != 1) { - llvm_cerr << ToolName << ": data packet truncated!\n"; + cerr << ToolName << ": data packet truncated!\n"; perror(0); exit(1); } @@ -48,7 +48,7 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F, // Read in the block of data... if (fread(&TempSpace[0], sizeof(unsigned)*NumEntries, 1, F) != 1) { - llvm_cerr << ToolName << ": data packet truncated!\n"; + cerr << ToolName << ": data packet truncated!\n"; perror(0); exit(1); } @@ -75,7 +75,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, Module &TheModule) : M(TheModule) { FILE *F = fopen(Filename.c_str(), "r"); if (F == 0) { - llvm_cerr << ToolName << ": Error opening '" << Filename << "': "; + cerr << ToolName << ": Error opening '" << Filename << "': "; perror(0); exit(1); } @@ -93,7 +93,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, case ArgumentInfo: { unsigned ArgLength; if (fread(&ArgLength, sizeof(unsigned), 1, F) != 1) { - llvm_cerr << ToolName << ": arguments packet truncated!\n"; + cerr << ToolName << ": arguments packet truncated!\n"; perror(0); exit(1); } @@ -104,7 +104,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, if (ArgLength) if (fread(&Chars[0], (ArgLength+3) & ~3, 1, F) != 1) { - llvm_cerr << ToolName << ": arguments packet truncated!\n"; + cerr << ToolName << ": arguments packet truncated!\n"; perror(0); exit(1); } @@ -129,7 +129,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, break; default: - llvm_cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n"; + cerr << ToolName << ": Unknown packet type #" << PacketType << "!\n"; exit(1); } } @@ -156,7 +156,7 @@ void ProfileInfoLoader::getFunctionCounts(std::vectorgetParent(), BlockCounts[i].second)); } else { - llvm_cerr << "Function counts are not available!\n"; + cerr << "Function counts are not available!\n"; } return; } @@ -200,8 +200,8 @@ void ProfileInfoLoader::getBlockCounts(std::vector= TI->getNumSuccessors()) { static bool Warned = false; if (!Warned) { - llvm_cerr << "WARNING: profile info doesn't seem to match" - << " the program!\n"; + cerr << "WARNING: profile info doesn't seem to match" + << " the program!\n"; Warned = true; } } else { @@ -226,7 +226,7 @@ void ProfileInfoLoader::getBlockCounts(std::vector > &Counts) { if (EdgeCounts.empty()) { - llvm_cerr << "Edge counts not available, and no synthesis " - << "is implemented yet!\n"; + cerr << "Edge counts not available, and no synthesis " + << "is implemented yet!\n"; return; } @@ -268,9 +268,8 @@ void ProfileInfoLoader::getEdgeCounts(std::vector &Trace) { if (BBTrace.empty ()) { - llvm_cerr << "Basic block trace is not available!\n"; + cerr << "Basic block trace is not available!\n"; return; } - llvm_cerr << "Basic block trace loading is not implemented yet!\n"; + cerr << "Basic block trace loading is not implemented yet!\n"; } - diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp index 08a45c62c5..426bd18746 100644 --- a/lib/Analysis/ProfileInfoLoaderPass.cpp +++ b/lib/Analysis/ProfileInfoLoaderPass.cpp @@ -76,8 +76,8 @@ bool LoaderPass::runOnModule(Module &M) { TerminatorInst *TI = BB->getTerminator(); if (SuccNum >= TI->getNumSuccessors()) { if (!PrintedWarning) { - llvm_cerr << "WARNING: profile information is inconsistent with " - << "the current program!\n"; + cerr << "WARNING: profile information is inconsistent with " + << "the current program!\n"; PrintedWarning = true; } } else { diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index ba903e0140..9fc0c76b0e 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -118,7 +118,7 @@ namespace { // SCEV::~SCEV() {} void SCEV::dump() const { - print(llvm_cerr); + print(cerr); } /// getValueRange - Return the tightest constant bounds that this value is @@ -1558,11 +1558,11 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) { break; default: #if 0 - llvm_cerr << "ComputeIterationCount "; + cerr << "ComputeIterationCount "; if (ExitCond->getOperand(0)->getType()->isUnsigned()) - llvm_cerr << "[unsigned] "; - llvm_cerr << *LHS << " " - << Instruction::getOpcodeName(Cond) << " " << *RHS << "\n"; + cerr << "[unsigned] "; + cerr << *LHS << " " + << Instruction::getOpcodeName(Cond) << " " << *RHS << "\n"; #endif break; } @@ -1678,9 +1678,9 @@ ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS, if (!isa(Result)) break; // Couldn't decide for sure if (cast(Result)->getValue() == false) { #if 0 - llvm_cerr << "\n***\n*** Computed loop count " << *ItCst - << "\n*** From global " << *GV << "*** BB: " << *L->getHeader() - << "***\n"; + cerr << "\n***\n*** Computed loop count " << *ItCst + << "\n*** From global " << *GV << "*** BB: " << *L->getHeader() + << "***\n"; #endif ++NumArrayLenItCounts; return SCEVConstant::get(ItCst); // Found terminating iteration! @@ -2147,8 +2147,8 @@ SCEVHandle ScalarEvolutionsImpl::HowFarToZero(SCEV *V, const Loop *L) { SCEVConstant *R2 = dyn_cast(Roots.second); if (R1) { #if 0 - llvm_cerr << "HFTZ: " << *V << " - sol#1: " << *R1 - << " sol#2: " << *R2 << "\n"; + cerr << "HFTZ: " << *V << " - sol#1: " << *R1 + << " sol#2: " << *R2 << "\n"; #endif // Pick the smallest positive root value. assert(R1->getType()->isUnsigned()&&"Didn't canonicalize to unsigned?"); @@ -2276,8 +2276,8 @@ HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L) { default: break; } - //llvm_cerr << "Computed Loop Trip Count as: " << - // *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n"; + //cerr << "Computed Loop Trip Count as: " + // << *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n"; return SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)); } @@ -2492,20 +2492,20 @@ static void PrintLoopInfo(std::ostream &OS, const ScalarEvolution *SE, for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) PrintLoopInfo(OS, SE, *I); - llvm_cerr << "Loop " << L->getHeader()->getName() << ": "; + cerr << "Loop " << L->getHeader()->getName() << ": "; std::vector ExitBlocks; L->getExitBlocks(ExitBlocks); if (ExitBlocks.size() != 1) - llvm_cerr << " "; + cerr << " "; if (SE->hasLoopInvariantIterationCount(L)) { - llvm_cerr << *SE->getIterationCount(L) << " iterations! "; + cerr << *SE->getIterationCount(L) << " iterations! "; } else { - llvm_cerr << "Unpredictable iteration count. "; + cerr << "Unpredictable iteration count. "; } - llvm_cerr << "\n"; + cerr << "\n"; } void ScalarEvolution::print(std::ostream &OS, const Module* ) const { diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index 2698ace5b3..9432cc278b 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -13,9 +13,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/ScalarEvolutionExpander.h" - +#include "llvm/Analysis/LoopInfo.h" using namespace llvm; /// InsertCastOfTo - Insert a cast of V to the specified type, doing what @@ -175,7 +174,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) { SCEVHandle IH = SCEVUnknown::get(I); // Get I as a "symbolic" SCEV. SCEVHandle V = S->evaluateAtIteration(IH); - //llvm_cerr << "Evaluated: " << *this << "\n to: " << *V << "\n"; + //cerr << "Evaluated: " << *this << "\n to: " << *V << "\n"; return expandInTy(V, Ty); } diff --git a/lib/Analysis/Trace.cpp b/lib/Analysis/Trace.cpp index d0457557c8..a0aa955ebe 100644 --- a/lib/Analysis/Trace.cpp +++ b/lib/Analysis/Trace.cpp @@ -25,14 +25,13 @@ Function *Trace::getFunction() const { return getEntryBasicBlock()->getParent(); } - Module *Trace::getModule() const { return getFunction()->getParent(); } /// print - Write trace to output stream. /// -void Trace::print(llvm_ostream &O) const { +void Trace::print(OStream &O) const { Function *F = getFunction (); O << "; Trace from function " << F->getName() << ", blocks:\n"; for (const_iterator i = begin(), e = end(); i != e; ++i) { @@ -48,5 +47,5 @@ void Trace::print(llvm_ostream &O) const { /// output stream. /// void Trace::dump() const { - print(llvm_cerr); + print(cerr); } diff --git a/lib/AsmParser/llvmAsmParser.cpp.cvs b/lib/AsmParser/llvmAsmParser.cpp.cvs index 84d6bada7c..681990382f 100644 --- a/lib/AsmParser/llvmAsmParser.cpp.cvs +++ b/lib/AsmParser/llvmAsmParser.cpp.cvs @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 2.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,13 +20,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -37,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -356,7 +366,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -403,7 +413,7 @@ static Module *ParserResult; // //#define DEBUG_UPREFS 1 #ifdef DEBUG_UPREFS -#define UR_OUT(X) llvm_cerr << X +#define UR_OUT(X) cerr << X #else #define UR_OUT(X) #endif @@ -1216,9 +1226,10 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { # define YYTOKEN_TABLE 0 #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 855 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" -typedef union YYSTYPE { +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 855 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" +{ llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -1259,9 +1270,10 @@ typedef union YYSTYPE { llvm::Module::Endianness Endianness; llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; -} YYSTYPE; -/* Line 196 of yacc.c. */ -#line 1265 "llvmAsmParser.tab.c" +} +/* Line 193 of yacc.c. */ +#line 1276 "llvmAsmParser.tab.c" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1272,23 +1284,56 @@ typedef union YYSTYPE { /* Copy the second part of user declarations. */ -/* Line 219 of yacc.c. */ -#line 1277 "llvmAsmParser.tab.c" +/* Line 216 of yacc.c. */ +#line 1289 "llvmAsmParser.tab.c" -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ +#ifdef short +# undef short #endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; #endif -#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; #endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif #endif +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS @@ -1301,7 +1346,32 @@ typedef union YYSTYPE { # endif #endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -1309,64 +1379,76 @@ typedef union YYSTYPE { # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if defined (__STDC__) || defined (__cplusplus) +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# define YYINCLUDED_STDLIB_H +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# ifdef __cplusplus -extern "C" { +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif -# ifdef __cplusplus -} -# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; + yytype_int16 yyss; YYSTYPE yyvs; }; @@ -1376,13 +1458,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -1393,7 +1475,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -1411,28 +1493,22 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 1509 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 159 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 78 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 297 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 578 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ @@ -1443,7 +1519,7 @@ union yyalloc ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1490,7 +1566,7 @@ static const unsigned char yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short int yyprhs[] = +static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, @@ -1524,8 +1600,8 @@ static const unsigned short int yyprhs[] = 884, 888, 895, 899, 906, 909, 914, 921 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = { 193, 0, -1, 5, -1, 6, -1, 3, -1, 4, -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, @@ -1623,7 +1699,7 @@ static const short int yyrhs[] = }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = +static const yytype_uint16 yyrline[] = { 0, 990, 990, 991, 999, 1000, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1011, 1011, 1011, 1012, 1012, @@ -1660,7 +1736,7 @@ static const unsigned short int yyrline[] = #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", @@ -1708,7 +1784,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -1730,7 +1806,7 @@ static const unsigned short int yytoknum[] = # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = +static const yytype_uint8 yyr1[] = { 0, 159, 160, 160, 161, 161, 162, 162, 162, 162, 162, 162, 162, 162, 162, 163, 163, 163, 164, 164, @@ -1765,7 +1841,7 @@ static const unsigned char yyr1[] = }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1802,7 +1878,7 @@ static const unsigned char yyr2[] = /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned short int yydefact[] = +static const yytype_uint16 yydefact[] = { 191, 0, 86, 177, 1, 176, 224, 79, 80, 81, 82, 83, 84, 85, 0, 87, 248, 173, 174, 248, @@ -1864,8 +1940,8 @@ static const unsigned short int yydefact[] = 0, 0, 0, 260, 0, 0, 259, 256 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = { -1, 86, 299, 316, 317, 318, 319, 320, 253, 270, 211, 212, 241, 213, 25, 15, 37, 497, 355, 436, @@ -1880,7 +1956,7 @@ static const short int yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -517 -static const short int yypact[] = +static const yytype_int16 yypact[] = { -517, 40, 69, 528, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, 16, 90, 76, -517, -517, 5, @@ -1943,7 +2019,7 @@ static const short int yypact[] = }; /* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = +static const yytype_int16 yypgoto[] = { -517, -517, -517, 286, 288, 291, 317, 320, 134, 80, -127, -125, -502, -517, 340, 391, -114, -517, -265, 14, @@ -1960,7 +2036,7 @@ static const short int yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -173 -static const short int yytable[] = +static const yytype_int16 yytable[] = { 89, 225, 106, 239, 228, 240, 26, 357, 414, 377, 378, 94, 400, 416, 434, 123, 89, 242, 215, 119, @@ -2115,7 +2191,7 @@ static const short int yytable[] = 0, 82, 0, 0, 83, 0, 0, 84, 0, 85 }; -static const short int yycheck[] = +static const yytype_int16 yycheck[] = { 37, 125, 53, 130, 128, 130, 3, 272, 15, 293, 294, 29, 154, 15, 34, 157, 53, 131, 112, 85, @@ -2272,7 +2348,7 @@ static const short int yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned char yystos[] = +static const yytype_uint8 yystos[] = { 0, 193, 194, 195, 0, 25, 31, 41, 42, 43, 44, 45, 46, 47, 62, 174, 212, 214, 216, 223, @@ -2359,7 +2435,7 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ @@ -2367,7 +2443,7 @@ do \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) #define YYTERROR 1 @@ -2382,7 +2458,7 @@ while (0) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (N) \ + if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -2396,7 +2472,7 @@ while (0) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (0) + while (YYID (0)) #endif @@ -2408,8 +2484,8 @@ while (0) # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -2436,36 +2512,96 @@ while (0) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) +} while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short int *bottom, short int *top) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) - short int *bottom; - short int *top; + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) + for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -2474,37 +2610,45 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void -yy_reduce_print (yyrule) +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; int yyrule; #endif { + int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -2538,42 +2682,44 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) - const char *yystr; -# endif + const char *yystr; +#endif { - const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif + char *yydest; + const char *yysrc; +#endif { char *yyd = yydest; const char *yys = yysrc; @@ -2599,7 +2745,7 @@ yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - size_t yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -2634,53 +2780,123 @@ yytnamerr (char *yyres, const char *yystr) } # endif -#endif /* YYERROR_VERBOSE */ - - - -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + int yyn = yypact[yystate]; - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) - { - default: - break; + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; } - YYFPRINTF (yyoutput, ")"); } +#endif /* YYERROR_VERBOSE */ + -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else @@ -2691,8 +2907,7 @@ yydestruct (yymsg, yytype, yyvaluep) YYSTYPE *yyvaluep; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; @@ -2702,7 +2917,7 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } @@ -2710,13 +2925,13 @@ yydestruct (yymsg, yytype, yyvaluep) /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); @@ -2741,14 +2956,18 @@ int yynerrs; `----------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else @@ -2766,6 +2985,12 @@ yyparse () int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif /* Three stacks and their tools: `yyss': related to states, @@ -2776,9 +3001,9 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - short int *yyssp; + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; @@ -2787,7 +3012,7 @@ yyparse () -#define YYPOPSTACK (yyvsp--, yyssp--) +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; @@ -2796,9 +3021,9 @@ yyparse () YYSTYPE yyval; - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); @@ -2822,8 +3047,7 @@ yyparse () `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -2836,11 +3060,11 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the @@ -2868,7 +3092,7 @@ yyparse () yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) @@ -2903,12 +3127,10 @@ yyparse () `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* yyresume: */ + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; @@ -2950,22 +3172,21 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the token being shifted unless it is eof. */ + /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; + yystate = yyn; *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - yystate = yyn; goto yynewstate; @@ -3001,165 +3222,165 @@ yyreduce: switch (yyn) { case 3: -#line 991 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 991 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! + if ((yyvsp[(1) - (1)].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); + (yyval.SIntVal) = (int32_t)(yyvsp[(1) - (1)].UIntVal); CHECK_FOR_ERROR ;} break; case 5: -#line 1000 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1000 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! + if ((yyvsp[(1) - (1)].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val); + (yyval.SInt64Val) = (int64_t)(yyvsp[(1) - (1)].UInt64Val); CHECK_FOR_ERROR ;} break; case 39: -#line 1017 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1017 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} break; case 40: -#line 1017 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1017 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} break; case 41: -#line 1018 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1018 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} break; case 42: -#line 1018 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1018 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} break; case 43: -#line 1019 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1019 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} break; case 44: -#line 1019 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1019 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} break; case 45: -#line 1020 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1020 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} break; case 46: -#line 1020 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1020 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} break; case 47: -#line 1021 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1021 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} break; case 48: -#line 1021 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1021 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} break; case 49: -#line 1025 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1025 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} break; case 50: -#line 1025 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1025 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} break; case 51: -#line 1026 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1026 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} break; case 52: -#line 1026 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1026 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} break; case 53: -#line 1027 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1027 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} break; case 54: -#line 1027 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1027 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} break; case 55: -#line 1028 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1028 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} break; case 56: -#line 1028 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1028 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} break; case 57: -#line 1029 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1029 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} break; case 58: -#line 1029 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1029 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} break; case 59: -#line 1030 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1030 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} break; case 60: -#line 1030 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1030 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} break; case 61: -#line 1031 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1031 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} break; case 62: -#line 1031 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1031 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} break; case 63: -#line 1032 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1032 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} break; case 64: -#line 1033 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1033 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} break; case 77: -#line 1044 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1044 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.StrVal) = (yyvsp[-1].StrVal); + (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); CHECK_FOR_ERROR ;} break; case 78: -#line 1048 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1048 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3167,99 +3388,99 @@ yyreduce: break; case 79: -#line 1053 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1053 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 80: -#line 1054 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1054 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 81: -#line 1055 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1055 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 82: -#line 1056 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1056 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 83: -#line 1057 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1057 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 84: -#line 1058 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1058 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 85: -#line 1059 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1059 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 86: -#line 1060 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1060 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 87: -#line 1062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1062 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 88: -#line 1063 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1063 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 89: -#line 1064 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1064 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::CSRet; ;} break; case 90: -#line 1065 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1065 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 91: -#line 1066 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1066 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 92: -#line 1067 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1067 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 93: -#line 1068 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1068 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 94: -#line 1069 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1069 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) + if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) GEN_ERROR("Calling conv too large!"); - (yyval.UIntVal) = (yyvsp[0].UInt64Val); + (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); CHECK_FOR_ERROR ;} break; case 95: -#line 1078 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1078 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 96: -#line 1079 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1079 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.UIntVal) = (yyvsp[0].UInt64Val); + (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) GEN_ERROR("Alignment must be a power of two!"); CHECK_FOR_ERROR @@ -3267,14 +3488,14 @@ yyreduce: break; case 97: -#line 1085 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1085 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 98: -#line 1086 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1086 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.UIntVal) = (yyvsp[0].UInt64Val); + (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) GEN_ERROR("Alignment must be a power of two!"); CHECK_FOR_ERROR @@ -3282,77 +3503,77 @@ yyreduce: break; case 99: -#line 1094 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1094 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) - if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') + for (unsigned i = 0, e = strlen((yyvsp[(2) - (2)].StrVal)); i != e; ++i) + if ((yyvsp[(2) - (2)].StrVal)[i] == '"' || (yyvsp[(2) - (2)].StrVal)[i] == '\\') GEN_ERROR("Invalid character in section name!"); - (yyval.StrVal) = (yyvsp[0].StrVal); + (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); CHECK_FOR_ERROR ;} break; case 100: -#line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1102 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 101: -#line 1103 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = (yyvsp[0].StrVal); ;} +#line 1103 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} break; case 102: -#line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1108 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" {;} break; case 103: -#line 1109 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1109 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" {;} break; case 104: -#line 1110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1110 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - CurGV->setSection((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + CurGV->setSection((yyvsp[(1) - (1)].StrVal)); + free((yyvsp[(1) - (1)].StrVal)); CHECK_FOR_ERROR ;} break; case 105: -#line 1115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1115 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) + if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Alignment must be a power of two!"); - CurGV->setAlignment((yyvsp[0].UInt64Val)); + CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); CHECK_FOR_ERROR ;} break; case 107: -#line 1129 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} +#line 1129 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} break; case 109: -#line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} +#line 1130 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} break; case 110: -#line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); - (yyval.TypeVal) = (yyvsp[0].TypeVal); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); + (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); CHECK_FOR_ERROR ;} break; case 124: -#line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -3360,28 +3581,28 @@ yyreduce: break; case 125: -#line 1148 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); + (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); CHECK_FOR_ERROR ;} break; case 126: -#line 1152 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1152 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... - const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); + const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); CHECK_FOR_ERROR (yyval.TypeVal) = new PATypeHolder(tmp); ;} break; case 127: -#line 1160 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1160 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Type UpReference - if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); + if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... + UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... (yyval.TypeVal) = new PATypeHolder(OT); UR_OUT("New Upreference!\n"); CHECK_FOR_ERROR @@ -3389,63 +3610,63 @@ yyreduce: break; case 128: -#line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1168 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Function derived type? std::vector Params; - for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), - E = (yyvsp[-1].TypeList)->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[(3) - (4)].TypeList)->begin(), + E = (yyvsp[(3) - (4)].TypeList)->end(); I != E; ++I) Params.push_back(*I); bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg))); - delete (yyvsp[-1].TypeList); // Delete the argument list - delete (yyvsp[-3].TypeVal); // Delete the return type handle + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[(1) - (4)].TypeVal),Params,isVarArg))); + delete (yyvsp[(3) - (4)].TypeList); // Delete the argument list + delete (yyvsp[(1) - (4)].TypeVal); // Delete the return type handle CHECK_FOR_ERROR ;} break; case 129: -#line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1181 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Sized array type? - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); - delete (yyvsp[-1].TypeVal); + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); + delete (yyvsp[(4) - (5)].TypeVal); CHECK_FOR_ERROR ;} break; case 130: -#line 1186 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1186 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Packed array type? - const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); - if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) + const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); + if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) GEN_ERROR("Unsigned result not equal to signed result"); if (!ElemTy->isPrimitiveType()) GEN_ERROR("Elemental type of a PackedType must be primitive"); - if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) + if (!isPowerOf2_32((yyvsp[(2) - (5)].UInt64Val))) GEN_ERROR("Vector length should be a power of 2!"); - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); - delete (yyvsp[-1].TypeVal); + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); + delete (yyvsp[(4) - (5)].TypeVal); CHECK_FOR_ERROR ;} break; case 131: -#line 1198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1198 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; - for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), - E = (yyvsp[-1].TypeList)->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), + E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) Elements.push_back(*I); (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); - delete (yyvsp[-1].TypeList); + delete (yyvsp[(2) - (3)].TypeList); CHECK_FOR_ERROR ;} break; case 132: -#line 1208 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1208 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -3453,43 +3674,43 @@ yyreduce: break; case 133: -#line 1212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1212 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Pointer type? - if (*(yyvsp[-1].TypeVal) == Type::LabelTy) + if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); - delete (yyvsp[-1].TypeVal); + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal)))); + delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR ;} break; case 134: -#line 1223 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1223 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); - (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); + (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); delete (yyvsp[(1) - (1)].TypeVal); CHECK_FOR_ERROR ;} break; case 135: -#line 1228 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1228 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); + ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); CHECK_FOR_ERROR ;} break; case 137: -#line 1235 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1235 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); + ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR ;} break; case 138: -#line 1239 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR @@ -3497,7 +3718,7 @@ yyreduce: break; case 139: -#line 1243 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1243 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); CHECK_FOR_ERROR @@ -3505,186 +3726,186 @@ yyreduce: break; case 140: -#line 1254 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1254 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); + const ArrayType *ATy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); + (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + - utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + + utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) + for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); + (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); } - (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); - delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); + (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); + delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); CHECK_FOR_ERROR ;} break; case 141: -#line 1280 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1280 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); + const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); + (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); int NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +"!"); (yyval.ConstVal) = ConstantArray::get(ATy, std::vector()); - delete (yyvsp[-2].TypeVal); + delete (yyvsp[(1) - (3)].TypeVal); CHECK_FOR_ERROR ;} break; case 142: -#line 1294 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1294 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); + const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); + (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); int NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); - char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); - if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) + char *EndStr = UnEscapeLexed((yyvsp[(3) - (3)].StrVal), true); + if (NumElements != -1 && NumElements != (EndStr-(yyvsp[(3) - (3)].StrVal))) GEN_ERROR("Can't build string constant of size " + - itostr((int)(EndStr-(yyvsp[0].StrVal))) + + itostr((int)(EndStr-(yyvsp[(3) - (3)].StrVal))) + " when array has size " + itostr(NumElements) + "!"); std::vector Vals; if (ETy == Type::SByteTy) { - for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C) + for (signed char *C = (signed char *)(yyvsp[(3) - (3)].StrVal); C != (signed char *)EndStr; ++C) Vals.push_back(ConstantInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { - for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); + for (unsigned char *C = (unsigned char *)(yyvsp[(3) - (3)].StrVal); C != (unsigned char*)EndStr; ++C) Vals.push_back(ConstantInt::get(ETy, *C)); } else { - free((yyvsp[0].StrVal)); + free((yyvsp[(3) - (3)].StrVal)); GEN_ERROR("Cannot build string arrays of non byte sized elements!"); } - free((yyvsp[0].StrVal)); + free((yyvsp[(3) - (3)].StrVal)); (yyval.ConstVal) = ConstantArray::get(ATy, Vals); - delete (yyvsp[-2].TypeVal); + delete (yyvsp[(1) - (3)].TypeVal); CHECK_FOR_ERROR ;} break; case 143: -#line 1324 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1324 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr - const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); + const PackedType *PTy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make packed constant with type: '" + - (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); + (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); const Type *ETy = PTy->getElementType(); int NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + - utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + + utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) + for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); + (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); } - (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); - delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); + (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); + delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); CHECK_FOR_ERROR ;} break; case 144: -#line 1350 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1350 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); + const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); + (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); - if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) + if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) GEN_ERROR("Illegal number of initializers for structure type!"); // Check to ensure that constants are compatible with the type initializer! - for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) - if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) + for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) + if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) GEN_ERROR("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + " of structure initializer!"); - (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); - delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); + (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); + delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); CHECK_FOR_ERROR ;} break; case 145: -#line 1371 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1371 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); + const StructType *STy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); + (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); if (STy->getNumContainedTypes() != 0) GEN_ERROR("Illegal number of initializers for structure type!"); (yyval.ConstVal) = ConstantStruct::get(STy, std::vector()); - delete (yyvsp[-2].TypeVal); + delete (yyvsp[(1) - (3)].TypeVal); CHECK_FOR_ERROR ;} break; case 146: -#line 1384 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1384 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); + const PointerType *PTy = dyn_cast((yyvsp[(1) - (2)].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make null pointer constant with type: '" + - (*(yyvsp[-1].TypeVal))->getDescription() + "'!"); + (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'!"); (yyval.ConstVal) = ConstantPointerNull::get(PTy); - delete (yyvsp[-1].TypeVal); + delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR ;} break; case 147: -#line 1394 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1394 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); - delete (yyvsp[-1].TypeVal); + (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); + delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR ;} break; case 148: -#line 1399 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1399 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); + const PointerType *Ty = dyn_cast((yyvsp[(1) - (2)].TypeVal)->get()); if (Ty == 0) GEN_ERROR("Global const reference must be a pointer type!"); @@ -3698,7 +3919,7 @@ yyreduce: Function *SavedCurFn = CurFun.CurrentFunction; CurFun.CurrentFunction = 0; - Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); + Value *V = getValNonImprovising(Ty, (yyvsp[(2) - (2)].ValIDVal)); CHECK_FOR_ERROR CurFun.CurrentFunction = SavedCurFn; @@ -3713,14 +3934,14 @@ yyreduce: // First check to see if the forward references value is already created! PerModuleInfo::GlobalRefsType::iterator I = - CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); + CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); if (I != CurModule.GlobalRefs.end()) { V = I->second; // Placeholder already exists, use it... - (yyvsp[0].ValIDVal).destroy(); + (yyvsp[(2) - (2)].ValIDVal).destroy(); } else { std::string Name; - if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; + if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[(2) - (2)].ValIDVal).Name; // Create the forward referenced global. GlobalValue *GV; @@ -3735,62 +3956,62 @@ yyreduce: } // Keep track of the fact that we have a forward ref to recycle it - CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV)); + CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV)); V = GV; } } (yyval.ConstVal) = cast(V); - delete (yyvsp[-1].TypeVal); // Free the type handle + delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle CHECK_FOR_ERROR ;} break; case 149: -#line 1460 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1460 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) + if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression!"); - (yyval.ConstVal) = (yyvsp[0].ConstVal); - delete (yyvsp[-1].TypeVal); + (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); + delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR ;} break; case 150: -#line 1467 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1467 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const Type *Ty = (yyvsp[-1].TypeVal)->get(); + const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) GEN_ERROR("Cannot create a null initialized value of this type!"); (yyval.ConstVal) = Constant::getNullValue(Ty); - delete (yyvsp[-1].TypeVal); + delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR ;} break; case 151: -#line 1475 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1475 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // integral constants - if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) + if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); + (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)); CHECK_FOR_ERROR ;} break; case 152: -#line 1481 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1481 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // integral constants - if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) + if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); + (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)); CHECK_FOR_ERROR ;} break; case 153: -#line 1487 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1487 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getTrue(); CHECK_FOR_ERROR @@ -3798,7 +4019,7 @@ yyreduce: break; case 154: -#line 1491 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1491 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::getFalse(); CHECK_FOR_ERROR @@ -3806,235 +4027,235 @@ yyreduce: break; case 155: -#line 1495 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1495 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants - if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) + if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal))) GEN_ERROR("Floating point constant invalid for type!!"); - (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); + (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal)); CHECK_FOR_ERROR ;} break; case 156: -#line 1503 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1503 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - Constant *Val = (yyvsp[-3].ConstVal); - const Type *Ty = (yyvsp[-1].TypeVal)->get(); + Constant *Val = (yyvsp[(3) - (6)].ConstVal); + const Type *Ty = (yyvsp[(5) - (6)].TypeVal)->get(); if (!Val->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + Val->getType()->getDescription() + "'!"); if (!Ty->isFirstClassType()) GEN_ERROR("cast constant expression to a non-primitive type: '" + Ty->getDescription() + "'!"); - (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get()); - delete (yyvsp[-1].TypeVal); + (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].TypeVal)->get()); + delete (yyvsp[(5) - (6)].TypeVal); ;} break; case 157: -#line 1515 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1515 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!isa((yyvsp[-2].ConstVal)->getType())) + if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) GEN_ERROR("GetElementPtr requires a pointer operand!"); const Type *IdxTy = - GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); + GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), *(yyvsp[(4) - (5)].ValueList), true); if (!IdxTy) GEN_ERROR("Index list invalid for constant getelementptr!"); std::vector IdxVec; - for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) - if (Constant *C = dyn_cast((*(yyvsp[-1].ValueList))[i])) + for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) + if (Constant *C = dyn_cast((*(yyvsp[(4) - (5)].ValueList))[i])) IdxVec.push_back(C); else GEN_ERROR("Indices to constant getelementptr must be constants!"); - delete (yyvsp[-1].ValueList); + delete (yyvsp[(4) - (5)].ValueList); - (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec); + (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), IdxVec); CHECK_FOR_ERROR ;} break; case 158: -#line 1536 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1536 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) + if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) GEN_ERROR("Select operand types must match!"); - (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); CHECK_FOR_ERROR ;} break; case 159: -#line 1544 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1544 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Binary operator types must match!"); CHECK_FOR_ERROR; - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); ;} break; case 160: -#line 1550 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1550 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("Logical operator types must match!"); - if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) { - if (!isa((yyvsp[-3].ConstVal)->getType()) || - !cast((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral()) + if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isIntegral()) { + if (!isa((yyvsp[(3) - (6)].ConstVal)->getType()) || + !cast((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); CHECK_FOR_ERROR ;} break; case 161: -#line 1561 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1561 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) GEN_ERROR("setcc operand types must match!"); - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); CHECK_FOR_ERROR ;} break; case 162: -#line 1567 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1567 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("icmp operand types must match!"); - (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); ;} break; case 163: -#line 1572 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1572 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) GEN_ERROR("fcmp operand types must match!"); - (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); ;} break; case 164: -#line 1577 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1577 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) + if ((yyvsp[(5) - (6)].ConstVal)->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); - if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) + if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); CHECK_FOR_ERROR; - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); CHECK_FOR_ERROR ;} break; case 165: -#line 1586 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1586 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) GEN_ERROR("Invalid extractelement operands!"); - (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); CHECK_FOR_ERROR ;} break; case 166: -#line 1592 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1592 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid insertelement operands!"); - (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); CHECK_FOR_ERROR ;} break; case 167: -#line 1598 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1598 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) GEN_ERROR("Invalid shufflevector operands!"); - (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); CHECK_FOR_ERROR ;} break; case 168: -#line 1607 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1607 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); + ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); CHECK_FOR_ERROR ;} break; case 169: -#line 1611 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1611 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); - (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); + (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR ;} break; case 170: -#line 1619 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1619 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 171: -#line 1619 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1619 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 172: -#line 1629 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1629 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); + (yyval.ModuleVal) = ParserResult = (yyvsp[(1) - (1)].ModuleVal); CurModule.ModuleDone(); CHECK_FOR_ERROR; ;} break; case 173: -#line 1637 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1637 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); CurFun.FunctionDone(); CHECK_FOR_ERROR ;} break; case 174: -#line 1642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1642 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); CHECK_FOR_ERROR ;} break; case 175: -#line 1646 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1646 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); + (yyval.ModuleVal) = (yyvsp[(1) - (4)].ModuleVal); CHECK_FOR_ERROR ;} break; case 176: -#line 1650 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1650 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); CHECK_FOR_ERROR ;} break; case 177: -#line 1654 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1654 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. @@ -4051,7 +4272,7 @@ yyreduce: break; case 178: -#line 1669 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1669 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: @@ -4062,62 +4283,62 @@ yyreduce: // If types are not resolved eagerly, then the two types will not be // determined to be the same type! // - ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); + ResolveTypeTo((yyvsp[(2) - (4)].StrVal), *(yyvsp[(4) - (4)].TypeVal)); - if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { + if (!setTypeName(*(yyvsp[(4) - (4)].TypeVal), (yyvsp[(2) - (4)].StrVal)) && !(yyvsp[(2) - (4)].StrVal)) { CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. - CurModule.Types.push_back(*(yyvsp[0].TypeVal)); + CurModule.Types.push_back(*(yyvsp[(4) - (4)].TypeVal)); } - delete (yyvsp[0].TypeVal); + delete (yyvsp[(4) - (4)].TypeVal); CHECK_FOR_ERROR ;} break; case 179: -#line 1691 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1691 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Function prototypes can be in const pool CHECK_FOR_ERROR ;} break; case 180: -#line 1694 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1694 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Asm blocks can be in the const pool CHECK_FOR_ERROR ;} break; case 181: -#line 1697 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1697 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[0].ConstVal) == 0) + if ((yyvsp[(5) - (5)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!"); - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); + CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), (yyvsp[(3) - (5)].Linkage), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal)); CHECK_FOR_ERROR ;} break; case 182: -#line 1702 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1702 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ;} break; case 183: -#line 1705 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1705 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::ExternalLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); CHECK_FOR_ERROR - delete (yyvsp[0].TypeVal); + delete (yyvsp[(5) - (5)].TypeVal); ;} break; case 184: -#line 1709 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1709 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4125,16 +4346,16 @@ yyreduce: break; case 185: -#line 1713 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1713 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); CHECK_FOR_ERROR - delete (yyvsp[0].TypeVal); + delete (yyvsp[(5) - (5)].TypeVal); ;} break; case 186: -#line 1717 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1717 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4142,17 +4363,17 @@ yyreduce: break; case 187: -#line 1721 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1721 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CurGV = - ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); CHECK_FOR_ERROR - delete (yyvsp[0].TypeVal); + delete (yyvsp[(5) - (5)].TypeVal); ;} break; case 188: -#line 1726 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1726 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4160,32 +4381,32 @@ yyreduce: break; case 189: -#line 1730 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1730 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 190: -#line 1733 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1733 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 191: -#line 1736 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1736 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { ;} break; case 192: -#line 1740 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1740 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); - char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); - std::string NewAsm((yyvsp[0].StrVal), EndStr); - free((yyvsp[0].StrVal)); + char *EndStr = UnEscapeLexed((yyvsp[(1) - (1)].StrVal), true); + std::string NewAsm((yyvsp[(1) - (1)].StrVal), EndStr); + free((yyvsp[(1) - (1)].StrVal)); if (AsmSoFar.empty()) CurModule.CurrentModule->setModuleInlineAsm(NewAsm); @@ -4196,124 +4417,124 @@ yyreduce: break; case 193: -#line 1753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1753 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::BigEndian; ;} break; case 194: -#line 1754 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1754 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::LittleEndian; ;} break; case 195: -#line 1756 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1756 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); + CurModule.CurrentModule->setEndianness((yyvsp[(3) - (3)].Endianness)); CHECK_FOR_ERROR ;} break; case 196: -#line 1760 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1760 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[0].UInt64Val) == 32) + if ((yyvsp[(3) - (3)].UInt64Val) == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); - else if ((yyvsp[0].UInt64Val) == 64) + else if ((yyvsp[(3) - (3)].UInt64Val) == 64) CurModule.CurrentModule->setPointerSize(Module::Pointer64); else - GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!"); + GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[(3) - (3)].UInt64Val)) + "'!"); CHECK_FOR_ERROR ;} break; case 197: -#line 1769 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1769 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + CurModule.CurrentModule->setTargetTriple((yyvsp[(3) - (3)].StrVal)); + free((yyvsp[(3) - (3)].StrVal)); ;} break; case 198: -#line 1773 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1773 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + CurModule.CurrentModule->setDataLayout((yyvsp[(3) - (3)].StrVal)); + free((yyvsp[(3) - (3)].StrVal)); ;} break; case 200: -#line 1780 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1780 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + CurModule.CurrentModule->addLibrary((yyvsp[(3) - (3)].StrVal)); + free((yyvsp[(3) - (3)].StrVal)); CHECK_FOR_ERROR ;} break; case 201: -#line 1785 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1785 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + CurModule.CurrentModule->addLibrary((yyvsp[(1) - (1)].StrVal)); + free((yyvsp[(1) - (1)].StrVal)); CHECK_FOR_ERROR ;} break; case 202: -#line 1790 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1790 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 206: -#line 1800 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1800 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 207: -#line 1802 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1802 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (*(yyvsp[-1].TypeVal) == Type::VoidTy) + if (*(yyvsp[(1) - (2)].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); - (yyval.ArgVal) = new std::pair((yyvsp[-1].TypeVal), (yyvsp[0].StrVal)); + (yyval.ArgVal) = new std::pair((yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].StrVal)); CHECK_FOR_ERROR ;} break; case 208: -#line 1809 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1809 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ArgList) = (yyvsp[-2].ArgList); - (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); - delete (yyvsp[0].ArgVal); + (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); + (yyvsp[(1) - (3)].ArgList)->push_back(*(yyvsp[(3) - (3)].ArgVal)); + delete (yyvsp[(3) - (3)].ArgVal); CHECK_FOR_ERROR ;} break; case 209: -#line 1815 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1815 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new std::vector >(); - (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); - delete (yyvsp[0].ArgVal); + (yyval.ArgList)->push_back(*(yyvsp[(1) - (1)].ArgVal)); + delete (yyvsp[(1) - (1)].ArgVal); CHECK_FOR_ERROR ;} break; case 210: -#line 1822 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1822 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ArgList) = (yyvsp[0].ArgList); + (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); CHECK_FOR_ERROR ;} break; case 211: -#line 1826 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1826 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ArgList) = (yyvsp[-2].ArgList); + (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); (yyval.ArgList)->push_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); CHECK_FOR_ERROR @@ -4321,7 +4542,7 @@ yyreduce: break; case 212: -#line 1832 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1832 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new std::vector >(); (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); @@ -4330,7 +4551,7 @@ yyreduce: break; case 213: -#line 1837 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1837 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -4338,28 +4559,28 @@ yyreduce: break; case 214: -#line 1843 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1843 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - UnEscapeLexed((yyvsp[-5].StrVal)); - std::string FunctionName((yyvsp[-5].StrVal)); - free((yyvsp[-5].StrVal)); // Free strdup'd memory! + UnEscapeLexed((yyvsp[(3) - (8)].StrVal)); + std::string FunctionName((yyvsp[(3) - (8)].StrVal)); + free((yyvsp[(3) - (8)].StrVal)); // Free strdup'd memory! - if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy) + if (!(*(yyvsp[(2) - (8)].TypeVal))->isFirstClassType() && *(yyvsp[(2) - (8)].TypeVal) != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); std::vector ParamTypeList; - if ((yyvsp[-3].ArgList)) { // If there are arguments... - for (std::vector >::iterator I = (yyvsp[-3].ArgList)->begin(); - I != (yyvsp[-3].ArgList)->end(); ++I) + if ((yyvsp[(5) - (8)].ArgList)) { // If there are arguments... + for (std::vector >::iterator I = (yyvsp[(5) - (8)].ArgList)->begin(); + I != (yyvsp[(5) - (8)].ArgList)->end(); ++I) ParamTypeList.push_back(I->first->get()); } bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; if (isVarArg) ParamTypeList.pop_back(); - const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg); + const FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (8)].TypeVal), ParamTypeList, isVarArg); const PointerType *PFT = PointerType::get(FT); - delete (yyvsp[-6].TypeVal); + delete (yyvsp[(2) - (8)].TypeVal); ValID ID; if (!FunctionName.empty()) { @@ -4403,24 +4624,24 @@ yyreduce: // another function. Fn->setLinkage(CurFun.Linkage); } - Fn->setCallingConv((yyvsp[-7].UIntVal)); - Fn->setAlignment((yyvsp[0].UIntVal)); - if ((yyvsp[-1].StrVal)) { - Fn->setSection((yyvsp[-1].StrVal)); - free((yyvsp[-1].StrVal)); + Fn->setCallingConv((yyvsp[(1) - (8)].UIntVal)); + Fn->setAlignment((yyvsp[(8) - (8)].UIntVal)); + if ((yyvsp[(7) - (8)].StrVal)) { + Fn->setSection((yyvsp[(7) - (8)].StrVal)); + free((yyvsp[(7) - (8)].StrVal)); } // Add all of the arguments we parsed to the function... - if ((yyvsp[-3].ArgList)) { // Is null if empty... + if ((yyvsp[(5) - (8)].ArgList)) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&& + assert((yyvsp[(5) - (8)].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[(5) - (8)].ArgList)->back().second == 0&& "Not a varargs marker!"); - delete (yyvsp[-3].ArgList)->back().first; - (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry + delete (yyvsp[(5) - (8)].ArgList)->back().first; + (yyvsp[(5) - (8)].ArgList)->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); - for (std::vector >::iterator I = (yyvsp[-3].ArgList)->begin(); - I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) { + for (std::vector >::iterator I = (yyvsp[(5) - (8)].ArgList)->begin(); + I != (yyvsp[(5) - (8)].ArgList)->end(); ++I, ++ArgIt) { delete I->first; // Delete the typeholder... setValueName(ArgIt, I->second); // Insert arg into symtab... @@ -4428,48 +4649,48 @@ yyreduce: InsertValue(ArgIt); } - delete (yyvsp[-3].ArgList); // We're now done with the argument list + delete (yyvsp[(5) - (8)].ArgList); // We're now done with the argument list } CHECK_FOR_ERROR ;} break; case 217: -#line 1939 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1939 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; // Make sure that we keep track of the linkage type even if there was a // previous "declare". - (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); + (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (3)].Linkage)); ;} break; case 220: -#line 1949 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1949 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; case 222: -#line 1955 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1955 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} break; case 223: -#line 1956 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1956 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;} break; case 224: -#line 1958 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1958 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 225: -#line 1958 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1958 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); @@ -4478,7 +4699,7 @@ yyreduce: break; case 226: -#line 1968 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1968 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4486,7 +4707,7 @@ yyreduce: break; case 227: -#line 1972 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1972 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4494,31 +4715,31 @@ yyreduce: break; case 228: -#line 1977 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1977 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant - (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); CHECK_FOR_ERROR ;} break; case 229: -#line 1981 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1981 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); CHECK_FOR_ERROR ;} break; case 230: -#line 1985 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1985 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? - (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); CHECK_FOR_ERROR ;} break; case 231: -#line 1989 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1989 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR @@ -4526,7 +4747,7 @@ yyreduce: break; case 232: -#line 1993 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1993 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR @@ -4534,7 +4755,7 @@ yyreduce: break; case 233: -#line 1997 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 1997 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -4542,7 +4763,7 @@ yyreduce: break; case 234: -#line 2001 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2001 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -4550,7 +4771,7 @@ yyreduce: break; case 235: -#line 2005 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2005 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -4558,10 +4779,10 @@ yyreduce: break; case 236: -#line 2009 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2009 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector - const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); - int NumElements = (yyvsp[-1].ConstVector)->size(); + const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); + int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); PackedType* pt = PackedType::get(ETy, NumElements); PATypeHolder* PTy = new PATypeHolder( @@ -4573,110 +4794,110 @@ yyreduce: ); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) + for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '" + - (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); + (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); } - (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); - delete PTy; delete (yyvsp[-1].ConstVector); + (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[(2) - (3)].ConstVector))); + delete PTy; delete (yyvsp[(2) - (3)].ConstVector); CHECK_FOR_ERROR ;} break; case 237: -#line 2034 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2034 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); CHECK_FOR_ERROR ;} break; case 238: -#line 2038 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2038 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); - std::string AsmStr = std::string((yyvsp[-2].StrVal), End); - End = UnEscapeLexed((yyvsp[0].StrVal), true); - std::string Constraints = std::string((yyvsp[0].StrVal), End); - (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); - free((yyvsp[-2].StrVal)); - free((yyvsp[0].StrVal)); + char *End = UnEscapeLexed((yyvsp[(3) - (5)].StrVal), true); + std::string AsmStr = std::string((yyvsp[(3) - (5)].StrVal), End); + End = UnEscapeLexed((yyvsp[(5) - (5)].StrVal), true); + std::string Constraints = std::string((yyvsp[(5) - (5)].StrVal), End); + (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[(2) - (5)].BoolVal)); + free((yyvsp[(3) - (5)].StrVal)); + free((yyvsp[(5) - (5)].StrVal)); CHECK_FOR_ERROR ;} break; case 239: -#line 2052 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2052 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SIntVal)); CHECK_FOR_ERROR ;} break; case 240: -#line 2056 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2056 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); + (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].StrVal)); CHECK_FOR_ERROR ;} break; case 243: -#line 2068 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2068 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); + (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); delete (yyvsp[(1) - (2)].TypeVal); CHECK_FOR_ERROR ;} break; case 244: -#line 2073 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2073 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; case 245: -#line 2077 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2077 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); CHECK_FOR_ERROR ;} break; case 246: -#line 2086 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2086 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); + setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); CHECK_FOR_ERROR - InsertValue((yyvsp[0].TermInstVal)); + InsertValue((yyvsp[(3) - (3)].TermInstVal)); - (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); - InsertValue((yyvsp[-2].BasicBlockVal)); - (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); + (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); + InsertValue((yyvsp[(1) - (3)].BasicBlockVal)); + (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); CHECK_FOR_ERROR ;} break; case 247: -#line 2097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2097 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (CastInst *CI1 = dyn_cast((yyvsp[0].InstVal))) + if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal))) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) if (CI2->getParent() == 0) - (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); - (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); - (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); + (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); + (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); + (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); CHECK_FOR_ERROR ;} break; case 248: -#line 2106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2106 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); CHECK_FOR_ERROR @@ -4692,9 +4913,9 @@ yyreduce: break; case 249: -#line 2118 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2118 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true); + (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[(1) - (1)].StrVal)), true); CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the @@ -4708,15 +4929,15 @@ yyreduce: break; case 250: -#line 2131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2131 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Return with a result... - (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); + (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal)); CHECK_FOR_ERROR ;} break; case 251: -#line 2135 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2135 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR @@ -4724,56 +4945,56 @@ yyreduce: break; case 252: -#line 2139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2139 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... - BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); + BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); CHECK_FOR_ERROR (yyval.TermInstVal) = new BranchInst(tmpBB); ;} break; case 253: -#line 2144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2144 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); + BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); + BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)); + Value* tmpVal = getVal(Type::BoolTy, (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); ;} break; case 254: -#line 2153 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2153 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); + Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); + BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); CHECK_FOR_ERROR - SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); (yyval.TermInstVal) = S; - std::vector >::iterator I = (yyvsp[-1].JumpTable)->begin(), - E = (yyvsp[-1].JumpTable)->end(); + std::vector >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), + E = (yyvsp[(8) - (9)].JumpTable)->end(); for (; I != E; ++I) { if (ConstantInt *CI = dyn_cast(I->first)) S->addCase(CI, I->second); else GEN_ERROR("Switch case is constant, but not a simple integer!"); } - delete (yyvsp[-1].JumpTable); + delete (yyvsp[(8) - (9)].JumpTable); CHECK_FOR_ERROR ;} break; case 255: -#line 2172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2172 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); + Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); + BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); CHECK_FOR_ERROR SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); (yyval.TermInstVal) = S; @@ -4782,17 +5003,17 @@ yyreduce: break; case 256: -#line 2182 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2182 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; - if (!(PFTy = dyn_cast((yyvsp[-10].TypeVal)->get())) || + if (!(PFTy = dyn_cast((yyvsp[(3) - (13)].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - if ((yyvsp[-7].ValueList)) { - for (std::vector::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end(); + if ((yyvsp[(6) - (13)].ValueList)) { + for (std::vector::iterator I = (yyvsp[(6) - (13)].ValueList)->begin(), E = (yyvsp[(6) - (13)].ValueList)->end(); I != E; ++I) ParamTypes.push_back((*I)->getType()); } @@ -4800,19 +5021,19 @@ yyreduce: bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg); + Ty = FunctionType::get((yyvsp[(3) - (13)].TypeVal)->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } - Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[(4) - (13)].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR - BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); + BasicBlock *Normal = getBBVal((yyvsp[(10) - (13)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); + BasicBlock *Except = getBBVal((yyvsp[(13) - (13)].ValIDVal)); CHECK_FOR_ERROR // Create the call node... - if (!(yyvsp[-7].ValueList)) { // Has no arguments? + if (!(yyvsp[(6) - (13)].ValueList)) { // Has no arguments? (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector()); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified @@ -4820,7 +5041,7 @@ yyreduce: // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end(); + std::vector::iterator ArgI = (yyvsp[(6) - (13)].ValueList)->begin(), ArgE = (yyvsp[(6) - (13)].ValueList)->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -4830,18 +5051,18 @@ yyreduce: if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList)); + (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[(6) - (13)].ValueList)); } - cast((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal)); + cast((yyval.TermInstVal))->setCallingConv((yyvsp[(2) - (13)].UIntVal)); - delete (yyvsp[-10].TypeVal); - delete (yyvsp[-7].ValueList); + delete (yyvsp[(3) - (13)].TypeVal); + delete (yyvsp[(6) - (13)].ValueList); CHECK_FOR_ERROR ;} break; case 257: -#line 2237 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2237 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -4849,7 +5070,7 @@ yyreduce: break; case 258: -#line 2241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2241 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -4857,97 +5078,97 @@ yyreduce: break; case 259: -#line 2248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2248 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.JumpTable) = (yyvsp[-5].JumpTable); - Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); + (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); + Constant *V = cast(getValNonImprovising((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); + BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); CHECK_FOR_ERROR (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); ;} break; case 260: -#line 2259 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2259 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); - Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); + Constant *V = cast(getValNonImprovising((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); + BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); CHECK_FOR_ERROR (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); ;} break; case 261: -#line 2272 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2272 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... - setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); + setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); CHECK_FOR_ERROR - InsertValue((yyvsp[0].InstVal)); - (yyval.InstVal) = (yyvsp[0].InstVal); + InsertValue((yyvsp[(2) - (2)].InstVal)); + (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); CHECK_FOR_ERROR ;} break; case 262: -#line 2281 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2281 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes (yyval.PHIList) = new std::list >(); - Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); + Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); + BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); CHECK_FOR_ERROR (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); - delete (yyvsp[-5].TypeVal); + delete (yyvsp[(1) - (6)].TypeVal); ;} break; case 263: -#line 2290 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2290 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.PHIList) = (yyvsp[-6].PHIList); - Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); + (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); + Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); + BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); CHECK_FOR_ERROR - (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); + (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); ;} break; case 264: -#line 2300 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2300 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { // Used for call statements, and memory insts... (yyval.ValueList) = new std::vector(); - (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); + (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); ;} break; case 265: -#line 2304 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2304 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValueList) = (yyvsp[-2].ValueList); - (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); + (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); + (yyvsp[(1) - (3)].ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); CHECK_FOR_ERROR ;} break; case 267: -#line 2311 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2311 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = 0; ;} break; case 268: -#line 2313 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2313 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4955,7 +5176,7 @@ yyreduce: break; case 269: -#line 2317 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2317 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4963,106 +5184,106 @@ yyreduce: break; case 270: -#line 2322 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2322 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && - !isa((*(yyvsp[-3].TypeVal)).get())) + if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && + !isa((*(yyvsp[(2) - (5)].TypeVal)).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*(yyvsp[-3].TypeVal)).get()) && - ((yyvsp[-4].BinaryOpVal) == Instruction::URem || - (yyvsp[-4].BinaryOpVal) == Instruction::SRem || - (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) + if (isa((*(yyvsp[(2) - (5)].TypeVal)).get()) && + ((yyvsp[(1) - (5)].BinaryOpVal) == Instruction::URem || + (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::SRem || + (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::FRem)) GEN_ERROR("U/S/FRem not supported on packed types!"); - Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); CHECK_FOR_ERROR - Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); + (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); + delete (yyvsp[(2) - (5)].TypeVal); ;} break; case 271: -#line 2341 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2341 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { - if (!isa((yyvsp[-3].TypeVal)->get()) || - !cast((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral()) + if (!(*(yyvsp[(2) - (5)].TypeVal))->isIntegral()) { + if (!isa((yyvsp[(2) - (5)].TypeVal)->get()) || + !cast((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); + (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); + delete (yyvsp[(2) - (5)].TypeVal); ;} break; case 272: -#line 2356 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2356 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if(isa((*(yyvsp[-3].TypeVal)).get())) { + if(isa((*(yyvsp[(2) - (5)].TypeVal)).get())) { GEN_ERROR( "PackedTypes currently not supported in setcc instructions!"); } - Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); + (yyval.InstVal) = new SetCondInst((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); + delete (yyvsp[(2) - (5)].TypeVal); ;} break; case 273: -#line 2370 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2370 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (isa((*(yyvsp[-3].TypeVal)).get())) + if (isa((*(yyvsp[(3) - (6)].TypeVal)).get())) GEN_ERROR("Packed types not supported by icmp instruction"); - Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); + (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2); if ((yyval.InstVal) == 0) GEN_ERROR("icmp operator returned null!"); ;} break; case 274: -#line 2381 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2381 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (isa((*(yyvsp[-3].TypeVal)).get())) + if (isa((*(yyvsp[(3) - (6)].TypeVal)).get())) GEN_ERROR("Packed types not supported by fcmp instruction"); - Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); + (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2); if ((yyval.InstVal) == 0) GEN_ERROR("fcmp operator returned null!"); ;} break; case 275: -#line 2392 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2392 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - llvm_cerr << "WARNING: Use of eliminated 'not' instruction:" - << " Replacing with 'xor'.\n"; + cerr << "WARNING: Use of eliminated 'not' instruction:" + << " Replacing with 'xor'.\n"; - Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType()); + Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[(2) - (2)].ValueVal)->getType()); if (Ones == 0) GEN_ERROR("Expected integral type for not instruction!"); - (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones); + (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[(2) - (2)].ValueVal), Ones); if ((yyval.InstVal) == 0) GEN_ERROR("Could not create a xor instruction!"); CHECK_FOR_ERROR @@ -5070,115 +5291,115 @@ yyreduce: break; case 276: -#line 2405 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2405 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) + if ((yyvsp[(4) - (4)].ValueVal)->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); - if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) + if (!(yyvsp[(2) - (4)].ValueVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); CHECK_FOR_ERROR; - (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + (yyval.InstVal) = new ShiftInst((yyvsp[(1) - (4)].OtherOpVal), (yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); CHECK_FOR_ERROR ;} break; case 277: -#line 2414 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2414 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - Value* Val = (yyvsp[-2].ValueVal); - const Type* Ty = (yyvsp[0].TypeVal)->get(); + Value* Val = (yyvsp[(2) - (4)].ValueVal); + const Type* Ty = (yyvsp[(4) - (4)].TypeVal)->get(); if (!Val->getType()->isFirstClassType()) GEN_ERROR("cast from a non-primitive type: '" + Val->getType()->getDescription() + "'!"); if (!Ty->isFirstClassType()) GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!"); - (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get()); - delete (yyvsp[0].TypeVal); + (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), (yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].TypeVal)->get()); + delete (yyvsp[(4) - (4)].TypeVal); ;} break; case 278: -#line 2425 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2425 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) + if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); - if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) + if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) GEN_ERROR("select value types should match!"); - (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); CHECK_FOR_ERROR ;} break; case 279: -#line 2433 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2433 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); - delete (yyvsp[0].TypeVal); + (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); + delete (yyvsp[(4) - (4)].TypeVal); CHECK_FOR_ERROR ;} break; case 280: -#line 2438 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2438 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) GEN_ERROR("Invalid extractelement operands!"); - (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); CHECK_FOR_ERROR ;} break; case 281: -#line 2444 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2444 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid insertelement operands!"); - (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); CHECK_FOR_ERROR ;} break; case 282: -#line 2450 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2450 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) GEN_ERROR("Invalid shufflevector operands!"); - (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); CHECK_FOR_ERROR ;} break; case 283: -#line 2456 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2456 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); + const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) GEN_ERROR("PHI node operands must be of first class type!"); (yyval.InstVal) = new PHINode(Ty); - ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); - while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { - if ((yyvsp[0].PHIList)->front().first->getType() != Ty) + ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); + while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { + if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) GEN_ERROR("All elements of a PHI node must be of the same type!"); - cast((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); - (yyvsp[0].PHIList)->pop_front(); + cast((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); + (yyvsp[(2) - (2)].PHIList)->pop_front(); } - delete (yyvsp[0].PHIList); // Free the list... + delete (yyvsp[(2) - (2)].PHIList); // Free the list... CHECK_FOR_ERROR ;} break; case 284: -#line 2471 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2471 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy = 0; const FunctionType *Ty = 0; - if (!(PFTy = dyn_cast((yyvsp[-4].TypeVal)->get())) || + if (!(PFTy = dyn_cast((yyvsp[(3) - (7)].TypeVal)->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - if ((yyvsp[-1].ValueList)) { - for (std::vector::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end(); + if ((yyvsp[(6) - (7)].ValueList)) { + for (std::vector::iterator I = (yyvsp[(6) - (7)].ValueList)->begin(), E = (yyvsp[(6) - (7)].ValueList)->end(); I != E; ++I) ParamTypes.push_back((*I)->getType()); } @@ -5186,18 +5407,18 @@ yyreduce: bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy) + if (!(*(yyvsp[(3) - (7)].TypeVal))->isFirstClassType() && *(yyvsp[(3) - (7)].TypeVal) != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); - Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg); + Ty = FunctionType::get((yyvsp[(3) - (7)].TypeVal)->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } - Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[(4) - (7)].ValIDVal)); // Get the function we're calling... CHECK_FOR_ERROR // Create the call node... - if (!(yyvsp[-1].ValueList)) { // Has no arguments? + if (!(yyvsp[(6) - (7)].ValueList)) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -5210,7 +5431,7 @@ yyreduce: // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end(); + std::vector::iterator ArgI = (yyvsp[(6) - (7)].ValueList)->begin(), ArgE = (yyvsp[(6) - (7)].ValueList)->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -5220,34 +5441,34 @@ yyreduce: if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList)); + (yyval.InstVal) = new CallInst(V, *(yyvsp[(6) - (7)].ValueList)); } - cast((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal)); - cast((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal)); - delete (yyvsp[-4].TypeVal); - delete (yyvsp[-1].ValueList); + cast((yyval.InstVal))->setTailCall((yyvsp[(1) - (7)].BoolVal)); + cast((yyval.InstVal))->setCallingConv((yyvsp[(2) - (7)].UIntVal)); + delete (yyvsp[(3) - (7)].TypeVal); + delete (yyvsp[(6) - (7)].ValueList); CHECK_FOR_ERROR ;} break; case 285: -#line 2530 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2530 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = (yyvsp[0].InstVal); + (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); CHECK_FOR_ERROR ;} break; case 286: -#line 2537 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2537 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValueList) = (yyvsp[0].ValueList); + (yyval.ValueList) = (yyvsp[(2) - (2)].ValueList); CHECK_FOR_ERROR ;} break; case 287: -#line 2540 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2540 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR @@ -5255,7 +5476,7 @@ yyreduce: break; case 288: -#line 2545 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2545 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5263,7 +5484,7 @@ yyreduce: break; case 289: -#line 2549 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2549 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5271,117 +5492,115 @@ yyreduce: break; case 290: -#line 2556 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2556 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); - delete (yyvsp[-1].TypeVal); + (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); + delete (yyvsp[(2) - (3)].TypeVal); CHECK_FOR_ERROR ;} break; case 291: -#line 2561 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2561 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); - delete (yyvsp[-4].TypeVal); + (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); + delete (yyvsp[(2) - (6)].TypeVal); ;} break; case 292: -#line 2567 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2567 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); - delete (yyvsp[-1].TypeVal); + (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); + delete (yyvsp[(2) - (3)].TypeVal); CHECK_FOR_ERROR ;} break; case 293: -#line 2572 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2572 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); - delete (yyvsp[-4].TypeVal); + (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); + delete (yyvsp[(2) - (6)].TypeVal); ;} break; case 294: -#line 2578 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2578 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!isa((yyvsp[0].ValueVal)->getType())) + if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + - (yyvsp[0].ValueVal)->getType()->getDescription() + "!"); - (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); + (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "!"); + (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); CHECK_FOR_ERROR ;} break; case 295: -#line 2586 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2586 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!isa((yyvsp[-1].TypeVal)->get())) + if (!isa((yyvsp[(3) - (4)].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + - (*(yyvsp[-1].TypeVal))->getDescription()); - if (!cast((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) + (*(yyvsp[(3) - (4)].TypeVal))->getDescription()); + if (!cast((yyvsp[(3) - (4)].TypeVal)->get())->getElementType()->isFirstClassType()) GEN_ERROR("Can't load from pointer of non-first-class type: " + - (*(yyvsp[-1].TypeVal))->getDescription()); - Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); + (*(yyvsp[(3) - (4)].TypeVal))->getDescription()); + Value* tmpVal = getVal(*(yyvsp[(3) - (4)].TypeVal), (yyvsp[(4) - (4)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); - delete (yyvsp[-1].TypeVal); + (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (4)].BoolVal)); + delete (yyvsp[(3) - (4)].TypeVal); ;} break; case 296: -#line 2598 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2598 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); + const PointerType *PT = dyn_cast((yyvsp[(5) - (6)].TypeVal)->get()); if (!PT) GEN_ERROR("Can't store to a nonpointer type: " + - (*(yyvsp[-1].TypeVal))->getDescription()); + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); const Type *ElTy = PT->getElementType(); - if (ElTy != (yyvsp[-3].ValueVal)->getType()) - GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + + if (ElTy != (yyvsp[(3) - (6)].ValueVal)->getType()) + GEN_ERROR("Can't store '" + (yyvsp[(3) - (6)].ValueVal)->getType()->getDescription() + "' into space of type '" + ElTy->getDescription() + "'!"); - Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); + Value* tmpVal = getVal(*(yyvsp[(5) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); - delete (yyvsp[-1].TypeVal); + (yyval.InstVal) = new StoreInst((yyvsp[(3) - (6)].ValueVal), tmpVal, (yyvsp[(1) - (6)].BoolVal)); + delete (yyvsp[(5) - (6)].TypeVal); ;} break; case 297: -#line 2613 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2613 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" { - if (!isa((yyvsp[-2].TypeVal)->get())) + if (!isa((yyvsp[(2) - (4)].TypeVal)->get())) GEN_ERROR("getelementptr insn requires pointer operand!"); - if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) + if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), *(yyvsp[(4) - (4)].ValueList), true)) GEN_ERROR("Invalid getelementptr indices for type '" + - (*(yyvsp[-2].TypeVal))->getDescription()+ "'!"); - Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'!"); + Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); CHECK_FOR_ERROR - (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); - delete (yyvsp[-2].TypeVal); - delete (yyvsp[0].ValueList); + (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[(4) - (4)].ValueList)); + delete (yyvsp[(2) - (4)].TypeVal); + delete (yyvsp[(4) - (4)].ValueList); ;} break; +/* Line 1267 of yacc.c. */ +#line 5598 "llvmAsmParser.tab.c" default: break; } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); -/* Line 1126 of yacc.c. */ -#line 5380 "llvmAsmParser.tab.c" - - yyvsp -= yylen; - yyssp -= yylen; - - + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; @@ -5410,110 +5629,41 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - char *yymsg = 0; -# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; } + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - - if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yymsg; - int yyi = 0; - while ((*yyp = *yyf)) - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - { - yyerror (YY_("syntax error")); + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) goto yyexhaustedlab; - } - } - else -#endif /* YYERROR_VERBOSE */ - yyerror (YY_("syntax error")); + } + } +#endif } @@ -5524,14 +5674,15 @@ yyerrlab: error, discard it. */ if (yychar <= YYEOF) - { + { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; - } + } else { - yydestruct ("Error: discarding", yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval); yychar = YYEMPTY; } } @@ -5549,11 +5700,14 @@ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ - if (0) + if (/*CONSTCOND*/ 0) goto yyerrorlab; -yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -5583,8 +5737,9 @@ yyerrlab1: YYABORT; - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } @@ -5595,7 +5750,7 @@ yyerrlab1: *++yyvsp = yylval; - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; @@ -5630,21 +5785,30 @@ yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); - YYPOPSTACK; + YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 2628 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" +#line 2628 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { diff --git a/lib/AsmParser/llvmAsmParser.h.cvs b/lib/AsmParser/llvmAsmParser.h.cvs index 4661132712..5e539625f3 100644 --- a/lib/AsmParser/llvmAsmParser.h.cvs +++ b/lib/AsmParser/llvmAsmParser.h.cvs @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 2.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,10 +20,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -320,9 +330,10 @@ -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 855 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y" -typedef union YYSTYPE { +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 855 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" +{ llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -363,9 +374,10 @@ typedef union YYSTYPE { llvm::Module::Endianness Endianness; llvm::ICmpInst::Predicate IPredicate; llvm::FCmpInst::Predicate FPredicate; -} YYSTYPE; -/* Line 1447 of yacc.c. */ -#line 369 "llvmAsmParser.tab.h" +} +/* Line 1529 of yacc.c. */ +#line 380 "llvmAsmParser.tab.h" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -373,5 +385,3 @@ typedef union YYSTYPE { extern YYSTYPE llvmAsmlval; - - diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 31306c2744..15524baf86 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -57,7 +57,7 @@ static Module *ParserResult; // //#define DEBUG_UPREFS 1 #ifdef DEBUG_UPREFS -#define UR_OUT(X) llvm_cerr << X +#define UR_OUT(X) cerr << X #else #define UR_OUT(X) #endif @@ -2390,8 +2390,8 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { GEN_ERROR("fcmp operator returned null!"); } | NOT ResolvedVal { - llvm_cerr << "WARNING: Use of eliminated 'not' instruction:" - << " Replacing with 'xor'.\n"; + cerr << "WARNING: Use of eliminated 'not' instruction:" + << " Replacing with 'xor'.\n"; Value *Ones = ConstantIntegral::getAllOnesValue($2->getType()); if (Ones == 0) diff --git a/lib/AsmParser/llvmAsmParser.y.cvs b/lib/AsmParser/llvmAsmParser.y.cvs index 31306c2744..15524baf86 100644 --- a/lib/AsmParser/llvmAsmParser.y.cvs +++ b/lib/AsmParser/llvmAsmParser.y.cvs @@ -57,7 +57,7 @@ static Module *ParserResult; // //#define DEBUG_UPREFS 1 #ifdef DEBUG_UPREFS -#define UR_OUT(X) llvm_cerr << X +#define UR_OUT(X) cerr << X #else #define UR_OUT(X) #endif @@ -2390,8 +2390,8 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { GEN_ERROR("fcmp operator returned null!"); } | NOT ResolvedVal { - llvm_cerr << "WARNING: Use of eliminated 'not' instruction:" - << " Replacing with 'xor'.\n"; + cerr << "WARNING: Use of eliminated 'not' instruction:" + << " Replacing with 'xor'.\n"; Value *Ones = ConstantIntegral::getAllOnesValue($2->getType()); if (Ones == 0) diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index efb6c436cd..9e096ee6eb 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -32,7 +32,7 @@ using namespace llvm; #if 0 #include "llvm/Support/Streams.h" -#define SC_DEBUG(X) llvm_cerr << X +#define SC_DEBUG(X) cerr << X #else #define SC_DEBUG(X) #endif diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index 37c6321e33..b69c1ad8b3 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -276,8 +276,8 @@ void BytecodeWriter::outputType(const Type *T) { break; default: - llvm_cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize" - << " Type '" << T->getDescription() << "'\n"; + cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize" + << " Type '" << T->getDescription() << "'\n"; break; } } @@ -387,8 +387,8 @@ void BytecodeWriter::outputConstant(const Constant *CPV) { case Type::VoidTyID: case Type::LabelTyID: default: - llvm_cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize" - << " type '" << *CPV->getType() << "'\n"; + cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to serialize" + << " type '" << *CPV->getType() << "'\n"; break; } return; @@ -1239,13 +1239,13 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { } } -void llvm::WriteBytecodeToFile(const Module *M, llvm_ostream &Out, +void llvm::WriteBytecodeToFile(const Module *M, OStream &Out, bool compress) { assert(M && "You can't write a null module!!"); // Make sure that std::cout is put into binary mode for systems // that care. - if (Out == llvm_cout) + if (Out == cout) sys::Program::ChangeStdoutToBinary(); // Create a vector of unsigned char for the bytecode output. We diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 1b25b015fa..4caa2c1be1 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -25,7 +25,6 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" -#include #include using namespace llvm; @@ -668,8 +667,8 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) { if (LastMI != MI) { ++Counter; LastMI = MI; } O << Counter; } else { - llvm_cerr << "Unknown special formatter '" << Code - << "' for machine instr: " << *MI; + cerr << "Unknown special formatter '" << Code + << "' for machine instr: " << *MI; exit(1); } } @@ -737,8 +736,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { case '(': // $( -> same as GCC's { character. ++LastEmitted; // Consume '(' character. if (CurVariant != -1) { - llvm_cerr << "Nested variants found in inline asm string: '" - << AsmStr << "'\n"; + cerr << "Nested variants found in inline asm string: '" + << AsmStr << "'\n"; exit(1); } CurVariant = 0; // We're in the first variant now. @@ -746,8 +745,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { case '|': ++LastEmitted; // consume '|' character. if (CurVariant == -1) { - llvm_cerr << "Found '|' character outside of variant in inline asm " - << "string: '" << AsmStr << "'\n"; + cerr << "Found '|' character outside of variant in inline asm " + << "string: '" << AsmStr << "'\n"; exit(1); } ++CurVariant; // We're in the next variant. @@ -755,8 +754,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { case ')': // $) -> same as GCC's } char. ++LastEmitted; // consume ')' character. if (CurVariant == -1) { - llvm_cerr << "Found '}' character outside of variant in inline asm " - << "string: '" << AsmStr << "'\n"; + cerr << "Found '}' character outside of variant in inline asm " + << "string: '" << AsmStr << "'\n"; exit(1); } CurVariant = -1; @@ -774,8 +773,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { char *IDEnd; long Val = strtol(IDStart, &IDEnd, 10); // We only accept numbers for IDs. if (!isdigit(*IDStart) || (Val == 0 && errno == EINVAL)) { - llvm_cerr << "Bad $ operand number in inline asm string: '" - << AsmStr << "'\n"; + cerr << "Bad $ operand number in inline asm string: '" + << AsmStr << "'\n"; exit(1); } LastEmitted = IDEnd; @@ -788,8 +787,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { if (*LastEmitted == ':') { ++LastEmitted; // Consume ':' character. if (*LastEmitted == 0) { - llvm_cerr << "Bad ${:} expression in inline asm string: '" - << AsmStr << "'\n"; + cerr << "Bad ${:} expression in inline asm string: '" + << AsmStr << "'\n"; exit(1); } @@ -798,16 +797,16 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { } if (*LastEmitted != '}') { - llvm_cerr << "Bad ${} expression in inline asm string: '" - << AsmStr << "'\n"; + cerr << "Bad ${} expression in inline asm string: '" + << AsmStr << "'\n"; exit(1); } ++LastEmitted; // Consume '}' character. } if ((unsigned)Val >= NumOperands-1) { - llvm_cerr << "Invalid $ operand number in inline asm string: '" - << AsmStr << "'\n"; + cerr << "Invalid $ operand number in inline asm string: '" + << AsmStr << "'\n"; exit(1); } @@ -841,8 +840,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { } } if (Error) { - llvm_cerr << "Invalid operand found in inline asm: '" - << AsmStr << "'\n"; + cerr << "Invalid operand found in inline asm: '" + << AsmStr << "'\n"; MI->dump(); exit(1); } diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index ac6987b0f0..8f62396218 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -31,10 +31,8 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetFrameInfo.h" - #include #include - using namespace llvm; using namespace llvm::dwarf; @@ -139,7 +137,7 @@ public: } #ifndef NDEBUG - void print(llvm_ostream &O) const { + void print(OStream &O) const { if (O.stream()) print(*O.stream()); } void print(std::ostream &O) const { @@ -247,7 +245,7 @@ public: void Emit(const Dwarf &DW) const; #ifndef NDEBUG - void print(llvm_ostream &O) { + void print(OStream &O) { if (O.stream()) print(*O.stream()); } void print(std::ostream &O); @@ -337,7 +335,7 @@ public: void Profile(FoldingSetNodeID &ID) ; #ifndef NDEBUG - void print(llvm_ostream &O, unsigned IncIndent = 0) { + void print(OStream &O, unsigned IncIndent = 0) { if (O.stream()) print(*O.stream(), IncIndent); } void print(std::ostream &O, unsigned IncIndent = 0); @@ -388,7 +386,7 @@ public: virtual void Profile(FoldingSetNodeID &ID) = 0; #ifndef NDEBUG - void print(llvm_ostream &O) { + void print(OStream &O) { if (O.stream()) print(*O.stream()); } virtual void print(std::ostream &O) = 0; @@ -2861,14 +2859,14 @@ void DIEAbbrev::print(std::ostream &O) { << "\n"; } } -void DIEAbbrev::dump() { print(llvm_cerr); } +void DIEAbbrev::dump() { print(cerr); } #endif //===----------------------------------------------------------------------===// #ifndef NDEBUG void DIEValue::dump() { - print(llvm_cerr); + print(cerr); } #endif @@ -3079,7 +3077,7 @@ void DIE::print(std::ostream &O, unsigned IncIndent) { } void DIE::dump() { - print(llvm_cerr); + print(cerr); } #endif diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp index 702102f2cd..ee9cecd579 100644 --- a/lib/CodeGen/ELFWriter.cpp +++ b/lib/CodeGen/ELFWriter.cpp @@ -39,7 +39,6 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/Streams.h" -#include using namespace llvm; //===----------------------------------------------------------------------===// @@ -104,9 +103,9 @@ void ELFCodeEmitter::startFunction(MachineFunction &F) { ELFWriter::ELFSection::SHF_EXECINSTR | ELFWriter::ELFSection::SHF_ALLOC); OutBuffer = &ES->SectionData; - llvm_cerr << "FIXME: This code needs to be updated for changes in the" - << " CodeEmitter interfaces. In particular, this should set " - << "BufferBegin/BufferEnd/CurBufferPtr, not deal with OutBuffer!"; + cerr << "FIXME: This code needs to be updated for changes in the" + << " CodeEmitter interfaces. In particular, this should set " + << "BufferBegin/BufferEnd/CurBufferPtr, not deal with OutBuffer!"; abort(); // Upgrade the section alignment if required. diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index d70a277f6d..753f4591c6 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -274,12 +274,12 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { switch (Callee->getIntrinsicID()) { case Intrinsic::not_intrinsic: - llvm_cerr << "Cannot lower a call to a non-intrinsic function '" - << Callee->getName() << "'!\n"; + cerr << "Cannot lower a call to a non-intrinsic function '" + << Callee->getName() << "'!\n"; abort(); default: - llvm_cerr << "Error: Code generator does not support intrinsic function '" - << Callee->getName() << "'!\n"; + cerr << "Error: Code generator does not support intrinsic function '" + << Callee->getName() << "'!\n"; abort(); // The setjmp/longjmp intrinsics should only exist in the code if it was @@ -356,9 +356,9 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { case Intrinsic::stackrestore: { static bool Warned = false; if (!Warned) - llvm_cerr << "WARNING: this target does not support the llvm.stack" - << (Callee->getIntrinsicID() == Intrinsic::stacksave ? - "save" : "restore") << " intrinsic.\n"; + cerr << "WARNING: this target does not support the llvm.stack" + << (Callee->getIntrinsicID() == Intrinsic::stacksave ? + "save" : "restore") << " intrinsic.\n"; Warned = true; if (Callee->getIntrinsicID() == Intrinsic::stacksave) CI->replaceAllUsesWith(Constant::getNullValue(CI->getType())); @@ -367,9 +367,9 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { case Intrinsic::returnaddress: case Intrinsic::frameaddress: - llvm_cerr << "WARNING: this target does not support the llvm." - << (Callee->getIntrinsicID() == Intrinsic::returnaddress ? - "return" : "frame") << "address intrinsic.\n"; + cerr << "WARNING: this target does not support the llvm." + << (Callee->getIntrinsicID() == Intrinsic::returnaddress ? + "return" : "frame") << "address intrinsic.\n"; CI->replaceAllUsesWith(ConstantPointerNull::get( cast(CI->getType()))); break; @@ -380,8 +380,8 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { case Intrinsic::pcmarker: break; // Simply strip out pcmarker on unsupported architectures case Intrinsic::readcyclecounter: { - llvm_cerr << "WARNING: this target does not support the llvm.readcyclecoun" - << "ter intrinsic. It is being lowered to a constant 0\n"; + cerr << "WARNING: this target does not support the llvm.readcyclecoun" + << "ter intrinsic. It is being lowered to a constant 0\n"; CI->replaceAllUsesWith(ConstantInt::get(Type::ULongTy, 0)); break; } diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index d178a6f444..e2a3bbaaf0 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/lib/CodeGen/LiveInterval.cpp @@ -23,7 +23,6 @@ #include "llvm/Support/Streams.h" #include "llvm/Target/MRegisterInfo.h" #include -#include #include using namespace llvm; @@ -472,10 +471,10 @@ std::ostream& llvm::operator<<(std::ostream& os, const LiveRange &LR) { } void LiveRange::dump() const { - llvm_cerr << *this << "\n"; + cerr << *this << "\n"; } -void LiveInterval::print(llvm_ostream OS, const MRegisterInfo *MRI) const { +void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const { if (MRI && MRegisterInfo::isPhysicalRegister(reg)) OS << MRI->getName(reg); else @@ -508,5 +507,5 @@ void LiveInterval::print(llvm_ostream OS, const MRegisterInfo *MRI) const { } void LiveInterval::dump() const { - llvm_cerr << *this << "\n"; + cerr << *this << "\n"; } diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index eeabbd1c05..2175d35848 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -419,9 +419,9 @@ addIntervalsForSpills(const LiveInterval &li, VirtRegMap &vrm, int slot) { void LiveIntervals::printRegName(unsigned reg) const { if (MRegisterInfo::isPhysicalRegister(reg)) - llvm_cerr << mri_->getName(reg); + cerr << mri_->getName(reg); else - llvm_cerr << "%reg" << reg; + cerr << "%reg" << reg; } /// isReDefinedByTwoAddr - Returns true if the Reg re-definition is due to diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 04bd265228..716b40fbf1 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -18,7 +18,6 @@ #include "llvm/Target/MRegisterInfo.h" #include "llvm/Support/LeakDetector.h" #include "llvm/Support/Streams.h" -#include using namespace llvm; /// MachineInstr ctor - This constructor creates a dummy MachineInstr with @@ -201,7 +200,7 @@ void MachineInstr::copyKillDeadInfo(const MachineInstr *MI) { } void MachineInstr::dump() const { - llvm_cerr << " " << *this; + cerr << " " << *this; } static inline void OutputReg(std::ostream &os, unsigned RegNo, diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp index 186072c01a..79d3b647fb 100644 --- a/lib/CodeGen/VirtRegMap.cpp +++ b/lib/CodeGen/VirtRegMap.cpp @@ -112,11 +112,11 @@ void VirtRegMap::virtFolded(unsigned VirtReg, MachineInstr *OldMI, } void VirtRegMap::print(std::ostream &OS) const { - llvm_ostream LOS(OS); + OStream LOS(OS); print(LOS); } -void VirtRegMap::print(llvm_ostream &OS) const { +void VirtRegMap::print(OStream &OS) const { const MRegisterInfo* MRI = MF.getTarget().getRegisterInfo(); OS << "********** REGISTER MAP **********\n"; @@ -135,7 +135,7 @@ void VirtRegMap::print(llvm_ostream &OS) const { } void VirtRegMap::dump() const { - llvm_ostream OS = DOUT; + OStream OS = DOUT; print(OS); } diff --git a/lib/CodeGen/VirtRegMap.h b/lib/CodeGen/VirtRegMap.h index c3fe951b37..342d800242 100644 --- a/lib/CodeGen/VirtRegMap.h +++ b/lib/CodeGen/VirtRegMap.h @@ -19,12 +19,12 @@ #include "llvm/Target/MRegisterInfo.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/Support/Streams.h" #include namespace llvm { class MachineInstr; class TargetInstrInfo; - class llvm_ostream; class VirtRegMap { public: @@ -145,7 +145,7 @@ namespace llvm { } void print(std::ostream &OS) const; - void print(llvm_ostream &OS) const; + void print(OStream &OS) const; void dump() const; }; diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index ff312f08a1..8aaf0eda2e 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -402,7 +402,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { default: break; } - llvm_cerr << "ConstantExpr not handled as global var init: " << *CE << "\n"; + cerr << "ConstantExpr not handled as global var init: " << *CE << "\n"; abort(); } @@ -432,7 +432,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { assert(0 && "Unknown constant pointer type!"); break; default: - llvm_cerr << "ERROR: Constant unimp for type: " << *C->getType() << "\n"; + cerr << "ERROR: Constant unimp for type: " << *C->getType() << "\n"; abort(); } return Result; @@ -477,7 +477,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, Ptr->Untyped[7] = (unsigned char)(Val.ULongVal >> 56); break; default: - llvm_cerr << "Cannot store value of type " << *Ty << "!\n"; + cerr << "Cannot store value of type " << *Ty << "!\n"; } } else { switch (Ty->getTypeID()) { @@ -511,7 +511,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, Ptr->Untyped[0] = (unsigned char)(Val.ULongVal >> 56); break; default: - llvm_cerr << "Cannot store value of type " << *Ty << "!\n"; + cerr << "Cannot store value of type " << *Ty << "!\n"; } } } @@ -552,7 +552,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, ((uint64_t)Ptr->Untyped[7] << 56); break; default: - llvm_cerr << "Cannot load value of type " << *Ty << "!\n"; + cerr << "Cannot load value of type " << *Ty << "!\n"; abort(); } } else { @@ -586,7 +586,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, ((uint64_t)Ptr->Untyped[0] << 56); break; default: - llvm_cerr << "Cannot load value of type " << *Ty << "!\n"; + cerr << "Cannot load value of type " << *Ty << "!\n"; abort(); } } @@ -634,7 +634,7 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { } default: - llvm_cerr << "Bad Type: " << *Init->getType() << "\n"; + cerr << "Bad Type: " << *Init->getType() << "\n"; assert(0 && "Unknown constant type to initialize memory with!"); } } @@ -718,8 +718,8 @@ void ExecutionEngine::emitGlobals() { sys::DynamicLibrary::SearchForAddressOfSymbol(I->getName().c_str())) addGlobalMapping(I, SymAddr); else { - llvm_cerr << "Could not resolve external global address: " - << I->getName() << "\n"; + cerr << "Could not resolve external global address: " + << I->getName() << "\n"; abort(); } } diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index 964435d380..f7400e9ac9 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -188,7 +188,7 @@ GenericValue Interpreter::getConstantExprValue (ConstantExpr *CE, getOperandValue(CE->getOperand(1), SF), getOperandValue(CE->getOperand(2), SF)); default: - llvm_cerr << "Unhandled ConstantExpr: " << *CE << "\n"; + cerr << "Unhandled ConstantExpr: " << *CE << "\n"; abort(); return GenericValue(); } @@ -236,7 +236,7 @@ static GenericValue executeAddInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_BINARY_OPERATOR(+, Float); IMPLEMENT_BINARY_OPERATOR(+, Double); default: - llvm_cerr << "Unhandled type for Add instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Add instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -257,7 +257,7 @@ static GenericValue executeSubInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_BINARY_OPERATOR(-, Float); IMPLEMENT_BINARY_OPERATOR(-, Double); default: - llvm_cerr << "Unhandled type for Sub instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Sub instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -278,7 +278,7 @@ static GenericValue executeMulInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_BINARY_OPERATOR(*, Float); IMPLEMENT_BINARY_OPERATOR(*, Double); default: - llvm_cerr << "Unhandled type for Mul instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Mul instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -296,7 +296,7 @@ static GenericValue executeUDivInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SIGNLESS_BINOP(/, UInt, Int); IMPLEMENT_SIGNLESS_BINOP(/, ULong, Long); default: - llvm_cerr << "Unhandled type for UDiv instruction: " << *Ty << "\n"; + cerr << "Unhandled type for UDiv instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -311,7 +311,7 @@ static GenericValue executeSDivInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SIGNLESS_BINOP(/, Int, UInt); IMPLEMENT_SIGNLESS_BINOP(/, Long, ULong); default: - llvm_cerr << "Unhandled type for SDiv instruction: " << *Ty << "\n"; + cerr << "Unhandled type for SDiv instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -324,7 +324,7 @@ static GenericValue executeFDivInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_BINARY_OPERATOR(/, Float); IMPLEMENT_BINARY_OPERATOR(/, Double); default: - llvm_cerr << "Unhandled type for Div instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Div instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -339,7 +339,7 @@ static GenericValue executeURemInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SIGNLESS_BINOP(%, UInt, Int); IMPLEMENT_SIGNLESS_BINOP(%, ULong, Long); default: - llvm_cerr << "Unhandled type for URem instruction: " << *Ty << "\n"; + cerr << "Unhandled type for URem instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -354,7 +354,7 @@ static GenericValue executeSRemInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SIGNLESS_BINOP(%, Int, UInt); IMPLEMENT_SIGNLESS_BINOP(%, Long, ULong); default: - llvm_cerr << "Unhandled type for Rem instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Rem instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -371,7 +371,7 @@ static GenericValue executeFRemInst(GenericValue Src1, GenericValue Src2, Dest.DoubleVal = fmod(Src1.DoubleVal, Src2.DoubleVal); break; default: - llvm_cerr << "Unhandled type for Rem instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Rem instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -391,7 +391,7 @@ static GenericValue executeAndInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_BINARY_OPERATOR(&, ULong); IMPLEMENT_BINARY_OPERATOR(&, Long); default: - llvm_cerr << "Unhandled type for And instruction: " << *Ty << "\n"; + cerr << "Unhandled type for And instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -411,7 +411,7 @@ static GenericValue executeOrInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_BINARY_OPERATOR(|, ULong); IMPLEMENT_BINARY_OPERATOR(|, Long); default: - llvm_cerr << "Unhandled type for Or instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Or instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -431,7 +431,7 @@ static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_BINARY_OPERATOR(^, ULong); IMPLEMENT_BINARY_OPERATOR(^, Long); default: - llvm_cerr << "Unhandled type for Xor instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Xor instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -465,7 +465,7 @@ static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SETCC(==, Double); IMPLEMENT_POINTERSETCC(==); default: - llvm_cerr << "Unhandled type for SetEQ instruction: " << *Ty << "\n"; + cerr << "Unhandled type for SetEQ instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -488,7 +488,7 @@ static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_POINTERSETCC(!=); default: - llvm_cerr << "Unhandled type for SetNE instruction: " << *Ty << "\n"; + cerr << "Unhandled type for SetNE instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -510,7 +510,7 @@ static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SETCC(<=, Double); IMPLEMENT_POINTERSETCC(<=); default: - llvm_cerr << "Unhandled type for SetLE instruction: " << *Ty << "\n"; + cerr << "Unhandled type for SetLE instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -532,7 +532,7 @@ static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SETCC(>=, Double); IMPLEMENT_POINTERSETCC(>=); default: - llvm_cerr << "Unhandled type for SetGE instruction: " << *Ty << "\n"; + cerr << "Unhandled type for SetGE instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -554,7 +554,7 @@ static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SETCC(<, Double); IMPLEMENT_POINTERSETCC(<); default: - llvm_cerr << "Unhandled type for SetLT instruction: " << *Ty << "\n"; + cerr << "Unhandled type for SetLT instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -576,7 +576,7 @@ static GenericValue executeSetGTInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SETCC(>, Double); IMPLEMENT_POINTERSETCC(>); default: - llvm_cerr << "Unhandled type for SetGT instruction: " << *Ty << "\n"; + cerr << "Unhandled type for SetGT instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -609,7 +609,7 @@ void Interpreter::visitBinaryOperator(BinaryOperator &I) { case Instruction::SetLT: R = executeSetLTInst(Src1, Src2, Ty); break; case Instruction::SetGT: R = executeSetGTInst(Src1, Src2, Ty); break; default: - llvm_cerr << "Don't know how to handle this binary operator!\n-->" << I; + cerr << "Don't know how to handle this binary operator!\n-->" << I; abort(); } @@ -710,7 +710,7 @@ void Interpreter::visitUnwindInst(UnwindInst &I) { } void Interpreter::visitUnreachableInst(UnreachableInst &I) { - llvm_cerr << "ERROR: Program executed an 'unreachable' instruction!\n"; + cerr << "ERROR: Program executed an 'unreachable' instruction!\n"; abort(); } @@ -978,7 +978,7 @@ static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SHIFT(<<, ULong); IMPLEMENT_SHIFT(<<, Long); default: - llvm_cerr << "Unhandled type for Shl instruction: " << *Ty << "\n"; + cerr << "Unhandled type for Shl instruction: " << *Ty << "\n"; } return Dest; } @@ -992,7 +992,7 @@ static GenericValue executeLShrInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SIGNLESS_SHIFT(>>, UInt, Int); IMPLEMENT_SIGNLESS_SHIFT(>>, ULong, Long); default: - llvm_cerr << "Unhandled type for LShr instruction: " << *Ty << "\n"; + cerr << "Unhandled type for LShr instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -1007,7 +1007,7 @@ static GenericValue executeAShrInst(GenericValue Src1, GenericValue Src2, IMPLEMENT_SIGNLESS_SHIFT(>>, Int, UInt); IMPLEMENT_SIGNLESS_SHIFT(>>, Long, ULong); default: - llvm_cerr << "Unhandled type for AShr instruction: " << *Ty << "\n"; + cerr << "Unhandled type for AShr instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -1065,14 +1065,14 @@ void Interpreter::visitAShr(ShiftInst &I) { IMPLEMENT_CAST(DESTTY, DESTCTY, Float); \ IMPLEMENT_CAST(DESTTY, DESTCTY, Double) \ default: \ - llvm_cerr << "Unhandled cast: " \ + cerr << "Unhandled cast: " \ << *SrcTy << " to " << *DstTy << "\n"; \ abort(); \ } \ break #define IMPLEMENT_CAST_END \ - default: llvm_cerr \ + default: cerr \ << "Unhandled dest type for cast instruction: " \ << *DstTy << "\n"; \ abort(); \ @@ -1226,8 +1226,7 @@ GenericValue Interpreter::executeCastOperation(Instruction::CastOps opcode, IMPLEMENT_CAST_END break; default: - llvm_cerr - << "Invalid cast opcode for cast instruction: " << opcode << "\n"; + cerr << "Invalid cast opcode for cast instruction: " << opcode << "\n"; abort(); } return Dest; @@ -1266,7 +1265,7 @@ void Interpreter::visitVAArgInst(VAArgInst &I) { IMPLEMENT_VAARG(Double); IMPLEMENT_VAARG(Bool); default: - llvm_cerr << "Unhandled dest type for vaarg instruction: " << *Ty << "\n"; + cerr << "Unhandled dest type for vaarg instruction: " << *Ty << "\n"; abort(); } diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index 161873c2c8..a1c43175da 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -93,8 +93,8 @@ GenericValue Interpreter::callExternalFunction(Function *F, std::map::iterator FI = Functions.find(F); ExFunc Fn = (FI == Functions.end()) ? lookupFunction(F) : FI->second; if (Fn == 0) { - llvm_cerr << "Tried to execute an unknown external function: " - << F->getType()->getDescription() << " " << F->getName() << "\n"; + cerr << "Tried to execute an unknown external function: " + << F->getType()->getDescription() << " " << F->getName() << "\n"; if (F->getName() == "__main") return GenericValue(); abort(); @@ -114,19 +114,19 @@ extern "C" { // Don't add C++ manglings to llvm mangling :) // void putchar(sbyte) GenericValue lle_Vb_putchar(FunctionType *M, const vector &Args) { - llvm_cout << Args[0].SByteVal; + cout << Args[0].SByteVal; return GenericValue(); } // int putchar(int) GenericValue lle_ii_putchar(FunctionType *M, const vector &Args) { - llvm_cout << ((char)Args[0].IntVal) << std::flush; + cout << ((char)Args[0].IntVal) << std::flush; return Args[0]; } // void putchar(ubyte) GenericValue lle_VB_putchar(FunctionType *M, const vector &Args) { - llvm_cout << Args[0].SByteVal << std::flush; + cout << Args[0].SByteVal << std::flush; return Args[0]; } @@ -332,7 +332,7 @@ GenericValue lle_X_sprintf(FunctionType *M, const vector &Args) { sprintf(Buffer, FmtBuf, (void*)GVTOP(Args[ArgNo++])); break; case 's': sprintf(Buffer, FmtBuf, (char*)GVTOP(Args[ArgNo++])); break; - default: llvm_cerr << ""; + default: cerr << ""; ArgNo++; break; } strcpy(OutputBuffer, Buffer); @@ -350,7 +350,7 @@ GenericValue lle_X_printf(FunctionType *M, const vector &Args) { NewArgs.push_back(PTOGV(Buffer)); NewArgs.insert(NewArgs.end(), Args.begin(), Args.end()); GenericValue GV = lle_X_sprintf(M, NewArgs); - llvm_cout << Buffer; + cout << Buffer; return GV; } diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index b09fd656f2..71239f7439 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -25,7 +25,6 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Support/Streams.h" #include "llvm/System/Path.h" -#include using namespace llvm; // Error - Simple wrapper function to conditionally assign to E and return true. @@ -251,11 +250,11 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) { static void PrintMap(const std::map &M) { for (std::map::const_iterator I = M.begin(), E =M.end(); I != E; ++I) { - llvm_cerr << " Fr: " << (void*)I->first << " "; + cerr << " Fr: " << (void*)I->first << " "; I->first->dump(); - llvm_cerr << " To: " << (void*)I->second << " "; + cerr << " To: " << (void*)I->second << " "; I->second->dump(); - llvm_cerr << "\n"; + cerr << "\n"; } } @@ -313,10 +312,10 @@ static Value *RemapOperand(const Value *In, } - llvm_cerr << "LinkModules ValueMap: \n"; + cerr << "LinkModules ValueMap: \n"; PrintMap(ValueMap); - llvm_cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n"; + cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n"; assert(0 && "Couldn't remap value!"); return 0; } @@ -844,13 +843,13 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) { if (Src->getEndianness() != Module::AnyEndianness && Dest->getEndianness() != Src->getEndianness()) - llvm_cerr << "WARNING: Linking two modules of different endianness!\n"; + cerr << "WARNING: Linking two modules of different endianness!\n"; if (Src->getPointerSize() != Module::AnyPointerSize && Dest->getPointerSize() != Src->getPointerSize()) - llvm_cerr << "WARNING: Linking two modules of different pointer size!\n"; + cerr << "WARNING: Linking two modules of different pointer size!\n"; if (!Src->getTargetTriple().empty() && Dest->getTargetTriple() != Src->getTargetTriple()) - llvm_cerr << "WARNING: Linking two modules of different target triples!\n"; + cerr << "WARNING: Linking two modules of different target triples!\n"; if (!Src->getModuleInlineAsm().empty()) { if (Dest->getModuleInlineAsm().empty()) diff --git a/lib/Linker/Linker.cpp b/lib/Linker/Linker.cpp index bf33196090..71905109ea 100644 --- a/lib/Linker/Linker.cpp +++ b/lib/Linker/Linker.cpp @@ -45,7 +45,7 @@ bool Linker::error(const std::string& message) { Error = message; if (!(Flags&QuietErrors)) - llvm_cerr << ProgramName << ": error: " << message << "\n"; + cerr << ProgramName << ": error: " << message << "\n"; return true; } @@ -53,14 +53,14 @@ bool Linker::warning(const std::string& message) { Error = message; if (!(Flags&QuietErrors)) - llvm_cerr << ProgramName << ": warning: " << message << "\n"; + cerr << ProgramName << ": warning: " << message << "\n"; return false; } void Linker::verbose(const std::string& message) { if (Flags&Verbose) - llvm_cerr << " " << message << "\n"; + cerr << " " << message << "\n"; } void diff --git a/lib/Support/Allocator.cpp b/lib/Support/Allocator.cpp index 96f0743f3d..632b5f7a22 100644 --- a/lib/Support/Allocator.cpp +++ b/lib/Support/Allocator.cpp @@ -102,6 +102,6 @@ void BumpPtrAllocator::PrintStats() const { for (; R; R = R->getNext(), ++NumRegions) BytesUsed += R->getNumBytesAllocated(); - llvm_cerr << "\nNumber of memory regions: " << NumRegions << "\n"; - llvm_cerr << "Bytes allocated: " << BytesUsed << "\n"; + cerr << "\nNumber of memory regions: " << NumRegions << "\n"; + cerr << "Bytes allocated: " << BytesUsed << "\n"; } diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 3b75f478af..920811a06c 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -84,8 +84,8 @@ static Option *getOption(const std::string &Str) { static void AddArgument(const char *ArgName, Option *Opt) { if (getOption(ArgName)) { - llvm_cerr << ProgramName << ": CommandLine Error: Argument '" - << ArgName << "' defined more than once!\n"; + cerr << ProgramName << ": CommandLine Error: Argument '" + << ArgName << "' defined more than once!\n"; } else { // Add argument to the argument map! (*Options)[ArgName] = Opt; @@ -129,9 +129,9 @@ static inline bool ProvideOption(Option *Handler, const char *ArgName, case ValueOptional: break; default: - llvm_cerr << ProgramName - << ": Bad ValueMask flag! CommandLine usage error:" - << Handler->getValueExpectedFlag() << "\n"; + cerr << ProgramName + << ": Bad ValueMask flag! CommandLine usage error:" + << Handler->getValueExpectedFlag() << "\n"; abort(); break; } @@ -468,8 +468,8 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, } if (Handler == 0) { - llvm_cerr << ProgramName << ": Unknown command line argument '" - << argv[i] << "'. Try: '" << argv[0] << " --help'\n"; + cerr << ProgramName << ": Unknown command line argument '" + << argv[i] << "'. Try: '" << argv[0] << " --help'\n"; ErrorParsing = true; continue; } @@ -505,18 +505,18 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, // Check and handle positional arguments now... if (NumPositionalRequired > PositionalVals.size()) { - llvm_cerr << ProgramName - << ": Not enough positional command line arguments specified!\n" - << "Must specify at least " << NumPositionalRequired - << " positional arguments: See: " << argv[0] << " --help\n"; + cerr << ProgramName + << ": Not enough positional command line arguments specified!\n" + << "Must specify at least " << NumPositionalRequired + << " positional arguments: See: " << argv[0] << " --help\n"; ErrorParsing = true; } else if (!HasUnlimitedPositionals && PositionalVals.size() > PositionalOpts.size()) { - llvm_cerr << ProgramName - << ": Too many positional arguments specified!\n" - << "Can specify at most " << PositionalOpts.size() - << " positional arguments: See: " << argv[0] << " --help\n"; + cerr << ProgramName + << ": Too many positional arguments specified!\n" + << "Can specify at most " << PositionalOpts.size() + << " positional arguments: See: " << argv[0] << " --help\n"; ErrorParsing = true; } else if (ConsumeAfterOpt == 0) { @@ -617,11 +617,11 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, bool Option::error(std::string Message, const char *ArgName) { if (ArgName == 0) ArgName = ArgStr; if (ArgName[0] == 0) - llvm_cerr << HelpStr; // Be nice for positional arguments + cerr << HelpStr; // Be nice for positional arguments else - llvm_cerr << ProgramName << ": for the -" << ArgName; + cerr << ProgramName << ": for the -" << ArgName; - llvm_cerr << " option: " << Message << "\n"; + cerr << " option: " << Message << "\n"; return true; } @@ -701,8 +701,8 @@ unsigned alias::getOptionWidth() const { // Print out the option for the alias. void alias::printOptionInfo(unsigned GlobalWidth) const { unsigned L = std::strlen(ArgStr); - llvm_cout << " -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - " - << HelpStr << "\n"; + cout << " -" << ArgStr << std::string(GlobalWidth-L-6, ' ') << " - " + << HelpStr << "\n"; } @@ -728,13 +728,13 @@ unsigned basic_parser_impl::getOptionWidth(const Option &O) const { // void basic_parser_impl::printOptionInfo(const Option &O, unsigned GlobalWidth) const { - llvm_cout << " -" << O.ArgStr; + cout << " -" << O.ArgStr; if (const char *ValName = getValueName()) - llvm_cout << "=<" << getValueStr(O, ValName) << ">"; + cout << "=<" << getValueStr(O, ValName) << ">"; - llvm_cout << std::string(GlobalWidth-getOptionWidth(O), ' ') << " - " - << O.HelpStr << "\n"; + cout << std::string(GlobalWidth-getOptionWidth(O), ' ') << " - " + << O.HelpStr << "\n"; } @@ -850,21 +850,21 @@ void generic_parser_base::printOptionInfo(const Option &O, unsigned GlobalWidth) const { if (O.hasArgStr()) { unsigned L = std::strlen(O.ArgStr); - llvm_cout << " -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ') - << " - " << O.HelpStr << "\n"; + cout << " -" << O.ArgStr << std::string(GlobalWidth-L-6, ' ') + << " - " << O.HelpStr << "\n"; for (unsigned i = 0, e = getNumOptions(); i != e; ++i) { unsigned NumSpaces = GlobalWidth-strlen(getOption(i))-8; - llvm_cout << " =" << getOption(i) << std::string(NumSpaces, ' ') - << " - " << getDescription(i) << "\n"; + cout << " =" << getOption(i) << std::string(NumSpaces, ' ') + << " - " << getDescription(i) << "\n"; } } else { if (O.HelpStr[0]) - llvm_cout << " " << O.HelpStr << "\n"; + cout << " " << O.HelpStr << "\n"; for (unsigned i = 0, e = getNumOptions(); i != e; ++i) { unsigned L = std::strlen(getOption(i)); - llvm_cout << " -" << getOption(i) << std::string(GlobalWidth-L-8, ' ') - << " - " << getDescription(i) << "\n"; + cout << " -" << getOption(i) << std::string(GlobalWidth-L-8, ' ') + << " - " << getDescription(i) << "\n"; } } } @@ -917,9 +917,9 @@ public: } if (ProgramOverview) - llvm_cout << "OVERVIEW:" << ProgramOverview << "\n"; + cout << "OVERVIEW:" << ProgramOverview << "\n"; - llvm_cout << "USAGE: " << ProgramName << " [options]"; + cout << "USAGE: " << ProgramName << " [options]"; // Print out the positional options. std::vector &PosOpts = *PositionalOptions; @@ -929,28 +929,28 @@ public: for (unsigned i = CAOpt != 0, e = PosOpts.size(); i != e; ++i) { if (PosOpts[i]->ArgStr[0]) - llvm_cout << " --" << PosOpts[i]->ArgStr; - llvm_cout << " " << PosOpts[i]->HelpStr; + cout << " --" << PosOpts[i]->ArgStr; + cout << " " << PosOpts[i]->HelpStr; } // Print the consume after option info if it exists... - if (CAOpt) llvm_cout << " " << CAOpt->HelpStr; + if (CAOpt) cout << " " << CAOpt->HelpStr; - llvm_cout << "\n\n"; + cout << "\n\n"; // Compute the maximum argument length... MaxArgLen = 0; for (unsigned i = 0, e = Opts.size(); i != e; ++i) MaxArgLen = std::max(MaxArgLen, Opts[i].second->getOptionWidth()); - llvm_cout << "OPTIONS:\n"; + cout << "OPTIONS:\n"; for (unsigned i = 0, e = Opts.size(); i != e; ++i) Opts[i].second->printOptionInfo(MaxArgLen); // Print any extra help the user has declared. for (std::vector::iterator I = MoreHelp->begin(), E = MoreHelp->end(); I != E; ++I) - llvm_cout << *I; + cout << *I; MoreHelp->clear(); // Halt the program since help information was printed @@ -982,21 +982,21 @@ public: void operator=(bool OptionWasSpecified) { if (OptionWasSpecified) { if (OverrideVersionPrinter == 0) { - llvm_cout << "Low Level Virtual Machine (http://llvm.org/):\n"; - llvm_cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION; + cout << "Low Level Virtual Machine (http://llvm.org/):\n"; + cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION; #ifdef LLVM_VERSION_INFO - llvm_cout << LLVM_VERSION_INFO; + cout << LLVM_VERSION_INFO; #endif - llvm_cout << "\n "; + cout << "\n "; #ifndef __OPTIMIZE__ - llvm_cout << "DEBUG build"; + cout << "DEBUG build"; #else - llvm_cout << "Optimized build"; + cout << "Optimized build"; #endif #ifndef NDEBUG - llvm_cout << " with assertions"; + cout << " with assertions"; #endif - llvm_cout << ".\n"; + cout << ".\n"; Options->clear(); // Don't bother making option dtors remove from map. exit(1); } else { diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index 1f1a1b5757..2c215866c6 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -370,5 +370,5 @@ void ConstantRange::print(std::ostream &OS) const { /// dump - Allow printing from a debugger easily... /// void ConstantRange::dump() const { - print(llvm_cerr); + print(cerr); } diff --git a/lib/Support/Debug.cpp b/lib/Support/Debug.cpp index 9cea94c547..949e3d932a 100644 --- a/lib/Support/Debug.cpp +++ b/lib/Support/Debug.cpp @@ -68,9 +68,9 @@ bool llvm::isCurrentDebugType(const char *DebugType) { // places the std::c* I/O streams into one .cpp file and relieves the whole // program from having to have hundreds of static c'tor/d'tors for them. // -llvm_ostream llvm::getErrorOutputStream(const char *DebugType) { +OStream llvm::getErrorOutputStream(const char *DebugType) { if (DebugFlag && isCurrentDebugType(DebugType)) - return llvm_cerr; + return cerr; else - return llvm_null; + return NullStream; } diff --git a/lib/Support/GraphWriter.cpp b/lib/Support/GraphWriter.cpp index 01da2e13c5..ecf2bfdb91 100644 --- a/lib/Support/GraphWriter.cpp +++ b/lib/Support/GraphWriter.cpp @@ -28,9 +28,9 @@ void llvm::DisplayGraph(const sys::Path &Filename) { args.push_back(Filename.c_str()); args.push_back(0); - llvm_cerr << "Running 'Graphviz' program... " << std::flush; + cerr << "Running 'Graphviz' program... " << std::flush; if (sys::Program::ExecuteAndWait(Graphviz, &args[0],0,0,0,&ErrMsg)) { - llvm_cerr << "Error viewing graph: " << ErrMsg << "\n"; + cerr << "Error viewing graph: " << ErrMsg << "\n"; } #elif (HAVE_GV && HAVE_DOT) sys::Path PSFilename = Filename; @@ -48,11 +48,11 @@ void llvm::DisplayGraph(const sys::Path &Filename) { args.push_back(PSFilename.c_str()); args.push_back(0); - llvm_cerr << "Running 'dot' program... " << std::flush; + cerr << "Running 'dot' program... " << std::flush; if (sys::Program::ExecuteAndWait(dot, &args[0],0,0,0,&ErrMsg)) { - llvm_cerr << "Error viewing graph: '" << ErrMsg << "\n"; + cerr << "Error viewing graph: '" << ErrMsg << "\n"; } else { - llvm_cerr << " done. \n"; + cerr << " done. \n"; sys::Path gv(LLVM_PATH_GV); args.clear(); @@ -62,7 +62,7 @@ void llvm::DisplayGraph(const sys::Path &Filename) { ErrMsg.clear(); if (sys::Program::ExecuteAndWait(gv, &args[0],0,0,0,&ErrMsg)) { - llvm_cerr << "Error viewing graph: " << ErrMsg << "\n"; + cerr << "Error viewing graph: " << ErrMsg << "\n"; } } PSFilename.eraseFromDisk(); @@ -73,9 +73,9 @@ void llvm::DisplayGraph(const sys::Path &Filename) { args.push_back(Filename.c_str()); args.push_back(0); - llvm_cerr << "Running 'dotty' program... " << std::flush; + cerr << "Running 'dotty' program... " << std::flush; if (sys::Program::ExecuteAndWait(dotty, &args[0],0,0,0,&ErrMsg)) { - llvm_cerr << "Error viewing graph: " << ErrMsg << "\n"; + cerr << "Error viewing graph: " << ErrMsg << "\n"; } else { #ifdef __MINGW32__ // Dotty spawns another app and doesn't wait until it returns return; diff --git a/lib/Support/PluginLoader.cpp b/lib/Support/PluginLoader.cpp index abd5e7af7a..97b253e4eb 100644 --- a/lib/Support/PluginLoader.cpp +++ b/lib/Support/PluginLoader.cpp @@ -26,8 +26,8 @@ void PluginLoader::operator=(const std::string &Filename) { std::string Error; if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) { - llvm_cerr << "Error opening '" << Filename << "': " << Error - << "\n -load request ignored.\n"; + cerr << "Error opening '" << Filename << "': " << Error + << "\n -load request ignored.\n"; } else { Plugins->push_back(Filename); } diff --git a/lib/Support/SlowOperationInformer.cpp b/lib/Support/SlowOperationInformer.cpp index 806e7a47cb..a7bdf12fd0 100644 --- a/lib/Support/SlowOperationInformer.cpp +++ b/lib/Support/SlowOperationInformer.cpp @@ -28,8 +28,8 @@ SlowOperationInformer::~SlowOperationInformer() { if (LastPrintAmount) { // If we have printed something, make _sure_ we print the 100% amount, and // also print a newline. - llvm_cout << std::string(LastPrintAmount, '\b') << "Progress " - << OperationName << ": 100% \n"; + cout << std::string(LastPrintAmount, '\b') << "Progress " + << OperationName << ": 100% \n"; } } @@ -40,7 +40,7 @@ SlowOperationInformer::~SlowOperationInformer() { bool SlowOperationInformer::progress(unsigned Amount) { int status = sys::AlarmStatus(); if (status == -1) { - llvm_cout << "\n"; + cout << "\n"; LastPrintAmount = 0; return true; } @@ -61,6 +61,6 @@ bool SlowOperationInformer::progress(unsigned Amount) { OS << "% "; LastPrintAmount = OS.str().size(); - llvm_cout << ToPrint+OS.str() << std::flush; + cout << ToPrint+OS.str() << std::flush; return false; } diff --git a/lib/Support/Streams.cpp b/lib/Support/Streams.cpp index 9ca7590e37..02aec1fff8 100644 --- a/lib/Support/Streams.cpp +++ b/lib/Support/Streams.cpp @@ -16,6 +16,7 @@ #include using namespace llvm; -llvm_ostream llvm::llvm_null; -llvm_ostream llvm::llvm_cout(std::cout); -llvm_ostream llvm::llvm_cerr(std::cerr); +OStream llvm::NullStream; +OStream llvm::cout(std::cout); +OStream llvm::cerr(std::cerr); +IStream llvm::cin(std::cin); diff --git a/lib/Support/SystemUtils.cpp b/lib/Support/SystemUtils.cpp index d4dbaeecc4..124251165d 100644 --- a/lib/Support/SystemUtils.cpp +++ b/lib/Support/SystemUtils.cpp @@ -23,10 +23,10 @@ bool llvm::CheckBytecodeOutputToConsole(std::ostream* stream_to_check, bool print_warning) { if (stream_to_check == &std::cout && sys::Process::StandardOutIsDisplayed()) { if (print_warning) { - llvm_cerr << "WARNING: You're attempting to print out a bytecode file.\n" - << "This is inadvisable as it may cause display problems. If\n" - << "you REALLY want to taste LLVM bytecode first-hand, you\n" - << "can force output with the `-f' option.\n\n"; + cerr << "WARNING: You're attempting to print out a bytecode file.\n" + << "This is inadvisable as it may cause display problems. If\n" + << "you REALLY want to taste LLVM bytecode first-hand, you\n" + << "can force output with the `-f' option.\n\n"; } return true; } diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index 39f21ead85..1ce6eedbee 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -693,8 +693,8 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, I->setName(""); Instruction *Res; // Result of conversion - //llvm_cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I - // << "BB Before: " << BB << endl; + //cerr << endl << endl << "Type:\t" << Ty << "\nInst: " << I + // << "BB Before: " << BB << endl; // Prevent I from being removed... ValueHandle IHandle(VMC, I); diff --git a/lib/Transforms/Hello/Hello.cpp b/lib/Transforms/Hello/Hello.cpp index 8324cbb6cb..0b0010df0f 100644 --- a/lib/Transforms/Hello/Hello.cpp +++ b/lib/Transforms/Hello/Hello.cpp @@ -30,7 +30,7 @@ namespace { HelloCounter++; std::string fname = F.getName(); EscapeString(fname); - llvm_cerr << "Hello: " << fname << "\n"; + cerr << "Hello: " << fname << "\n"; return false; } }; @@ -43,7 +43,7 @@ namespace { HelloCounter++; std::string fname = F.getName(); EscapeString(fname); - llvm_cerr << "Hello: " << fname << "\n"; + cerr << "Hello: " << fname << "\n"; return false; } diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index a0dc9373d6..764205baaa 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -494,17 +494,17 @@ static bool AllUsesOfValueWillTrapIfNull(Value *V) { // Will trap. } else if (StoreInst *SI = dyn_cast(*UI)) { if (SI->getOperand(0) == V) { - //llvm_cerr << "NONTRAPPING USE: " << **UI; + //cerr << "NONTRAPPING USE: " << **UI; return false; // Storing the value. } } else if (CallInst *CI = dyn_cast(*UI)) { if (CI->getOperand(0) != V) { - //llvm_cerr << "NONTRAPPING USE: " << **UI; + //cerr << "NONTRAPPING USE: " << **UI; return false; // Not calling the ptr } } else if (InvokeInst *II = dyn_cast(*UI)) { if (II->getOperand(0) != V) { - //llvm_cerr << "NONTRAPPING USE: " << **UI; + //cerr << "NONTRAPPING USE: " << **UI; return false; // Not calling the ptr } } else if (CastInst *CI = dyn_cast(*UI)) { @@ -515,7 +515,7 @@ static bool AllUsesOfValueWillTrapIfNull(Value *V) { isa(UI->getOperand(1))) { // Ignore setcc X, null } else { - //llvm_cerr << "NONTRAPPING USE: " << **UI; + //cerr << "NONTRAPPING USE: " << **UI; return false; } return true; @@ -533,7 +533,7 @@ static bool AllUsesOfLoadedValueWillTrapIfNull(GlobalVariable *GV) { // Ignore stores to the global. } else { // We don't know or understand this user, bail out. - //llvm_cerr << "UNKNOWN USER OF GLOBAL!: " << **UI; + //cerr << "UNKNOWN USER OF GLOBAL!: " << **UI; return false; } @@ -1206,25 +1206,25 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV, if (!AnalyzeGlobal(GV, GS, PHIUsers)) { #if 0 - llvm_cerr << "Global: " << *GV; - llvm_cerr << " isLoaded = " << GS.isLoaded << "\n"; - llvm_cerr << " StoredType = "; + cerr << "Global: " << *GV; + cerr << " isLoaded = " << GS.isLoaded << "\n"; + cerr << " StoredType = "; switch (GS.StoredType) { - case GlobalStatus::NotStored: llvm_cerr << "NEVER STORED\n"; break; - case GlobalStatus::isInitializerStored: llvm_cerr << "INIT STORED\n"; break; - case GlobalStatus::isStoredOnce: llvm_cerr << "STORED ONCE\n"; break; - case GlobalStatus::isStored: llvm_cerr << "stored\n"; break; + case GlobalStatus::NotStored: cerr << "NEVER STORED\n"; break; + case GlobalStatus::isInitializerStored: cerr << "INIT STORED\n"; break; + case GlobalStatus::isStoredOnce: cerr << "STORED ONCE\n"; break; + case GlobalStatus::isStored: cerr << "stored\n"; break; } if (GS.StoredType == GlobalStatus::isStoredOnce && GS.StoredOnceValue) - llvm_cerr << " StoredOnceValue = " << *GS.StoredOnceValue << "\n"; + cerr << " StoredOnceValue = " << *GS.StoredOnceValue << "\n"; if (GS.AccessingFunction && !GS.HasMultipleAccessingFunctions) - llvm_cerr << " AccessingFunction = " << GS.AccessingFunction->getName() + cerr << " AccessingFunction = " << GS.AccessingFunction->getName() << "\n"; - llvm_cerr << " HasMultipleAccessingFunctions = " + cerr << " HasMultipleAccessingFunctions = " << GS.HasMultipleAccessingFunctions << "\n"; - llvm_cerr << " HasNonInstructionUser = " << GS.HasNonInstructionUser<<"\n"; - llvm_cerr << " isNotSuitableForSRA = " << GS.isNotSuitableForSRA << "\n"; - llvm_cerr << "\n"; + cerr << " HasNonInstructionUser = " << GS.HasNonInstructionUser<<"\n"; + cerr << " isNotSuitableForSRA = " << GS.isNotSuitableForSRA << "\n"; + cerr << "\n"; #endif // If this is a first class global and has only one accessing function diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp index 3e7dcc67ae..f43a27f698 100644 --- a/lib/Transforms/IPO/Internalize.cpp +++ b/lib/Transforms/IPO/Internalize.cpp @@ -74,8 +74,7 @@ void InternalizePass::LoadFile(const char *Filename) { // Load the APIFile... std::ifstream In(Filename); if (!In.good()) { - llvm_cerr << "WARNING: Internalize couldn't load file '" << Filename - << "'!\n"; + cerr << "WARNING: Internalize couldn't load file '" << Filename << "'!\n"; return; // Do not internalize anything... } while (In) { diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp index af2928b0fc..af438f9655 100644 --- a/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp @@ -47,8 +47,8 @@ ModulePass *llvm::createFunctionProfilerPass() { bool FunctionProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { - llvm_cerr << "WARNING: cannot insert function profiling into a module" - << " with no main function!\n"; + cerr << "WARNING: cannot insert function profiling into a module" + << " with no main function!\n"; return false; // No main, no instrumentation! } @@ -90,8 +90,8 @@ ModulePass *llvm::createBlockProfilerPass() { return new BlockProfiler(); } bool BlockProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { - llvm_cerr << "WARNING: cannot insert block profiling into a module" - << " with no main function!\n"; + cerr << "WARNING: cannot insert block profiling into a module" + << " with no main function!\n"; return false; // No main, no instrumentation! } diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp index 40a8faaf50..36cf3e9430 100644 --- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp @@ -17,6 +17,7 @@ // //===----------------------------------------------------------------------===// +#include "ProfilingUtils.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" @@ -24,7 +25,6 @@ #include "llvm/Support/Streams.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Instrumentation.h" -#include "ProfilingUtils.h" #include using namespace llvm; @@ -42,8 +42,8 @@ ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); } bool EdgeProfiler::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { - llvm_cerr << "WARNING: cannot insert edge profiling into a module" - << " with no main function!\n"; + cerr << "WARNING: cannot insert edge profiling into a module" + << " with no main function!\n"; return false; // No main, no instrumentation! } diff --git a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp index 076fa81074..10b3641978 100644 --- a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp +++ b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#include "ProfilingUtils.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" @@ -20,7 +21,6 @@ #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Instrumentation.h" #include "llvm/Instructions.h" -#include "ProfilingUtils.h" #include "llvm/Support/Debug.h" #include using namespace llvm; @@ -61,8 +61,8 @@ static void InsertInstrumentationCall (BasicBlock *BB, bool TraceBasicBlocks::runOnModule(Module &M) { Function *Main = M.getMainFunction(); if (Main == 0) { - llvm_cerr << "WARNING: cannot insert basic-block trace instrumentation" - << " into a module with no main function!\n"; + cerr << "WARNING: cannot insert basic-block trace instrumentation" + << " into a module with no main function!\n"; return false; // No main, no instrumentation! } diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 5073bde0ba..4c0bbf4316 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7018,8 +7018,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { // If we are removing arguments to the function, emit an obnoxious warning... if (FT->getNumParams() < NumActualArgs) if (!FT->isVarArg()) { - llvm_cerr << "WARNING: While resolving call to function '" - << Callee->getName() << "' arguments were dropped!\n"; + cerr << "WARNING: While resolving call to function '" + << Callee->getName() << "' arguments were dropped!\n"; } else { // Add all of the arguments in their promoted form to the arg list... for (unsigned i = FT->getNumParams(); i != NumActualArgs; ++i, ++AI) { diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index a262cf79fb..66b595fd7f 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -507,12 +507,12 @@ namespace { } void BasedUser::dump() const { - llvm_cerr << " Base=" << *Base; - llvm_cerr << " Imm=" << *Imm; + cerr << " Base=" << *Base; + cerr << " Imm=" << *Imm; if (EmittedBase) - llvm_cerr << " EB=" << *EmittedBase; + cerr << " EB=" << *EmittedBase; - llvm_cerr << " Inst: " << *Inst; + cerr << " Inst: " << *Inst; } Value *BasedUser::InsertCodeForBaseAtPosition(const SCEVHandle &NewBase, diff --git a/lib/Transforms/Scalar/LowerPacked.cpp b/lib/Transforms/Scalar/LowerPacked.cpp index f02c40f4d8..25de5fb24c 100644 --- a/lib/Transforms/Scalar/LowerPacked.cpp +++ b/lib/Transforms/Scalar/LowerPacked.cpp @@ -73,8 +73,7 @@ public: /// @param I the unhandled instruction void visitInstruction(Instruction &I) { if (isa(I.getType())) - llvm_cerr << "Unhandled Instruction with Packed ReturnType: " - << I << '\n'; + cerr << "Unhandled Instruction with Packed ReturnType: " << I << '\n'; } private: /// @brief Retrieves lowered values for a packed value. diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index a5f7db8f6e..5d928c145d 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -350,7 +350,7 @@ private: void visitInstruction(Instruction &I) { // If a new instruction is added to LLVM that we don't handle... - llvm_cerr << "SCCP: Don't know how to handle: " << I; + cerr << "SCCP: Don't know how to handle: " << I; markOverdefined(&I); // Just in case } }; @@ -400,7 +400,7 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI, Succs[0] = true; } } else { - llvm_cerr << "SCCP: Don't know how to handle: " << TI; + cerr << "SCCP: Don't know how to handle: " << TI; Succs.assign(TI.getNumSuccessors(), true); } } @@ -459,7 +459,7 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) { } return false; } else { - llvm_cerr << "Unknown terminator instruction: " << *TI; + cerr << "Unknown terminator instruction: " << *TI; abort(); } } diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index 52d53d53e9..a63e4e0407 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -699,10 +699,10 @@ ExtractCodeRegion(const std::vector &code) { } } - //llvm_cerr << "NEW FUNCTION: " << *newFunction; + //cerr << "NEW FUNCTION: " << *newFunction; // verifyFunction(*newFunction); - // llvm_cerr << "OLD FUNCTION: " << *oldFunction; + // cerr << "OLD FUNCTION: " << *oldFunction; // verifyFunction(*oldFunction); DEBUG(if (verifyFunction(*newFunction)) abort()); diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index 4ad12b9c25..2adfb3ef30 100644 --- a/lib/Transforms/Utils/LowerSwitch.cpp +++ b/lib/Transforms/Utils/LowerSwitch.cpp @@ -96,8 +96,7 @@ bool LowerSwitch::runOnFunction(Function &F) { // operator<< - Used for debugging purposes. // -llvm_ostream& operator<<(llvm_ostream &O, - const std::vector &C) { +OStream& operator<<(OStream &O, const std::vector &C) { O << "["; for (std::vector::const_iterator B = C.begin(), diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 30baed4c64..072fc51d22 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -829,7 +829,7 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) { case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break; case GlobalValue::ExternalLinkage: break; case GlobalValue::GhostLinkage: - llvm_cerr << "GhostLinkage not allowed in AsmWriter!\n"; + cerr << "GhostLinkage not allowed in AsmWriter!\n"; abort(); } @@ -928,7 +928,7 @@ void AssemblyWriter::printFunction(const Function *F) { case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break; case GlobalValue::ExternalLinkage: break; case GlobalValue::GhostLinkage: - llvm_cerr << "GhostLinkage not allowed in AsmWriter!\n"; + cerr << "GhostLinkage not allowed in AsmWriter!\n"; abort(); } @@ -1328,18 +1328,18 @@ void Argument::print(std::ostream &o) const { // Value::dump - allow easy printing of Values from the debugger. // Located here because so much of the needed functionality is here. -void Value::dump() const { print(std::cerr); llvm_cerr << '\n'; } +void Value::dump() const { print(std::cerr); cerr << '\n'; } // Type::dump - allow easy printing of Values from the debugger. // Located here because so much of the needed functionality is here. -void Type::dump() const { print(std::cerr); llvm_cerr << '\n'; } +void Type::dump() const { print(std::cerr); cerr << '\n'; } //===----------------------------------------------------------------------===// // SlotMachine Implementation //===----------------------------------------------------------------------===// #if 0 -#define SC_DEBUG(X) llvm_cerr << X +#define SC_DEBUG(X) cerr << X #else #define SC_DEBUG(X) #endif diff --git a/lib/VMCore/LeakDetector.cpp b/lib/VMCore/LeakDetector.cpp index 4c9f125807..68bf161699 100644 --- a/lib/VMCore/LeakDetector.cpp +++ b/lib/VMCore/LeakDetector.cpp @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Support/Compiler.h" #include "llvm/Support/LeakDetector.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Streams.h" #include "llvm/Value.h" #include @@ -21,12 +21,12 @@ using namespace llvm; namespace { template struct VISIBILITY_HIDDEN PrinterTrait { - static void print(const T* P) { llvm_cerr << P; } + static void print(const T* P) { cerr << P; } }; template<> struct VISIBILITY_HIDDEN PrinterTrait { - static void print(const Value* P) { llvm_cerr << *P; } + static void print(const Value* P) { cerr << *P; } }; template @@ -59,15 +59,14 @@ namespace { assert(Cache == 0 && "No value should be cached anymore!"); if (!Ts.empty()) { - llvm_cerr - << "Leaked " << Name << " objects found: " << Message << ":\n"; + cerr << "Leaked " << Name << " objects found: " << Message << ":\n"; for (typename std::set::iterator I = Ts.begin(), E = Ts.end(); I != E; ++I) { - llvm_cerr << "\t"; + cerr << "\t"; PrinterTrait::print(*I); - llvm_cerr << "\n"; + cerr << "\n"; } - llvm_cerr << '\n'; + cerr << '\n'; return true; } @@ -123,8 +122,8 @@ void LeakDetector::checkForGarbageImpl(const std::string &Message) { // use non-short-circuit version so that both checks are performed if (getObjects().hasGarbage(Message) | getLLVMObjects().hasGarbage(Message)) - llvm_cerr << "\nThis is probably because you removed an object, but didn't " - << "delete it. Please check your code for memory leaks.\n"; + cerr << "\nThis is probably because you removed an object, but didn't " + << "delete it. Please check your code for memory leaks.\n"; // Clear out results so we don't get duplicate warnings on // next call... diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index d01ef3e4a7..7fdc62a9ea 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -442,7 +442,7 @@ bool FunctionPassManager_New::runOnModule(Module &M) { bool FunctionPassManager_New::run(Function &F) { std::string errstr; if (MP->materializeFunction(&F, &errstr)) { - llvm_cerr << "Error reading bytecode file: " << errstr << "\n"; + cerr << "Error reading bytecode file: " << errstr << "\n"; abort(); } return FPM->runOnFunction(F); diff --git a/lib/VMCore/TypeSymbolTable.cpp b/lib/VMCore/TypeSymbolTable.cpp index 7af7bea407..cfd8cbf935 100644 --- a/lib/VMCore/TypeSymbolTable.cpp +++ b/lib/VMCore/TypeSymbolTable.cpp @@ -66,7 +66,7 @@ Type* TypeSymbolTable::erase(iterator Entry) { #if DEBUG_SYMBOL_TABLE dump(); - llvm_cerr << " Removing Value: " << Result->getName() << "\n"; + cerr << " Removing Value: " << Result->getName() << "\n"; #endif tmap.erase(Entry); @@ -75,7 +75,7 @@ Type* TypeSymbolTable::erase(iterator Entry) { // list... if (Result->isAbstract()) { #if DEBUG_ABSTYPE - llvm_cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n"; + cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n"; #endif cast(Result)->removeAbstractTypeUser(this); } @@ -95,8 +95,8 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) { #if DEBUG_SYMBOL_TABLE dump(); - llvm_cerr << " Inserting type: " << UniqueName << ": " - << T->getDescription() << "\n"; + cerr << " Inserting type: " << UniqueName << ": " + << T->getDescription() << "\n"; #endif // Insert the tmap entry @@ -106,7 +106,7 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) { if (T->isAbstract()) { cast(T)->addAbstractTypeUser(this); #if DEBUG_ABSTYPE - llvm_cerr << "Added abstract type to ST: " << T->getDescription() << "\n"; + cerr << "Added abstract type to ST: " << T->getDescription() << "\n"; #endif } } @@ -152,14 +152,14 @@ void TypeSymbolTable::refineAbstractType(const DerivedType *OldType, for (iterator I = begin(), E = end(); I != E; ++I) { if (I->second == (Type*)OldType) { // FIXME when Types aren't const. #if DEBUG_ABSTYPE - llvm_cerr << "Removing type " << OldType->getDescription() << "\n"; + cerr << "Removing type " << OldType->getDescription() << "\n"; #endif OldType->removeAbstractTypeUser(this); I->second = (Type*)NewType; // TODO FIXME when types aren't const if (NewType->isAbstract()) { #if DEBUG_ABSTYPE - llvm_cerr << "Added type " << NewType->getDescription() << "\n"; + cerr << "Added type " << NewType->getDescription() << "\n"; #endif cast(NewType)->addAbstractTypeUser(this); } @@ -179,13 +179,13 @@ void TypeSymbolTable::typeBecameConcrete(const DerivedType *AbsTy) { } static void DumpTypes(const std::pair& T ) { - llvm_cerr << " '" << T.first << "' = "; + cerr << " '" << T.first << "' = "; T.second->dump(); - llvm_cerr << "\n"; + cerr << "\n"; } void TypeSymbolTable::dump() const { - llvm_cerr << "TypeSymbolPlane: "; + cerr << "TypeSymbolPlane: "; for_each(tmap.begin(), tmap.end(), DumpTypes); } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 4e43a0cf07..cf812a8fff 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -60,7 +60,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Compiler.h" #include -#include #include using namespace llvm; @@ -156,11 +155,11 @@ namespace { // Anonymous namespace for class switch (action) { case AbortProcessAction: msgs << "compilation aborted!\n"; - llvm_cerr << msgs.str(); + cerr << msgs.str(); abort(); case PrintMessageAction: msgs << "verification continues.\n"; - llvm_cerr << msgs.str(); + cerr << msgs.str(); return false; case ReturnStatusAction: msgs << "compilation terminated.\n"; diff --git a/projects/Stacker/tools/stkrc/stkrc.cpp b/projects/Stacker/tools/stkrc/stkrc.cpp index f468330e62..38ed78e02d 100644 --- a/projects/Stacker/tools/stkrc/stkrc.cpp +++ b/projects/Stacker/tools/stkrc/stkrc.cpp @@ -115,7 +115,7 @@ int main(int argc, char **argv) } if (DumpAsm) - llvm_cerr << "Here's the assembly:" << M.get(); + cerr << "Here's the assembly:" << M.get(); if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "-") { // Not stdout? @@ -163,15 +163,15 @@ int main(int argc, char **argv) throw std::string("error opening ") + OutputFilename + "!"; } - llvm_ostream L(*Out); + OStream L(*Out); WriteBytecodeToFile(M.get(), L); } catch (const ParseError &E) { - llvm_cerr << argv[0] << ": " << E.getMessage() << "\n"; + cerr << argv[0] << ": " << E.getMessage() << "\n"; return 1; } } catch (const std::string& msg ) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; return 1; } diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 0ec66baddf..8a19739e28 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -56,7 +56,7 @@ bool BugDriver::writeProgramToFile(const std::string &Filename, std::ofstream Out(Filename.c_str(), io_mode); if (!Out.good()) return true; try { - llvm_ostream L(Out); + OStream L(Out); WriteBytecodeToFile(M ? M : Program, L, /*compression=*/true); } catch (...) { return true; @@ -74,15 +74,15 @@ void BugDriver::EmitProgressBytecode(const std::string &ID, bool NoFlyer) { // std::string Filename = "bugpoint-" + ID + ".bc"; if (writeProgramToFile(Filename)) { - llvm_cerr << "Error opening file '" << Filename << "' for writing!\n"; + cerr << "Error opening file '" << Filename << "' for writing!\n"; return; } - llvm_cout << "Emitted bytecode to '" << Filename << "'\n"; + cout << "Emitted bytecode to '" << Filename << "'\n"; if (NoFlyer || PassesToRun.empty()) return; - llvm_cout << "\n*** You can reproduce the problem with: "; - llvm_cout << "opt " << Filename << " "; - llvm_cout << getPassesString(PassesToRun) << "\n"; + cout << "\n*** You can reproduce the problem with: "; + cout << "opt " << Filename << " "; + cout << getPassesString(PassesToRun) << "\n"; } int BugDriver::runPassesAsChild(const std::vector &Passes) { @@ -91,7 +91,7 @@ int BugDriver::runPassesAsChild(const std::vector &Passes) { std::ios::binary; std::ofstream OutFile(ChildOutput.c_str(), io_mode); if (!OutFile.good()) { - llvm_cerr << "Error opening bytecode file: " << ChildOutput << "\n"; + cerr << "Error opening bytecode file: " << ChildOutput << "\n"; return 1; } @@ -103,14 +103,13 @@ int BugDriver::runPassesAsChild(const std::vector &Passes) { if (Passes[i]->getNormalCtor()) PM.add(Passes[i]->getNormalCtor()()); else - llvm_cerr << "Cannot create pass yet: " << Passes[i]->getPassName() - << "\n"; + cerr << "Cannot create pass yet: " << Passes[i]->getPassName() << "\n"; } // Check that the module is well formed on completion of optimization PM.add(createVerifierPass()); // Write bytecode out to disk as the last step... - llvm_ostream L(OutFile); + OStream L(OutFile); PM.add(new WriteBytecodePass(&L)); // Run all queued passes. @@ -131,12 +130,12 @@ bool BugDriver::runPasses(const std::vector &Passes, std::string &OutputFilename, bool DeleteOutput, bool Quiet) const { // setup the output file name - llvm_cout << std::flush; + cout << std::flush; sys::Path uniqueFilename("bugpoint-output.bc"); std::string ErrMsg; if (uniqueFilename.makeUnique(true, &ErrMsg)) { - llvm_cerr << getToolName() << ": Error making unique filename: " - << ErrMsg << "\n"; + cerr << getToolName() << ": Error making unique filename: " + << ErrMsg << "\n"; return(1); } OutputFilename = uniqueFilename.toString(); @@ -144,18 +143,18 @@ bool BugDriver::runPasses(const std::vector &Passes, // set up the input file name sys::Path inputFilename("bugpoint-input.bc"); if (inputFilename.makeUnique(true, &ErrMsg)) { - llvm_cerr << getToolName() << ": Error making unique filename: " - << ErrMsg << "\n"; + cerr << getToolName() << ": Error making unique filename: " + << ErrMsg << "\n"; return(1); } std::ios::openmode io_mode = std::ios::out | std::ios::trunc | std::ios::binary; std::ofstream InFile(inputFilename.c_str(), io_mode); if (!InFile.good()) { - llvm_cerr << "Error opening bytecode file: " << inputFilename << "\n"; + cerr << "Error opening bytecode file: " << inputFilename << "\n"; return(1); } - llvm_ostream L(InFile); + OStream L(InFile); WriteBytecodeToFile(Program,L,false); InFile.close(); @@ -207,17 +206,17 @@ bool BugDriver::runPasses(const std::vector &Passes, if (!Quiet) { if (result == 0) - llvm_cout << "Success!\n"; + cout << "Success!\n"; else if (result > 0) - llvm_cout << "Exited with error code '" << result << "'\n"; + cout << "Exited with error code '" << result << "'\n"; else if (result < 0) { if (result == -1) - llvm_cout << "Execute failed: " << ErrMsg << "\n"; + cout << "Execute failed: " << ErrMsg << "\n"; else - llvm_cout << "Crashed with signal #" << abs(result) << "\n"; + cout << "Crashed with signal #" << abs(result) << "\n"; } if (result & 0x01000000) - llvm_cout << "Dumped core\n"; + cout << "Dumped core\n"; } // Was the child successful? @@ -235,8 +234,8 @@ Module *BugDriver::runPassesOn(Module *M, std::string BytecodeResult; if (runPasses(Passes, BytecodeResult, false/*delete*/, true/*quiet*/)) { if (AutoDebugCrashes) { - llvm_cerr << " Error running this sequence of passes" - << " on the input program!\n"; + cerr << " Error running this sequence of passes" + << " on the input program!\n"; delete OldProgram; EmitProgressBytecode("pass-error", false); exit(debugOptimizerCrash()); @@ -250,8 +249,8 @@ Module *BugDriver::runPassesOn(Module *M, Module *Ret = ParseInputFile(BytecodeResult); if (Ret == 0) { - llvm_cerr << getToolName() << ": Error reading bytecode file '" - << BytecodeResult << "'!\n"; + cerr << getToolName() << ": Error reading bytecode file '" + << BytecodeResult << "'!\n"; exit(1); } sys::Path(BytecodeResult).eraseFromDisk(); // No longer need the file on disk diff --git a/tools/gccas/gccas.cpp b/tools/gccas/gccas.cpp index a898d4cd77..2d08f36cc8 100644 --- a/tools/gccas/gccas.cpp +++ b/tools/gccas/gccas.cpp @@ -143,7 +143,7 @@ int main(int argc, char **argv) { ParseError Err; std::auto_ptr M(ParseAssemblyFile(InputFilename,&Err)); if (M.get() == 0) { - llvm_cerr << argv[0] << ": " << Err.getMessage() << "\n"; + cerr << argv[0] << ": " << Err.getMessage() << "\n"; return 1; } @@ -178,7 +178,7 @@ int main(int argc, char **argv) { if (!Out->good()) { - llvm_cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } @@ -197,7 +197,7 @@ int main(int argc, char **argv) { Passes.add(createVerifierPass()); // Write bytecode to file... - llvm_ostream L(*Out); + OStream L(*Out); Passes.add(new WriteBytecodePass(&L,false,!NoCompress)); // Run our queue of passes all at once now, efficiently. @@ -206,9 +206,9 @@ int main(int argc, char **argv) { if (Out != &std::cout) delete Out; return 0; } catch (const std::string& msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp index c84c7d3640..13bda75b42 100644 --- a/tools/gccld/GenerateCode.cpp +++ b/tools/gccld/GenerateCode.cpp @@ -123,10 +123,10 @@ static void RemoveEnv(const char * name, char ** const envp) { } static void dumpArgs(const char **args) { - llvm_cerr << *args++; + cerr << *args++; while (*args) - llvm_cerr << ' ' << *args++; - llvm_cerr << '\n' << std::flush; + cerr << ' ' << *args++; + cerr << '\n' << std::flush; } static inline void addPass(PassManager &PM, Pass *P) { @@ -283,7 +283,7 @@ int llvm::GenerateBytecode(Module *M, int StripLevel, bool Internalize, Passes.add(createVerifierPass()); // Add the pass that writes bytecode to the output file... - llvm_ostream L(*Out); + OStream L(*Out); addPass(Passes, new WriteBytecodePass(&L, false, !NoCompress)); // Run our queue of passes all at once now, efficiently. diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp index 46ffac1122..77ab03c027 100644 --- a/tools/gccld/gccld.cpp +++ b/tools/gccld/gccld.cpp @@ -127,7 +127,7 @@ namespace { /// Message - The message to print to standard error. /// static int PrintAndReturn(const char *progname, const std::string &Message) { - llvm_cerr << progname << ": " << Message << "\n"; + cerr << progname << ": " << Message << "\n"; return 1; } @@ -141,11 +141,11 @@ static void EmitShellScript(char **argv) { std::string ErrMsg; sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]); if (llvmstub.isEmpty()) { - llvm_cerr << "Could not find llvm-stub.exe executable!\n"; + cerr << "Could not find llvm-stub.exe executable!\n"; exit(1); } if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; exit(1); } @@ -326,18 +326,18 @@ int main(int argc, char **argv, char **envp ) { return PrintAndReturn(argv[0], "Failed to find gcc"); // Generate an assembly language file for the bytecode. - if (Verbose) llvm_cout << "Generating Assembly Code\n"; + if (Verbose) cout << "Generating Assembly Code\n"; std::string ErrMsg; if (0 != GenerateAssembly( AssemblyFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } - if (Verbose) llvm_cout << "Generating Native Code\n"; + if (Verbose) cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(), LibPaths, Libraries, gcc, envp, LinkAsLibrary, NoInternalize, RPath, SOName, ErrMsg, Verbose) ) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } @@ -366,18 +366,18 @@ int main(int argc, char **argv, char **envp ) { return PrintAndReturn(argv[0], "Failed to find gcc"); // Generate an assembly language file for the bytecode. - if (Verbose) llvm_cout << "Generating C Source Code\n"; + if (Verbose) cout << "Generating C Source Code\n"; std::string ErrMsg; if (0 != GenerateCFile( CFile.toString(), RealBytecodeOutput, llc, ErrMsg, Verbose)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } - if (Verbose) llvm_cout << "Generating Native Code\n"; + if (Verbose) cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, CFile.toString(), LibPaths, Libraries, gcc, envp, LinkAsLibrary, NoInternalize, RPath, SOName, ErrMsg, Verbose)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } @@ -394,11 +394,11 @@ int main(int argc, char **argv, char **envp ) { // Make the bytecode file readable and directly executable in LLEE std::string ErrMsg; if (sys::Path(RealBytecodeOutput).makeExecutableOnDisk(&ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } if (sys::Path(RealBytecodeOutput).makeReadableOnDisk(&ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } } @@ -406,18 +406,18 @@ int main(int argc, char **argv, char **envp ) { // Make the output, whether native or script, executable as well... std::string ErrMsg; if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } } catch (const char*msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; exitCode = 1; } catch (const std::string& msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; exitCode = 2; } catch (...) { // This really shouldn't happen, but just in case .... - llvm_cerr << argv[0] << ": An unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": An unexpected unknown exception occurred.\n"; exitCode = 3; } diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index c1c0a0c4a9..dd29bc19e8 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -62,29 +62,29 @@ int main(int argc, char **argv) { ParseError Err; std::auto_ptr M(ParseAssemblyFile(InputFilename,&Err)); if (M.get() == 0) { - llvm_cerr << argv[0] << ": " << Err.getMessage() << "\n"; + cerr << argv[0] << ": " << Err.getMessage() << "\n"; return 1; } if (!DisableVerify) { std::string Err; if (verifyModule(*M.get(), ReturnStatusAction, &Err)) { - llvm_cerr << argv[0] - << ": assembly parsed, but does not verify as correct!\n"; - llvm_cerr << Err; + cerr << argv[0] + << ": assembly parsed, but does not verify as correct!\n"; + cerr << Err; return 1; } } - if (DumpAsm) llvm_cerr << "Here's the assembly:\n" << *M.get(); + if (DumpAsm) cerr << "Here's the assembly:\n" << *M.get(); if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "-") { // Not stdout? if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - llvm_cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; return 1; } Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | @@ -110,9 +110,9 @@ int main(int argc, char **argv) { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - llvm_cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; return 1; } @@ -125,19 +125,19 @@ int main(int argc, char **argv) { } if (!Out->good()) { - llvm_cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } if (Force || !CheckBytecodeOutputToConsole(Out,true)) { - llvm_ostream L(*Out); + OStream L(*Out); WriteBytecodeToFile(M.get(), L, !NoCompress); } } catch (const std::string& msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; exitCode = 1; } catch (...) { - llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; exitCode = 1; } diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 8d9e9aace0..d2022fd9f8 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -50,11 +50,11 @@ int main(int argc, char **argv) { std::auto_ptr M(ParseBytecodeFile(InputFilename, &ErrorMessage)); if (M.get() == 0) { - llvm_cerr << argv[0] << ": "; + cerr << argv[0] << ": "; if (ErrorMessage.size()) - llvm_cerr << ErrorMessage << "\n"; + cerr << ErrorMessage << "\n"; else - llvm_cerr << "bytecode didn't read correctly.\n"; + cerr << "bytecode didn't read correctly.\n"; return 1; } @@ -62,8 +62,8 @@ int main(int argc, char **argv) { if (OutputFilename != "-") { // Not stdout? if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - llvm_cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists! Sending to standard output.\n"; + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists! Sending to standard output.\n"; } else { Out = new std::ofstream(OutputFilename.c_str()); } @@ -83,8 +83,8 @@ int main(int argc, char **argv) { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - llvm_cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists! Sending to standard output.\n"; + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists! Sending to standard output.\n"; } else { Out = new std::ofstream(OutputFilename.c_str()); @@ -96,14 +96,14 @@ int main(int argc, char **argv) { } if (!Out->good()) { - llvm_cerr << argv[0] << ": error opening " << OutputFilename - << ": sending to stdout instead!\n"; + cerr << argv[0] << ": error opening " << OutputFilename + << ": sending to stdout instead!\n"; Out = &std::cout; } // All that llvm-dis does is write the assembly to a file. PassManager Passes; - llvm_ostream L(*Out); + OStream L(*Out); Passes.add(new PrintModulePass(&L)); Passes.run(*M.get()); @@ -113,9 +113,9 @@ int main(int argc, char **argv) { } return 0; } catch (const std::string& msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index a6edc721c9..882455fc27 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -55,15 +55,15 @@ int main(int argc, char **argv) { std::auto_ptr M(ParseBytecodeFile(InputFilename)); if (M.get() == 0) { - llvm_cerr << argv[0] << ": bytecode didn't read correctly.\n"; + cerr << argv[0] << ": bytecode didn't read correctly.\n"; return 1; } // Figure out which function we should extract Function *F = M.get()->getNamedFunction(ExtractFunc); if (F == 0) { - llvm_cerr << argv[0] << ": program doesn't contain function named '" - << ExtractFunc << "'!\n"; + cerr << argv[0] << ": program doesn't contain function named '" + << ExtractFunc << "'!\n"; return 1; } @@ -82,9 +82,9 @@ int main(int argc, char **argv) { if (OutputFilename != "-") { // Not stdout? if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - llvm_cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; return 1; } std::ios::openmode io_mode = std::ios::out | std::ios::trunc | @@ -95,7 +95,7 @@ int main(int argc, char **argv) { Out = &std::cout; } - llvm_ostream L(*Out); + OStream L(*Out); Passes.add(new WriteBytecodePass(&L)); // Write bytecode to file... Passes.run(*M.get()); @@ -103,9 +103,9 @@ int main(int argc, char **argv) { delete Out; return 0; } catch (const std::string& msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 20ea463633..2e599064a5 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -109,7 +109,7 @@ static std::string progname; /// Message - The message to print to standard error. /// static int PrintAndReturn(const std::string &Message) { - llvm_cerr << progname << ": " << Message << "\n"; + cerr << progname << ": " << Message << "\n"; return 1; } @@ -208,7 +208,7 @@ void GenerateBytecode(Module* M, const std::string& FileName) { sys::RemoveFileOnSignal(sys::Path(FileName)); // Write it out - llvm_ostream L(Out); + OStream L(Out); WriteBytecodeToFile(M, L, !DisableCompression); // Close the bytecode file. @@ -352,12 +352,12 @@ static void EmitShellScript(char **argv) { std::string ErrMsg; sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]); if (llvmstub.isEmpty()) { - llvm_cerr << "Could not find llvm-stub.exe executable!\n"; + cerr << "Could not find llvm-stub.exe executable!\n"; exit(1); } if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; exit(1); } @@ -520,14 +520,14 @@ int main(int argc, char **argv, char **envp) { sys::Path target(RealBytecodeOutput); target.eraseFromDisk(); if (tmp_output.renamePathOnDisk(target, &ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } } else return PrintAndReturn( "Post-link optimization output is not bytecode"); } else { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 2; } } @@ -556,18 +556,18 @@ int main(int argc, char **argv, char **envp) { return PrintAndReturn("Failed to find gcc"); // Generate an assembly language file for the bytecode. - if (Verbose) llvm_cout << "Generating Assembly Code\n"; + if (Verbose) cout << "Generating Assembly Code\n"; std::string ErrMsg; if (0 != GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc, ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } - if (Verbose) llvm_cout << "Generating Native Code\n"; + if (Verbose) cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(), LinkItems,gcc,envp,ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } @@ -591,18 +591,18 @@ int main(int argc, char **argv, char **envp) { return PrintAndReturn("Failed to find gcc"); // Generate an assembly language file for the bytecode. - if (Verbose) llvm_cout << "Generating Assembly Code\n"; + if (Verbose) cout << "Generating Assembly Code\n"; std::string ErrMsg; if (0 != GenerateCFile( CFile.toString(), RealBytecodeOutput, llc, ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } - if (Verbose) llvm_cout << "Generating Native Code\n"; + if (Verbose) cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, CFile.toString(), LinkItems, gcc, envp, ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } @@ -616,26 +616,26 @@ int main(int argc, char **argv, char **envp) { // Make the script executable... std::string ErrMsg; if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } // Make the bytecode file readable and directly executable in LLEE as well if (sys::Path(RealBytecodeOutput).makeExecutableOnDisk(&ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } if (sys::Path(RealBytecodeOutput).makeReadableOnDisk(&ErrMsg)) { - llvm_cerr << argv[0] << ": " << ErrMsg << "\n"; + cerr << argv[0] << ": " << ErrMsg << "\n"; return 1; } } return 0; } catch (const std::string& msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index 35fce1e1c5..be556d1ed2 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -52,24 +52,23 @@ static cl::opt NoCompress("disable-compression", cl::init(false), static inline std::auto_ptr LoadFile(const std::string &FN) { sys::Path Filename; if (!Filename.set(FN)) { - llvm_cerr << "Invalid file name: '" << FN << "'\n"; + cerr << "Invalid file name: '" << FN << "'\n"; return std::auto_ptr(); } std::string ErrorMessage; if (Filename.exists()) { - if (Verbose) llvm_cerr << "Loading '" << Filename.c_str() << "'\n"; + if (Verbose) cerr << "Loading '" << Filename.c_str() << "'\n"; Module* Result = ParseBytecodeFile(Filename.toString(), &ErrorMessage); if (Result) return std::auto_ptr(Result); // Load successful! if (Verbose) { - llvm_cerr << "Error opening bytecode file: '" << Filename.c_str() << "'"; - if (ErrorMessage.size()) llvm_cerr << ": " << ErrorMessage; - llvm_cerr << "\n"; + cerr << "Error opening bytecode file: '" << Filename.c_str() << "'"; + if (ErrorMessage.size()) cerr << ": " << ErrorMessage; + cerr << "\n"; } } else { - llvm_cerr << "Bytecode file: '" << Filename.c_str() - << "' does not exist.\n"; + cerr << "Bytecode file: '" << Filename.c_str() << "' does not exist.\n"; } return std::auto_ptr(); @@ -87,24 +86,23 @@ int main(int argc, char **argv) { std::auto_ptr Composite(LoadFile(InputFilenames[BaseArg])); if (Composite.get() == 0) { - llvm_cerr << argv[0] << ": error loading file '" - << InputFilenames[BaseArg] << "'\n"; + cerr << argv[0] << ": error loading file '" + << InputFilenames[BaseArg] << "'\n"; return 1; } for (unsigned i = BaseArg+1; i < InputFilenames.size(); ++i) { std::auto_ptr M(LoadFile(InputFilenames[i])); if (M.get() == 0) { - llvm_cerr << argv[0] << ": error loading file '" - << InputFilenames[i] << "'\n"; + cerr << argv[0] << ": error loading file '" <good()) { - llvm_cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n"; + cerr << argv[0] << ": error opening '" << OutputFilename << "'!\n"; return 1; } @@ -138,20 +136,20 @@ int main(int argc, char **argv) { } if (verifyModule(*Composite.get())) { - llvm_cerr << argv[0] << ": linked module is broken!\n"; + cerr << argv[0] << ": linked module is broken!\n"; return 1; } - if (Verbose) llvm_cerr << "Writing bytecode...\n"; - llvm_ostream L(*Out); + if (Verbose) cerr << "Writing bytecode...\n"; + OStream L(*Out); WriteBytecodeToFile(Composite.get(), L, !NoCompress); if (Out != &std::cout) delete Out; return 0; } catch (const std::string& msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } diff --git a/tools/llvm-upgrade/llvm-upgrade.cpp b/tools/llvm-upgrade/llvm-upgrade.cpp index d39aa92d12..65ee452e1c 100644 --- a/tools/llvm-upgrade/llvm-upgrade.cpp +++ b/tools/llvm-upgrade/llvm-upgrade.cpp @@ -57,9 +57,9 @@ int main(int argc, char **argv) { if (OutputFilename != "-") { // Not stdout? if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - llvm_cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; return 1; } Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | @@ -84,9 +84,9 @@ int main(int argc, char **argv) { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - llvm_cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; return 1; } @@ -106,22 +106,22 @@ int main(int argc, char **argv) { } if (!Out->good()) { - llvm_cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } if (!In->good()) { - llvm_cerr << argv[0] << ": error opening " << InputFilename << "!\n"; + cerr << argv[0] << ": error opening " << InputFilename << "!\n"; return 1; } UpgradeAssembly(InputFilename, *In, *Out, Debug); } catch (const std::string& caught_message) { - llvm_cerr << argv[0] << ": " << caught_message << "\n"; + cerr << argv[0] << ": " << caught_message << "\n"; exitCode = 1; } catch (...) { - llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; exitCode = 1; } diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 65fcef62d0..430829712c 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -361,7 +361,7 @@ LTO::optimizeModules(const std::string &OutputFilename, std::string tempFileName(FinalOutputPath.c_str()); tempFileName += "0.bc"; std::ofstream Out(tempFileName.c_str(), io_mode); - llvm_ostream L(Out); + OStream L(Out); WriteBytecodeToFile(bigOne, L, true); } @@ -378,17 +378,17 @@ LTO::optimizeModules(const std::string &OutputFilename, std::string ErrMsg; sys::Path TempDir = sys::Path::GetTemporaryDirectory(&ErrMsg); if (TempDir.isEmpty()) { - llvm_cerr << "lto: " << ErrMsg << "\n"; + cerr << "lto: " << ErrMsg << "\n"; return LTO_WRITE_FAILURE; } sys::Path tmpAsmFilePath(TempDir); if (!tmpAsmFilePath.appendComponent("lto")) { - llvm_cerr << "lto: " << ErrMsg << "\n"; + cerr << "lto: " << ErrMsg << "\n"; TempDir.eraseFromDisk(true); return LTO_WRITE_FAILURE; } if (tmpAsmFilePath.createTemporaryFileOnDisk(&ErrMsg)) { - llvm_cerr << "lto: " << ErrMsg << "\n"; + cerr << "lto: " << ErrMsg << "\n"; TempDir.eraseFromDisk(true); return LTO_WRITE_FAILURE; } @@ -415,7 +415,7 @@ LTO::optimizeModules(const std::string &OutputFilename, std::string tempFileName(FinalOutputPath.c_str()); tempFileName += "1.bc"; std::ofstream Out(tempFileName.c_str(), io_mode); - llvm_ostream L(Out); + OStream L(Out); WriteBytecodeToFile(bigOne, L, true); } @@ -445,7 +445,7 @@ LTO::optimizeModules(const std::string &OutputFilename, args.push_back(0); if (sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 1, &ErrMsg)) { - llvm_cerr << "lto: " << ErrMsg << "\n"; + cerr << "lto: " << ErrMsg << "\n"; return LTO_ASM_FAILURE; } diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 6afdc6834a..7d5dd2113d 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -87,9 +87,8 @@ struct ModulePassPrinter : public ModulePass { virtual bool runOnModule(Module &M) { if (!Quiet) { - llvm_cout << "Printing analysis '" << PassToPrint->getPassName() - << "':\n"; - getAnalysisID(PassToPrint).print(llvm_cout, &M); + cout << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; + getAnalysisID(PassToPrint).print(cout, &M); } // Get and print pass... @@ -110,11 +109,11 @@ struct FunctionPassPrinter : public FunctionPass { virtual bool runOnFunction(Function &F) { if (!Quiet) { - llvm_cout << "Printing analysis '" << PassToPrint->getPassName() - << "' for function '" << F.getName() << "':\n"; + cout << "Printing analysis '" << PassToPrint->getPassName() + << "' for function '" << F.getName() << "':\n"; } // Get and print pass... - getAnalysisID(PassToPrint).print(llvm_cout, F.getParent()); + getAnalysisID(PassToPrint).print(cout, F.getParent()); return false; } @@ -132,13 +131,12 @@ struct BasicBlockPassPrinter : public BasicBlockPass { virtual bool runOnBasicBlock(BasicBlock &BB) { if (!Quiet) { - llvm_cout << "Printing Analysis info for BasicBlock '" << BB.getName() - << "': Pass " << PassToPrint->getPassName() << ":\n"; + cout << "Printing Analysis info for BasicBlock '" << BB.getName() + << "': Pass " << PassToPrint->getPassName() << ":\n"; } // Get and print pass... - getAnalysisID(PassToPrint).print( - llvm_cout, BB.getParent()->getParent()); + getAnalysisID(PassToPrint).print(cout, BB.getParent()->getParent()); return false; } @@ -172,11 +170,11 @@ int main(int argc, char **argv) { // Load the input module... std::auto_ptr M(ParseBytecodeFile(InputFilename, &ErrorMessage)); if (M.get() == 0) { - llvm_cerr << argv[0] << ": "; + cerr << argv[0] << ": "; if (ErrorMessage.size()) - llvm_cerr << ErrorMessage << "\n"; + cerr << ErrorMessage << "\n"; else - llvm_cerr << "bytecode didn't read correctly.\n"; + cerr << "bytecode didn't read correctly.\n"; return 1; } @@ -186,9 +184,9 @@ int main(int argc, char **argv) { if (OutputFilename != "-") { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - llvm_cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; + cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; return 1; } std::ios::openmode io_mode = std::ios::out | std::ios::trunc | @@ -196,7 +194,7 @@ int main(int argc, char **argv) { Out = new std::ofstream(OutputFilename.c_str(), io_mode); if (!Out->good()) { - llvm_cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } @@ -227,8 +225,8 @@ int main(int argc, char **argv) { if (PassInf->getNormalCtor()) P = PassInf->getNormalCtor()(); else - llvm_cerr << argv[0] << ": cannot create pass: " - << PassInf->getPassName() << "\n"; + cerr << argv[0] << ": cannot create pass: " + << PassInf->getPassName() << "\n"; if (P) { Passes.add(P); @@ -243,7 +241,7 @@ int main(int argc, char **argv) { } if (PrintEachXForm) - Passes.add(new PrintModulePass(&llvm_cerr)); + Passes.add(new PrintModulePass(&cerr)); } // Check that the module is well formed on completion of optimization @@ -251,7 +249,7 @@ int main(int argc, char **argv) { Passes.add(createVerifierPass()); // Write bytecode out to disk or cout as the last step... - llvm_ostream L(*Out); + OStream L(*Out); if (!NoOutput && !AnalyzeOnly) Passes.add(new WriteBytecodePass(&L, false, !NoCompress)); @@ -261,9 +259,9 @@ int main(int argc, char **argv) { return 0; } catch (const std::string& msg) { - llvm_cerr << argv[0] << ": " << msg << "\n"; + cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } -- cgit v1.2.3-70-g09d2 From db8d2bed6a0ef890b81fabb014bfcb678e891695 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sun, 31 Dec 2006 05:50:28 +0000 Subject: For PR950: Convert signed integer types to signless. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32786 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/Fibonacci/fibonacci.cpp | 10 +-- examples/HowToUseJIT/HowToUseJIT.cpp | 10 +-- examples/ModuleMaker/ModuleMaker.cpp | 6 +- examples/ParallelJIT/ParallelJIT.cpp | 14 ++-- projects/Stacker/lib/compiler/StackerCompiler.cpp | 88 +++++++++++------------ utils/TableGen/CodeGenIntrinsics.h | 2 +- 6 files changed, 65 insertions(+), 65 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp index 96aeb6340a..80b7f32226 100644 --- a/examples/Fibonacci/fibonacci.cpp +++ b/examples/Fibonacci/fibonacci.cpp @@ -38,15 +38,15 @@ using namespace llvm; static Function *CreateFibFunction(Module *M) { // Create the fib function and insert it into module M. This function is said // to return an int and take an int parameter. - Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy, + Function *FibF = M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty, (Type *)0); // Add a basic block to the function. BasicBlock *BB = new BasicBlock("EntryBlock", FibF); // Get pointers to the constants. - Value *One = ConstantInt::get(Type::IntTy, 1); - Value *Two = ConstantInt::get(Type::IntTy, 2); + Value *One = ConstantInt::get(Type::Int32Ty, 1); + Value *Two = ConstantInt::get(Type::Int32Ty, 2); // Get pointer to the integer argument of the add1 function... Argument *ArgX = FibF->arg_begin(); // Get the arg. @@ -111,10 +111,10 @@ int main(int argc, char **argv) { // Call the Fibonacci function with argument n: std::vector Args(1); - Args[0].IntVal = n; + Args[0].Int32Val = n; GenericValue GV = EE->runFunction(FibF, Args); // import result of execution - std::cout << "Result: " << GV.IntVal << "\n"; + std::cout << "Result: " << GV.Int32Val << "\n"; return 0; } diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp index 8023cc7a18..438ed0616c 100644 --- a/examples/HowToUseJIT/HowToUseJIT.cpp +++ b/examples/HowToUseJIT/HowToUseJIT.cpp @@ -52,7 +52,7 @@ int main() { // Create the add1 function entry and insert this entry into module M. The // function will have a return type of "int" and take an argument of "int". // The '0' terminates the list of argument types. - Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy, + Function *Add1F = M->getOrInsertFunction("add1", Type::Int32Ty, Type::Int32Ty, (Type *)0); // Add a basic block to the function. As before, it automatically inserts @@ -60,7 +60,7 @@ int main() { BasicBlock *BB = new BasicBlock("EntryBlock", Add1F); // Get pointers to the constant `1'. - Value *One = ConstantInt::get(Type::IntTy, 1); + Value *One = ConstantInt::get(Type::Int32Ty, 1); // Get pointers to the integer argument of the add1 function... assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg @@ -78,13 +78,13 @@ int main() { // Now we going to create function `foo', which returns an int and takes no // arguments. - Function *FooF = M->getOrInsertFunction("foo", Type::IntTy, (Type *)0); + Function *FooF = M->getOrInsertFunction("foo", Type::Int32Ty, (Type *)0); // Add a basic block to the FooF function. BB = new BasicBlock("EntryBlock", FooF); // Get pointers to the constant `10'. - Value *Ten = ConstantInt::get(Type::IntTy, 10); + Value *Ten = ConstantInt::get(Type::Int32Ty, 10); // Pass Ten to the call call: std::vector Params; @@ -107,6 +107,6 @@ int main() { GenericValue gv = EE->runFunction(FooF, noargs); // Import result of execution: - std::cout << "Result: " << gv.IntVal << "\n"; + std::cout << "Result: " << gv.Int32Val << "\n"; return 0; } diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 0c9a61853e..4983597952 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -27,7 +27,7 @@ int main() { Module *M = new Module("test"); // Create the main function: first create the type 'int ()' - FunctionType *FT = FunctionType::get(Type::IntTy, std::vector(), + FunctionType *FT = FunctionType::get(Type::Int32Ty, std::vector(), /*not vararg*/false); // By passing a module as the last parameter to the Function constructor, @@ -39,8 +39,8 @@ int main() { BasicBlock *BB = new BasicBlock("EntryBlock", F); // Get pointers to the constant integers... - Value *Two = ConstantInt::get(Type::IntTy, 2); - Value *Three = ConstantInt::get(Type::IntTy, 3); + Value *Two = ConstantInt::get(Type::Int32Ty, 2); + Value *Three = ConstantInt::get(Type::Int32Ty, 3); // Create the add instruction... does not insert... Instruction *Add = BinaryOperator::create(Instruction::Add, Two, Three, diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp index 7f2e1bfc10..67d777049f 100644 --- a/examples/ParallelJIT/ParallelJIT.cpp +++ b/examples/ParallelJIT/ParallelJIT.cpp @@ -34,7 +34,7 @@ static Function* createAdd1(Module* M) // Create the add1 function entry and insert this entry into module M. The // function will have a return type of "int" and take an argument of "int". // The '0' terminates the list of argument types. - Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy, + Function *Add1F = M->getOrInsertFunction("add1", Type::Int32Ty, Type::Int32Ty, (Type *)0); // Add a basic block to the function. As before, it automatically inserts @@ -42,7 +42,7 @@ static Function* createAdd1(Module* M) BasicBlock *BB = new BasicBlock("EntryBlock", Add1F); // Get pointers to the constant `1'. - Value *One = ConstantInt::get(Type::IntTy, 1); + Value *One = ConstantInt::get(Type::Int32Ty, 1); // Get pointers to the integer argument of the add1 function... assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg @@ -63,15 +63,15 @@ static Function *CreateFibFunction(Module *M) { // Create the fib function and insert it into module M. This function is said // to return an int and take an int parameter. - Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy, + Function *FibF = M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty, (Type *)0); // Add a basic block to the function. BasicBlock *BB = new BasicBlock("EntryBlock", FibF); // Get pointers to the constants. - Value *One = ConstantInt::get(Type::IntTy, 1); - Value *Two = ConstantInt::get(Type::IntTy, 2); + Value *One = ConstantInt::get(Type::Int32Ty, 1); + Value *Two = ConstantInt::get(Type::Int32Ty, 2); // Get pointer to the integer argument of the add1 function... Argument *ArgX = FibF->arg_begin(); // Get the arg. @@ -221,12 +221,12 @@ void* callFunc( void* param ) // Call the `foo' function with no arguments: std::vector Args(1); - Args[0].IntVal = p->value; + Args[0].Int32Val = p->value; synchronize.block(); // wait until other threads are at this point GenericValue gv = p->EE->runFunction(p->F, Args); - return (void*) intptr_t(gv.IntVal); + return (void*) intptr_t(gv.Int32Val); } int main() diff --git a/projects/Stacker/lib/compiler/StackerCompiler.cpp b/projects/Stacker/lib/compiler/StackerCompiler.cpp index 2f01fbbb0b..440de0c7ad 100644 --- a/projects/Stacker/lib/compiler/StackerCompiler.cpp +++ b/projects/Stacker/lib/compiler/StackerCompiler.cpp @@ -122,7 +122,7 @@ StackerCompiler::compile( // Create a type to represent the stack. This is the same as the LLVM // Assembly type [ 256 x long ] - stack_type = ArrayType::get( Type::LongTy, stack_size ); + stack_type = ArrayType::get( Type::Int64Ty, stack_size ); // Create a global variable for the stack. Note the use of appending // linkage linkage so that multiple modules will make the stack larger. @@ -141,10 +141,10 @@ StackerCompiler::compile( // of LinkOnce linkage. Only one copy of _index_ will be retained // after linking TheIndex = new GlobalVariable( - /*type=*/Type::LongTy, + /*type=*/Type::Int64Ty, /*isConstant=*/false, /*Linkage=*/GlobalValue::LinkOnceLinkage, - /*initializer=*/ Constant::getNullValue(Type::LongTy), + /*initializer=*/ Constant::getNullValue(Type::Int64Ty), /*name=*/"_index_", /*parent=*/TheModule ); @@ -155,9 +155,9 @@ StackerCompiler::compile( DefinitionType = FunctionType::get( Type::VoidTy, params, false ); // Create a function for printf(3) - params.push_back( PointerType::get( Type::SByteTy ) ); + params.push_back( PointerType::get( Type::Int8Ty ) ); FunctionType* printf_type = - FunctionType::get( Type::IntTy, params, true ); + FunctionType::get( Type::Int32Ty, params, true ); ThePrintf = new Function( printf_type, GlobalValue::ExternalLinkage, "printf", TheModule); @@ -167,7 +167,7 @@ StackerCompiler::compile( // Create a function for exit(3) params.clear(); - params.push_back( Type::IntTy ); + params.push_back( Type::Int32Ty ); FunctionType* exit_type = FunctionType::get( Type::VoidTy, params, false ); TheExit = new Function( @@ -175,7 +175,7 @@ StackerCompiler::compile( Constant* str_format = ConstantArray::get("%s"); StrFormat = new GlobalVariable( - /*type=*/ArrayType::get( Type::SByteTy, 3 ), + /*type=*/ArrayType::get( Type::Int8Ty, 3 ), /*isConstant=*/true, /*Linkage=*/GlobalValue::LinkOnceLinkage, /*initializer=*/str_format, @@ -185,7 +185,7 @@ StackerCompiler::compile( Constant* in_str_format = ConstantArray::get(" %as"); InStrFormat = new GlobalVariable( - /*type=*/ArrayType::get( Type::SByteTy, 5 ), + /*type=*/ArrayType::get( Type::Int8Ty, 5 ), /*isConstant=*/true, /*Linkage=*/GlobalValue::LinkOnceLinkage, /*initializer=*/in_str_format, @@ -195,7 +195,7 @@ StackerCompiler::compile( Constant* num_format = ConstantArray::get("%d"); NumFormat = new GlobalVariable( - /*type=*/ArrayType::get( Type::SByteTy, 3 ), + /*type=*/ArrayType::get( Type::Int8Ty, 3 ), /*isConstant=*/true, /*Linkage=*/GlobalValue::LinkOnceLinkage, /*initializer=*/num_format, @@ -205,7 +205,7 @@ StackerCompiler::compile( Constant* in_num_format = ConstantArray::get(" %d"); InNumFormat = new GlobalVariable( - /*type=*/ArrayType::get( Type::SByteTy, 4 ), + /*type=*/ArrayType::get( Type::Int8Ty, 4 ), /*isConstant=*/true, /*Linkage=*/GlobalValue::LinkOnceLinkage, /*initializer=*/in_num_format, @@ -215,7 +215,7 @@ StackerCompiler::compile( Constant* chr_format = ConstantArray::get("%c"); ChrFormat = new GlobalVariable( - /*type=*/ArrayType::get( Type::SByteTy, 3 ), + /*type=*/ArrayType::get( Type::Int8Ty, 3 ), /*isConstant=*/true, /*Linkage=*/GlobalValue::LinkOnceLinkage, /*initializer=*/chr_format, @@ -225,7 +225,7 @@ StackerCompiler::compile( Constant* in_chr_format = ConstantArray::get(" %c"); InChrFormat = new GlobalVariable( - /*type=*/ArrayType::get( Type::SByteTy, 4 ), + /*type=*/ArrayType::get( Type::Int8Ty, 4 ), /*isConstant=*/true, /*Linkage=*/GlobalValue::LinkOnceLinkage, /*initializer=*/in_chr_format, @@ -234,12 +234,12 @@ StackerCompiler::compile( ); // Get some constants so we aren't always creating them - Zero = ConstantInt::get( Type::LongTy, 0 ); - One = ConstantInt::get( Type::LongTy, 1 ); - Two = ConstantInt::get( Type::LongTy, 2 ); - Three = ConstantInt::get( Type::LongTy, 3 ); - Four = ConstantInt::get( Type::LongTy, 4 ); - Five = ConstantInt::get( Type::LongTy, 5 ); + Zero = ConstantInt::get( Type::Int64Ty, 0 ); + One = ConstantInt::get( Type::Int64Ty, 1 ); + Two = ConstantInt::get( Type::Int64Ty, 2 ); + Three = ConstantInt::get( Type::Int64Ty, 3 ); + Four = ConstantInt::get( Type::Int64Ty, 4 ); + Five = ConstantInt::get( Type::Int64Ty, 5 ); // Reset the current line number Stackerlineno = 1; @@ -363,7 +363,7 @@ StackerCompiler::incr_stack_index( BasicBlock* bb, Value* ival = 0 ) // Increment the loaded index value if ( ival == 0 ) ival = One; - CastInst* caster = CastInst::createSExtOrBitCast( ival, Type::LongTy ); + CastInst* caster = CastInst::createSExtOrBitCast( ival, Type::Int64Ty ); bb->getInstList().push_back( caster ); BinaryOperator* addop = BinaryOperator::create( Instruction::Add, loadop, caster); @@ -384,7 +384,7 @@ StackerCompiler::decr_stack_index( BasicBlock* bb, Value* ival = 0 ) // Decrement the loaded index value if ( ival == 0 ) ival = One; - CastInst* caster = CastInst::createSExtOrBitCast( ival, Type::LongTy ); + CastInst* caster = CastInst::createSExtOrBitCast( ival, Type::Int64Ty ); bb->getInstList().push_back( caster ); BinaryOperator* subop = BinaryOperator::create( Instruction::Sub, loadop, caster); @@ -418,7 +418,7 @@ StackerCompiler::get_stack_pointer( BasicBlock* bb, Value* index = 0 ) } else { - CastInst* caster = CastInst::createSExtOrBitCast( index, Type::LongTy ); + CastInst* caster = CastInst::createSExtOrBitCast( index, Type::Int64Ty ); bb->getInstList().push_back( caster ); BinaryOperator* subop = BinaryOperator::create( Instruction::Sub, loadop, caster ); @@ -448,7 +448,7 @@ StackerCompiler::push_value( BasicBlock* bb, Value* val ) (isa(val->getType()) ? Instruction::PtrToInt : (val->getType()->getPrimitiveSizeInBits() < 64 ? Instruction::SExt : Instruction::BitCast)); - CastInst* cast_inst = CastInst::create(opcode, val, Type::LongTy ); + CastInst* cast_inst = CastInst::create(opcode, val, Type::Int64Ty ); bb->getInstList().push_back( cast_inst ); // Store the value @@ -462,7 +462,7 @@ Instruction* StackerCompiler::push_integer(BasicBlock* bb, int64_t value ) { // Just push a constant integer value - return push_value( bb, ConstantInt::get( Type::LongTy, value ) ); + return push_value( bb, ConstantInt::get( Type::Int64Ty, value ) ); } Instruction* @@ -491,7 +491,7 @@ StackerCompiler::push_string( BasicBlock* bb, const char* value ) // Create a type for the string constant. Length is +1 for // the terminating 0. - ArrayType* char_array = ArrayType::get( Type::SByteTy, len + 1 ); + ArrayType* char_array = ArrayType::get( Type::Int8Ty, len + 1 ); // Create an initializer for the value Constant* initVal = ConstantArray::get( value ); @@ -523,7 +523,7 @@ StackerCompiler::pop_string( BasicBlock* bb ) // Cast the integer to a sbyte* CastInst* caster = - new IntToPtrInst(loader, PointerType::get(Type::SByteTy)); + new IntToPtrInst(loader, PointerType::get(Type::Int8Ty)); bb->getInstList().push_back( caster ); // Decrement stack index @@ -576,7 +576,7 @@ StackerCompiler::stack_top_string( BasicBlock* bb, Value* index = 0 ) // Cast the integer to a sbyte* CastInst* caster = - new IntToPtrInst(loader, PointerType::get(Type::SByteTy) ); + new IntToPtrInst(loader, PointerType::get(Type::Int8Ty) ); bb->getInstList().push_back( caster ); // Return the value @@ -652,7 +652,7 @@ StackerCompiler::handle_main_definition( Function* func ) TheStack->setLinkage( GlobalValue::LinkOnceLinkage ); // Turn "_index_" into an intialized variable for the same reason. - TheIndex->setInitializer( Constant::getNullValue(Type::LongTy) ); + TheIndex->setInitializer( Constant::getNullValue(Type::Int64Ty) ); TheIndex->setLinkage( GlobalValue::LinkOnceLinkage ); return func; @@ -722,7 +722,7 @@ StackerCompiler::handle_if( char* ifTrue, char* ifFalse ) // Compare the condition against 0 ICmpInst* cond_inst = new ICmpInst( ICmpInst::ICMP_NE, cond, - ConstantInt::get( Type::LongTy, 0) ); + ConstantInt::get( Type::Int64Ty, 0) ); bb->getInstList().push_back( cond_inst ); // Create an exit block @@ -806,7 +806,7 @@ StackerCompiler::handle_while( char* todo ) // Compare the condition against 0 ICmpInst* cond_inst = new ICmpInst( - ICmpInst::ICMP_NE, cond, ConstantInt::get( Type::LongTy, 0)); + ICmpInst::ICMP_NE, cond, ConstantInt::get( Type::Int64Ty, 0)); test->getInstList().push_back( cond_inst ); // Add the branch instruction @@ -1020,7 +1020,7 @@ StackerCompiler::handle_word( int tkn ) if (echo) bb->setName("DECR"); LoadInst* op1 = cast(pop_integer(bb)); BinaryOperator* subop = BinaryOperator::create( Instruction::Sub, op1, - ConstantInt::get( Type::LongTy, 1 ) ); + ConstantInt::get( Type::Int64Ty, 1 ) ); bb->getInstList().push_back( subop ); push_value( bb, subop ); break; @@ -1090,7 +1090,7 @@ StackerCompiler::handle_word( int tkn ) // bb->getInstList().push_back( negop ); // So we'll multiply by -1 (ugh) BinaryOperator* multop = BinaryOperator::create( Instruction::Mul, op1, - ConstantInt::get( Type::LongTy, -1 ) ); + ConstantInt::get( Type::Int64Ty, -1 ) ); bb->getInstList().push_back( multop ); push_value( bb, multop ); break; @@ -1245,7 +1245,7 @@ StackerCompiler::handle_word( int tkn ) if (echo) bb->setName("SHL"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - CastInst* castop = new TruncInst( op1, Type::UByteTy ); + CastInst* castop = new TruncInst( op1, Type::Int8Ty ); bb->getInstList().push_back( castop ); ShiftInst* shlop = new ShiftInst( Instruction::Shl, op2, castop ); bb->getInstList().push_back( shlop ); @@ -1257,7 +1257,7 @@ StackerCompiler::handle_word( int tkn ) if (echo) bb->setName("SHR"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - CastInst* castop = new TruncInst( op1, Type::UByteTy ); + CastInst* castop = new TruncInst( op1, Type::Int8Ty ); bb->getInstList().push_back( castop ); ShiftInst* shrop = new ShiftInst( Instruction::AShr, op2, castop ); bb->getInstList().push_back( shrop ); @@ -1479,11 +1479,11 @@ StackerCompiler::handle_word( int tkn ) LoadInst* op1 = cast( pop_integer(bb) ); // Make sure its a UIntTy - CastInst* caster = CastInst::createTruncOrBitCast( op1, Type::UIntTy ); + CastInst* caster = CastInst::createTruncOrBitCast( op1, Type::Int32Ty ); bb->getInstList().push_back( caster ); // Allocate the bytes - MallocInst* mi = new MallocInst( Type::SByteTy, caster ); + MallocInst* mi = new MallocInst( Type::Int8Ty, caster ); bb->getInstList().push_back( mi ); // Push the pointer @@ -1507,7 +1507,7 @@ StackerCompiler::handle_word( int tkn ) if (echo) bb->setName("GET"); // Get the character index LoadInst* op1 = cast( stack_top(bb) ); - CastInst* chr_idx = CastInst::createSExtOrBitCast( op1, Type::LongTy ); + CastInst* chr_idx = CastInst::createSExtOrBitCast( op1, Type::Int64Ty ); bb->getInstList().push_back( chr_idx ); // Get the String pointer @@ -1522,7 +1522,7 @@ StackerCompiler::handle_word( int tkn ) // Get the value and push it LoadInst* loader = new LoadInst( gep ); bb->getInstList().push_back( loader ); - CastInst* caster = CastInst::createTruncOrBitCast(loader, Type::IntTy); + CastInst* caster = CastInst::createTruncOrBitCast(loader, Type::Int32Ty); bb->getInstList().push_back( caster ); // Push the result back on stack @@ -1539,7 +1539,7 @@ StackerCompiler::handle_word( int tkn ) // Get the character index LoadInst* w2 = cast( pop_integer(bb) ); - CastInst* chr_idx = CastInst::createSExtOrBitCast( w2, Type::LongTy ); + CastInst* chr_idx = CastInst::createSExtOrBitCast( w2, Type::Int64Ty ); bb->getInstList().push_back( chr_idx ); // Get the String pointer @@ -1552,7 +1552,7 @@ StackerCompiler::handle_word( int tkn ) bb->getInstList().push_back( gep ); // Cast the value and put it - CastInst* caster = new TruncInst( w1, Type::SByteTy ); + CastInst* caster = new TruncInst( w1, Type::Int8Ty ); bb->getInstList().push_back( caster ); StoreInst* storer = new StoreInst( caster, gep ); bb->getInstList().push_back( storer ); @@ -1580,7 +1580,7 @@ StackerCompiler::handle_word( int tkn ) LoadInst* op1 = cast(pop_integer(bb)); // Cast down to an integer - CastInst* caster = new TruncInst( op1, Type::IntTy ); + CastInst* caster = new TruncInst( op1, Type::Int32Ty ); bb->getInstList().push_back( caster ); // Call exit(3) @@ -1602,7 +1602,7 @@ StackerCompiler::handle_word( int tkn ) bb->getInstList().push_back( format_gep ); // Get the character to print (a tab) - ConstantInt* newline = ConstantInt::get(Type::IntTy, + ConstantInt* newline = ConstantInt::get(Type::Int32Ty, static_cast('\t')); // Call printf @@ -1624,7 +1624,7 @@ StackerCompiler::handle_word( int tkn ) bb->getInstList().push_back( format_gep ); // Get the character to print (a space) - ConstantInt* newline = ConstantInt::get(Type::IntTy, + ConstantInt* newline = ConstantInt::get(Type::Int32Ty, static_cast(' ')); // Call printf @@ -1646,7 +1646,7 @@ StackerCompiler::handle_word( int tkn ) bb->getInstList().push_back( format_gep ); // Get the character to print (a newline) - ConstantInt* newline = ConstantInt::get(Type::IntTy, + ConstantInt* newline = ConstantInt::get(Type::Int32Ty, static_cast('\n')); // Call printf @@ -1664,7 +1664,7 @@ StackerCompiler::handle_word( int tkn ) GetElementPtrInst* gep_value = cast(get_stack_pointer(bb)); CastInst* caster = - new BitCastInst(gep_value, PointerType::get(Type::SByteTy)); + new BitCastInst(gep_value, PointerType::get(Type::Int8Ty)); // Make room for the count result incr_stack_index(bb); diff --git a/utils/TableGen/CodeGenIntrinsics.h b/utils/TableGen/CodeGenIntrinsics.h index 4bae8f15a5..0d1b39bd15 100644 --- a/utils/TableGen/CodeGenIntrinsics.h +++ b/utils/TableGen/CodeGenIntrinsics.h @@ -31,7 +31,7 @@ namespace llvm { std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics. /// ArgTypes - The type primitive enum value for the return value and all - /// of the arguments. These are things like Type::UIntTyID. + /// of the arguments. These are things like Type::Int32TyID. std::vector ArgTypes; /// ArgVTs - The MVT::ValueType for each argument type. Note that this list -- cgit v1.2.3-70-g09d2 From 4bcca0f2ac85c918fc8617e34b7642e5e5233460 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 May 2007 09:29:13 +0000 Subject: switch this to bitcode instead of bytecode git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36867 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/Makefile | 2 +- examples/ModuleMaker/ModuleMaker.cpp | 6 +++--- lib/Debugger/Debugger.cpp | 17 +++++------------ lib/Linker/LinkArchives.cpp | 6 +++--- lib/Linker/Linker.cpp | 19 +++++-------------- 5 files changed, 17 insertions(+), 33 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/Makefile b/examples/ModuleMaker/Makefile index f669bf2593..8bb934f873 100644 --- a/examples/ModuleMaker/Makefile +++ b/examples/ModuleMaker/Makefile @@ -9,6 +9,6 @@ LEVEL=../.. TOOLNAME=ModuleMaker EXAMPLE_TOOL = 1 -LINK_COMPONENTS := bcwriter +LINK_COMPONENTS := bitwriter include $(LEVEL)/Makefile.common diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index 4983597952..ec7398c97f 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -17,8 +17,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" -#include "llvm/Bytecode/Writer.h" -#include "llvm/Support/Streams.h" +#include "llvm/Bitcode/ReaderWriter.h" +#include using namespace llvm; int main() { @@ -53,7 +53,7 @@ int main() { BB->getInstList().push_back(new ReturnInst(Add)); // Output the bytecode file to stdout - WriteBytecodeToFile(M, cout); + WriteBitcodeToFile(M, std::cout); // Delete the module and all of its contents. delete M; diff --git a/lib/Debugger/Debugger.cpp b/lib/Debugger/Debugger.cpp index 90741afc8e..a38bde7cc3 100644 --- a/lib/Debugger/Debugger.cpp +++ b/lib/Debugger/Debugger.cpp @@ -14,7 +14,6 @@ #include "llvm/Debugger/Debugger.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" -#include "llvm/Bytecode/Reader.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Debugger/InferiorProcess.h" #include "llvm/Support/MemoryBuffer.h" @@ -22,8 +21,6 @@ #include using namespace llvm; -static bool Bitcode = false; - /// Debugger constructor - Initialize the debugger to its initial, empty, state. /// Debugger::Debugger() : Environment(0), Program(0), Process(0) { @@ -49,15 +46,11 @@ std::string Debugger::getProgramPath() const { static Module * getMaterializedModuleProvider(const std::string &Filename) { - if (Bitcode) { - return ParseBytecodeFile(Filename); - } else { - std::auto_ptr Buffer; - Buffer.reset(MemoryBuffer::getFileOrSTDIN(&Filename[0], Filename.size())); - if (Buffer.get()) - return ParseBitcodeFile(Buffer.get()); - return 0; - } + std::auto_ptr Buffer; + Buffer.reset(MemoryBuffer::getFileOrSTDIN(&Filename[0], Filename.size())); + if (Buffer.get()) + return ParseBitcodeFile(Buffer.get()); + return 0; } /// loadProgram - If a program is currently loaded, unload it. Then search diff --git a/lib/Linker/LinkArchives.cpp b/lib/Linker/LinkArchives.cpp index e6a3b8a523..416b2857db 100644 --- a/lib/Linker/LinkArchives.cpp +++ b/lib/Linker/LinkArchives.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file contains routines to handle linking together LLVM bytecode files, +// This file contains routines to handle linking together LLVM bitcode files, // and to handle annoying things like static libraries. // //===----------------------------------------------------------------------===// @@ -16,7 +16,7 @@ #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/ADT/SetOperations.h" -#include "llvm/Bytecode/Archive.h" +#include "llvm/Bitcode/Archive.h" #include "llvm/Config/config.h" #include #include @@ -96,7 +96,7 @@ Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) { // Open the archive file verbose("Linking archive file '" + Filename.toString() + "'"); - // Find all of the symbols currently undefined in the bytecode program. + // Find all of the symbols currently undefined in the bitcode program. // If all the symbols are defined, the program is complete, and there is // no reason to link in any archive files. std::set UndefinedSymbols; diff --git a/lib/Linker/Linker.cpp b/lib/Linker/Linker.cpp index bfa30044dc..077bcd7ba6 100644 --- a/lib/Linker/Linker.cpp +++ b/lib/Linker/Linker.cpp @@ -13,16 +13,12 @@ #include "llvm/Linker.h" #include "llvm/Module.h" -#include "llvm/Bytecode/Reader.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Config/config.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Streams.h" -#include "llvm/Support/Compressor.h" using namespace llvm; -static const bool Bitcode = false; - Linker::Linker(const std::string& progname, const std::string& modname, unsigned flags) : Composite(0) , LibPaths() @@ -107,18 +103,13 @@ Linker::LoadObject(const sys::Path &FN) { Module *Result = 0; const std::string &FNS = FN.toString(); - if (Bitcode) { - std::auto_ptr Buffer( + std::auto_ptr Buffer( MemoryBuffer::getFileOrSTDIN(&FNS[0], FNS.size())); - if (Buffer.get()) - Result = ParseBitcodeFile(Buffer.get(), &ParseErrorMessage); - else - ParseErrorMessage = "Error reading file '" + FNS + "'"; + if (Buffer.get()) + Result = ParseBitcodeFile(Buffer.get(), &ParseErrorMessage); + else + ParseErrorMessage = "Error reading file '" + FNS + "'"; - } else { - Result = ParseBytecodeFile(FNS, Compressor::decompressToNewBuffer, - &ParseErrorMessage); - } if (Result) return std::auto_ptr(Result); Error = "Bytecode file '" + FN.toString() + "' could not be loaded"; -- cgit v1.2.3-70-g09d2 From a99be51bf5cdac1438069d4b01766c47704961c8 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Thu, 5 Jul 2007 17:07:56 +0000 Subject: Here is the bulk of the sanitizing. Almost all occurrences of "bytecode" in the sources have been eliminated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37913 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/ModuleMaker/ModuleMaker.cpp | 4 +- include/llvm/AbstractTypeUser.h | 2 +- include/llvm/Analysis/ConstantsScanner.h | 2 +- include/llvm/Bitcode/Archive.h | 22 +++++------ include/llvm/GlobalValue.h | 4 +- include/llvm/Linker.h | 14 +++---- include/llvm/Support/SystemUtils.h | 4 +- include/llvm/System/Path.h | 6 +-- include/llvm/Type.h | 4 +- lib/Archive/Archive.cpp | 16 ++++---- lib/Archive/ArchiveInternals.h | 20 +++++----- lib/Archive/ArchiveReader.cpp | 22 +++++------ lib/Archive/ArchiveWriter.cpp | 12 +++--- lib/Bitcode/Reader/BitcodeReader.cpp | 6 +-- lib/CodeGen/ELFWriter.h | 2 +- lib/ExecutionEngine/JIT/JIT.cpp | 6 +-- lib/ExecutionEngine/JIT/JITEmitter.cpp | 4 +- lib/Linker/LinkArchives.cpp | 2 +- lib/Linker/LinkItems.cpp | 16 ++++---- lib/Linker/Linker.cpp | 6 +-- lib/Support/SystemUtils.cpp | 8 ++-- lib/System/Unix/Path.inc | 2 +- lib/Target/ARM/ARMISelLowering.cpp | 2 +- lib/Target/PowerPC/PPCCodeEmitter.cpp | 2 +- lib/Target/PowerPC/PPCSubtarget.cpp | 2 +- lib/Target/X86/X86Subtarget.cpp | 2 +- lib/VMCore/PassManager.cpp | 2 +- tools/llc/llc.cpp | 6 +-- tools/lli/lli.cpp | 4 +- tools/llvm-ar/llvm-ar.cpp | 14 +++---- tools/llvm-as/llvm-as.cpp | 2 +- tools/llvm-db/Commands.cpp | 2 +- tools/llvm-dis/llvm-dis.cpp | 8 ++-- tools/llvm-extract/llvm-extract.cpp | 4 +- tools/llvm-ld/llvm-ld.cpp | 66 ++++++++++++++++---------------- tools/llvm-link/llvm-link.cpp | 10 ++--- tools/llvm-nm/llvm-nm.cpp | 4 +- tools/llvm-prof/llvm-prof.cpp | 10 ++--- tools/llvm-ranlib/llvm-ranlib.cpp | 2 +- tools/llvm2cpp/llvm2cpp.cpp | 4 +- tools/llvmc/CompilerDriver.cpp | 22 +++++------ tools/llvmc/CompilerDriver.h | 6 +-- tools/llvmc/ConfigLexer.h | 2 +- tools/llvmc/ConfigLexer.l | 6 +-- tools/llvmc/Configuration.cpp | 10 ++--- tools/llvmc/llvmc.cpp | 2 +- tools/lto/lto-c.cpp | 2 +- tools/lto/lto.cpp | 6 +-- tools/opt/opt.cpp | 10 ++--- 49 files changed, 198 insertions(+), 198 deletions(-) (limited to 'examples/ModuleMaker/ModuleMaker.cpp') diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp index ec7398c97f..ed56625eed 100644 --- a/examples/ModuleMaker/ModuleMaker.cpp +++ b/examples/ModuleMaker/ModuleMaker.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // This programs is a simple example that creates an LLVM module "from scratch", -// emitting it as a bytecode file to standard out. This is just to show how +// emitting it as a bitcode file to standard out. This is just to show how // LLVM projects work and to demonstrate some of the LLVM APIs. // //===----------------------------------------------------------------------===// @@ -52,7 +52,7 @@ int main() { // Create the return instruction and add it to the basic block BB->getInstList().push_back(new ReturnInst(Add)); - // Output the bytecode file to stdout + // Output the bitcode file to stdout WriteBitcodeToFile(M, std::cout); // Delete the module and all of its contents. diff --git a/include/llvm/AbstractTypeUser.h b/include/llvm/AbstractTypeUser.h index fe51effc61..2b643ab935 100644 --- a/include/llvm/AbstractTypeUser.h +++ b/include/llvm/AbstractTypeUser.h @@ -41,7 +41,7 @@ class DerivedType; /// /// Classes must implement this interface so that they may be notified when an /// abstract type is resolved. Abstract types may be resolved into more -/// concrete types through: linking, parsing, and bytecode reading. When this +/// concrete types through: linking, parsing, and bitcode reading. When this /// happens, all of the users of the type must be updated to reference the new, /// more concrete type. They are notified through the AbstractTypeUser /// interface. diff --git a/include/llvm/Analysis/ConstantsScanner.h b/include/llvm/Analysis/ConstantsScanner.h index 1f71f3900c..9ea9ed6ce6 100644 --- a/include/llvm/Analysis/ConstantsScanner.h +++ b/include/llvm/Analysis/ConstantsScanner.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // This class implements an iterator to walk through the constants referenced by -// a method. This is used by the Bytecode & Assembly writers to build constant +// a method. This is used by the Bitcode & Assembly writers to build constant // pools. // //===----------------------------------------------------------------------===// diff --git a/include/llvm/Bitcode/Archive.h b/include/llvm/Bitcode/Archive.h index 26dcf60e1a..eee3922f04 100644 --- a/include/llvm/Bitcode/Archive.h +++ b/include/llvm/Bitcode/Archive.h @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_BITECODE_ARCHIVE_H -#define LLVM_BITECODE_ARCHIVE_H +#ifndef LLVM_BITCODE_ARCHIVE_H +#define LLVM_BITCODE_ARCHIVE_H #include "llvm/ADT/ilist" #include "llvm/System/Path.h" @@ -377,13 +377,13 @@ class Archive { /// @brief Get the offset to the first "real" file member in the archive. unsigned getFirstFileOffset() { return firstFileOffset; } - /// This method will scan the archive for bytecode modules, interpret them + /// This method will scan the archive for bitcode modules, interpret them /// and return a vector of the instantiated modules in \p Modules. If an /// error occurs, this method will return true. If \p ErrMessage is not null /// and an error occurs, \p *ErrMessage will be set to a string explaining /// the error that occurred. /// @returns true if an error occurred - /// @brief Instantiate all the bytecode modules located in the archive + /// @brief Instantiate all the bitcode modules located in the archive bool getAllModules(std::vector& Modules, std::string* ErrMessage); /// This accessor looks up the \p symbol in the archive's symbol table and @@ -418,13 +418,13 @@ class Archive { ); /// This method determines whether the archive is a properly formed llvm - /// bytecode archive. It first makes sure the symbol table has been loaded + /// bitcode archive. It first makes sure the symbol table has been loaded /// and has a non-zero size. If it does, then it is an archive. If not, - /// then it tries to load all the bytecode modules of the archive. Finally, + /// then it tries to load all the bitcode modules of the archive. Finally, /// it returns whether it was successfull. - /// @returns true if the archive is a proper llvm bytecode archive - /// @brief Determine whether the archive is a proper llvm bytecode archive. - bool isBytecodeArchive(); + /// @returns true if the archive is a proper llvm bitcode archive + /// @brief Determine whether the archive is a proper llvm bitcode archive. + bool isBitcodeArchive(); /// @} /// @name Mutators @@ -433,7 +433,7 @@ class Archive { /// This method is the only way to get the archive written to disk. It /// creates or overwrites the file specified when \p this was created /// or opened. The arguments provide options for writing the archive. If - /// \p CreateSymbolTable is true, the archive is scanned for bytecode files + /// \p CreateSymbolTable is true, the archive is scanned for bitcode files /// and a symbol table of the externally visible function and global /// variable names is created. If \p TruncateNames is true, the names of the /// archive members will have their path component stripped and the file @@ -525,7 +525,7 @@ class Archive { /// @brief Frees all the members and unmaps the archive file. void cleanUpMemory(); - /// This type is used to keep track of bytecode modules loaded from the + /// This type is used to keep track of bitcode modules loaded from the /// symbol table. It maps the file offset to a pair that consists of the /// associated ArchiveMember and the ModuleProvider. /// @brief Module mapping type diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index d2d9130370..6735cb5007 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -108,12 +108,12 @@ public: void setLinkage(LinkageTypes LT) { Linkage = LT; } LinkageTypes getLinkage() const { return Linkage; } - /// hasNotBeenReadFromBytecode - If a module provider is being used to lazily + /// hasNotBeenReadFromBitcode - If a module provider is being used to lazily /// stream in functions from disk, this method can be used to check to see if /// the function has been read in yet or not. Unless you are working on the /// JIT or something else that streams stuff in lazily, you don't need to /// worry about this. - bool hasNotBeenReadFromBytecode() const { return Linkage == GhostLinkage; } + bool hasNotBeenReadFromBitcode() const { return Linkage == GhostLinkage; } /// Override from Constant class. No GlobalValue's are null values so this /// always returns false. diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h index 66a8483367..cc0372d973 100644 --- a/include/llvm/Linker.h +++ b/include/llvm/Linker.h @@ -28,7 +28,7 @@ class Module; /// In this case the Linker still retains ownership of the Module. If the /// releaseModule() method is used, the ownership of the Module is transferred /// to the caller and the Linker object is only suitable for destruction. -/// The Linker can link Modules from memory, bytecode files, or bytecode +/// The Linker can link Modules from memory, bitcode files, or bitcode /// archives. It retains a set of search paths in which to find any libraries /// presented to it. By default, the linker will generate error and warning /// messages to std::cerr but this capability can be turned off with the @@ -162,10 +162,10 @@ class Linker { ItemList& NativeItems ///< Output list of native files/libs ); - /// This function links the bytecode \p Files into the composite module. + /// This function links the bitcode \p Files into the composite module. /// Note that this does not do any linking of unresolved symbols. The \p /// Files are all completely linked into \p HeadModule regardless of - /// unresolved symbols. This function just loads each bytecode file and + /// unresolved symbols. This function just loads each bitcode file and /// calls LinkInModule on them. /// @returns true if an error occurs, false otherwise /// @see getLastError @@ -174,9 +174,9 @@ class Linker { const std::vector & Files ///< Files to link in ); - /// This function links a single bytecode file, \p File, into the composite + /// This function links a single bitcode file, \p File, into the composite /// module. Note that this does not attempt to resolve symbols. This method - /// just loads the bytecode file and calls LinkInModule on it. If an error + /// just loads the bitcode file and calls LinkInModule on it. If an error /// occurs, the Linker's error string is set. /// @returns true if an error occurs, false otherwise /// @see getLastError @@ -216,7 +216,7 @@ class Linker { bool& is_native ///< Indicates if lib a native library ); - /// This function links one bytecode archive, \p Filename, into the module. + /// This function links one bitcode archive, \p Filename, into the module. /// The archive is searched to resolve outstanding symbols. Any modules in /// the archive that resolve outstanding symbols will be linked in. The /// library is searched repeatedly until no more modules that resolve @@ -271,7 +271,7 @@ class Linker { /// @name Implementation /// @{ private: - /// Read in and parse the bytecode file named by FN and return the + /// Read in and parse the bitcode file named by FN and return the /// Module it contains (wrapped in an auto_ptr), or 0 if an error occurs. std::auto_ptr LoadObject(const sys::Path& FN); diff --git a/include/llvm/Support/SystemUtils.h b/include/llvm/Support/SystemUtils.h index 93432b57bf..6dc5c2727b 100644 --- a/include/llvm/Support/SystemUtils.h +++ b/include/llvm/Support/SystemUtils.h @@ -21,10 +21,10 @@ namespace llvm { /// Determine if the ostream provided is connected to the std::cout and /// displayed or not (to a console window). If so, generate a warning message -/// advising against display of bytecode and return true. Otherwise just return +/// advising against display of bitcode and return true. Otherwise just return /// false /// @brief Check for output written to a console -bool CheckBytecodeOutputToConsole( +bool CheckBitcodeOutputToConsole( std::ostream* stream_to_check, ///< The stream to be checked bool print_warning = true ///< Control whether warnings are printed ); diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h index 97876a3f81..537a5af5a3 100644 --- a/include/llvm/System/Path.h +++ b/include/llvm/System/Path.h @@ -112,15 +112,15 @@ namespace sys { /// @brief Construct a path to the system library directory static void GetSystemLibraryPaths(std::vector& Paths); - /// Construct a vector of sys::Path that contains the "standard" bytecode + /// Construct a vector of sys::Path that contains the "standard" bitcode /// library paths suitable for linking into an llvm program. This function /// *must* return the value of LLVM_LIB_SEARCH_PATH as well as the value /// of LLVM_LIBDIR. It also must provide the System library paths as /// returned by GetSystemLibraryPaths. /// @see GetSystemLibraryPaths - /// @brief Construct a list of directories in which bytecode could be + /// @brief Construct a list of directories in which bitcode could be /// found. - static void GetBytecodeLibraryPaths(std::vector& Paths); + static void GetBitcodeLibraryPaths(std::vector& Paths); /// Find the path to a library using its short name. Use the system /// dependent library paths to locate the library. diff --git a/include/llvm/Type.h b/include/llvm/Type.h index d19bec2712..cf1c64fc9d 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -52,7 +52,7 @@ class TypeMapBase; /// /// Opaque types are also kinda weird and scary and different because they have /// to keep a list of uses of the type. When, through linking, parsing, or -/// bytecode reading, they become resolved, they need to find and update all +/// bitcode reading, they become resolved, they need to find and update all /// users of the unknown type, causing them to reference a new, more concrete /// type. Opaque types are deleted when their use list dwindles to zero users. /// @@ -77,7 +77,7 @@ public: IntegerTyID, ///< 4: Arbitrary bit width integers FunctionTyID, ///< 5: Functions StructTyID, ///< 6: Structures - PackedStructTyID,///< 7: Packed Structure. This is for bytecode only + PackedStructTyID,///< 7: Packed Structure. This is for bitcode only ArrayTyID, ///< 8: Arrays PointerTyID, ///< 9: Pointers OpaqueTyID, ///< 10: Opaque: type with unknown structure diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp index 6fabc5c862..d0c64097a2 100644 --- a/lib/Archive/Archive.cpp +++ b/lib/Archive/Archive.cpp @@ -210,10 +210,10 @@ static void getSymbols(Module*M, std::vector& symbols) { symbols.push_back(FI->getName()); } -// Get just the externally visible defined symbols from the bytecode -bool llvm::GetBytecodeSymbols(const sys::Path& fName, - std::vector& symbols, - std::string* ErrMsg) { +// Get just the externally visible defined symbols from the bitcode +bool llvm::GetBitcodeSymbols(const sys::Path& fName, + std::vector& symbols, + std::string* ErrMsg) { std::auto_ptr Buffer( MemoryBuffer::getFileOrSTDIN(&fName.toString()[0], fName.toString().size())); @@ -242,10 +242,10 @@ bool llvm::GetBytecodeSymbols(const sys::Path& fName, } ModuleProvider* -llvm::GetBytecodeSymbols(const unsigned char *BufPtr, unsigned Length, - const std::string& ModuleID, - std::vector& symbols, - std::string* ErrMsg) { +llvm::GetBitcodeSymbols(const unsigned char *BufPtr, unsigned Length, + const std::string& ModuleID, + std::vector& symbols, + std::string* ErrMsg) { // Get the module provider MemoryBuffer *Buffer =MemoryBuffer::getNewMemBuffer(Length, ModuleID.c_str()); memcpy((char*)Buffer->getBufferStart(), BufPtr, Length); diff --git a/lib/Archive/ArchiveInternals.h b/lib/Archive/ArchiveInternals.h index 4642f7a30a..8648bbbf29 100644 --- a/lib/Archive/ArchiveInternals.h +++ b/lib/Archive/ArchiveInternals.h @@ -1,4 +1,4 @@ -//===-- lib/Bytecode/ArchiveInternals.h -------------------------*- C++ -*-===// +//===-- lib/Archive/ArchiveInternals.h -------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LIB_BYTECODE_ARCHIVEINTERNALS_H -#define LIB_BYTECODE_ARCHIVEINTERNALS_H +#ifndef LIB_ARCHIVE_ARCHIVEINTERNALS_H +#define LIB_ARCHIVE_ARCHIVEINTERNALS_H #include "llvm/Bitcode/Archive.h" #include "llvm/System/TimeValue.h" @@ -29,7 +29,7 @@ namespace llvm { - /// The ArchiveMemberHeader structure is used internally for bytecode + /// The ArchiveMemberHeader structure is used internally for bitcode /// archives. /// The header precedes each file member in the archive. This structure is /// defined using character arrays for direct and correct interpretation @@ -67,15 +67,15 @@ namespace llvm { } }; - // Get just the externally visible defined symbols from the bytecode - bool GetBytecodeSymbols(const sys::Path& fName, + // Get just the externally visible defined symbols from the bitcode + bool GetBitcodeSymbols(const sys::Path& fName, std::vector& symbols, std::string* ErrMsg); - ModuleProvider* GetBytecodeSymbols(const unsigned char*Buffer,unsigned Length, - const std::string& ModuleID, - std::vector& symbols, - std::string* ErrMsg); + ModuleProvider* GetBitcodeSymbols(const unsigned char*Buffer,unsigned Length, + const std::string& ModuleID, + std::vector& symbols, + std::string* ErrMsg); } #endif diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp index c38389e2d7..93eaac18f6 100644 --- a/lib/Archive/ArchiveReader.cpp +++ b/lib/Archive/ArchiveReader.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// Builds up standard unix archive files (.a) containing LLVM bytecode. +// Builds up standard unix archive files (.a) containing LLVM bitcode. // //===----------------------------------------------------------------------===// @@ -109,7 +109,7 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error) // it will accept them. If the name starts with #1/ and the remainder is // digits, then those digits specify the length of the name that is // stored immediately following the header. The special name - // __LLVM_SYM_TAB__ identifies the symbol table for LLVM bytecode. + // __LLVM_SYM_TAB__ identifies the symbol table for LLVM bitcode. // Anything else is a regular, short filename that is terminated with // a '/' and blanks. @@ -344,7 +344,7 @@ Archive::OpenAndLoad(const sys::Path& file, std::string* ErrorMessage) return result.release(); } -// Get all the bytecode modules from the archive +// Get all the bitcode modules from the archive bool Archive::getAllModules(std::vector& Modules, std::string* ErrMessage) { @@ -487,7 +487,7 @@ Archive::findModuleDefiningSymbol(const std::string& symbol, if (!mbr) return 0; - // Now, load the bytecode module to get the ModuleProvider + // Now, load the bitcode module to get the ModuleProvider std::string FullMemberName = archPath.toString() + "(" + mbr->getPath().toString() + ")"; MemoryBuffer *Buffer =MemoryBuffer::getNewMemBuffer(mbr->getSize(), @@ -541,8 +541,8 @@ Archive::findModulesDefiningSymbols(std::set& symbols, std::string FullMemberName = archPath.toString() + "(" + mbr->getPath().toString() + ")"; ModuleProvider* MP = - GetBytecodeSymbols((const unsigned char*)At, mbr->getSize(), - FullMemberName, symbols, error); + GetBitcodeSymbols((const unsigned char*)At, mbr->getSize(), + FullMemberName, symbols, error); if (MP) { // Insert the module's symbols into the symbol table @@ -555,7 +555,7 @@ Archive::findModulesDefiningSymbols(std::set& symbols, modules.insert(std::make_pair(offset, std::make_pair(MP, mbr))); } else { if (error) - *error = "Can't parse bytecode member: " + + *error = "Can't parse bitcode member: " + mbr->getPath().toString() + ": " + *error; delete mbr; return false; @@ -591,7 +591,7 @@ Archive::findModulesDefiningSymbols(std::set& symbols, return true; } -bool Archive::isBytecodeArchive() { +bool Archive::isBitcodeArchive() { // Make sure the symTab has been loaded. In most cases this should have been // done when the archive was constructed, but still, this is just in case. if (!symTab.size()) @@ -602,14 +602,14 @@ bool Archive::isBytecodeArchive() { // if it has a size if (symTab.size()) return true; - //We still can't be sure it isn't a bytecode archive + // We still can't be sure it isn't a bitcode archive if (!loadArchive(0)) return false; std::vector Modules; std::string ErrorMessage; - // Scan the archive, trying to load a bytecode member. We only load one to + // Scan the archive, trying to load a bitcode member. We only load one to // see if this works. for (iterator I = begin(), E = end(); I != E; ++I) { if (!I->isBytecode() && !I->isCompressedBytecode()) @@ -624,7 +624,7 @@ bool Archive::isBytecodeArchive() { Module *M = ParseBitcodeFile(Buffer); delete Buffer; if (!M) - return false; // Couldn't parse bytecode, not a bytecode archive. + return false; // Couldn't parse bitcode, not a bitcode archive. delete M; return true; } diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp index 051d31fce9..d67937ea11 100644 --- a/lib/Archive/ArchiveWriter.cpp +++ b/lib/Archive/ArchiveWriter.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// Builds up an LLVM archive file (.a) containing LLVM bytecode. +// Builds up an LLVM archive file (.a) containing LLVM bitcode. // //===----------------------------------------------------------------------===// @@ -222,7 +222,7 @@ Archive::writeMember( } // Now that we have the data in memory, update the - // symbol table if its a bytecode file. + // symbol table if its a bitcode file. if (CreateSymbolTable && (member.isBytecode() || member.isCompressedBytecode())) { std::vector symbols; @@ -230,10 +230,10 @@ Archive::writeMember( member.getPath().toString() + ")"; ModuleProvider* MP = - GetBytecodeSymbols((const unsigned char*)data,fSize, - FullMemberName, symbols, ErrMsg); + GetBitcodeSymbols((const unsigned char*)data,fSize, + FullMemberName, symbols, ErrMsg); - // If the bytecode parsed successfully + // If the bitcode parsed successfully if ( MP ) { for (std::vector::iterator SI = symbols.begin(), SE = symbols.end(); SI != SE; ++SI) { @@ -255,7 +255,7 @@ Archive::writeMember( delete mFile; } if (ErrMsg) - *ErrMsg = "Can't parse bytecode member: " + member.getPath().toString() + *ErrMsg = "Can't parse bitcode member: " + member.getPath().toString() + ": " + *ErrMsg; return true; } diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 7408580b23..b040df3383 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1564,7 +1564,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { bool BitcodeReader::materializeFunction(Function *F, std::string *ErrInfo) { // If it already is material, ignore the request. - if (!F->hasNotBeenReadFromBytecode()) return false; + if (!F->hasNotBeenReadFromBitcode()) return false; DenseMap >::iterator DFII = DeferredFunctionInfo.find(F); @@ -1585,7 +1585,7 @@ bool BitcodeReader::materializeFunction(Function *F, std::string *ErrInfo) { void BitcodeReader::dematerializeFunction(Function *F) { // If this function isn't materialized, or if it is a proto, this is a noop. - if (F->hasNotBeenReadFromBytecode() || F->isDeclaration()) + if (F->hasNotBeenReadFromBitcode() || F->isDeclaration()) return; assert(DeferredFunctionInfo.count(F) && "No info to read function later?"); @@ -1601,7 +1601,7 @@ Module *BitcodeReader::materializeModule(std::string *ErrInfo) { DeferredFunctionInfo.begin(), E = DeferredFunctionInfo.end(); I != E; ++I) { Function *F = I->first; - if (F->hasNotBeenReadFromBytecode() && + if (F->hasNotBeenReadFromBitcode() && materializeFunction(F, ErrInfo)) return 0; } diff --git a/lib/CodeGen/ELFWriter.h b/lib/CodeGen/ELFWriter.h index 04cd1773c1..f27d78f4f0 100644 --- a/lib/CodeGen/ELFWriter.h +++ b/lib/CodeGen/ELFWriter.h @@ -90,7 +90,7 @@ namespace llvm { private: // The buffer we accumulate the file header into. Note that this should be - // changed into something much more efficient later (and the bytecode writer + // changed into something much more efficient later (and the bitcode writer // as well!). DataBuffer FileHeader; diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index cb698c35d2..603f8ec14a 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // This tool implements a just-in-time compiler for LLVM, allowing direct -// execution of LLVM bytecode in an efficient manner. +// execution of LLVM bitcode in an efficient manner. // //===----------------------------------------------------------------------===// @@ -258,7 +258,7 @@ void *JIT::getPointerToFunction(Function *F) { return Addr; // Check if function already code gen'd // Make sure we read in the function if it exists in this Module. - if (F->hasNotBeenReadFromBytecode()) { + if (F->hasNotBeenReadFromBitcode()) { // Determine the module provider this function is provided by. Module *M = F->getParent(); ModuleProvider *MP = 0; @@ -273,7 +273,7 @@ void *JIT::getPointerToFunction(Function *F) { std::string ErrorMsg; if (MP->materializeFunction(F, &ErrorMsg)) { cerr << "Error reading function '" << F->getName() - << "' from bytecode file: " << ErrorMsg << "\n"; + << "' from bitcode file: " << ErrorMsg << "\n"; abort(); } } diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index fc746d6df8..840af5997a 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -543,7 +543,7 @@ void *JITResolver::getFunctionStub(Function *F) { // Call the lazy resolver function unless we already KNOW it is an external // function, in which case we just skip the lazy resolution step. void *Actual = (void*)(intptr_t)LazyResolverFn; - if (F->isDeclaration() && !F->hasNotBeenReadFromBytecode()) + if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode()) Actual = TheJIT->getPointerToFunction(F); // Otherwise, codegen a new stub. For now, the stub will call the lazy @@ -762,7 +762,7 @@ void *JITEmitter::getPointerToGlobal(GlobalValue *V, void *Reference, void *ResultPtr = TheJIT->getPointerToGlobalIfAvailable(F); if (ResultPtr) return ResultPtr; - if (F->isDeclaration() && !F->hasNotBeenReadFromBytecode()) { + if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode()) { // If this is an external function pointer, we can force the JIT to // 'compile' it, which really just adds it to the map. if (DoesntNeedStub) diff --git a/lib/Linker/LinkArchives.cpp b/lib/Linker/LinkArchives.cpp index 416b2857db..381d0e7e5a 100644 --- a/lib/Linker/LinkArchives.cpp +++ b/lib/Linker/LinkArchives.cpp @@ -117,7 +117,7 @@ Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) { if (!arch) return error("Cannot read archive '" + Filename.toString() + "': " + ErrMsg); - if (!arch->isBytecodeArchive()) { + if (!arch->isBitcodeArchive()) { is_native = true; return false; } diff --git a/lib/Linker/LinkItems.cpp b/lib/Linker/LinkItems.cpp index 50efe46bd1..e66fa5b6e6 100644 --- a/lib/Linker/LinkItems.cpp +++ b/lib/Linker/LinkItems.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file contains routines to handle linking together LLVM bytecode files, +// This file contains routines to handle linking together LLVM bitcode files, // and to handle annoying things like static libraries. // //===----------------------------------------------------------------------===// @@ -20,7 +20,7 @@ using namespace llvm; // LinkItems - This function is the main entry point into linking. It takes a // list of LinkItem which indicates the order the files should be linked and // how each file should be treated (plain file or with library search). The -// function only links bytecode and produces a result list of items that are +// function only links bitcode and produces a result list of items that are // native objects. bool Linker::LinkInItems(const ItemList& Items, ItemList& NativeItems) { @@ -109,7 +109,7 @@ bool Linker::LinkInLibrary(const std::string& Lib, bool& is_native) { } /// LinkLibraries - takes the specified library files and links them into the -/// main bytecode object file. +/// main bitcode object file. /// /// Inputs: /// Libraries - The list of libraries to link into the module. @@ -140,11 +140,11 @@ bool Linker::LinkInLibraries(const std::vector &Libraries) { return false; } -/// LinkInFile - opens a bytecode file and links in all objects which +/// LinkInFile - opens a bitcode file and links in all objects which /// provide symbols that are currently undefined. /// /// Inputs: -/// File - The pathname of the bytecode file. +/// File - The pathname of the bitcode file. /// /// Outputs: /// ErrorMessage - A C++ string detailing what error occurred, if any. @@ -179,7 +179,7 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) { case sys::Bitcode_FileType: case sys::Bytecode_FileType: case sys::CompressedBytecode_FileType: { - verbose("Linking bytecode file '" + File.toString() + "'"); + verbose("Linking bitcode file '" + File.toString() + "'"); std::auto_ptr M(LoadObject(File)); if (M.get() == 0) return error("Cannot load file '" + File.toString() + "'" + Error); @@ -208,9 +208,9 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) { /// or relative pathname, or as a file somewhere in LLVM_LIB_SEARCH_PATH. /// /// Inputs: -/// Files - A vector of sys::Path indicating the LLVM bytecode filenames +/// Files - A vector of sys::Path indicating the LLVM bitcode filenames /// to be linked. The names can refer to a mixture of pure LLVM -/// bytecode files and archive (ar) formatted files. +/// bitcode files and archive (ar) formatted files. /// /// Return value: /// FALSE - No errors. diff --git a/lib/Linker/Linker.cpp b/lib/Linker/Linker.cpp index 077bcd7ba6..4604305b6d 100644 --- a/lib/Linker/Linker.cpp +++ b/lib/Linker/Linker.cpp @@ -80,7 +80,7 @@ Linker::addPaths(const std::vector& paths) { void Linker::addSystemPaths() { - sys::Path::GetBytecodeLibraryPaths(LibPaths); + sys::Path::GetBitcodeLibraryPaths(LibPaths); LibPaths.insert(LibPaths.begin(),sys::Path("./")); } @@ -94,7 +94,7 @@ Linker::releaseModule() { return result; } -// LoadObject - Read in and parse the bytecode file named by FN and return the +// LoadObject - Read in and parse the bitcode file named by FN and return the // module it contains (wrapped in an auto_ptr), or auto_ptr() and set // Error if an error occurs. std::auto_ptr @@ -112,7 +112,7 @@ Linker::LoadObject(const sys::Path &FN) { if (Result) return std::auto_ptr(Result); - Error = "Bytecode file '" + FN.toString() + "' could not be loaded"; + Error = "Bitcode file '" + FN.toString() + "' could not be loaded"; if (ParseErrorMessage.size()) Error += ": " + ParseErrorMessage; return std::auto_ptr(); diff --git a/lib/Support/SystemUtils.cpp b/lib/Support/SystemUtils.cpp index 30b9f8d43d..afa0d7e961 100644 --- a/lib/Support/SystemUtils.cpp +++ b/lib/Support/SystemUtils.cpp @@ -19,14 +19,14 @@ #include using namespace llvm; -bool llvm::CheckBytecodeOutputToConsole(std::ostream* stream_to_check, - bool print_warning) { +bool llvm::CheckBitcodeOutputToConsole(std::ostream* stream_to_check, + bool print_warning) { if (stream_to_check == cout.stream() && sys::Process::StandardOutIsDisplayed()) { if (print_warning) { - cerr << "WARNING: You're attempting to print out a bytecode file.\n" + cerr << "WARNING: You're attempting to print out a bitcode file.\n" << "This is inadvisable as it may cause display problems. If\n" - << "you REALLY want to taste LLVM bytecode first-hand, you\n" + << "you REALLY want to taste LLVM bitcode first-hand, you\n" << "can force output with the `-f' option.\n\n"; } return true; diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index db95e3c216..e4916baf28 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -218,7 +218,7 @@ Path::GetSystemLibraryPaths(std::vector& Paths) { } void -Path::GetBytecodeLibraryPaths(std::vector& Paths) { +Path::GetBitcodeLibraryPaths(std::vector& Paths) { char * env_var = getenv("LLVM_LIB_SEARCH_PATH"); if (env_var != 0) { getPathList(env_var,Paths); diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 6f67d66e67..6f63fbdcb3 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -824,7 +824,7 @@ SDOperand ARMTargetLowering::LowerGlobalAddressELF(SDOperand Op, static bool GVIsIndirectSymbol(GlobalValue *GV, Reloc::Model RelocM) { return RelocM != Reloc::Static && (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || - (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode())); + (GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode())); } SDOperand ARMTargetLowering::LowerGlobalAddressDarwin(SDOperand Op, diff --git a/lib/Target/PowerPC/PPCCodeEmitter.cpp b/lib/Target/PowerPC/PPCCodeEmitter.cpp index 446e0310fa..5dceffdb68 100644 --- a/lib/Target/PowerPC/PPCCodeEmitter.cpp +++ b/lib/Target/PowerPC/PPCCodeEmitter.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // This file defines the PowerPC 32-bit CodeEmitter and associated machinery to -// JIT-compile bytecode to native PowerPC. +// JIT-compile bitcode to native PowerPC. // //===----------------------------------------------------------------------===// diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp index 62f8995bb8..4419d200b9 100644 --- a/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/lib/Target/PowerPC/PPCSubtarget.cpp @@ -137,5 +137,5 @@ bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const { return false; return GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || - (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode()); + (GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode()); } diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index 124c97ac70..1a75e04511 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -40,7 +40,7 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, if (isTargetDarwin()) { return (!isDirectCall && (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || - (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode()))); + (GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode()))); } else if (TM.getRelocationModel() == Reloc::PIC_ && isPICStyleGOT()) { // Extra load is needed for all non-statics. return (!isDirectCall && diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index f257a07efb..23e45c0b95 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -1037,7 +1037,7 @@ void FunctionPassManager::add(Pass *P) { bool FunctionPassManager::run(Function &F) { std::string errstr; if (MP->materializeFunction(&F, &errstr)) { - cerr << "Error reading bytecode file: " << errstr << "\n"; + cerr << "Error reading bitcode file: " << errstr << "\n"; abort(); } return FPM->run(F); diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 8797c58ce8..b53f59b41c 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -9,7 +9,7 @@ // // This is the llc code generator driver. It provides a convenient // command-line interface for generating native assembly-language code -// or C code, given LLVM bytecode. +// or C code, given LLVM bitcode. // //===----------------------------------------------------------------------===// @@ -44,7 +44,7 @@ using namespace llvm; // and back-end code generation options are specified with the target machine. // static cl::opt -InputFilename(cl::Positional, cl::desc(""), cl::init("-")); +InputFilename(cl::Positional, cl::desc(""), cl::init("-")); static cl::opt OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename")); @@ -184,7 +184,7 @@ int main(int argc, char **argv) { if (Buffer.get()) M.reset(ParseBitcodeFile(Buffer.get(), &ErrorMessage)); if (M.get() == 0) { - std::cerr << argv[0] << ": bytecode didn't read correctly.\n"; + std::cerr << argv[0] << ": bitcode didn't read correctly.\n"; std::cerr << "Reason: " << ErrorMessage << "\n"; return 1; } diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index fdb5f4aa39..3ce28077ae 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -33,7 +33,7 @@ using namespace llvm; namespace { cl::opt - InputFile(cl::desc(""), cl::Positional, cl::init("-")); + InputFile(cl::desc(""), cl::Positional, cl::init("-")); cl::list InputArgv(cl::ConsumeAfter, cl::desc("...")); @@ -74,7 +74,7 @@ int main(int argc, char **argv, char * const *envp) { if (DisableCoreFiles) sys::Process::PreventCoreFiles(); - // Load the bytecode... + // Load the bitcode... std::string ErrorMsg; ModuleProvider *MP = 0; if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)){ diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index d0601c66c1..2cd16e361e 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // Builds up (relatively) standard unix archive files (.a) containing LLVM -// bytecode or other files. +// bitcode or other files. // //===----------------------------------------------------------------------===// @@ -54,7 +54,7 @@ static cl::extrahelp MoreHelp( " [b] - put file(s) before [relpos] (same as [i])\n" " [f] - truncate inserted file names\n" " [i] - put file(s) before [relpos] (same as [b])\n" - " [k] - always print bytecode files (default is to skip them)\n" + " [k] - always print bitcode files (default is to skip them)\n" " [N] - use instance [count] of name\n" " [o] - preserve original dates\n" " [P] - use full path names when matching\n" @@ -88,7 +88,7 @@ bool AddBefore = false; ///< 'b' modifier bool Create = false; ///< 'c' modifier bool TruncateNames = false; ///< 'f' modifier bool InsertBefore = false; ///< 'i' modifier -bool DontSkipBytecode = false; ///< 'k' modifier +bool DontSkipBitcode = false; ///< 'k' modifier bool UseCount = false; ///< 'N' modifier bool OriginalDates = false; ///< 'o' modifier bool FullPath = false; ///< 'P' modifier @@ -193,7 +193,7 @@ ArchiveOperation parseCommandLine() { case 'x': ++NumOperations; Operation = Extract; break; case 'c': Create = true; break; case 'f': TruncateNames = true; break; - case 'k': DontSkipBytecode = true; break; + case 'k': DontSkipBitcode = true; break; case 'l': /* accepted but unused */ break; case 'o': OriginalDates = true; break; case 'P': FullPath = true; break; @@ -341,7 +341,7 @@ void printSymbolTable() { // doPrint - Implements the 'p' operation. This function traverses the archive // looking for members that match the path list. It is careful to uncompress -// things that should be and to skip bytecode files unless the 'k' modifier was +// things that should be and to skip bitcode files unless the 'k' modifier was // given. bool doPrint(std::string* ErrMsg) { if (buildPaths(false, ErrMsg)) @@ -356,7 +356,7 @@ bool doPrint(std::string* ErrMsg) { // Skip things that don't make sense to print if (I->isLLVMSymbolTable() || I->isSVR4SymbolTable() || - I->isBSD4SymbolTable() || (!DontSkipBytecode && + I->isBSD4SymbolTable() || (!DontSkipBitcode && (I->isBytecode() || I->isCompressedBytecode()))) continue; @@ -694,7 +694,7 @@ int main(int argc, char **argv) { // like --help and --version. cl::ParseCommandLineOptions(argc, argv, " LLVM Archiver (llvm-ar)\n\n" - " This program archives bytecode files into single libraries\n" + " This program archives bitcode files into single libraries\n" ); // Print a stack trace if we signal out. diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index e4c7344776..41b6846fe1 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -125,7 +125,7 @@ int main(int argc, char **argv) { return 1; } - if (Force || !CheckBytecodeOutputToConsole(Out,true)) + if (Force || !CheckBitcodeOutputToConsole(Out,true)) WriteBitcodeToFile(M.get(), *Out); } catch (const std::string& msg) { cerr << argv[0] << ": " << msg << "\n"; diff --git a/tools/llvm-db/Commands.cpp b/tools/llvm-db/Commands.cpp index e0162e3956..a3d14b0085 100644 --- a/tools/llvm-db/Commands.cpp +++ b/tools/llvm-db/Commands.cpp @@ -219,7 +219,7 @@ void CLIDebugger::parseProgramOptions(std::string &Options) { /// file command - If the user specifies an option, search the PATH for the -/// specified program/bytecode file and load it. If the user does not specify +/// specified program/bitcode file and load it. If the user does not specify /// an option, unload the current program. void CLIDebugger::fileCommand(std::string &Options) { std::string Prog = getToken(Options); diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 97ec4c7306..0c87f8ce66 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -8,8 +8,8 @@ //===----------------------------------------------------------------------===// // // This utility may be invoked in the following manner: -// llvm-dis [options] - Read LLVM bytecode from stdin, write asm to stdout -// llvm-dis [options] x.bc - Read LLVM bytecode from the x.bc file, write asm +// llvm-dis [options] - Read LLVM bitcode from stdin, write asm to stdout +// llvm-dis [options] x.bc - Read LLVM bitcode from the x.bc file, write asm // to the x.ll file. // Options: // --help - Output information about command line switches @@ -31,7 +31,7 @@ using namespace llvm; static cl::opt -InputFilename(cl::Positional, cl::desc(""), cl::init("-")); +InputFilename(cl::Positional, cl::desc(""), cl::init("-")); static cl::opt OutputFilename("o", cl::desc("Override output filename"), @@ -65,7 +65,7 @@ int main(int argc, char **argv) { if (ErrorMessage.size()) cerr << ErrorMessage << "\n"; else - cerr << "bytecode didn't read correctly.\n"; + cerr << "bitcode didn't read correctly.\n"; return 1; } diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index 441063848c..becceb690b 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -28,7 +28,7 @@ using namespace llvm; // InputFilename - The filename to read from. static cl::opt -InputFilename(cl::Positional, cl::desc(""), +InputFilename(cl::Positional, cl::desc(""), cl::init("-"), cl::value_desc("filename")); static cl::opt @@ -67,7 +67,7 @@ int main(int argc, char **argv) { delete Buffer; if (M.get() == 0) { - cerr << argv[0] << ": bytecode didn't read correctly.\n"; + cerr << argv[0] << ": bitcode didn't read correctly.\n"; return 1; } diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index c86341fda5..46788b1011 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -11,7 +11,7 @@ // system 'ld' conventions. As such, the default output file is ./a.out. // Additionally, this program outputs a shell script that is used to invoke LLI // to execute the program. In this manner, the generated executable (a.out for -// example), is directly executable, whereas the bytecode file actually lives in +// example), is directly executable, whereas the bitcode file actually lives in // the a.out.bc file generated by this program. Also, Force is on by default. // // Note that if someone (or a script) deletes the executable program generated, @@ -42,7 +42,7 @@ using namespace llvm; // Input/Output Options static cl::list InputFilenames(cl::Positional, cl::OneOrMore, - cl::desc("")); + cl::desc("")); static cl::opt OutputFilename("o", cl::init("a.out"), cl::desc("Override output filename"), @@ -203,11 +203,11 @@ static void RemoveEnv(const char * name, char ** const envp) { return; } -/// GenerateBytecode - generates a bytecode file from the module provided -void GenerateBytecode(Module* M, const std::string& FileName) { +/// GenerateBitcode - generates a bitcode file from the module provided +void GenerateBitcode(Module* M, const std::string& FileName) { if (Verbose) - cout << "Generating Bytecode To " << FileName << '\n'; + cout << "Generating Bitcode To " << FileName << '\n'; // Create the output file. std::ios::openmode io_mode = std::ios::out | std::ios::trunc | @@ -216,22 +216,22 @@ void GenerateBytecode(Module* M, const std::string& FileName) { if (!Out.good()) PrintAndExit("error opening '" + FileName + "' for writing!"); - // Ensure that the bytecode file gets removed from the disk if we get a + // Ensure that the bitcode file gets removed from the disk if we get a // terminating signal. sys::RemoveFileOnSignal(sys::Path(FileName)); // Write it out WriteBitcodeToFile(M, Out); - // Close the bytecode file. + // Close the bitcode file. Out.close(); } /// GenerateAssembly - generates a native assembly language source file from the -/// specified bytecode file. +/// specified bitcode file. /// /// Inputs: -/// InputFilename - The name of the input bytecode file. +/// InputFilename - The name of the input bitcode file. /// OutputFilename - The name of the file to generate. /// llc - The pathname to use for LLC. /// envp - The environment to use when running LLC. @@ -242,7 +242,7 @@ static int GenerateAssembly(const std::string &OutputFilename, const std::string &InputFilename, const sys::Path &llc, std::string &ErrMsg ) { - // Run LLC to convert the bytecode file into assembly code. + // Run LLC to convert the bitcode file into assembly code. std::vector args; args.push_back(llc.c_str()); args.push_back("-f"); @@ -259,12 +259,12 @@ static int GenerateAssembly(const std::string &OutputFilename, return sys::Program::ExecuteAndWait(llc, &args[0], 0, 0, 0, 0, &ErrMsg); } -/// GenerateCFile - generates a C source file from the specified bytecode file. +/// GenerateCFile - generates a C source file from the specified bitcode file. static int GenerateCFile(const std::string &OutputFile, const std::string &InputFile, const sys::Path &llc, std::string& ErrMsg) { - // Run LLC to convert the bytecode file into C. + // Run LLC to convert the bitcode file into C. std::vector args; args.push_back(llc.c_str()); args.push_back("-march=c"); @@ -283,10 +283,10 @@ static int GenerateCFile(const std::string &OutputFile, } /// GenerateNative - generates a native object file from the -/// specified bytecode file. +/// specified bitcode file. /// /// Inputs: -/// InputFilename - The name of the input bytecode file. +/// InputFilename - The name of the input bitcode file. /// OutputFilename - The name of the file to generate. /// NativeLinkItems - The native libraries, files, code with which to link /// LibPaths - The list of directories in which to find libraries. @@ -377,7 +377,7 @@ static int GenerateNative(const std::string &OutputFilename, } /// EmitShellScript - Output the wrapper file that invokes the JIT on the LLVM -/// bytecode file for the program. +/// bitcode file for the program. static void EmitShellScript(char **argv) { if (Verbose) cout << "Emitting Shell Script\n"; @@ -478,7 +478,7 @@ int main(int argc, char **argv, char **envp) { // Construct a Linker (now that Verbose is set) Linker TheLinker(progname, OutputFilename, Verbose); - // Keep track of the native link items (versus the bytecode items) + // Keep track of the native link items (versus the bitcode items) Linker::ItemList NativeLinkItems; // Add library paths to the linker @@ -517,10 +517,10 @@ int main(int argc, char **argv, char **envp) { // Optimize the module Optimize(Composite.get()); - // Generate the bytecode for the optimized module. - std::string RealBytecodeOutput = OutputFilename; - if (!LinkAsLibrary) RealBytecodeOutput += ".bc"; - GenerateBytecode(Composite.get(), RealBytecodeOutput); + // Generate the bitcode for the optimized module. + std::string RealBitcodeOutput = OutputFilename; + if (!LinkAsLibrary) RealBitcodeOutput += ".bc"; + GenerateBitcode(Composite.get(), RealBitcodeOutput); // If we are not linking a library, generate either a native executable // or a JIT shell script, depending upon what the user wants. @@ -545,17 +545,17 @@ int main(int argc, char **argv, char **envp) { const char* args[4]; args[0] = I->c_str(); - args[1] = RealBytecodeOutput.c_str(); + args[1] = RealBitcodeOutput.c_str(); args[2] = tmp_output.c_str(); args[3] = 0; if (0 == sys::Program::ExecuteAndWait(prog, args, 0,0,0,0, &ErrMsg)) { - if (tmp_output.isBytecodeFile() || tmp_output.isBitcodeFile()) { - sys::Path target(RealBytecodeOutput); + if (tmp_output.isBitcodeFile() || tmp_output.isBitcodeFile()) { + sys::Path target(RealBitcodeOutput); target.eraseFromDisk(); if (tmp_output.renamePathOnDisk(target, &ErrMsg)) PrintAndExit(ErrMsg, 2); } else - PrintAndExit("Post-link optimization output is not bytecode"); + PrintAndExit("Post-link optimization output is not bitcode"); } else { PrintAndExit(ErrMsg); } @@ -563,9 +563,9 @@ int main(int argc, char **argv, char **envp) { } // If the user wants to generate a native executable, compile it from the - // bytecode file. + // bitcode file. // - // Otherwise, create a script that will run the bytecode through the JIT. + // Otherwise, create a script that will run the bitcode through the JIT. if (Native) { // Name of the Assembly Language output file sys::Path AssemblyFile ( OutputFilename); @@ -584,9 +584,9 @@ int main(int argc, char **argv, char **envp) { if (gcc.isEmpty()) PrintAndExit("Failed to find gcc"); - // Generate an assembly language file for the bytecode. + // Generate an assembly language file for the bitcode. std::string ErrMsg; - if (0 != GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, + if (0 != GenerateAssembly(AssemblyFile.toString(), RealBitcodeOutput, llc, ErrMsg)) PrintAndExit(ErrMsg); @@ -613,10 +613,10 @@ int main(int argc, char **argv, char **envp) { if (gcc.isEmpty()) PrintAndExit("Failed to find gcc"); - // Generate an assembly language file for the bytecode. + // Generate an assembly language file for the bitcode. std::string ErrMsg; if (0 != GenerateCFile( - CFile.toString(), RealBytecodeOutput, llc, ErrMsg)) + CFile.toString(), RealBitcodeOutput, llc, ErrMsg)) PrintAndExit(ErrMsg); if (0 != GenerateNative(OutputFilename, CFile.toString(), @@ -635,11 +635,11 @@ int main(int argc, char **argv, char **envp) { if (sys::Path(OutputFilename).makeExecutableOnDisk(&ErrMsg)) PrintAndExit(ErrMsg); - // Make the bytecode file readable and directly executable in LLEE as well - if (sys::Path(RealBytecodeOutput).makeExecutableOnDisk(&ErrMsg)) + // Make the bitcode file readable and directly executable in LLEE as well + if (sys::Path(RealBitcodeOutput).makeExecutableOnDisk(&ErrMsg)) PrintAndExit(ErrMsg); - if (sys::Path(RealBytecodeOutput).makeReadableOnDisk(&ErrMsg)) + if (sys::Path(RealBitcodeOutput).makeReadableOnDisk(&ErrMsg)) PrintAndExit(ErrMsg); } } catch (const std::string& msg) { diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index 28be3a97f3..5db13aabae 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -28,7 +28,7 @@ using namespace llvm; static cl::list InputFilenames(cl::Positional, cl::OneOrMore, - cl::desc("")); + cl::desc("")); static cl::opt OutputFilename("o", cl::desc("Override output filename"), cl::init("-"), @@ -42,7 +42,7 @@ Verbose("v", cl::desc("Print information about actions taken")); static cl::opt DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden); -// LoadFile - Read the specified bytecode file in and return it. This routine +// LoadFile - Read the specified bitcode file in and return it. This routine // searches the link path for the specified file to try to find it... // static inline std::auto_ptr LoadFile(const std::string &FN) { @@ -66,12 +66,12 @@ static inline std::auto_ptr LoadFile(const std::string &FN) { if (Result) return std::auto_ptr(Result); // Load successful! if (Verbose) { - cerr << "Error opening bytecode file: '" << Filename.c_str() << "'"; + cerr << "Error opening bitcode file: '" << Filename.c_str() << "'"; if (ErrorMessage.size()) cerr << ": " << ErrorMessage; cerr << "\n"; } } else { - cerr << "Bytecode file: '" << Filename.c_str() << "' does not exist.\n"; + cerr << "Bitcode file: '" << Filename.c_str() << "' does not exist.\n"; } return std::auto_ptr(); @@ -142,7 +142,7 @@ int main(int argc, char **argv) { return 1; } - if (Verbose) cerr << "Writing bytecode...\n"; + if (Verbose) cerr << "Writing bitcode...\n"; WriteBitcodeToFile(Composite.get(), *Out); if (Out != &std::cout) delete Out; diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index a1890a9d26..bf98653179 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // // This program is a utility that works like traditional Unix "nm", -// that is, it prints out the names of symbols in a bytecode file, +// that is, it prints out the names of symbols in a bitcode file, // along with some information about each symbol. // // This "nm" does not print symbols' addresses. It supports many of @@ -43,7 +43,7 @@ namespace { cl::aliasopt(OutputFormat)); cl::list - InputFilenames(cl::Positional, cl::desc(""), + InputFilenames(cl::Positional, cl::desc(""), cl::ZeroOrMore); cl::opt UndefinedOnly("undefined-only", diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index c85b0da1bc..dcb9d1ff21 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -32,8 +32,8 @@ using namespace llvm; namespace { cl::opt - BytecodeFile(cl::Positional, cl::desc(""), - cl::Required); + BitcodeFile(cl::Positional, cl::desc(""), + cl::Required); cl::opt ProfileDataFile(cl::Positional, cl::desc(""), @@ -115,16 +115,16 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm profile dump decoder\n"); sys::PrintStackTraceOnErrorSignal(); - // Read in the bytecode file... + // Read in the bitcode file... std::string ErrorMessage; Module *M = 0; - if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(BytecodeFile, + if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(BitcodeFile, &ErrorMessage)) { M = ParseBitcodeFile(Buffer, &ErrorMessage); delete Buffer; } if (M == 0) { - std::cerr << argv[0] << ": " << BytecodeFile << ": " + std::cerr << argv[0] << ": " << BitcodeFile << ": " << ErrorMessage << "\n"; return 1; } diff --git a/tools/llvm-ranlib/llvm-ranlib.cpp b/tools/llvm-ranlib/llvm-ranlib.cpp index 440b536194..9085b7ed45 100644 --- a/tools/llvm-ranlib/llvm-ranlib.cpp +++ b/tools/llvm-ranlib/llvm-ranlib.cpp @@ -48,7 +48,7 @@ int main(int argc, char **argv) { // like --help and --version. cl::ParseCommandLineOptions(argc, argv, " LLVM Archive Index Generator (llvm-ranlib)\n\n" - " This program adds or updates an index of bytecode symbols\n" + " This program adds or updates an index of bitcode symbols\n" " to an LLVM archive file." ); diff --git a/tools/llvm2cpp/llvm2cpp.cpp b/tools/llvm2cpp/llvm2cpp.cpp index d4382cd5ce..2db7543f48 100644 --- a/tools/llvm2cpp/llvm2cpp.cpp +++ b/tools/llvm2cpp/llvm2cpp.cpp @@ -31,7 +31,7 @@ using namespace llvm; static cl::opt -InputFilename(cl::Positional, cl::desc(""), +InputFilename(cl::Positional, cl::desc(""), cl::init("-")); static cl::opt @@ -60,7 +60,7 @@ int main(int argc, char **argv) { if (ErrorMessage.size()) std::cerr << ErrorMessage << "\n"; else - std::cerr << "bytecode didn't read correctly.\n"; + std::cerr << "bitcode didn't read correctly.\n"; return 1; } diff --git a/tools/llvmc/CompilerDriver.cpp b/tools/llvmc/CompilerDriver.cpp index b170270b0c..4be9f138ae 100644 --- a/tools/llvmc/CompilerDriver.cpp +++ b/tools/llvmc/CompilerDriver.cpp @@ -65,9 +65,9 @@ void DumpConfigData(CompilerDriver::ConfigData* cd, const std::string& type ){ DumpAction(&cd->Linker); } -static bool GetBytecodeDependentLibraries(const std::string &fname, - Module::LibraryListType& deplibs, - std::string* ErrMsg) { +static bool GetBitcodeDependentLibraries(const std::string &fname, + Module::LibraryListType& deplibs, + std::string* ErrMsg) { ModuleProvider *MP = 0; if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(fname)) { MP = getBitcodeModuleProvider(Buffer); @@ -558,8 +558,8 @@ private: } /// This method processes a linkage item. The item could be a - /// Bytecode file needing translation to native code and that is - /// dependent on other bytecode libraries, or a native code + /// Bitcode file needing translation to native code and that is + /// dependent on other bitcode libraries, or a native code /// library that should just be linked into the program. bool ProcessLinkageItem(const llvm::sys::Path& link_item, SetVector& set, @@ -586,11 +586,11 @@ private: // If we got here fullpath is the path to the file, and its readable. set.insert(fullpath); - // If its an LLVM bytecode file ... - if (fullpath.isBytecodeFile()) { + // If its an LLVM bitcode file ... + if (fullpath.isBitcodeFile()) { // Process the dependent libraries recursively Module::LibraryListType modlibs; - if (GetBytecodeDependentLibraries(fullpath.toString(),modlibs, &err)) { + if (GetBitcodeDependentLibraries(fullpath.toString(),modlibs, &err)) { // Traverse the dependent libraries list Module::lib_iterator LI = modlibs.begin(); Module::lib_iterator LE = modlibs.end(); @@ -675,7 +675,7 @@ public: // Get the suffix of the file name const std::string& ftype = I->second; - // If its a library, bytecode file, or object file, save + // If its a library, bitcode file, or object file, save // it for linking below and short circuit the // pre-processing/translation/assembly phases if (ftype.empty() || ftype == "o" || ftype == "bc" || ftype=="a") { @@ -771,7 +771,7 @@ public: // ll -> bc Helper if (action.isSet(OUTPUT_IS_ASM_FLAG)) { /// The output of the translator is an LLVM Assembly program - /// We need to translate it to bytecode + /// We need to translate it to bitcode Action* action = new Action(); action->program.set("llvm-as"); action->args.push_back(InFile.toString()); @@ -816,7 +816,7 @@ public: // ll -> bc Helper if (action.isSet(OUTPUT_IS_ASM_FLAG)) { /// The output of the optimizer is an LLVM Assembly program - /// We need to translate it to bytecode with llvm-as + /// We need to translate it to bitcode with llvm-as Action* action = new Action(); action->program.set("llvm-as"); action->args.push_back(InFile.toString()); diff --git a/tools/llvmc/CompilerDriver.h b/tools/llvmc/CompilerDriver.h index 02ec0e9f52..f2be5cc8cf 100644 --- a/tools/llvmc/CompilerDriver.h +++ b/tools/llvmc/CompilerDriver.h @@ -43,10 +43,10 @@ namespace llvm { /// @brief The phases of processing that llvmc understands enum Phases { PREPROCESSING, ///< Source language combining, filtering, substitution - TRANSLATION, ///< Translate source -> LLVM bytecode/assembly + TRANSLATION, ///< Translate source -> LLVM bitcode/assembly OPTIMIZATION, ///< Optimize translation result ASSEMBLY, ///< Convert program to executable - LINKING, ///< Link bytecode and native code + LINKING, ///< Link bitcode and native code NUM_PHASES ///< Always last! }; @@ -129,7 +129,7 @@ namespace llvm { TIME_ACTIONS_FLAG = 0x0010, ///< Time the actions as they execute SHOW_STATS_FLAG = 0x0020, ///< Show pass statistics EMIT_NATIVE_FLAG = 0x0040, ///< Emit native code instead of bc - EMIT_RAW_FLAG = 0x0080, ///< Emit raw, unoptimized bytecode + EMIT_RAW_FLAG = 0x0080, ///< Emit raw, unoptimized bitcode KEEP_TEMPS_FLAG = 0x0100, ///< Don't delete temporary files STRIP_OUTPUT_FLAG = 0x0200, ///< Strip symbols from linked output DRIVER_FLAGS_MASK = 0x03FF ///< Union of the above flags diff --git a/tools/llvmc/ConfigLexer.h b/tools/llvmc/ConfigLexer.h index 39960c88b9..9693b34bb4 100644 --- a/tools/llvmc/ConfigLexer.h +++ b/tools/llvmc/ConfigLexer.h @@ -56,7 +56,7 @@ enum ConfigLexerTokens { BINDIR_SUBST, ///< The substitution item %bindir% ASSEMBLY, ///< The value "assembly" (and variants) ASSEMBLER, ///< The name "assembler" (and variants) - BYTECODE, ///< The value "bytecode" (and variants) + BITCODE, ///< The value "bitcode" (and variants) COMMAND, ///< The name "command" (and variants) DEFS_SUBST, ///< The substitution item %defs% EQUALS, ///< The equals sign, = diff --git a/tools/llvmc/ConfigLexer.l b/tools/llvmc/ConfigLexer.l index 34b9a17de1..6bd61c85b9 100644 --- a/tools/llvmc/ConfigLexer.l +++ b/tools/llvmc/ConfigLexer.l @@ -79,7 +79,7 @@ ASSEMBLER assembler|Assembler|ASSEMBLER COMMAND command|Command|COMMAND LANG lang|Lang|LANG LIBS libs|Libs|LIBS -LINKER linker|Linker|LINKER +LINKER linker|Linker|LINKER NAME name|Name|NAME OPT1 opt1|Opt1|OPT1 OPT2 opt2|Opt2|OPT2 @@ -97,7 +97,7 @@ VERSION version|Version|VERSION True true|True|TRUE|on|On|ON|yes|Yes|YES False false|False|FALSE|off|Off|OFF|no|No|NO -Bytecode bc|BC|bytecode|Bytecode|BYTECODE +Bitcode bc|BC|bitcode|Bitcode|BITCODE Assembly asm|ASM|assembly|Assembly|ASSEMBLY BadSubst \%[a-zA-Z]*\% @@ -186,7 +186,7 @@ White [ \t]* %WOpts% { return handleSubstitution(WOPTS_SUBST); } {Assembly} { return handleValueContext(ASSEMBLY); } -{Bytecode} { return handleValueContext(BYTECODE); } +{Bitcode} { return handleValueContext(BITCODE); } {True} { return handleValueContext(TRUETOK); } {False} { return handleValueContext(FALSETOK); } diff --git a/tools/llvmc/Configuration.cpp b/tools/llvmc/Configuration.cpp index 1364e9b2eb..aafca792b1 100644 --- a/tools/llvmc/Configuration.cpp +++ b/tools/llvmc/Configuration.cpp @@ -291,8 +291,8 @@ namespace { case ASSEMBLY: str += "assembly"; break; - case BYTECODE: - str += "bytecode"; + case BITCODE: + str += "bitcode"; break; case TRUETOK: str += "true"; @@ -340,8 +340,8 @@ namespace { case ASSEMBLY: anOption += "assembly"; break; - case BYTECODE: - anOption += "bytecode"; + case BITCODE: + anOption += "bitcode"; break; case TRUETOK: anOption += "true"; @@ -392,7 +392,7 @@ namespace { next(); if (token == ASSEMBLY) { return true; - } else if (token == BYTECODE) { + } else if (token == BITCODE) { return false; } else { error("Expecting output type value"); diff --git a/tools/llvmc/llvmc.cpp b/tools/llvmc/llvmc.cpp index 081ae453ec..c257a3ebab 100644 --- a/tools/llvmc/llvmc.cpp +++ b/tools/llvmc/llvmc.cpp @@ -143,7 +143,7 @@ static cl::opt OutputMachine("m", cl::Prefix, cl::desc("Specify a target machine"), cl::value_desc("machine")); static cl::opt Native("native", cl::init(false), - cl::desc("Generative native code instead of bytecode")); + cl::desc("Generative native code instead of bitcode")); static cl::opt DebugOutput("g", cl::init(false), cl::desc("Generate objects that include debug symbols")); diff --git a/tools/lto/lto-c.cpp b/tools/lto/lto-c.cpp index f89b374e19..ae939a99bf 100644 --- a/tools/lto/lto-c.cpp +++ b/tools/lto/lto-c.cpp @@ -30,7 +30,7 @@ void llvm_destroy_optimizer(llvm_lto_t lto) { delete (llvm::LTO*)lto; } -/// Read an LLVM bytecode file using LTO::readLLVMObjectFile. +/// Read an LLVM bitcode file using LTO::readLLVMObjectFile. extern "C" llvm_lto_status llvm_read_object_file(llvm_lto_t lto, const char *input_filename) { diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 3420cdf67b..dacea661d1 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -107,7 +107,7 @@ LTO::removeModule (const std::string &InputFilename) delete m; } -/// InputFilename is a LLVM bytecode file. If Module with InputFilename is +/// InputFilename is a LLVM bitcode file. If Module with InputFilename is /// available then return it. Otherwise parseInputFilename. Module * LTO::getModule(const std::string &InputFilename) @@ -128,7 +128,7 @@ LTO::getModule(const std::string &InputFilename) return m; } -/// InputFilename is a LLVM bytecode file. Reade this bytecode file and +/// InputFilename is a LLVM bitcode file. Reade this bitcode file and /// set corresponding target triplet string. void LTO::getTargetTriple(const std::string &InputFilename, @@ -139,7 +139,7 @@ LTO::getTargetTriple(const std::string &InputFilename, targetTriple = m->getTargetTriple(); } -/// InputFilename is a LLVM bytecode file. Read it using bytecode reader. +/// InputFilename is a LLVM bitcode file. Read it using bitcode reader. /// Collect global functions and symbol names in symbols vector. /// Collect external references in references vector. /// Return LTO_READ_SUCCESS if there is no error. diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index ace0d3c9bc..4eca308425 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -46,7 +46,7 @@ PassList(cl::desc("Optimizations available:")); // Other command line options... // static cl::opt -InputFilename(cl::Positional, cl::desc(""), +InputFilename(cl::Positional, cl::desc(""), cl::init("-"), cl::value_desc("filename")); static cl::opt @@ -61,7 +61,7 @@ PrintEachXForm("p", cl::desc("Print module after each transformation")); static cl::opt NoOutput("disable-output", - cl::desc("Do not write result bytecode file"), cl::Hidden); + cl::desc("Do not write result bitcode file"), cl::Hidden); static cl::opt NoVerify("disable-verify", cl::desc("Do not verify result module"), cl::Hidden); @@ -330,7 +330,7 @@ int main(int argc, char **argv) { if (ErrorMessage.size()) cerr << ErrorMessage << "\n"; else - cerr << "bytecode didn't read correctly.\n"; + cerr << "bitcode didn't read correctly.\n"; return 1; } @@ -362,7 +362,7 @@ int main(int argc, char **argv) { // If the output is set to be emitted to standard out, and standard out is a // console, print out a warning message and refuse to do it. We don't // impress anyone by spewing tons of binary goo to a terminal. - if (!Force && !NoOutput && CheckBytecodeOutputToConsole(Out,!Quiet)) { + if (!Force && !NoOutput && CheckBitcodeOutputToConsole(Out,!Quiet)) { NoOutput = true; } @@ -418,7 +418,7 @@ int main(int argc, char **argv) { if (!NoVerify && !VerifyEach) Passes.add(createVerifierPass()); - // Write bytecode out to disk or cout as the last step... + // Write bitcode out to disk or cout as the last step... if (!NoOutput && !AnalyzeOnly) Passes.add(CreateBitcodeWriterPass(*Out)); -- cgit v1.2.3-70-g09d2