diff options
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/AsmPrinter.h | 110 | ||||
-rw-r--r-- | include/llvm/CodeGen/FileWriters.h | 10 | ||||
-rw-r--r-- | include/llvm/CodeGen/LinkAllCodegenComponents.h | 1 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineBasicBlock.h | 4 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 8 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineModuleInfo.h | 3 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineOperand.h | 4 | ||||
-rw-r--r-- | include/llvm/CodeGen/Passes.h | 4 | ||||
-rw-r--r-- | include/llvm/CodeGen/SchedulerRegistry.h | 5 | ||||
-rw-r--r-- | include/llvm/CodeGen/SelectionDAG.h | 11 | ||||
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 53 |
11 files changed, 123 insertions, 90 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 9a07e31..377096c 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -48,10 +48,12 @@ namespace llvm { class MCSection; class MCStreamer; class MCSymbol; + class MDNode; class DwarfWriter; class Mangler; class MCAsmInfo; class TargetLoweringObjectFile; + class Twine; class Type; class formatted_raw_ostream; @@ -131,10 +133,10 @@ namespace llvm { /// Mangler *Mang; - /// Cache of mangled name for current function. This is recalculated at the + /// The symbol for the current function. This is recalculated at the /// beginning of each call to runOnMachineFunction(). /// - std::string CurrentFnName; + MCSymbol *CurrentFnSym; /// getCurrentSection() - Return the current section we are emitting to. const MCSection *getCurrentSection() const; @@ -151,7 +153,7 @@ namespace llvm { mutable unsigned Counter; // Private state for processDebugLoc() - mutable DebugLocTuple PrevDLT; + mutable const MDNode *PrevDLT; protected: explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM, @@ -213,10 +215,6 @@ namespace llvm { unsigned AsmVariant, const char *ExtraCode); - /// PrintGlobalVariable - Emit the specified global variable and its - /// initializer to the output stream. - virtual void PrintGlobalVariable(const GlobalVariable *GV) = 0; - /// SetupMachineFunction - This should be called when a new MachineFunction /// is being processed from runOnMachineFunction. void SetupMachineFunction(MachineFunction &MF); @@ -238,6 +236,9 @@ namespace llvm { /// void EmitJumpTableInfo(MachineJumpTableInfo *MJTI, MachineFunction &MF); + /// EmitGlobalVariable - Emit the specified global variable to the .s file. + virtual void EmitGlobalVariable(const GlobalVariable *GV); + /// EmitSpecialLLVMGlobal - Check to see if the specified global is a /// special global used by LLVM. If so, emit it and return true, otherwise /// do nothing and return false. @@ -245,39 +246,9 @@ namespace llvm { public: //===------------------------------------------------------------------===// - /// LEB 128 number encoding. - - /// PrintULEB128 - Print a series of hexidecimal values(separated by commas) - /// representing an unsigned leb128 value. - void PrintULEB128(unsigned Value) const; - - /// PrintSLEB128 - Print a series of hexidecimal values(separated by commas) - /// representing a signed leb128 value. - void PrintSLEB128(int Value) const; - - //===------------------------------------------------------------------===// // Emission and print routines // - /// PrintHex - Print a value as a hexidecimal value. - /// - void PrintHex(int Value) const; - - /// EOL - Print a newline character to asm stream. If a comment is present - /// then it will be printed first. Comments should not contain '\n'. - void EOL() const; - void EOL(const std::string &Comment) const; - void EOL(const char* Comment) const; - void EOL(const char *Comment, unsigned Encoding) const; - - /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an - /// unsigned leb128 value. - void EmitULEB128Bytes(unsigned Value) const; - - /// EmitSLEB128Bytes - print an assembler byte data directive to compose a - /// signed leb128 value. - void EmitSLEB128Bytes(int Value) const; - /// EmitInt8 - Emit a byte directive and value. /// void EmitInt8(int Value) const; @@ -294,14 +265,8 @@ namespace llvm { /// void EmitInt64(uint64_t Value) const; - /// EmitString - Emit a string with quotes and a null terminator. - /// Special characters are emitted properly. - /// @verbatim (Eg. '\t') @endverbatim - void EmitString(const StringRef String) const; - void EmitString(const char *String, unsigned Size) const; - /// EmitFile - Emit a .file directive. - void EmitFile(unsigned Number, const std::string &Name) const; + void EmitFile(unsigned Number, StringRef Name) const; //===------------------------------------------------------------------===// @@ -336,13 +301,32 @@ namespace llvm { /// EmitComments - Pretty-print comments for instructions void EmitComments(const MachineInstr &MI) const; - /// EmitComments - Pretty-print comments for basic blocks - void EmitComments(const MachineBasicBlock &MBB) const; + /// GetGlobalValueSymbol - Return the MCSymbol for the specified global + /// value. + MCSymbol *GetGlobalValueSymbol(const GlobalValue *GV) const; + + /// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with + /// global value name as its base, with the specified suffix, and where the + /// symbol is forced to have private linkage if ForcePrivate is true. + MCSymbol *GetSymbolWithGlobalValueBase(const GlobalValue *GV, + StringRef Suffix, + bool ForcePrivate = true) const; + + /// GetExternalSymbolSymbol - Return the MCSymbol for the specified + /// ExternalSymbol. + MCSymbol *GetExternalSymbolSymbol(StringRef Sym) const; + /// GetMBBSymbol - Return the MCSymbol corresponding to the specified basic /// block label. MCSymbol *GetMBBSymbol(unsigned MBBID) const; + /// GetCPISymbol - Return the symbol for the specified constant pool entry. + MCSymbol *GetCPISymbol(unsigned CPID) const; + + /// GetJTISymbol - Return the symbol for the specified jump table entry. + MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const; + /// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress /// uses of the specified basic block. MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA, @@ -355,22 +339,14 @@ namespace llvm { /// MachineBasicBlock, an alignment (if present) and a comment describing /// it if appropriate. void EmitBasicBlockStart(const MachineBasicBlock *MBB) const; - protected: - /// EmitZeros - Emit a block of zeros. - /// - void EmitZeros(uint64_t NumZeros, unsigned AddrSpace = 0) const; - - /// EmitString - Emit a zero-byte-terminated string constant. - /// - virtual void EmitString(const ConstantArray *CVA) const; - - /// EmitConstantValueOnly - Print out the specified constant, without a - /// storage class. Only constants of first-class type are allowed here. - void EmitConstantValueOnly(const Constant *CV); - + + + // Data emission. + /// EmitGlobalConstant - Print a general LLVM constant to the .s file. void EmitGlobalConstant(const Constant* CV, unsigned AddrSpace = 0); - + + protected: virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV); /// processDebugLoc - Processes the debug information of each machine @@ -398,26 +374,16 @@ namespace llvm { const MachineBasicBlock *MBB, unsigned uid) const; - /// printDataDirective - This method prints the asm directive for the - /// specified type. - void printDataDirective(const Type *type, unsigned AddrSpace = 0); - /// printVisibility - This prints visibility information about symbol, if /// this is suported by the target. - void printVisibility(const std::string& Name, unsigned Visibility) const; - + void printVisibility(MCSymbol *Sym, unsigned Visibility) const; + /// printOffset - This is just convenient handler for printing offsets. void printOffset(int64_t Offset) const; private: void EmitLLVMUsedList(Constant *List); void EmitXXStructorList(Constant *List); - void EmitGlobalConstantStruct(const ConstantStruct* CVS, - unsigned AddrSpace); - void EmitGlobalConstantArray(const ConstantArray* CVA, unsigned AddrSpace); - void EmitGlobalConstantVector(const ConstantVector* CP); - void EmitGlobalConstantFP(const ConstantFP* CFP, unsigned AddrSpace); - void EmitGlobalConstantLargeInt(const ConstantInt* CI, unsigned AddrSpace); GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C); }; } diff --git a/include/llvm/CodeGen/FileWriters.h b/include/llvm/CodeGen/FileWriters.h index a913d21..9dba838 100644 --- a/include/llvm/CodeGen/FileWriters.h +++ b/include/llvm/CodeGen/FileWriters.h @@ -20,11 +20,17 @@ namespace llvm { class ObjectCodeEmitter; class TargetMachine; class raw_ostream; + class formatted_raw_ostream; + class MachineFunctionPass; + class MCAsmInfo; + class MCCodeEmitter; ObjectCodeEmitter *AddELFWriter(PassManagerBase &FPM, raw_ostream &O, TargetMachine &TM); - ObjectCodeEmitter *AddMachOWriter(PassManagerBase &FPM, raw_ostream &O, - TargetMachine &TM); + MachineFunctionPass *createMachOWriter(formatted_raw_ostream &O, + TargetMachine &TM, + const MCAsmInfo *T, + MCCodeEmitter *MCE); } // end llvm namespace diff --git a/include/llvm/CodeGen/LinkAllCodegenComponents.h b/include/llvm/CodeGen/LinkAllCodegenComponents.h index 5608c99..27947e8 100644 --- a/include/llvm/CodeGen/LinkAllCodegenComponents.h +++ b/include/llvm/CodeGen/LinkAllCodegenComponents.h @@ -44,6 +44,7 @@ namespace { (void) llvm::createBURRListDAGScheduler(NULL, llvm::CodeGenOpt::Default); (void) llvm::createTDRRListDAGScheduler(NULL, llvm::CodeGenOpt::Default); + (void) llvm::createSourceListDAGScheduler(NULL,llvm::CodeGenOpt::Default); (void) llvm::createTDListDAGScheduler(NULL, llvm::CodeGenOpt::Default); (void) llvm::createFastDAGScheduler(NULL, llvm::CodeGenOpt::Default); (void) llvm::createDefaultScheduler(NULL, llvm::CodeGenOpt::Default); diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index 6b4c640..20644c1 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -337,6 +337,10 @@ public: MachineBasicBlock *DestB, bool isCond); + /// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping + /// any DEBUG_VALUE instructions. Return UnknownLoc if there is none. + DebugLoc findDebugLoc(MachineBasicBlock::iterator &MBBI); + // Debugging methods. void dump() const; void print(raw_ostream &OS) const; diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index a12a55a..6ca51bf 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -26,6 +26,7 @@ namespace llvm { +class DILocation; class Value; class Function; class MachineRegisterInfo; @@ -174,9 +175,6 @@ public: AlignOf<Ty>::Alignment)); MFInfo = new (Loc) Ty(*this); } - - assert((void*)dynamic_cast<Ty*>(MFInfo) == (void*)MFInfo && - "Invalid concrete type or multiple inheritence for getInfo"); return static_cast<Ty*>(MFInfo); } @@ -368,8 +366,8 @@ public: // Debug location. // - /// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object. - DebugLocTuple getDebugLocTuple(DebugLoc DL) const; + /// getDILocation - Get the DILocation for a given DebugLoc object. + DILocation getDILocation(DebugLoc DL) const; /// getDefaultDebugLoc - Get the default debug location for the machine /// function. diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index e9b645b..d365029 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -172,9 +172,6 @@ public: Ty &getObjFileInfo() { if (ObjFileMMI == 0) ObjFileMMI = new Ty(*this); - - assert((void*)dynamic_cast<Ty*>(ObjFileMMI) == (void*)ObjFileMMI && - "Invalid concrete type or multiple inheritence for getInfo"); return *static_cast<Ty*>(ObjFileMMI); } diff --git a/include/llvm/CodeGen/MachineOperand.h b/include/llvm/CodeGen/MachineOperand.h index 907c25a..07d886d 100644 --- a/include/llvm/CodeGen/MachineOperand.h +++ b/include/llvm/CodeGen/MachineOperand.h @@ -453,11 +453,9 @@ public: Op.setTargetFlags(TargetFlags); return Op; } - static MachineOperand CreateMetadata(MDNode *Meta, - unsigned char TargetFlags = 0) { + static MachineOperand CreateMetadata(MDNode *Meta) { MachineOperand Op(MachineOperand::MO_Metadata); Op.Contents.MD = Meta; - Op.setTargetFlags(TargetFlags); return Op; } diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h index 2203f8c..7e0da3f 100644 --- a/include/llvm/CodeGen/Passes.h +++ b/include/llvm/CodeGen/Passes.h @@ -195,10 +195,6 @@ namespace llvm { /// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow. FunctionPass *createSjLjEHPass(const TargetLowering *tli); - /// createMaxStackAlignmentCalculatorPass() - Determine the maximum required - /// alignment for a function. - FunctionPass* createMaxStackAlignmentCalculatorPass(); - } // End llvm namespace #endif diff --git a/include/llvm/CodeGen/SchedulerRegistry.h b/include/llvm/CodeGen/SchedulerRegistry.h index 1cf64a0..cf3274f 100644 --- a/include/llvm/CodeGen/SchedulerRegistry.h +++ b/include/llvm/CodeGen/SchedulerRegistry.h @@ -73,6 +73,11 @@ ScheduleDAGSDNodes *createBURRListDAGScheduler(SelectionDAGISel *IS, ScheduleDAGSDNodes *createTDRRListDAGScheduler(SelectionDAGISel *IS, CodeGenOpt::Level OptLevel); +/// createBURRListDAGScheduler - This creates a bottom up register usage +/// reduction list scheduler that schedules in source code order when possible. +ScheduleDAGSDNodes *createSourceListDAGScheduler(SelectionDAGISel *IS, + CodeGenOpt::Level OptLevel); + /// createTDListDAGScheduler - This creates a top-down list scheduler with /// a hazard recognizer. ScheduleDAGSDNodes *createTDListDAGScheduler(SelectionDAGISel *IS, diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index d55dd7f..33ebd00 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -63,6 +63,10 @@ enum CombineLevel { NoIllegalOperations // Combine may only create legal operations and types. }; +class SelectionDAG; +void checkForCycles(const SDNode *N); +void checkForCycles(const SelectionDAG *DAG); + /// SelectionDAG class - This is used to represent a portion of an LLVM function /// in a low-level Data Dependence DAG representation suitable for instruction /// selection. This DAG is constructed as the first step of instruction @@ -204,7 +208,12 @@ public: const SDValue &setRoot(SDValue N) { assert((!N.getNode() || N.getValueType() == MVT::Other) && "DAG root value is not a chain!"); - return Root = N; + if (N.getNode()) + checkForCycles(N.getNode()); + Root = N; + if (N.getNode()) + checkForCycles(this); + return Root; } /// Combine - This iterates over the nodes in the SelectionDAG, folding diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 7b1931a..45a9d40 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -44,6 +44,8 @@ template <typename T> struct DenseMapInfo; template <typename T> struct simplify_type; template <typename T> struct ilist_traits; +void checkForCycles(const SDNode *N); + /// SDVTList - This represents a list of ValueType's that has been intern'd by /// a SelectionDAG. Instances of this simple value class are returned by /// SelectionDAG::getVTList(...). @@ -1285,11 +1287,56 @@ public: void print_details(raw_ostream &OS, const SelectionDAG *G) const; void print(raw_ostream &OS, const SelectionDAG *G = 0) const; void printr(raw_ostream &OS, const SelectionDAG *G = 0) const; + + /// printrFull - Print a SelectionDAG node and all children down to + /// the leaves. The given SelectionDAG allows target-specific nodes + /// to be printed in human-readable form. Unlike printr, this will + /// print the whole DAG, including children that appear multiple + /// times. + /// + void printrFull(raw_ostream &O, const SelectionDAG *G = 0) const; + + /// printrWithDepth - Print a SelectionDAG node and children up to + /// depth "depth." The given SelectionDAG allows target-specific + /// nodes to be printed in human-readable form. Unlike printr, this + /// will print children that appear multiple times wherever they are + /// used. + /// + void printrWithDepth(raw_ostream &O, const SelectionDAG *G = 0, + unsigned depth = 100) const; + + + /// dump - Dump this node, for debugging. void dump() const; + + /// dumpr - Dump (recursively) this node and its use-def subgraph. void dumpr() const; + + /// dump - Dump this node, for debugging. + /// The given SelectionDAG allows target-specific nodes to be printed + /// in human-readable form. void dump(const SelectionDAG *G) const; + + /// dumpr - Dump (recursively) this node and its use-def subgraph. + /// The given SelectionDAG allows target-specific nodes to be printed + /// in human-readable form. void dumpr(const SelectionDAG *G) const; + /// dumprFull - printrFull to dbgs(). The given SelectionDAG allows + /// target-specific nodes to be printed in human-readable form. + /// Unlike dumpr, this will print the whole DAG, including children + /// that appear multiple times. + /// + void dumprFull(const SelectionDAG *G = 0) const; + + /// dumprWithDepth - printrWithDepth to dbgs(). The given + /// SelectionDAG allows target-specific nodes to be printed in + /// human-readable form. Unlike dumpr, this will print children + /// that appear multiple times wherever they are used. + /// + void dumprWithDepth(const SelectionDAG *G = 0, unsigned depth = 100) const; + + static bool classof(const SDNode *) { return true; } /// Profile - Gather unique data for the node. @@ -1318,6 +1365,7 @@ protected: OperandList[i].setUser(this); OperandList[i].setInitial(Ops[i]); } + checkForCycles(this); } /// This constructor adds no operands itself; operands can be @@ -1334,6 +1382,7 @@ protected: Ops[0].setInitial(Op0); NumOperands = 1; OperandList = Ops; + checkForCycles(this); } /// InitOperands - Initialize the operands list of this with 2 operands. @@ -1344,6 +1393,7 @@ protected: Ops[1].setInitial(Op1); NumOperands = 2; OperandList = Ops; + checkForCycles(this); } /// InitOperands - Initialize the operands list of this with 3 operands. @@ -1357,6 +1407,7 @@ protected: Ops[2].setInitial(Op2); NumOperands = 3; OperandList = Ops; + checkForCycles(this); } /// InitOperands - Initialize the operands list of this with 4 operands. @@ -1372,6 +1423,7 @@ protected: Ops[3].setInitial(Op3); NumOperands = 4; OperandList = Ops; + checkForCycles(this); } /// InitOperands - Initialize the operands list of this with N operands. @@ -1382,6 +1434,7 @@ protected: } NumOperands = N; OperandList = Ops; + checkForCycles(this); } /// DropOperands - Release the operands and set this node to have |