[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotTable.h
Changes in directory llvm/lib/Bytecode/Writer: SlotTable.h (r1.5) removed --- Log message: This file has been dead for a long time. Remove it. --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-extract/llvm-extract.cpp
Changes in directory llvm/tools/llvm-extract: llvm-extract.cpp updated: 1.33 -> 1.34 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+7 -2) llvm-extract.cpp |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/tools/llvm-extract/llvm-extract.cpp diff -u llvm/tools/llvm-extract/llvm-extract.cpp:1.33 llvm/tools/llvm-extract/llvm-extract.cpp:1.34 --- llvm/tools/llvm-extract/llvm-extract.cpp:1.33 Wed Dec 6 19:30:31 2006 +++ llvm/tools/llvm-extract/llvm-extract.cppSun Jan 28 07:31:35 2007 @@ -42,6 +42,10 @@ static cl::opt DeleteFn("delete", cl::desc("Delete specified function from Module")); +static cl::opt +Relink("relink", + cl::desc("Turn external linkage for callees of function to delete")); + // ExtractFunc - The function to extract from the module... defaults to main. static cl::opt ExtractFunc("func", cl::desc("Specify function to extract"), cl::init("main"), @@ -72,8 +76,9 @@ PassManager Passes; Passes.add(new TargetData(M.get())); // Use correct TargetData // Either isolate the function or delete it from the Module -Passes.add(createFunctionExtractionPass(F, DeleteFn)); -Passes.add(createGlobalDCEPass()); // Delete unreachable globals +Passes.add(createFunctionExtractionPass(F, DeleteFn, Relink)); +if (!DeleteFn) + Passes.add(createGlobalDCEPass()); // Delete unreachable globals Passes.add(createFunctionResolvingPass()); // Delete prototypes Passes.add(createDeadTypeEliminationPass()); // Remove dead types... ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h
Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.102 -> 1.103 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+2 -0) TargetLowering.h |2 ++ 1 files changed, 2 insertions(+) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.102 llvm/include/llvm/Target/TargetLowering.h:1.103 --- llvm/include/llvm/Target/TargetLowering.h:1.102 Fri Jan 12 17:21:42 2007 +++ llvm/include/llvm/Target/TargetLowering.h Sun Jan 28 07:31:35 2007 @@ -730,6 +730,8 @@ SDOperand Node; const Type* Ty; bool isSigned; +bool isInReg; +bool isSRet; }; typedef std::vector ArgListTy; virtual std::pair ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CallingConv.h DerivedTypes.h
Changes in directory llvm/include/llvm: CallingConv.h updated: 1.5 -> 1.6 DerivedTypes.h updated: 1.81 -> 1.82 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+7 -9) CallingConv.h |8 DerivedTypes.h |8 +++- 2 files changed, 7 insertions(+), 9 deletions(-) Index: llvm/include/llvm/CallingConv.h diff -u llvm/include/llvm/CallingConv.h:1.5 llvm/include/llvm/CallingConv.h:1.6 --- llvm/include/llvm/CallingConv.h:1.5 Sun Sep 17 15:25:45 2006 +++ llvm/include/llvm/CallingConv.h Sun Jan 28 07:31:35 2007 @@ -30,14 +30,6 @@ /// certain amounts of prototype mismatch. C = 0, -/// CSRet - C Struct Return calling convention. This convention requires -/// that the function return void and take a pointer as the first argument -/// of the struct. This is used by targets which need to distinguish -/// between C functions returning a structure, and C functions taking a -/// structure pointer as the first argument to the function. -CSRet = 1, - - // Generic LLVM calling conventions. None of these calling conventions // support varargs calls, and all assume that the caller and callee // prototype exactly match. Index: llvm/include/llvm/DerivedTypes.h diff -u llvm/include/llvm/DerivedTypes.h:1.81 llvm/include/llvm/DerivedTypes.h:1.82 --- llvm/include/llvm/DerivedTypes.h:1.81 Fri Jan 19 15:13:56 2007 +++ llvm/include/llvm/DerivedTypes.hSun Jan 28 07:31:35 2007 @@ -134,7 +134,9 @@ NoAttributeSet= 0, ///< No attribute value has been set ZExtAttribute = 1, ///< zero extended before/after call SExtAttribute = 1 << 1, ///< sign extended before/after call -NoReturnAttribute = 1 << 2 ///< mark the function as not returning +NoReturnAttribute = 1 << 2, ///< mark the function as not returning +InRegAttribute= 1 << 3, ///< force argument to be passed in register +StructRetAttribute= 1 << 4 ///< hidden pointer to structure to return }; typedef std::vector ParamAttrsList; private: @@ -176,6 +178,10 @@ /// unsigned getNumParams() const { return unsigned(ContainedTys.size()-1); } + bool isStructReturn() const { +return (getNumParams() && paramHasAttr(1, StructRetAttribute)); + } + /// The parameter attributes for the \p ith parameter are returned. The 0th /// parameter refers to the return type of the function. /// @returns The ParameterAttributes for the \p ith parameter. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Type.cpp Verifier.cpp
Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.255 -> 1.256 Type.cpp updated: 1.166 -> 1.167 Verifier.cpp updated: 1.186 -> 1.187 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+9 -8) AsmWriter.cpp |3 --- Type.cpp |4 Verifier.cpp | 10 +- 3 files changed, 9 insertions(+), 8 deletions(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.255 llvm/lib/VMCore/AsmWriter.cpp:1.256 --- llvm/lib/VMCore/AsmWriter.cpp:1.255 Fri Jan 26 02:02:52 2007 +++ llvm/lib/VMCore/AsmWriter.cpp Sun Jan 28 07:31:35 2007 @@ -956,7 +956,6 @@ // Print the calling convention. switch (F->getCallingConv()) { case CallingConv::C: break; // default - case CallingConv::CSRet:Out << "csretcc "; break; case CallingConv::Fast: Out << "fastcc "; break; case CallingConv::Cold: Out << "coldcc "; break; case CallingConv::X86_StdCall: Out << "x86_stdcallcc "; break; @@ -1166,7 +1165,6 @@ // Print the calling convention being used. switch (CI->getCallingConv()) { case CallingConv::C: break; // default -case CallingConv::CSRet: Out << " csretcc"; break; case CallingConv::Fast: Out << " fastcc"; break; case CallingConv::Cold: Out << " coldcc"; break; case CallingConv::X86_StdCall: Out << "x86_stdcallcc "; break; @@ -1209,7 +1207,6 @@ // Print the calling convention being used. switch (II->getCallingConv()) { case CallingConv::C: break; // default -case CallingConv::CSRet: Out << " csretcc"; break; case CallingConv::Fast: Out << " fastcc"; break; case CallingConv::Cold: Out << " coldcc"; break; case CallingConv::X86_StdCall: Out << "x86_stdcallcc "; break; Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.166 llvm/lib/VMCore/Type.cpp:1.167 --- llvm/lib/VMCore/Type.cpp:1.166 Fri Jan 26 01:51:36 2007 +++ llvm/lib/VMCore/Type.cppSun Jan 28 07:31:35 2007 @@ -1089,6 +1089,10 @@ Result += "sext "; if (Attr & NoReturnAttribute) Result += "noreturn "; + if (Attr & InRegAttribute) +Result += "inreg "; + if (Attr & StructRetAttribute) +Result += "sret "; return Result; } Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.186 llvm/lib/VMCore/Verifier.cpp:1.187 --- llvm/lib/VMCore/Verifier.cpp:1.186 Sun Jan 14 20:27:26 2007 +++ llvm/lib/VMCore/Verifier.cppSun Jan 28 07:31:35 2007 @@ -338,17 +338,17 @@ F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); + Assert1(!FT->isStructReturn() || + (FT->getReturnType() == Type::VoidTy && + FT->getNumParams() > 0 && isa(FT->getParamType(0))), + "Invalid struct-return function!", &F); + // Check that this function meets the restrictions on this calling convention. switch (F.getCallingConv()) { default: break; case CallingConv::C: break; - case CallingConv::CSRet: -Assert1(FT->getReturnType() == Type::VoidTy && -FT->getNumParams() > 0 && isa(FT->getParamType(0)), -"Invalid struct-return function!", &F); -break; case CallingConv::Fast: case CallingConv::Cold: case CallingConv::X86_FastCall: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Transforms/IPO.h
Changes in directory llvm/include/llvm/Transforms: IPO.h updated: 1.47 -> 1.48 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+2 -1) IPO.h |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Transforms/IPO.h diff -u llvm/include/llvm/Transforms/IPO.h:1.47 llvm/include/llvm/Transforms/IPO.h:1.48 --- llvm/include/llvm/Transforms/IPO.h:1.47 Thu Jan 25 18:47:38 2007 +++ llvm/include/llvm/Transforms/IPO.h Sun Jan 28 07:31:35 2007 @@ -82,7 +82,8 @@ /// the specified function. Otherwise, it deletes as much of the module as /// possible, except for the function specified. /// -ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false); +ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false, + bool relinkCallees = false); //===--===// ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.247 -> 1.248 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+3 -3) PPCISelLowering.cpp |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.247 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.248 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.247 Fri Jan 26 08:34:51 2007 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sun Jan 28 07:31:35 2007 @@ -1360,9 +1360,9 @@ // On PPC64, promote integers to 64-bit values. if (isPPC64 && Arg.getValueType() == MVT::i32) { - unsigned ExtOp = ISD::ZERO_EXTEND; - if (cast(Op.getOperand(5+2*i+1))->getValue()) -ExtOp = ISD::SIGN_EXTEND; + unsigned Flags = cast(Op.getOperand(5+2*i+1))->getValue(); + unsigned ExtOp = (Flags & 1) ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND; + Arg = DAG.getNode(ExtOp, MVT::i64, Arg); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.165 -> 1.166 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+14 -9) SelectionDAGNodes.h | 23 ++- 1 files changed, 14 insertions(+), 9 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.165 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.166 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.165 Fri Jan 26 15:22:28 2007 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Sun Jan 28 07:31:35 2007 @@ -133,20 +133,25 @@ // UNDEF - An undefined node UNDEF, -/// FORMAL_ARGUMENTS(CHAIN, CC#, ISVARARG) - This node represents the formal -/// arguments for a function. CC# is a Constant value indicating the -/// calling convention of the function, and ISVARARG is a flag that -/// indicates whether the function is varargs or not. This node has one -/// result value for each incoming argument, plus one for the output chain. -/// It must be custom legalized. +/// FORMAL_ARGUMENTS(CHAIN, CC#, ISVARARG, FLAG0, ..., FLAGn) - This node +/// represents the formal arguments for a function. CC# is a Constant value +/// indicating the calling convention of the function, and ISVARARG is a +/// flag that indicates whether the function is varargs or not. This node +/// has one result value for each incoming argument, plus one for the output +/// chain. It must be custom legalized. See description of CALL node for +/// FLAG argument contents explanation. /// FORMAL_ARGUMENTS, /// RV1, RV2...RVn, CHAIN = CALL(CHAIN, CC#, ISVARARG, ISTAILCALL, CALLEE, -/// ARG0, SIGN0, ARG1, SIGN1, ... ARGn, SIGNn) +/// ARG0, FLAG0, ARG1, FLAG1, ... ARGn, FLAGn) /// This node represents a fully general function call, before the legalizer -/// runs. This has one result value for each argument / signness pair, plus -/// a chain result. It must be custom legalized. +/// runs. This has one result value for each argument / flag pair, plus +/// a chain result. It must be custom legalized. Flag argument indicates +/// misc. argument attributes. Currently: +/// Bit 0 - signness +/// Bit 1 - 'inreg' attribute +/// Bit 2 - 'sret' attribute CALL, // EXTRACT_ELEMENT - This is used to get the first or second (determined by ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l Lexer.l.cvs llvmAsmParser.y llvmAsmParser.y.cvs
Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.96 -> 1.97 Lexer.l.cvs updated: 1.23 -> 1.24 llvmAsmParser.y updated: 1.313 -> 1.314 llvmAsmParser.y.cvs updated: 1.59 -> 1.60 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+16 -14) Lexer.l |3 ++- Lexer.l.cvs |3 ++- llvmAsmParser.y | 12 ++-- llvmAsmParser.y.cvs | 12 ++-- 4 files changed, 16 insertions(+), 14 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.96 llvm/lib/AsmParser/Lexer.l:1.97 --- llvm/lib/AsmParser/Lexer.l:1.96 Fri Jan 26 02:04:51 2007 +++ llvm/lib/AsmParser/Lexer.l Sun Jan 28 07:31:35 2007 @@ -227,7 +227,6 @@ cc { return CC_TOK; } ccc { return CCC_TOK; } -csretcc { return CSRETCC_TOK; } fastcc { return FASTCC_TOK; } coldcc { return COLDCC_TOK; } x86_stdcallcc { return X86_STDCALLCC_TOK; } @@ -287,6 +286,8 @@ trunc { RET_TOK(CastOpVal, Trunc, TRUNC); } zext{ RET_TOK(CastOpVal, ZExt, ZEXT); } sext{ RET_TOK(CastOpVal, SExt, SEXT); } +inreg { return INREG; } +sret{ return SRET; } fptrunc { RET_TOK(CastOpVal, FPTrunc, FPTRUNC); } fpext { RET_TOK(CastOpVal, FPExt, FPEXT); } uitofp { RET_TOK(CastOpVal, UIToFP, UITOFP); } Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.23 llvm/lib/AsmParser/Lexer.l.cvs:1.24 --- llvm/lib/AsmParser/Lexer.l.cvs:1.23 Fri Jan 26 02:05:27 2007 +++ llvm/lib/AsmParser/Lexer.l.cvs Sun Jan 28 07:31:35 2007 @@ -227,7 +227,6 @@ cc { return CC_TOK; } ccc { return CCC_TOK; } -csretcc { return CSRETCC_TOK; } fastcc { return FASTCC_TOK; } coldcc { return COLDCC_TOK; } x86_stdcallcc { return X86_STDCALLCC_TOK; } @@ -287,6 +286,8 @@ trunc { RET_TOK(CastOpVal, Trunc, TRUNC); } zext{ RET_TOK(CastOpVal, ZExt, ZEXT); } sext{ RET_TOK(CastOpVal, SExt, SEXT); } +inreg { return INREG; } +sret{ return SRET; } fptrunc { RET_TOK(CastOpVal, FPTrunc, FPTRUNC); } fpext { RET_TOK(CastOpVal, FPExt, FPEXT); } uitofp { RET_TOK(CastOpVal, UIToFP, UITOFP); } Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.313 llvm/lib/AsmParser/llvmAsmParser.y:1.314 --- llvm/lib/AsmParser/llvmAsmParser.y:1.313Fri Jan 26 02:04:51 2007 +++ llvm/lib/AsmParser/llvmAsmParser.y Sun Jan 28 07:31:35 2007 @@ -984,8 +984,7 @@ %token DLLIMPORT DLLEXPORT EXTERN_WEAK %token OPAQUE EXTERNAL TARGET TRIPLE ALIGN %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT -%token CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK -%token X86_STDCALLCC_TOK X86_FASTCALLCC_TOK +%token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK X86_STDCALLCC_TOK X86_FASTCALLCC_TOK %token DATALAYOUT %type OptCallingConv %type OptParamAttrs ParamAttr @@ -1017,7 +1016,7 @@ %token EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR // Function Attributes -%token NORETURN +%token NORETURN INREG SRET // Visibility Styles %token DEFAULT HIDDEN @@ -1119,7 +1118,6 @@ OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | CCC_TOK{ $$ = CallingConv::C; } | - CSRETCC_TOK{ $$ = CallingConv::CSRet; } | FASTCC_TOK { $$ = CallingConv::Fast; } | COLDCC_TOK { $$ = CallingConv::Cold; } | X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; } | @@ -1131,8 +1129,10 @@ CHECK_FOR_ERROR }; -ParamAttr : ZEXT { $$ = FunctionType::ZExtAttribute; } - | SEXT { $$ = FunctionType::SExtAttribute; } +ParamAttr : ZEXT { $$ = FunctionType::ZExtAttribute; } + | SEXT { $$ = Functio
[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp
Changes in directory llvm/lib/Target/ARM: ARMISelLowering.cpp updated: 1.4 -> 1.5 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+0 -1) ARMISelLowering.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/ARM/ARMISelLowering.cpp diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.4 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.5 --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.4 Fri Jan 26 08:34:51 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Sun Jan 28 07:31:35 2007 @@ -352,7 +352,6 @@ SDOperand Chain= Op.getOperand(0); unsigned CallConv = cast(Op.getOperand(1))->getValue(); assert((CallConv == CallingConv::C || - CallConv == CallingConv::CSRet || CallConv == CallingConv::Fast) && "unknown calling convention"); SDOperand Callee = Op.getOperand(4); unsigned NumOps= (Op.getNumOperands() - 5) / 2; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp ExtractFunction.cpp
Changes in directory llvm/lib/Transforms/IPO: DeadArgumentElimination.cpp updated: 1.34 -> 1.35 ExtractFunction.cpp updated: 1.15 -> 1.16 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+29 -7) DeadArgumentElimination.cpp |7 --- ExtractFunction.cpp | 29 + 2 files changed, 29 insertions(+), 7 deletions(-) Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.34 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.35 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.34Sat Dec 30 23:48:39 2006 +++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Sun Jan 28 07:31:35 2007 @@ -230,9 +230,10 @@ // (used in a computation), MaybeLive (only passed as an argument to a call), or // Dead (not used). DAE::Liveness DAE::getArgumentLiveness(const Argument &A) { - // If this is the return value of a csret function, it's not really dead. - if (A.getParent()->getCallingConv() == CallingConv::CSRet && - &*A.getParent()->arg_begin() == &A) + const FunctionType *FTy = A.getParent()->getFunctionType(); + + // If this is the return value of a struct function, it's not really dead. + if (FTy->isStructReturn() && &*A.getParent()->arg_begin() == &A) return Live; if (A.use_empty()) // First check, directly dead? Index: llvm/lib/Transforms/IPO/ExtractFunction.cpp diff -u llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.15 llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.16 --- llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.15Thu Jan 25 11:38:26 2007 +++ llvm/lib/Transforms/IPO/ExtractFunction.cpp Sun Jan 28 07:31:35 2007 @@ -11,6 +11,7 @@ // //===--===// +#include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Transforms/IPO.h" @@ -20,13 +21,15 @@ class FunctionExtractorPass : public ModulePass { Function *Named; bool deleteFunc; +bool reLink; public: /// FunctionExtractorPass - If deleteFn is true, this pass deletes as the /// specified function. Otherwise, it deletes as much of the module as /// possible, except for the function specified. /// -FunctionExtractorPass(Function *F = 0, bool deleteFn = true) - : Named(F), deleteFunc(deleteFn) {} +FunctionExtractorPass(Function *F = 0, bool deleteFn = true, + bool relinkCallees = false) + : Named(F), deleteFunc(deleteFn), reLink(relinkCallees) {} bool runOnModule(Module &M) { if (Named == 0) { @@ -41,6 +44,23 @@ } bool deleteFunction() { + // If we're in relinking mode, set linkage of all internal callees to + // external. This will allow us extract function, and then - link + // everything together + if (reLink) { +for (Function::iterator B = Named->begin(), BE = Named->end(); + B != BE; ++B) { + for (BasicBlock::iterator I = B->begin(), E = B->end(); + I != E; ++I) { +if (CallInst* callInst = dyn_cast(&*I)) { + Function* Callee = callInst->getCalledFunction(); + if (Callee && Callee->hasInternalLinkage()) +Callee->setLinkage(GlobalValue::ExternalLinkage); +} + } +} + } + Named->setLinkage(GlobalValue::ExternalLinkage); Named->deleteBody(); assert(Named->isExternal() && "This didn't make the function external!"); @@ -113,6 +133,7 @@ RegisterPass X("extract", "Function Extractor"); } -ModulePass *llvm::createFunctionExtractionPass(Function *F, bool deleteFn) { - return new FunctionExtractorPass(F, deleteFn); +ModulePass *llvm::createFunctionExtractionPass(Function *F, bool deleteFn, + bool relinkCallees) { +
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.459 -> 1.460 SelectionDAGISel.cpp updated: 1.346 -> 1.347 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+33 -13) LegalizeDAG.cpp |6 -- SelectionDAGISel.cpp | 40 +--- 2 files changed, 33 insertions(+), 13 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.459 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.460 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.459 Fri Jan 26 15:22:28 2007 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jan 28 07:31:35 2007 @@ -2168,6 +2168,7 @@ const char *FnName = 0; if (Node->getOpcode() == ISD::MEMSET) { Entry.Node = Tmp2; Entry.isSigned = false; Entry.Ty = IntPtrTy; + Entry.isInReg = false; Args.push_back(Entry); // Extend the (previously legalized) ubyte argument to be an int value // for the call. @@ -2176,6 +2177,7 @@ else Tmp3 = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Tmp3); Entry.Node = Tmp3; Entry.Ty = Type::Int32Ty; Entry.isSigned = true; + Entry.isInReg = false; Args.push_back(Entry); Entry.Node = Tmp4; Entry.Ty = IntPtrTy; Entry.isSigned = false; Args.push_back(Entry); @@ -2183,7 +2185,7 @@ FnName = "memset"; } else if (Node->getOpcode() == ISD::MEMCPY || Node->getOpcode() == ISD::MEMMOVE) { -Entry.Ty = IntPtrTy; Entry.isSigned = false; +Entry.Ty = IntPtrTy; Entry.isSigned = false; Entry.isInReg = false; Entry.Node = Tmp2; Args.push_back(Entry); Entry.Node = Tmp3; Args.push_back(Entry); Entry.Node = Tmp4; Args.push_back(Entry); @@ -4124,7 +4126,7 @@ MVT::ValueType ArgVT = Node->getOperand(i).getValueType(); const Type *ArgTy = MVT::getTypeForValueType(ArgVT); Entry.Node = Node->getOperand(i); Entry.Ty = ArgTy; -Entry.isSigned = isSigned; +Entry.isSigned = isSigned; Entry.isInReg = false; Args.push_back(Entry); } SDOperand Callee = DAG.getExternalSymbol(Name, TLI.getPointerTy()); Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.346 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.347 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.346Fri Jan 26 15:22:28 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Jan 28 07:31:35 2007 @@ -2167,6 +2167,8 @@ SDOperand ArgNode = getValue(Arg); Entry.Node = ArgNode; Entry.Ty = Arg->getType(); Entry.isSigned = FTy->paramHasAttr(i, FunctionType::SExtAttribute); +Entry.isInReg = FTy->paramHasAttr(i, FunctionType::InRegAttribute); +Entry.isSRet = FTy->paramHasAttr(i, FunctionType::StructRetAttribute); Args.push_back(Entry); } @@ -2761,6 +2763,8 @@ Entry.Node = Src; Entry.Ty = TLI.getTargetData()->getIntPtrType(); Entry.isSigned = false; + Entry.isInReg = false; + Entry.isSRet = false; Args.push_back(Entry); std::pair Result = @@ -2777,6 +2781,8 @@ Entry.Node = getValue(I.getOperand(0)); Entry.Ty = TLI.getTargetData()->getIntPtrType(); Entry.isSigned = false; + Entry.isInReg = false; + Entry.isSRet = false; Args.push_back(Entry); MVT::ValueType IntPtr = TLI.getPointerTy(); std::pair Result = @@ -2859,6 +2865,7 @@ /// integrated into SDISel. std::vector TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) { + const FunctionType *FTy = F.getFunctionType(); // Add CC# and isVararg as operands to the FORMAL_ARGUMENTS node. std::vector Ops; Ops.push_back(DAG.getRoot()); @@ -2867,16 +2874,22 @@ // Add one result value for each formal argument. std::vector RetVals; + unsigned j = 0; for (Function::arg_iterator
[llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp
Changes in directory llvm/lib/Target/CBackend: CBackend.cpp updated: 1.320 -> 1.321 --- Log message: Propagate changes from my local tree. This patch includes: 1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. --- Diffs of the changes: (+17 -11) CBackend.cpp | 28 +--- 1 files changed, 17 insertions(+), 11 deletions(-) Index: llvm/lib/Target/CBackend/CBackend.cpp diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.320 llvm/lib/Target/CBackend/CBackend.cpp:1.321 --- llvm/lib/Target/CBackend/CBackend.cpp:1.320 Fri Jan 26 02:01:30 2007 +++ llvm/lib/Target/CBackend/CBackend.cpp Sun Jan 28 07:31:35 2007 @@ -1748,8 +1748,8 @@ } void CWriter::printFunctionSignature(const Function *F, bool Prototype) { - /// isCStructReturn - Should this function actually return a struct by-value? - bool isCStructReturn = F->getCallingConv() == CallingConv::CSRet; + /// isStructReturn - Should this function actually return a struct by-value? + bool isStructReturn = F->getFunctionType()->isStructReturn(); if (F->hasInternalLinkage()) Out << "static "; if (F->hasDLLImportLinkage()) Out << "__declspec(dllimport) "; @@ -1778,7 +1778,7 @@ // If this is a struct-return function, don't print the hidden // struct-return argument. - if (isCStructReturn) { + if (isStructReturn) { assert(I != E && "Invalid struct return function!"); ++I; } @@ -1804,7 +1804,7 @@ // If this is a struct-return function, don't print the hidden // struct-return argument. -if (isCStructReturn) { +if (isStructReturn) { assert(I != E && "Invalid struct return function!"); ++I; } @@ -1832,7 +1832,7 @@ // Get the return tpe for the function. const Type *RetTy; - if (!isCStructReturn) + if (!isStructReturn) RetTy = F->getReturnType(); else { // If this is a struct-return function, print the struct-return type. @@ -1855,11 +1855,14 @@ } void CWriter::printFunction(Function &F) { + /// isStructReturn - Should this function actually return a struct by-value? + bool isStructReturn = F.getFunctionType()->isStructReturn(); + printFunctionSignature(&F, false); Out << " {\n"; // If this is a struct return function, handle the result with magic. - if (F.getCallingConv() == CallingConv::CSRet) { + if (isStructReturn) { const Type *StructTy = cast(F.arg_begin()->getType())->getElementType(); Out << " "; @@ -1977,7 +1980,10 @@ // void CWriter::visitReturnInst(ReturnInst &I) { // If this is a struct return function, return the temporary struct. - if (I.getParent()->getParent()->getCallingConv() == CallingConv::CSRet) { + bool isStructReturn = I.getParent()->getParent()-> +getFunctionType()->isStructReturn(); + + if (isStructReturn) { Out << " return StructReturn;\n"; return; } @@ -2468,9 +2474,12 @@ Value *Callee = I.getCalledValue(); + const PointerType *PTy = cast(Callee->getType()); + const FunctionType *FTy = cast(PTy->getElementType()); + // If this is a call to a struct-return function, assign to the first // parameter instead of passing it to the call. - bool isStructRet = I.getCallingConv() == CallingConv::CSRet; + bool isStructRet = FTy->isStructReturn(); if (isStructRet) { Out << "*("; writeOperand(I.getOperand(1)); @@ -2478,9 +2487,6 @@ } if (I.isTailCall()) Out << " /*tail*/ "; - - const PointerType *PTy = cast(Callee->getType()); - const FunctionType *FTy = cast(PTy->getElementType()); if (!WroteCallee) { // If this is an indirect call to a struct return function, we need to cast ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y UpgradeParser.y.cvs
Changes in directory llvm/tools/llvm-upgrade: UpgradeParser.y updated: 1.49 -> 1.50 UpgradeParser.y.cvs updated: 1.47 -> 1.48 --- Log message: Drop CSRET CC --- Diffs of the changes: (+22 -126) UpgradeParser.y | 74 +++- UpgradeParser.y.cvs | 74 +++- 2 files changed, 22 insertions(+), 126 deletions(-) Index: llvm/tools/llvm-upgrade/UpgradeParser.y diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.49 llvm/tools/llvm-upgrade/UpgradeParser.y:1.50 --- llvm/tools/llvm-upgrade/UpgradeParser.y:1.49Sat Jan 27 18:51:40 2007 +++ llvm/tools/llvm-upgrade/UpgradeParser.y Sun Jan 28 07:36:18 2007 @@ -570,7 +570,6 @@ } } -/// @brief This just makes any name given to it unique, up to MAX_UINT times. static std::string makeNameUnique(const std::string& Name) { static unsigned UniqueNameCounter = 1; std::string Result(Name); @@ -578,57 +577,6 @@ return Result; } -/// This is the implementation portion of TypeHasInteger. It traverses the -/// type given, avoiding recursive types, and returns true as soon as it finds -/// an integer type. If no integer type is found, it returns false. -static bool TypeHasIntegerI(const Type *Ty, std::vector Stack) { - // Handle some easy cases - if (Ty->isPrimitiveType() || (Ty->getTypeID() == Type::OpaqueTyID)) -return false; - if (Ty->isInteger()) -return true; - if (const SequentialType *STy = dyn_cast(Ty)) -return STy->getElementType()->isInteger(); - - // Avoid type structure recursion - for (std::vector::iterator I = Stack.begin(), E = Stack.end(); - I != E; ++I) -if (Ty == *I) - return false; - - // Push us on the type stack - Stack.push_back(Ty); - - if (const FunctionType *FTy = dyn_cast(Ty)) { -if (TypeHasIntegerI(FTy->getReturnType(), Stack)) - return true; -FunctionType::param_iterator I = FTy->param_begin(); -FunctionType::param_iterator E = FTy->param_end(); -for (; I != E; ++I) - if (TypeHasIntegerI(*I, Stack)) -return true; -return false; - } else if (const StructType *STy = dyn_cast(Ty)) { -StructType::element_iterator I = STy->element_begin(); -StructType::element_iterator E = STy->element_end(); -for (; I != E; ++I) { - if (TypeHasIntegerI(*I, Stack)) -return true; -} -return false; - } - // There shouldn't be anything else, but its definitely not integer - assert(0 && "What type is this?"); - return false; -} - -/// This is the interface to TypeHasIntegerI. It just provides the type stack, -/// to avoid recursion, and then calls TypeHasIntegerI. -static inline bool TypeHasInteger(const Type *Ty) { - std::vector TyStack; - return TypeHasIntegerI(Ty, TyStack); -} - // setValueName - Set the specified value to the name given. The name may be // null potentially, in which case this is a noop. The string passed in is // assumed to be a malloc'd string buffer, and is free'd by this function. @@ -657,16 +605,16 @@ } } if (Existing) { - // An existing value of the same name was found. This might have happened - // because of the integer type planes collapsing in LLVM 2.0. - if (Existing->getType() == V->getType() && - !TypeHasInteger(Existing->getType())) { -// If the type does not contain any integers in them then this can't be -// a type plane collapsing issue. It truly is a redefinition and we -// should error out as the assembly is invalid. -error("Redefinition of value named '" + Name + "' of type '" + - V->getType()->getDescription() + "'"); -return; + if (Existing->getType() == V->getType()) { +// The type of the Existing value and the new one are the same. This +// is probably a type plane collapsing error. If the types involved +// are both integer, just rename it. Otherwise it +// is a redefinition error. +if (!Existing->getType()->isInteger()) { + error("Redefinition of value named '" + Name + "' in the '" + +V->getType()->getDescription() + "' type plane"); + return; +} } // In LLVM 2.0 we don't allow names to be re-used for any values in a // function, regardless of Type. Previously re-use of names was okay as @@ -1628,7 +1576,7 @@ OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | CCC_TOK{ $$ = CallingConv::C; } - | CSRETCC_TOK{ $$ = CallingConv::CSRet; } + | CSRETCC_TOK{ $$ = CallingConv::C; } | FASTCC_TOK { $$ = CallingConv::Fast; } | COLDCC_TOK { $$ = CallingConv::Cold; } | X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; } Index: llvm/tools/llvm-upgrade/UpgradeParser.y.cvs diff -u llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.47 llvm/tools/llvm-upgrade/UpgradeParser.y.cvs:1.48 --- llvm/tools/llvm-upgrade/Upgra
[llvm-commits] CVS: llvm/docs/LangRef.html
Changes in directory llvm/docs: LangRef.html updated: 1.203 -> 1.204 --- Log message: Document 'inreg' & 'sret' --- Diffs of the changes: (+8 -20) LangRef.html | 28 1 files changed, 8 insertions(+), 20 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.203 llvm/docs/LangRef.html:1.204 --- llvm/docs/LangRef.html:1.203Tue Jan 23 06:35:46 2007 +++ llvm/docs/LangRef.html Sun Jan 28 08:30:45 2007 @@ -530,19 +530,6 @@ prototype and implemented declaration of the function (as does normal C). - "csretcc" - The C struct return calling convention: - - This calling convention matches the target C calling conventions, except - that functions with this convention are required to take a pointer as their - first argument, and the return type of the function must be void. This is - used for C functions that return aggregates by-value. In this case, the - function has been transformed to take a pointer to the struct as the first - argument to the function. For targets where the ABI specifies specific - behavior for structure-return calls, the calling convention can be used to - distinguish between struct return functions and other functions that take a - pointer to a struct as the first argument. - - "fastcc" - The fast calling convention: This calling convention attempts to make calls as fast as possible @@ -743,14 +730,15 @@ sext This indicates that the parameter should be sign extended just before a call to this function. +inreg +This indicates that the parameter should be placed in register (if +possible) during assembling function call. It's currently supported in x86 +backend only. +sret +This indicates, that the parameter is special hidden pointer to struct +to return. Usually such parameter needs special handling during codegen. - The current motivation for parameter attributes is to enable the sign and - zero extend information necessary for the C calling convention to be passed - from the front end to LLVM. The zext and sext attributes - are used by the code generator to perform the required extension. However, - parameter attributes are an orthogonal feature to calling conventions and - may be used for other purposes in the future. @@ -4519,7 +4507,7 @@ mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.org";>The LLVM Compiler Infrastructure - Last modified: $Date: 2007/01/23 12:35:46 $ + Last modified: $Date: 2007/01/28 14:30:45 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y UpgradeParser.y.cvs
> Changes in directory llvm/tools/llvm-upgrade: > > UpgradeParser.y updated: 1.49 -> 1.50 > UpgradeParser.y.cvs updated: 1.47 -> 1.48 > --- > Log message: > > Drop CSRET CC Is this patch right? Two issues: 1. You removed TypeHasInteger[I]. Is that correct? 2. You map csretcc directly to ccc. You should also arrange for the 'sret' attribute to be applied to the first argument. Maybe I'm missing how this is done. -Chris > > --- > Diffs of the changes: (+22 -126) > > UpgradeParser.y | 74 ++ > +- > UpgradeParser.y.cvs | 74 ++ > +- > 2 files changed, 22 insertions(+), 126 deletions(-) > > > Index: llvm/tools/llvm-upgrade/UpgradeParser.y > diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.49 llvm/tools/ > llvm-upgrade/UpgradeParser.y:1.50 > --- llvm/tools/llvm-upgrade/UpgradeParser.y:1.49 Sat Jan 27 > 18:51:40 2007 > +++ llvm/tools/llvm-upgrade/UpgradeParser.y Sun Jan 28 07:36:18 2007 > @@ -570,7 +570,6 @@ >} > } > > -/// @brief This just makes any name given to it unique, up to > MAX_UINT times. > static std::string makeNameUnique(const std::string& Name) { >static unsigned UniqueNameCounter = 1; >std::string Result(Name); > @@ -578,57 +577,6 @@ >return Result; > } > > -/// This is the implementation portion of TypeHasInteger. It > traverses the > -/// type given, avoiding recursive types, and returns true as soon > as it finds > -/// an integer type. If no integer type is found, it returns false. > -static bool TypeHasIntegerI(const Type *Ty, std::vector Type*> Stack) { > - // Handle some easy cases > - if (Ty->isPrimitiveType() || (Ty->getTypeID() == Type::OpaqueTyID)) > -return false; > - if (Ty->isInteger()) > -return true; > - if (const SequentialType *STy = dyn_cast(Ty)) > -return STy->getElementType()->isInteger(); > - > - // Avoid type structure recursion > - for (std::vector::iterator I = Stack.begin(), E = > Stack.end(); > - I != E; ++I) > -if (Ty == *I) > - return false; > - > - // Push us on the type stack > - Stack.push_back(Ty); > - > - if (const FunctionType *FTy = dyn_cast(Ty)) { > -if (TypeHasIntegerI(FTy->getReturnType(), Stack)) > - return true; > -FunctionType::param_iterator I = FTy->param_begin(); > -FunctionType::param_iterator E = FTy->param_end(); > -for (; I != E; ++I) > - if (TypeHasIntegerI(*I, Stack)) > -return true; > -return false; > - } else if (const StructType *STy = dyn_cast(Ty)) { > -StructType::element_iterator I = STy->element_begin(); > -StructType::element_iterator E = STy->element_end(); > -for (; I != E; ++I) { > - if (TypeHasIntegerI(*I, Stack)) > -return true; > -} > -return false; > - } > - // There shouldn't be anything else, but its definitely not integer > - assert(0 && "What type is this?"); > - return false; > -} > - > -/// This is the interface to TypeHasIntegerI. It just provides the > type stack, > -/// to avoid recursion, and then calls TypeHasIntegerI. > -static inline bool TypeHasInteger(const Type *Ty) { > - std::vector TyStack; > - return TypeHasIntegerI(Ty, TyStack); > -} > - > // setValueName - Set the specified value to the name given. The > name may be > // null potentially, in which case this is a noop. The string > passed in is > // assumed to be a malloc'd string buffer, and is free'd by this > function. > @@ -657,16 +605,16 @@ >} > } > if (Existing) { > - // An existing value of the same name was found. This might > have happened > - // because of the integer type planes collapsing in LLVM 2.0. > - if (Existing->getType() == V->getType() && > - !TypeHasInteger(Existing->getType())) { > -// If the type does not contain any integers in them then > this can't be > -// a type plane collapsing issue. It truly is a > redefinition and we > -// should error out as the assembly is invalid. > -error("Redefinition of value named '" + Name + "' of type > '" + > - V->getType()->getDescription() + "'"); > -return; > + if (Existing->getType() == V->getType()) { > +// The type of the Existing value and the new one are the > same. This > +// is probably a type plane collapsing error. If the types > involved > +// are both integer, just rename it. Otherwise it > +// is a redefinition error. > +if (!Existing->getType()->isInteger()) { > + error("Redefinition of value named '" + Name + "' in the > '" + > +V->getType()->getDescription() + "' type plane"); > + return; > +} >} >// In LLVM 2.0 we don't allow names to be re-used for any > values in a >// function, regardless of Type. Previously re-use of names > was okay as > @@ -1628,7 +1576,7 @@ > OptCallingConv >
Re: [llvm-commits] CVS: llvm/docs/LangRef.html
> Document 'inreg' & 'sret' Nice. > @@ -743,14 +730,15 @@ > sext > This indicates that the parameter should be sign extended > just before > a call to this function. > +inreg > +This indicates that the parameter should be placed in > register (if > +possible) during assembling function call. It's currently > supported in x86 > +backend only. Please say "Support for this attribute is target-specific." instead of saying that only the x86 backend implements it. I'd prefer to keep 'current status' out of LangRef.html. > +sret > +This indicates, that the parameter is special hidden > pointer to struct > +to return. Grammar, I suggest: "This indicates that the parameter specifies the address of a structure that is the return value of the function in the source program." Thanks Anton! -Chris > Usually such parameter needs special handling during codegen. > > > - The current motivation for parameter attributes is to enable > the sign and > - zero extend information necessary for the C calling convention > to be passed > - from the front end to LLVM. The zext and sext > attributes > - are used by the code generator to perform the required > extension. However, > - parameter attributes are an orthogonal feature to calling > conventions and > - may be used for other purposes in the future. > > > > @@ -4519,7 +4507,7 @@ > >mailto:[EMAIL PROTECTED]">Chris Lattner >http://llvm.org";>The LLVM Compiler Infrastructure > - Last modified: $Date: 2007/01/23 12:35:46 $ > + Last modified: $Date: 2007/01/28 14:30:45 $ > > > > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/docs/LangRef.html
Changes in directory llvm/docs: LangRef.html updated: 1.204 -> 1.205 --- Log message: Grammar fix --- Diffs of the changes: (+6 -5) LangRef.html | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.204 llvm/docs/LangRef.html:1.205 --- llvm/docs/LangRef.html:1.204Sun Jan 28 08:30:45 2007 +++ llvm/docs/LangRef.html Sun Jan 28 09:27:21 2007 @@ -732,11 +732,12 @@ a call to this function. inreg This indicates that the parameter should be placed in register (if -possible) during assembling function call. It's currently supported in x86 -backend only. +possible) during assembling function call. Support for this attribute is +target-specific sret -This indicates, that the parameter is special hidden pointer to struct -to return. Usually such parameter needs special handling during codegen. +This indicates that the parameter specifies the address of a structure +that is the return value of the function in the source program. + @@ -4507,7 +4508,7 @@ mailto:[EMAIL PROTECTED]">Chris Lattner http://llvm.org";>The LLVM Compiler Infrastructure - Last modified: $Date: 2007/01/28 14:30:45 $ + Last modified: $Date: 2007/01/28 15:27:21 $ ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp ExtractFunction.cpp
> bool deleteFunction() { > + // If we're in relinking mode, set linkage of all internal > callees to > + // external. This will allow us extract function, and then - > link > + // everything together I think 'relink' should always be true. In the case where you are extracting a single function, it will never matter. In the case where you are deleting a function, you certainly want this. As such, I'd just make it unconditional. > + if (reLink) { > +for (Function::iterator B = Named->begin(), BE = Named->end > (); > + B != BE; ++B) { > + for (BasicBlock::iterator I = B->begin(), E = B->end(); > + I != E; ++I) { > +if (CallInst* callInst = dyn_cast(&*I)) { > + Function* Callee = callInst->getCalledFunction(); > + if (Callee && Callee->hasInternalLinkage()) > +Callee->setLinkage(GlobalValue::ExternalLinkage); > +} > + } > +} However, this implementation won't work for functions whose addresses are taken. Why not just scan the function and global var list and mark everything external? Global vars should have the same problem, no? -Chris > + } > + >Named->setLinkage(GlobalValue::ExternalLinkage); >Named->deleteBody(); >assert(Named->isExternal() && "This didn't make the function > external!"); > @@ -113,6 +133,7 @@ >RegisterPass X("extract", "Function > Extractor"); > } > > -ModulePass *llvm::createFunctionExtractionPass(Function *F, bool > deleteFn) { > - return new FunctionExtractorPass(F, deleteFn); > +ModulePass *llvm::createFunctionExtractionPass(Function *F, bool > deleteFn, > + bool relinkCallees) { > + return new FunctionExtractorPass(F, deleteFn, relinkCallees); > } > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
> +/// runs. This has one result value for each argument / flag > pair, plus > +/// a chain result. It must be custom legalized. Flag argument > indicates > +/// misc. argument attributes. Currently: > +/// Bit 0 - signness > +/// Bit 1 - 'inreg' attribute > +/// Bit 2 - 'sret' attribute > CALL, Is there any reason not to use the parameter attribute enum directly? -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp
> +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jan 28 > 07:31:35 2007 > @@ -2168,6 +2168,7 @@ >const char *FnName = 0; >if (Node->getOpcode() == ISD::MEMSET) { > Entry.Node = Tmp2; Entry.isSigned = false; Entry.Ty = > IntPtrTy; > + Entry.isInReg = false; Please remove the tabs here and elsewhere. >// Add one result value for each formal argument. >std::vector RetVals; > + unsigned j = 0; >for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); > I != E; ++I) { > MVT::ValueType VT = getValueType(I->getType()); > +bool isInReg = FTy->paramHasAttr(++j, > FunctionType::InRegAttribute); Please increment j in the for loop, e.g. "++I, ++j" to make it more clear how j is evolving. Overall, this is a great patch, nice work! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.317 -> 1.318 --- Log message: Fix compile error "jump to case label crosses initialization". What compiler are people using that accepts this code? --- Diffs of the changes: (+6 -5) X86ISelLowering.cpp | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.317 llvm/lib/Target/X86/X86ISelLowering.cpp:1.318 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.317 Sun Jan 28 07:31:35 2007 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sun Jan 28 09:39:16 2007 @@ -1542,11 +1542,12 @@ default: assert(0 && "Unhandled argument type!"); case MVT::i8: case MVT::i16: - case MVT::i32: - unsigned RegToUse = GPRArgRegs[ObjectVT-MVT::i8][GPRInd][NumIntRegs]; - Reg = AddLiveIn(MF, RegToUse, GPRClasses[ObjectVT-MVT::i8]); - ArgValue = DAG.getCopyFromReg(Root, Reg, ObjectVT); - break; + case MVT::i32: { +unsigned RegToUse = GPRArgRegs[ObjectVT-MVT::i8][GPRInd][NumIntRegs]; +Reg = AddLiveIn(MF, RegToUse, GPRClasses[ObjectVT-MVT::i8]); +ArgValue = DAG.getCopyFromReg(Root, Reg, ObjectVT); +break; + } case MVT::v16i8: case MVT::v8i16: case MVT::v4i32: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] SRet & InReg patch for llvm-gcc
Hello, Everyone. Attached patch will enable llvm-gcc to use sret & inreg attributes. -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. diff -r 19e687420e52 gcc/config/i386/cygming.h --- a/gcc/config/i386/cygming.h Sun Jan 28 02:52:06 2007 +0300 +++ b/gcc/config/i386/cygming.h Sun Jan 28 17:55:48 2007 +0300 @@ -429,6 +429,8 @@ extern int i386_pe_dllimport_p (tree); #endif /* APPLE LOCAL begin LLVM */ +#ifdef ENABLE_LLVM + /* LLVM specific stuff for supporting dllimport & dllexport linkage output */ #define TARGET_ADJUST_LLVM_LINKAGE(GV, decl)\ @@ -439,18 +441,11 @@ extern int i386_pe_dllimport_p (tree); (GV)->setLinkage(GlobalValue::DLLExportLinkage); \ } \ } - -/* LLVM specific stuff for supporting calling convention output */ - -#define TARGET_ADJUST_LLVM_CC(CC, type) \ - { \ -tree type_attributes = TYPE_ATTRIBUTES (type); \ -if (lookup_attribute ("stdcall", type_attributes)) {\ - CC = CallingConv::X86_StdCall;\ -} else if (lookup_attribute("fastcall", type_attributes)) { \ - CC = CallingConv::X86_FastCall; \ -} \ - } \ - + +/* Add general target specific stuff */ +#include "llvm-i386-target.h" + /* APPLE LOCAL end LLVM */ + +#endif diff -r 19e687420e52 gcc/config/i386/darwin.h --- a/gcc/config/i386/darwin.h Sun Jan 28 02:52:06 2007 +0300 +++ b/gcc/config/i386/darwin.h Sun Jan 28 17:57:02 2007 +0300 @@ -343,3 +343,13 @@ extern void ix86_darwin_init_expanders ( #undef TARGET_DEEP_BRANCH_PREDICTION #define TARGET_DEEP_BRANCH_PREDICTION ((m_PPRO | m_K6 | m_ATHLON_K8 | m_PENT4) & TUNEMASK) /* APPLE LOCAL end 4106131 */ + +/* APPLE LOCAL begin LLVM */ +#ifdef ENABLE_LLVM + +/* Add general target specific stuff */ +#include "llvm-i386-target.h" + +/* APPLE LOCAL end LLVM */ + +#endif diff -r 19e687420e52 gcc/config/i386/linux.h --- a/gcc/config/i386/linux.h Sun Jan 28 02:52:06 2007 +0300 +++ b/gcc/config/i386/linux.h Sun Jan 28 17:57:05 2007 +0300 @@ -190,11 +190,15 @@ Boston, MA 02111-1307, USA. */ #ifdef ENABLE_LLVM /* Yes, we're supporting PIC codegen for X86-Linux-ELF target! */ - #define LLVM_SET_TARGET_OPTIONS(argvec) \ if (flag_pic) \ argvec.push_back ("--relocation-model=pic"); \ else \ argvec.push_back ("--relocation-model=static"); -#endif + +/* Add general target specific stuff */ +#include "llvm-i386-target.h" + /* APPLE LOCAL end LLVM */ + +#endif diff -r 19e687420e52 gcc/llvm-abi.h --- a/gcc/llvm-abi.h Sun Jan 28 02:52:06 2007 +0300 +++ b/gcc/llvm-abi.h Fri Jan 26 11:31:36 2007 +0300 @@ -47,6 +47,8 @@ extern "C" { /// DefaultABIClient - This is a simple implementation of the ABI client /// interface that can be subclassed. struct DefaultABIClient { + bool isStructReturn() { return false; } + /// HandleScalarResult - This callback is invoked if the function returns a /// simple scalar result value. void HandleScalarResult(const Type *RetTy) {} @@ -136,6 +138,8 @@ protected: Client &C; public: DefaultABI(Client &c) : C(c) {} + + bool isStructReturn() const { return C.isStructReturn(); } /// HandleReturnType - This is invoked by the target-independent code for the /// return type. It potentially breaks down the argument and invokes methods diff -r 19e687420e52 gcc/llvm-convert.cpp --- a/gcc/llvm-convert.cpp Sun Jan 28 02:52:06 2007 +0300 +++ b/gcc/llvm-convert.cpp Sun Jan 28 02:53:45 2007 +0300 @@ -1876,6 +1876,7 @@ namespace { tree CallExpression; std::vector &CallOperands; CallingConv::ID &CallingConvention; +bool isStructRet; BasicBlock *CurBB; Value *DestLoc; std::vector LocStack; @@ -1886,6 +1887,7 @@ namespace { : CallExpression(exp), CallOperands(ops), CallingConvention(cc), CurBB(bb), DestLoc(destloc) { CallingConvention = CallingConv::C; + isStructRet = false; #ifdef TARGET_ADJUST_LLVM_CC tree ftype; if (tree fdecl = get_callee_fndecl(exp)) { @@ -1931,8 +1933,8 @@ namespace { /// function. void HandleAggregateShadowArgument(const PointerType *PtrArgTy, bool RetPtr) { - // Make sure this call is marked as csret calling convention. - CallingConvention = CallingConv::CSRet; + // Make sure this call is marked as 'struct return'. + isStructRet = true; // If the front-end has already made the argument explicit, don't do it // again. diff -r 19e687420e52 gcc/ll
Re: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Hello, Nick. > Fix compile error "jump to case label crosses initialization". > What compiler are people using that accepts this code? Sorry for the breakage. It was just gcc 3.4.6 :( I know about this "feature" and double checked the code. However, I was wrong -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] SRet & InReg patch for llvm-gcc
On Jan 28, 2007, at 7:43 AM, Anton Korobeynikov wrote: > Hello, Everyone. > > Attached patch will enable llvm-gcc to use sret & inreg attributes. Applied, thanks! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp
Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.34 -> 1.35 --- Log message: Drop CSRET from here too. --- Diffs of the changes: (+0 -1) CppWriter.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.34 llvm/tools/llvm2cpp/CppWriter.cpp:1.35 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.34 Sun Jan 14 20:27:26 2007 +++ llvm/tools/llvm2cpp/CppWriter.cpp Sun Jan 28 09:51:15 2007 @@ -258,7 +258,6 @@ // Print the calling convention. switch (cc) { case CallingConv::C: Out << "CallingConv::C"; break; -case CallingConv::CSRet: Out << "CallingConv::CSRet"; break; case CallingConv::Fast: Out << "CallingConv::Fast"; break; case CallingConv::Cold: Out << "CallingConv::Cold"; break; case CallingConv::FirstTargetCC: Out << "CallingConv::FirstTargetCC"; break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp
On Jan 28, 2007, at 7:51 AM, Nick Lewycky wrote: > Changes in directory llvm/tools/llvm2cpp: > > CppWriter.cpp updated: 1.34 -> 1.35 > --- > Log message: > > Drop CSRET from here too. Thanks Nick, Note that llvm2cpp should probably be enhanced to support function/ param attributes (in general) as well at some point. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Hello, Chris. > Is there any reason not to use the parameter attribute enum directly? Well. Actually not all attributes should be propagated to lowering stage. Also, there can be possible another attributes. Maybe it's worth to make just new enum for this? -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.460 -> 1.461 SelectionDAGISel.cpp updated: 1.347 -> 1.348 --- Log message: More cleanup --- Diffs of the changes: (+5 -4) LegalizeDAG.cpp |4 ++-- SelectionDAGISel.cpp |5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.460 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.461 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.460 Sun Jan 28 07:31:35 2007 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jan 28 10:04:40 2007 @@ -2168,7 +2168,7 @@ const char *FnName = 0; if (Node->getOpcode() == ISD::MEMSET) { Entry.Node = Tmp2; Entry.isSigned = false; Entry.Ty = IntPtrTy; - Entry.isInReg = false; +Entry.isInReg = false; Args.push_back(Entry); // Extend the (previously legalized) ubyte argument to be an int value // for the call. @@ -2177,7 +2177,7 @@ else Tmp3 = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Tmp3); Entry.Node = Tmp3; Entry.Ty = Type::Int32Ty; Entry.isSigned = true; - Entry.isInReg = false; +Entry.isInReg = false; Args.push_back(Entry); Entry.Node = Tmp4; Entry.Ty = IntPtrTy; Entry.isSigned = false; Args.push_back(Entry); Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.347 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.348 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.347Sun Jan 28 07:31:35 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Jan 28 10:04:40 2007 @@ -2875,9 +2875,10 @@ // Add one result value for each formal argument. std::vector RetVals; unsigned j = 0; - for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) { + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); + I != E; ++I, ++j) { MVT::ValueType VT = getValueType(I->getType()); -bool isInReg = FTy->paramHasAttr(++j, FunctionType::InRegAttribute); +bool isInReg = FTy->paramHasAttr(j, FunctionType::InRegAttribute); bool isSRet = FTy->paramHasAttr(j, FunctionType::StructRetAttribute); unsigned Flags = (isInReg << 1) | (isSRet << 2); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.348 -> 1.349 --- Log message: Arguments are counting from 1. not from 0. Maybe we should change numbering somehow? E.g. make return argument the last? --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.348 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.349 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.348Sun Jan 28 10:04:40 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Jan 28 12:01:49 2007 @@ -2874,7 +2874,7 @@ // Add one result value for each formal argument. std::vector RetVals; - unsigned j = 0; + unsigned j = 1; for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++j) { MVT::ValueType VT = getValueType(I->getType()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y UpgradeParser.y.cvs
On Sun, 2007-01-28 at 07:04 -0800, Chris Lattner wrote: > > Changes in directory llvm/tools/llvm-upgrade: > > > > UpgradeParser.y updated: 1.49 -> 1.50 > > UpgradeParser.y.cvs updated: 1.47 -> 1.48 > > --- > > Log message: > > > > Drop CSRET CC > > Is this patch right? No its not. It reverts the fix for PR1137. > > Two issues: > > 1. You removed TypeHasInteger[I]. Is that correct? > 2. You map csretcc directly to ccc. You should also arrange for the > 'sret' attribute to be applied to the first argument. Maybe I'm > missing how this is done. > > -Chris > > > > > --- > > Diffs of the changes: (+22 -126) > > > > UpgradeParser.y | 74 ++ > > +- > > UpgradeParser.y.cvs | 74 ++ > > +- > > 2 files changed, 22 insertions(+), 126 deletions(-) > > > > > > Index: llvm/tools/llvm-upgrade/UpgradeParser.y > > diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.49 llvm/tools/ > > llvm-upgrade/UpgradeParser.y:1.50 > > --- llvm/tools/llvm-upgrade/UpgradeParser.y:1.49Sat Jan 27 > > 18:51:40 2007 > > +++ llvm/tools/llvm-upgrade/UpgradeParser.y Sun Jan 28 07:36:18 2007 > > @@ -570,7 +570,6 @@ > >} > > } > > > > -/// @brief This just makes any name given to it unique, up to > > MAX_UINT times. > > static std::string makeNameUnique(const std::string& Name) { > >static unsigned UniqueNameCounter = 1; > >std::string Result(Name); > > @@ -578,57 +577,6 @@ > >return Result; > > } > > > > -/// This is the implementation portion of TypeHasInteger. It > > traverses the > > -/// type given, avoiding recursive types, and returns true as soon > > as it finds > > -/// an integer type. If no integer type is found, it returns false. > > -static bool TypeHasIntegerI(const Type *Ty, std::vector > Type*> Stack) { > > - // Handle some easy cases > > - if (Ty->isPrimitiveType() || (Ty->getTypeID() == Type::OpaqueTyID)) > > -return false; > > - if (Ty->isInteger()) > > -return true; > > - if (const SequentialType *STy = dyn_cast(Ty)) > > -return STy->getElementType()->isInteger(); > > - > > - // Avoid type structure recursion > > - for (std::vector::iterator I = Stack.begin(), E = > > Stack.end(); > > - I != E; ++I) > > -if (Ty == *I) > > - return false; > > - > > - // Push us on the type stack > > - Stack.push_back(Ty); > > - > > - if (const FunctionType *FTy = dyn_cast(Ty)) { > > -if (TypeHasIntegerI(FTy->getReturnType(), Stack)) > > - return true; > > -FunctionType::param_iterator I = FTy->param_begin(); > > -FunctionType::param_iterator E = FTy->param_end(); > > -for (; I != E; ++I) > > - if (TypeHasIntegerI(*I, Stack)) > > -return true; > > -return false; > > - } else if (const StructType *STy = dyn_cast(Ty)) { > > -StructType::element_iterator I = STy->element_begin(); > > -StructType::element_iterator E = STy->element_end(); > > -for (; I != E; ++I) { > > - if (TypeHasIntegerI(*I, Stack)) > > -return true; > > -} > > -return false; > > - } > > - // There shouldn't be anything else, but its definitely not integer > > - assert(0 && "What type is this?"); > > - return false; > > -} > > - > > -/// This is the interface to TypeHasIntegerI. It just provides the > > type stack, > > -/// to avoid recursion, and then calls TypeHasIntegerI. > > -static inline bool TypeHasInteger(const Type *Ty) { > > - std::vector TyStack; > > - return TypeHasIntegerI(Ty, TyStack); > > -} > > - > > // setValueName - Set the specified value to the name given. The > > name may be > > // null potentially, in which case this is a noop. The string > > passed in is > > // assumed to be a malloc'd string buffer, and is free'd by this > > function. > > @@ -657,16 +605,16 @@ > >} > > } > > if (Existing) { > > - // An existing value of the same name was found. This might > > have happened > > - // because of the integer type planes collapsing in LLVM 2.0. > > - if (Existing->getType() == V->getType() && > > - !TypeHasInteger(Existing->getType())) { > > -// If the type does not contain any integers in them then > > this can't be > > -// a type plane collapsing issue. It truly is a > > redefinition and we > > -// should error out as the assembly is invalid. > > -error("Redefinition of value named '" + Name + "' of type > > '" + > > - V->getType()->getDescription() + "'"); > > -return; > > + if (Existing->getType() == V->getType()) { > > +// The type of the Existing value and the new one are the > > same. This > > +// is probably a type plane collapsing error. If the types > > involved > > +// are both integer, just rename it. Otherwise it > > +// is a redefinition error. > > +if (!Existing->getType()->isInteger()) { > > + error("Redefinitio
[llvm-commits] CVS: llvm/include/llvm/CodeGen/IntrinsicLowering.h
Changes in directory llvm/include/llvm/CodeGen: IntrinsicLowering.h updated: 1.11 -> 1.12 --- Log message: Adjust a comment to reflect reality. --- Diffs of the changes: (+4 -4) IntrinsicLowering.h |8 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/IntrinsicLowering.h diff -u llvm/include/llvm/CodeGen/IntrinsicLowering.h:1.11 llvm/include/llvm/CodeGen/IntrinsicLowering.h:1.12 --- llvm/include/llvm/CodeGen/IntrinsicLowering.h:1.11 Wed Nov 15 12:00:10 2006 +++ llvm/include/llvm/CodeGen/IntrinsicLowering.h Sun Jan 28 16:26:42 2007 @@ -31,10 +31,10 @@ /// inserted into the module specified. void AddPrototypes(Module &M); -/// LowerIntrinsicCall - This method returns the LLVM function which should -/// be used to implement the specified intrinsic function call. If an -/// intrinsic function must be implemented by the code generator (such as -/// va_start), this function should print a message and abort. +/// LowerIntrinsicCall - This method replaces a call with the LLVM function +/// which should be used to implement the specified intrinsic function call. +/// If an intrinsic function must be implemented by the code generator +/// (such as va_start), this function should print a message and abort. /// /// Otherwise, if an intrinsic function call can be lowered, the code to /// implement it (often a call to a non-intrinsic function) is inserted ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.59 -> 1.60 --- Log message: For PR1138: http://llvm.org/PR1138 : Force memcpy to be the 32-bit variant. Since this is only used with CBE and lli which both target 32-bit machines, this should be okay. --- Diffs of the changes: (+11 -4) IntrinsicLowering.cpp | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.60 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 Sun Jan 14 20:27:26 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sun Jan 28 16:28:00 2007 @@ -77,13 +77,17 @@ break; case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: -EnsureFunctionExists(M, "memcpy", I->arg_begin(), --I->arg_end(), - I->arg_begin()->getType()); +M.getOrInsertFunction("memcpy", PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), Type::Int32Ty, + (Type *)0); break; case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: -EnsureFunctionExists(M, "memmove", I->arg_begin(), --I->arg_end(), - I->arg_begin()->getType()); +M.getOrInsertFunction("memmove", PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), Type::Int32Ty, + (Type *)0); break; case Intrinsic::memset_i32: case Intrinsic::memset_i64: @@ -360,6 +364,9 @@ } case Intrinsic::memcpy_i64: { static Constant *MemcpyFCache = 0; +Value * Size = cast(CI->op_end()-1); +if (Size->getType() != Type::Int32Ty) + Size->replaceAllUsesWith(new TruncInst(Size, Type::Int32Ty)); ReplaceCallWith("memcpy", CI, CI->op_begin()+1, CI->op_end()-1, (*(CI->op_begin()+1))->getType(), MemcpyFCache); break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
> For PR1138: http://llvm.org/PR1138 : > Force memcpy to be the 32-bit variant. Since this is only used with > CBE and lli which both target 32-bit machines, this should be okay. What do you mean, "which both target 32-bit machines"? CBE supports Alpha, sparcv9, x86-64, and ppc64. -Chris > > --- > Diffs of the changes: (+11 -4) > > IntrinsicLowering.cpp | 15 +++ > 1 files changed, 11 insertions(+), 4 deletions(-) > > > Index: llvm/lib/CodeGen/IntrinsicLowering.cpp > diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 llvm/lib/ > CodeGen/IntrinsicLowering.cpp:1.60 > --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 Sun Jan 14 20:27:26 > 2007 > +++ llvm/lib/CodeGen/IntrinsicLowering.cppSun Jan 28 16:28:00 2007 > @@ -77,13 +77,17 @@ > break; >case Intrinsic::memcpy_i32: >case Intrinsic::memcpy_i64: > -EnsureFunctionExists(M, "memcpy", I->arg_begin(), --I- > >arg_end(), > - I->arg_begin()->getType()); > +M.getOrInsertFunction("memcpy", PointerType::get > (Type::Int8Ty), > + PointerType::get(Type::Int8Ty), > + PointerType::get(Type::Int8Ty), > Type::Int32Ty, > + (Type *)0); > break; >case Intrinsic::memmove_i32: >case Intrinsic::memmove_i64: > -EnsureFunctionExists(M, "memmove", I->arg_begin(), --I- > >arg_end(), > - I->arg_begin()->getType()); > +M.getOrInsertFunction("memmove", PointerType::get > (Type::Int8Ty), > + PointerType::get(Type::Int8Ty), > + PointerType::get(Type::Int8Ty), > Type::Int32Ty, > + (Type *)0); > break; >case Intrinsic::memset_i32: >case Intrinsic::memset_i64: > @@ -360,6 +364,9 @@ >} >case Intrinsic::memcpy_i64: { > static Constant *MemcpyFCache = 0; > +Value * Size = cast(CI->op_end()-1); > +if (Size->getType() != Type::Int32Ty) > + Size->replaceAllUsesWith(new TruncInst(Size, Type::Int32Ty)); > ReplaceCallWith("memcpy", CI, CI->op_begin()+1, CI->op_end()-1, > (*(CI->op_begin()+1))->getType(), MemcpyFCache); > break; > > > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Type.h
Changes in directory llvm/include/llvm: Type.h updated: 1.102 -> 1.103 --- Log message: Make doxygen happy --- Diffs of the changes: (+1 -1) Type.h |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.102 llvm/include/llvm/Type.h:1.103 --- llvm/include/llvm/Type.h:1.102 Fri Jan 19 15:13:56 2007 +++ llvm/include/llvm/Type.hSun Jan 28 18:09:00 2007 @@ -59,7 +59,7 @@ /// @brief Root of type hierarchy class Type : public AbstractTypeUser { public: - ///===---===// + //===---===// /// Definitions of all of the base types for the Type system. Based on this /// value, you can cast to a "DerivedType" subclass (see DerivedTypes.h) /// Note: If you add an element to this, you need to add an element to the ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp
Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.127 -> 1.128 --- Log message: Fix PR1139: http://llvm.org/PR1139 --- Diffs of the changes: (+23 -16) LinkModules.cpp | 39 +++ 1 files changed, 23 insertions(+), 16 deletions(-) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.127 llvm/lib/Linker/LinkModules.cpp:1.128 --- llvm/lib/Linker/LinkModules.cpp:1.127 Fri Jan 26 02:11:39 2007 +++ llvm/lib/Linker/LinkModules.cpp Sun Jan 28 18:21:34 2007 @@ -849,24 +849,31 @@ assert(Dest != 0 && "Invalid Destination module"); assert(Src != 0 && "Invalid Source Module"); - std::string DataLayout; + if (Dest->getDataLayout().empty()) { +if (!Src->getDataLayout().empty()) { + Dest->setDataLayout(Src->getTargetTriple()); +} else { + std::string DataLayout; + + if (Dest->getEndianness() == Module::AnyEndianness) +if (Src->getEndianness() == Module::BigEndian) + DataLayout.append("E"); +else if (Src->getEndianness() == Module::LittleEndian) + DataLayout.append("e"); + if (Dest->getPointerSize() == Module::AnyPointerSize) +if (Src->getPointerSize() == Module::Pointer64) + DataLayout.append(DataLayout.length() == 0 ? "p:64:64" : "-p:64:64"); +else if (Src->getPointerSize() == Module::Pointer32) + DataLayout.append(DataLayout.length() == 0 ? "p:32:32" : "-p:32:32"); + Dest->setDataLayout(DataLayout); +} + } - if (Dest->getEndianness() == Module::AnyEndianness) -if (Src->getEndianness() == Module::BigEndian) - DataLayout.append("E"); -else if (Src->getEndianness() == Module::LittleEndian) - DataLayout.append("e"); - if (Dest->getPointerSize() == Module::AnyPointerSize) -if (Src->getPointerSize() == Module::Pointer64) - DataLayout.append(DataLayout.length() == 0 ? "p:64:64" : "-p:64:64"); -else if (Src->getPointerSize() == Module::Pointer32) - DataLayout.append(DataLayout.length() == 0 ? "p:32:32" : "-p:32:32"); - if (Dest->getTargetTriple().empty()) + if (Dest->getTargetTriple().empty() && !Src->getTargetTriple().empty()) Dest->setTargetTriple(Src->getTargetTriple()); - Dest->setDataLayout(DataLayout); - - if (Src->getDataLayout().length() > 0 && Dest->getDataLayout().length() > 0 && - Src->getDataLayout().compare(Dest->getDataLayout()) != 0) + + if (!Src->getDataLayout().empty() && !Dest->getDataLayout().empty() && + Src->getDataLayout() != Dest->getDataLayout()) cerr << "WARNING: Linking two modules of different data layouts!\n"; if (!Src->getTargetTriple().empty() && Dest->getTargetTriple() != Src->getTargetTriple()) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp
Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.128 -> 1.129 --- Log message: Read from the right place. --- Diffs of the changes: (+1 -1) LinkModules.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.128 llvm/lib/Linker/LinkModules.cpp:1.129 --- llvm/lib/Linker/LinkModules.cpp:1.128 Sun Jan 28 18:21:34 2007 +++ llvm/lib/Linker/LinkModules.cpp Sun Jan 28 20:18:13 2007 @@ -851,7 +851,7 @@ if (Dest->getDataLayout().empty()) { if (!Src->getDataLayout().empty()) { - Dest->setDataLayout(Src->getTargetTriple()); + Dest->setDataLayout(Src->getDataLayout()); } else { std::string DataLayout; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
Changes in directory llvm/lib/Transforms/Scalar: PredicateSimplifier.cpp updated: 1.49 -> 1.50 --- Log message: Simplify names of lattice values. SGTUNE becomes SGT, for example. Fix initializeConstant, now initializeInt. Fixes major performance bottleneck. X == Y || X->DominatedBy(Y) is redundant. Remove the X == Y part. Fix crasher in makeEqual where getOrInsertNode would add a new constant, producing an NE relationship between the two members we're trying to make equal. This now allows us to mark more BBs as unreachable. --- Diffs of the changes: (+127 -71) PredicateSimplifier.cpp | 198 ++-- 1 files changed, 127 insertions(+), 71 deletions(-) Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.49 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.50 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.49 Tue Jan 16 20:23:37 2007 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Sun Jan 28 20:56:54 2007 @@ -52,14 +52,14 @@ // responsible for analyzing the variable and seeing what new inferences // can be made from each property. For example: // -// %P = seteq int* %ptr, null -// %a = or bool %P, %Q +// %P = setne int* %ptr, null +// %a = and bool %P, %Q // br bool %a label %cond_true, label %cond_false // // For the true branch, the VRPSolver will start with %a EQ true and look at // the definition of %a and find that it can infer that %P and %Q are both // true. From %P being true, it can infer that %ptr NE null. For the false -// branch it can't infer anything from the "or" instruction. +// branch it can't infer anything from the "and" instruction. // // Besides branches, we can also infer properties from instruction that may // have undefined behaviour in certain cases. For example, the dividend of @@ -102,18 +102,18 @@ // 0 1 0 1 1 -- GE 11 // 0 1 1 0 0 -- SGTULT 12 // 0 1 1 0 1 -- SGEULE 13 - // 0 1 1 1 0 -- SGTUNE 14 - // 0 1 1 1 1 -- SGEUANY 15 + // 0 1 1 1 0 -- SGT 14 + // 0 1 1 1 1 -- SGE 15 // 1 0 0 1 0 -- SLTUGT 18 // 1 0 0 1 1 -- SLEUGE 19 // 1 0 1 0 0 -- LT 20 // 1 0 1 0 1 -- LE 21 - // 1 0 1 1 0 -- SLTUNE 22 - // 1 0 1 1 1 -- SLEUANY 23 - // 1 1 0 1 0 -- SNEUGT 26 - // 1 1 0 1 1 -- SANYUGE 27 - // 1 1 1 0 0 -- SNEULT 28 - // 1 1 1 0 1 -- SANYULE 29 + // 1 0 1 1 0 -- SLT 22 + // 1 0 1 1 1 -- SLE 23 + // 1 1 0 1 0 -- UGT 26 + // 1 1 0 1 1 -- UGE 27 + // 1 1 1 0 0 -- ULT 28 + // 1 1 1 0 1 -- ULE 29 // 1 1 1 1 0 -- NE 30 enum LatticeBits { EQ_BIT = 1, UGT_BIT = 2, ULT_BIT = 4, SGT_BIT = 8, SLT_BIT = 16 @@ -128,23 +128,23 @@ SGEULE = SGTULT | EQ_BIT, SLTUGT = SLT_BIT | UGT_BIT, SLEUGE = SLTUGT | EQ_BIT, -SNEULT = SLT_BIT | SGT_BIT | ULT_BIT, -SNEUGT = SLT_BIT | SGT_BIT | UGT_BIT, -SLTUNE = SLT_BIT | ULT_BIT | UGT_BIT, -SGTUNE = SGT_BIT | ULT_BIT | UGT_BIT, -SLEUANY = SLT_BIT | ULT_BIT | UGT_BIT | EQ_BIT, -SGEUANY = SGT_BIT | ULT_BIT | UGT_BIT | EQ_BIT, -SANYULE = SLT_BIT | SGT_BIT | ULT_BIT | EQ_BIT, -SANYUGE = SLT_BIT | SGT_BIT | UGT_BIT | EQ_BIT +ULT = SLT_BIT | SGT_BIT | ULT_BIT, +UGT = SLT_BIT | SGT_BIT | UGT_BIT, +SLT = SLT_BIT | ULT_BIT | UGT_BIT, +SGT = SGT_BIT | ULT_BIT | UGT_BIT, +SLE = SLT | EQ_BIT, +SGE = SGT | EQ_BIT, +ULE = ULT | EQ_BIT, +UGE = UGT | EQ_BIT }; static bool validPredicate(LatticeVal LV) { switch (LV) { case GT: case GE: case LT: case LE: case NE: -case SGTULT: case SGTUNE: case SGEULE: -case SLTUGT: case SLTUNE: case SLEUGE: -case SNEULT: case SNEUGT: -case SLEUANY: case SGEUANY: case SANYULE: case SANYUGE: +case SGTULT: case SGT: case SGEULE: +case SLTUGT: case SLT: case SLEUGE: +case ULT: case UGT: +case SLE: case SGE: case ULE: case UGE: return true; default: return false; @@ -366,36 +366,91 @@ std::vector Nodes; -std::vector > Constants; -void initializeConstant(Constant *C, unsigned index) { - ConstantInt *CI = dyn_cast(C); - if (!CI) return; - - // XXX: instead of O(n) calls to addInequality, just find the 2, 3 or 4 - // nodes that are nearest less than or greater than (signed or unsigned). - for (std::vector >::iterator - I = Constants.begin(), E = Constants.end(); I != E; ++I) { -ConstantInt
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
On Sun, 2007-01-28 at 16:04 -0800, Chris Lattner wrote: > > For PR1138: http://llvm.org/PR1138 : > > Force memcpy to be the 32-bit variant. Since this is only used with > > CBE and lli which both target 32-bit machines, this should be okay. > > What do you mean, "which both target 32-bit machines"? CBE supports > Alpha, sparcv9, x86-64, and ppc64. Just going on statements you made in IRC about CBE targeting only 32-bit machines. > > -Chris > > > > > --- > > Diffs of the changes: (+11 -4) > > > > IntrinsicLowering.cpp | 15 +++ > > 1 files changed, 11 insertions(+), 4 deletions(-) > > > > > > Index: llvm/lib/CodeGen/IntrinsicLowering.cpp > > diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 llvm/lib/ > > CodeGen/IntrinsicLowering.cpp:1.60 > > --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 Sun Jan 14 20:27:26 > > 2007 > > +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sun Jan 28 16:28:00 2007 > > @@ -77,13 +77,17 @@ > > break; > >case Intrinsic::memcpy_i32: > >case Intrinsic::memcpy_i64: > > -EnsureFunctionExists(M, "memcpy", I->arg_begin(), --I- > > >arg_end(), > > - I->arg_begin()->getType()); > > +M.getOrInsertFunction("memcpy", PointerType::get > > (Type::Int8Ty), > > + PointerType::get(Type::Int8Ty), > > + PointerType::get(Type::Int8Ty), > > Type::Int32Ty, > > + (Type *)0); > > break; > >case Intrinsic::memmove_i32: > >case Intrinsic::memmove_i64: > > -EnsureFunctionExists(M, "memmove", I->arg_begin(), --I- > > >arg_end(), > > - I->arg_begin()->getType()); > > +M.getOrInsertFunction("memmove", PointerType::get > > (Type::Int8Ty), > > + PointerType::get(Type::Int8Ty), > > + PointerType::get(Type::Int8Ty), > > Type::Int32Ty, > > + (Type *)0); > > break; > >case Intrinsic::memset_i32: > >case Intrinsic::memset_i64: > > @@ -360,6 +364,9 @@ > >} > >case Intrinsic::memcpy_i64: { > > static Constant *MemcpyFCache = 0; > > +Value * Size = cast(CI->op_end()-1); > > +if (Size->getType() != Type::Int32Ty) > > + Size->replaceAllUsesWith(new TruncInst(Size, Type::Int32Ty)); > > ReplaceCallWith("memcpy", CI, CI->op_begin()+1, CI->op_end()-1, > > (*(CI->op_begin()+1))->getType(), MemcpyFCache); > > break; > > > > > > > > ___ > > llvm-commits mailing list > > llvm-commits@cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > ___ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
On Jan 28, 2007, at 7:52 PM, Reid Spencer wrote: > On Sun, 2007-01-28 at 16:04 -0800, Chris Lattner wrote: >>> For PR1138: http://llvm.org/PR1138 : >>> Force memcpy to be the 32-bit variant. Since this is only used with >>> CBE and lli which both target 32-bit machines, this should be okay. >> >> What do you mean, "which both target 32-bit machines"? CBE supports >> Alpha, sparcv9, x86-64, and ppc64. > > Just going on statements you made in IRC about CBE targeting only > 32-bit > machines. I don't recall making that the statement, but even if I did, it is certainly not true :) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
On Sun, 2007-01-28 at 20:31 -0800, Chris Lattner wrote: > On Jan 28, 2007, at 7:52 PM, Reid Spencer wrote: > > > On Sun, 2007-01-28 at 16:04 -0800, Chris Lattner wrote: > >>> For PR1138: http://llvm.org/PR1138 : > >>> Force memcpy to be the 32-bit variant. Since this is only used with > >>> CBE and lli which both target 32-bit machines, this should be okay. > >> > >> What do you mean, "which both target 32-bit machines"? CBE supports > >> Alpha, sparcv9, x86-64, and ppc64. > > > > Just going on statements you made in IRC about CBE targeting only > > 32-bit > > machines. > > I don't recall making that the statement, but even if I did, it is > certainly not true :) I gathered that :) I'll use TD to get the right size and trunc or zext up to deal with 32/64 mismatches. However, this will take a bit. IntrinsicLowering doesn't have TargetData so I have to pass it in from the callers. If I don't get to it tonight, I'll do it tomorrow. > > -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
>> I don't recall making that the statement, but even if I did, it is >> certainly not true :) > > I gathered that :) > > I'll use TD to get the right size and trunc or zext up to deal with > 32/64 mismatches. However, this will take a bit. IntrinsicLowering > doesn't have TargetData so I have to pass it in from the callers. > If I > don't get to it tonight, I'll do it tomorrow. Okay, thanks Reid! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll
Changes in directory llvm/test/Assembler: 2006-05-26-VarargsCallEncode.ll updated: 1.2 -> 1.3 --- Log message: Update this test case to look for sret parameter attribute not csret cc. --- Diffs of the changes: (+2 -1) 2006-05-26-VarargsCallEncode.ll |3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll diff -u llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll:1.2 llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll:1.3 --- llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll Sun Jan 28 23:40:02 2007 @@ -1,4 +1,5 @@ -; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep 'tail call csretcc' +; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | \ +; RUN:grep 'tail call void ({ }\* sret' declare csretcc void %foo({}*, ...) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y UpgradeInternals.h
Changes in directory llvm/tools/llvm-upgrade: UpgradeParser.y updated: 1.51 -> 1.52 UpgradeInternals.h updated: 1.6 -> 1.7 --- Log message: Upgrade old csret calling convention into sret parameter attribute. --- Diffs of the changes: (+60 -15) UpgradeInternals.h |7 + UpgradeParser.y| 68 + 2 files changed, 60 insertions(+), 15 deletions(-) Index: llvm/tools/llvm-upgrade/UpgradeParser.y diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.51 llvm/tools/llvm-upgrade/UpgradeParser.y:1.52 --- llvm/tools/llvm-upgrade/UpgradeParser.y:1.51Sun Jan 28 09:25:24 2007 +++ llvm/tools/llvm-upgrade/UpgradeParser.y Sun Jan 28 23:41:09 2007 @@ -171,6 +171,7 @@ std::map > BBForwardRefs; std::vector NumberedBlocks; RenameMapType RenameMap; + unsigned LastCC; unsigned NextBBNum; inline PerFunctionInfo() { @@ -1243,6 +1244,19 @@ return IdxTy; } +unsigned upgradeCallingConv(unsigned CC) { + switch (CC) { +case OldCallingConv::C : return CallingConv::C; +case OldCallingConv::CSRet : return CallingConv::C; +case OldCallingConv::Fast: return CallingConv::Fast; +case OldCallingConv::Cold: return CallingConv::Cold; +case OldCallingConv::X86_StdCall : return CallingConv::X86_StdCall; +case OldCallingConv::X86_FastCall: return CallingConv::X86_FastCall; +default: + return CC; + } +} + Module* UpgradeAssembly(const std::string &infile, std::istream& in, bool debug, bool addAttrs) { @@ -1626,13 +1640,13 @@ ; OptCallingConv - : /*empty*/ { $$ = CallingConv::C; } - | CCC_TOK{ $$ = CallingConv::C; } - | CSRETCC_TOK{ $$ = CallingConv::C; } - | FASTCC_TOK { $$ = CallingConv::Fast; } - | COLDCC_TOK { $$ = CallingConv::Cold; } - | X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; } - | X86_FASTCALLCC_TOK { $$ = CallingConv::X86_FastCall; } + : /*empty*/ { CurFun.LastCC = $$ = OldCallingConv::C; } + | CCC_TOK{ CurFun.LastCC = $$ = OldCallingConv::C; } + | CSRETCC_TOK{ CurFun.LastCC = $$ = OldCallingConv::CSRet; } + | FASTCC_TOK { CurFun.LastCC = $$ = OldCallingConv::Fast; } + | COLDCC_TOK { CurFun.LastCC = $$ = OldCallingConv::Cold; } + | X86_STDCALLCC_TOK { CurFun.LastCC = $$ = OldCallingConv::X86_StdCall; } + | X86_FASTCALLCC_TOK { CurFun.LastCC = $$ = OldCallingConv::X86_FastCall; } | CC_TOK EUINT64VAL { if ((unsigned)$2 != $2) error("Calling conv too large"); @@ -1762,11 +1776,16 @@ Params.push_back(I->T->get()); delete I->T; } +FunctionType::ParamAttrsList ParamAttrs; +if (CurFun.LastCC == OldCallingConv::CSRet) { + ParamAttrs.push_back(FunctionType::NoAttributeSet); + ParamAttrs.push_back(FunctionType::StructRetAttribute); +} bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); -$$.T = new PATypeHolder(HandleUpRefs( - FunctionType::get($1.T->get(),Params,isVarArg))); +$$.T = new PATypeHolder( + HandleUpRefs(FunctionType::get($1.T->get(),Params,isVarArg, ParamAttrs))); $$.S = $1.S; delete $1.T;// Delete the return type handle delete $3; // Delete the argument list @@ -2533,7 +2552,16 @@ ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; if (isVarArg) ParamTypeList.pop_back(); -const FunctionType *FT = FunctionType::get(RetTy, ParamTypeList, isVarArg); +// Convert the CSRet calling convention into the corresponding parameter +// attribute. +FunctionType::ParamAttrsList ParamAttrs; +if ($1 == OldCallingConv::CSRet) { + ParamAttrs.push_back(FunctionType::NoAttributeSet); // result + ParamAttrs.push_back(FunctionType::StructRetAttribute); // first arg +} + +const FunctionType *FT = FunctionType::get(RetTy, ParamTypeList, isVarArg, + ParamAttrs); const PointerType *PFT = PointerType::get(FT); delete $2.T; @@ -2579,7 +2607,7 @@ // argument to another function. Fn->setLinkage(CurFun.Linkage); } -Fn->setCallingConv($1); +Fn->setCallingConv(upgradeCallingConv($1)); Fn->setAlignment($8); if ($7) { Fn->setSection($7); @@ -2825,9 +2853,14 @@ I != E; ++I) ParamTypes.push_back((*I).V->getType()); } + FunctionType::ParamAttrsList ParamAttrs; + if ($2 == OldCallingConv::CSRet) { +ParamAttrs.push_back(FunctionType::NoAttributeSet); +ParamAttrs.push_back(FunctionType::StructRetAttribute); + } bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - Ty = FunctionType::get($3.T->get(), ParamTypes, isVarArg); + Ty = FunctionType::get($3.T->get(),