[llvm-commits] linux/ppc32 exception handling
Hi everyone, This patch enables exception handling for linux/ppc32. OK to commit? Index: PPCTargetAsmInfo.cpp === --- PPCTargetAsmInfo.cpp(revision 45260) +++ PPCTargetAsmInfo.cpp(working copy) @@ -28,10 +28,6 @@ InlineAsmEnd = "# InlineAsm End"; AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor(); - NeedsSet = true; - DwarfEHFrameSection = - ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; - DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; } DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) @@ -60,7 +56,12 @@ HiddenDirective = "\t.private_extern\t"; SupportsExceptionHandling = true; NeedsIndirectEncoding = true; + NeedsSet = true; BSSSection = 0; + + DwarfEHFrameSection = + ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; + DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; @@ -98,6 +99,9 @@ WeakRefDirective = "\t.weak\t"; BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits"; + // Debug Information + AbsoluteDebugSectionOffsets = true; + SupportsDebugInformation = true; DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits"; DwarfInfoSection ="\t.section\t.debug_info,\"\",@progbits"; DwarfLineSection ="\t.section\t.debug_line,\"\",@progbits"; @@ -109,4 +113,20 @@ DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits"; DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits"; DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits"; + + ReadOnlySection = "\t.section\t.rodata"; + FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4"; + EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8"; + SixteenByteConstantSection = "\t.section\t.rodata.cst16,\"aM\",@progbits,16"; + PCSymbol = "."; + + // Set up DWARF directives + HasLEB128 = true; // Target asm supports leb128 directives (little-endian) + + // Exceptions handling + if (!TM.getSubtargetImpl()->isPPC64()) +SupportsExceptionHandling = true; + AbsoluteEHSectionOffsets = false; + DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits"; + DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits"; } Index: PPCISelLowering.cpp === --- PPCISelLowering.cpp (revision 45260) +++ PPCISelLowering.cpp (working copy) @@ -167,15 +167,13 @@ // Support label based line numbers. setOperationAction(ISD::LOCATION, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); - if (!TM.getSubtarget().isDarwin()) { -setOperationAction(ISD::LABEL, MVT::Other, Expand); - } else { -setOperationAction(ISD::EXCEPTIONADDR, MVT::i64, Expand); -setOperationAction(ISD::EHSELECTION, MVT::i64, Expand); -setOperationAction(ISD::EXCEPTIONADDR, MVT::i32, Expand); -setOperationAction(ISD::EHSELECTION, MVT::i32, Expand); - } + setOperationAction(ISD::EXCEPTIONADDR, MVT::i64, Expand); + setOperationAction(ISD::EHSELECTION, MVT::i64, Expand); + setOperationAction(ISD::EXCEPTIONADDR, MVT::i32, Expand); + setOperationAction(ISD::EHSELECTION, MVT::i32, Expand); + + // We want to legalize GlobalAddress and ConstantPool nodes into the // appropriate instructions to materialize the address. setOperationAction(ISD::GlobalAddress, MVT::i32, Custom); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] linux/ppc32 exception handling
Hello, Nicolas > This patch enables exception handling for linux/ppc32. OK to commit? Looks ok for me. Does it even work? :) (with gcc-compiled runtime) -- 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] [llvm] r45281 - in /llvm/trunk/lib/Target/PowerPC: PPCISelLowering.cpp PPCTargetAsmInfo.cpp
Author: geoffray Date: Fri Dec 21 06:19:44 2007 New Revision: 45281 URL: http://llvm.org/viewvc/llvm-project?rev=45281&view=rev Log: Enable EH for linux/ppc32 targets Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=45281&r1=45280&r2=45281&view=diff == --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Dec 21 06:19:44 2007 @@ -167,14 +167,12 @@ // Support label based line numbers. setOperationAction(ISD::LOCATION, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); - if (!TM.getSubtarget().isDarwin()) { -setOperationAction(ISD::LABEL, MVT::Other, Expand); - } else { -setOperationAction(ISD::EXCEPTIONADDR, MVT::i64, Expand); -setOperationAction(ISD::EHSELECTION, MVT::i64, Expand); -setOperationAction(ISD::EXCEPTIONADDR, MVT::i32, Expand); -setOperationAction(ISD::EHSELECTION, MVT::i32, Expand); - } + + setOperationAction(ISD::EXCEPTIONADDR, MVT::i64, Expand); + setOperationAction(ISD::EHSELECTION, MVT::i64, Expand); + setOperationAction(ISD::EXCEPTIONADDR, MVT::i32, Expand); + setOperationAction(ISD::EHSELECTION, MVT::i32, Expand); + // We want to legalize GlobalAddress and ConstantPool nodes into the // appropriate instructions to materialize the address. @@ -1771,9 +1769,9 @@ // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol // node so that legalize doesn't hack it. - if (GlobalAddressSDNode *G = dyn_cast(Callee)) -Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); - else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) + //if (GlobalAddressSDNode *G = dyn_cast(Callee)) + // Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); + if (ExternalSymbolSDNode *S = dyn_cast(Callee)) Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType()); else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG)) // If this is an absolute destination address, use the munged value. Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=45281&r1=45280&r2=45281&view=diff == --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Fri Dec 21 06:19:44 2007 @@ -28,10 +28,6 @@ InlineAsmEnd = "# InlineAsm End"; AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor(); - NeedsSet = true; - DwarfEHFrameSection = - ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; - DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; } DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) @@ -60,7 +56,12 @@ HiddenDirective = "\t.private_extern\t"; SupportsExceptionHandling = true; NeedsIndirectEncoding = true; + NeedsSet = true; BSSSection = 0; + + DwarfEHFrameSection = + ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; + DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; @@ -98,6 +99,9 @@ WeakRefDirective = "\t.weak\t"; BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits"; + // Debug Information + AbsoluteDebugSectionOffsets = true; + SupportsDebugInformation = true; DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits"; DwarfInfoSection ="\t.section\t.debug_info,\"\",@progbits"; DwarfLineSection ="\t.section\t.debug_line,\"\",@progbits"; @@ -109,4 +113,20 @@ DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits"; DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits"; DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits"; + + ReadOnlySection = "\t.section\t.rodata"; + FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4"; + EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8"; + SixteenByteConstantSection = "\t.section\t.rodata.cst16,\"aM\",@progbits,16"; + PCSymbol = "."; + + // Set up DWARF directives + HasLEB128 = true; // Target asm supports leb128 directives (little-endian) + + // Exceptions handling + if (!TM.getSubtargetImpl()->isPPC64()) +SupportsExceptionHandling = true; + AbsoluteEHSectionOffsets = false; + DwarfEHFrameSection = "\t.section\t.eh_frame,\"
[llvm-commits] [llvm] r45282 - /llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
Author: geoffray Date: Fri Dec 21 06:22:29 2007 New Revision: 45282 URL: http://llvm.org/viewvc/llvm-project?rev=45282&view=rev Log: Fix unintented change from last commit Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=45282&r1=45281&r2=45282&view=diff == --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Dec 21 06:22:29 2007 @@ -1769,9 +1769,9 @@ // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol // node so that legalize doesn't hack it. - //if (GlobalAddressSDNode *G = dyn_cast(Callee)) - // Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); - if (ExternalSymbolSDNode *S = dyn_cast(Callee)) + if (GlobalAddressSDNode *G = dyn_cast(Callee)) +Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType()); + else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType()); else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG)) // If this is an absolute destination address, use the munged value. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45285 - in /llvm/trunk: include/llvm/ParameterAttributes.h lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll
Author: baldrick Date: Fri Dec 21 13:16:16 2007 New Revision: 45285 URL: http://llvm.org/viewvc/llvm-project?rev=45285&view=rev Log: Make DAE not wipe out attributes on calls, and not drop return attributes on the floor. In the case of a call to a varargs function where the varargs arguments are being removed, any call attributes on those arguments need to be dropped. I didn't do this because I plan to make it illegal to have such attributes (see next patch). With this change, compiling the gcc filter2 eh test at -O0 and then running opt -std-compile-opts on it results in a correctly working program (compiling at -O1 or higher results in the test failing due to a problem with how we output eh info into the IR). Added: llvm/trunk/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll Modified: llvm/trunk/include/llvm/ParameterAttributes.h llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Modified: llvm/trunk/include/llvm/ParameterAttributes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ParameterAttributes.h?rev=45285&r1=45284&r2=45285&view=diff == --- llvm/trunk/include/llvm/ParameterAttributes.h (original) +++ llvm/trunk/include/llvm/ParameterAttributes.h Fri Dec 21 13:16:16 2007 @@ -50,8 +50,6 @@ const uint16_t Informative = NoReturn | NoUnwind | NoAlias | ReadNone | ReadOnly; -/// The following attribute sets are used by the verifier: - /// @brief Attributes that only apply to function parameters. const uint16_t ParameterOnly = ByVal | InReg | Nest | StructRet; @@ -64,6 +62,10 @@ /// @brief Attributes that only apply to pointers. const uint16_t PointerTypeOnly = ByVal | Nest | NoAlias | StructRet; +/// @brief Attributes that do not apply to void type function return values. +const uint16_t VoidTypeIncompatible = IntegerTypeOnly | PointerTypeOnly | + ParameterOnly; + /// @brief Attributes that are mutually incompatible. const uint16_t MutuallyIncompatible[3] = { ByVal | InReg | Nest | StructRet, Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=45285&r1=45284&r2=45285&view=diff == --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Fri Dec 21 13:16:16 2007 @@ -122,18 +122,18 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { assert(Fn.getFunctionType()->isVarArg() && "Function isn't varargs!"); if (Fn.isDeclaration() || !Fn.hasInternalLinkage()) return false; - + // Ensure that the function is only directly called. for (Value::use_iterator I = Fn.use_begin(), E = Fn.use_end(); I != E; ++I) { // If this use is anything other than a call site, give up. CallSite CS = CallSite::get(*I); Instruction *TheCall = CS.getInstruction(); if (!TheCall) return false; // Not a direct call site? - + // The addr of this function is passed to the call. if (I.getOperandNo() != 0) return false; } - + // Okay, we know we can transform this function if safe. Scan its body // looking for calls to llvm.vastart. for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) { @@ -144,24 +144,24 @@ } } } - + // If we get here, there are no calls to llvm.vastart in the function body, // remove the "..." and adjust all the calls. - + // Start by computing a new prototype for the function, which is the same as // the old function, but has fewer arguments. const FunctionType *FTy = Fn.getFunctionType(); std::vector Params(FTy->param_begin(), FTy->param_end()); FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params, false); unsigned NumArgs = Params.size(); - + // Create the new function body and insert it into the module... Function *NF = new Function(NFTy, Fn.getLinkage()); NF->setCallingConv(Fn.getCallingConv()); NF->setParamAttrs(Fn.getParamAttrs()); Fn.getParent()->getFunctionList().insert(&Fn, NF); NF->takeName(&Fn); - + // Loop over all of the callers of the function, transforming the call sites // to pass in a smaller number of arguments into the new function. // @@ -169,40 +169,40 @@ while (!Fn.use_empty()) { CallSite CS = CallSite::get(Fn.use_back()); Instruction *Call = CS.getInstruction(); - + // Pass all the same arguments. Args.assign(CS.arg_begin(), CS.arg_begin()+NumArgs); - + Instruction *New; if (InvokeInst *II = dyn_cast(Call)) { New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(), Args.begin(), Args.end(), "", Call); cast(New)->setCallingConv(CS.getCallingConv()); - cast(New)->setPar
[llvm-commits] [llvm] r45286 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/Verifier/2007-12-21-InvokeParamAttrs.ll
Author: baldrick Date: Fri Dec 21 13:19:01 2007 New Revision: 45286 URL: http://llvm.org/viewvc/llvm-project?rev=45286&view=rev Log: Get the verifier to check attributes on calls as well as on functions. Make it verify invokes and not just ordinary calls. As a (desired) side-effect, it is no longer legal to have call attributes on arguments that are being passed to the varargs part of a varargs function (llvm-as drops them on the floor anyway). Added: llvm/trunk/test/Verifier/2007-12-21-InvokeParamAttrs.ll Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=45286&r1=45285&r2=45286&view=diff == --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Fri Dec 21 13:19:01 2007 @@ -53,6 +53,7 @@ #include "llvm/PassManager.h" #include "llvm/Analysis/Dominators.h" #include "llvm/CodeGen/ValueTypes.h" +#include "llvm/Support/CallSite.h" #include "llvm/Support/CFG.h" #include "llvm/Support/InstVisitor.h" #include "llvm/Support/Streams.h" @@ -243,6 +244,7 @@ void visitShuffleVectorInst(ShuffleVectorInst &EI); void visitVAArgInst(VAArgInst &VAA) { visitInstruction(VAA); } void visitCallInst(CallInst &CI); +void visitInvokeInst(InvokeInst &II); void visitGetElementPtrInst(GetElementPtrInst &GEP); void visitLoadInst(LoadInst &LI); void visitStoreInst(StoreInst &SI); @@ -256,8 +258,11 @@ void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI); void visitAllocationInst(AllocationInst &AI); +void VerifyCallSite(CallSite CS); void VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, unsigned Count, ...); +void VerifyParamAttrs(const FunctionType *FT, const ParamAttrsList *Attrs, + const Value *V); void WriteValue(const Value *V) { if (!V) return; @@ -377,6 +382,70 @@ void Verifier::verifyTypeSymbolTable(TypeSymbolTable &ST) { } +// VerifyParamAttrs - Check parameter attributes against a function type. +// The value V is printed in error messages. +void Verifier::VerifyParamAttrs(const FunctionType *FT, +const ParamAttrsList *Attrs, +const Value *V) { + if (!Attrs) +return; + + // Note that when calling a varargs function, the following test disallows + // parameter attributes for the arguments corresponding to the varargs part. + Assert1(Attrs->size() && + Attrs->getParamIndex(Attrs->size()-1) <= FT->getNumParams(), + "Attributes after end of type!", V); + + bool SawNest = false; + + for (unsigned Idx = 0; Idx <= FT->getNumParams(); ++Idx) { +uint16_t Attr = Attrs->getParamAttrs(Idx); + +if (!Idx) { + uint16_t RetI = Attr & ParamAttr::ParameterOnly; + Assert1(!RetI, "Attribute " + Attrs->getParamAttrsText(RetI) + + "does not apply to return values!", V); +} else { + uint16_t ParmI = Attr & ParamAttr::ReturnOnly; + Assert1(!ParmI, "Attribute " + Attrs->getParamAttrsText(ParmI) + + "only applies to return values!", V); +} + +for (unsigned i = 0; + i < array_lengthof(ParamAttr::MutuallyIncompatible); ++i) { + uint16_t MutI = Attr & ParamAttr::MutuallyIncompatible[i]; + Assert1(!(MutI & (MutI - 1)), "Attributes " + + Attrs->getParamAttrsText(MutI) + "are incompatible!", V); +} + +uint16_t IType = Attr & ParamAttr::IntegerTypeOnly; +Assert1(!IType || FT->getParamType(Idx-1)->isInteger(), +"Attribute " + Attrs->getParamAttrsText(IType) + +"should only apply to Integer type!", V); + +uint16_t PType = Attr & ParamAttr::PointerTypeOnly; +Assert1(!PType || isa(FT->getParamType(Idx-1)), +"Attribute " + Attrs->getParamAttrsText(PType) + +"should only apply to Pointer type!", V); + +if (Attr & ParamAttr::ByVal) { + const PointerType *Ty = + dyn_cast(FT->getParamType(Idx-1)); + Assert1(!Ty || isa(Ty->getElementType()), + "Attribute byval should only apply to pointer to structs!", V); +} + +if (Attr & ParamAttr::Nest) { + Assert1(!SawNest, "More than one parameter has attribute nest!", V); + SawNest = true; +} + +if (Attr & ParamAttr::StructRet) { + Assert1(Idx == 1, "Attribute sret not on first parameter!", V); +} + } +} + // visitFunction - Verify that a function is ok. // void Verifier::visitFunction(Function &F) { @@ -394,67 +463,8 @@ Assert1(!F.isStructReturn() || FT->getReturnType() == Type::VoidTy, "Invalid struct-return function!", &F); - bool SawSRet = false; - - if (const ParamAttrsList *Attrs = F.getParamAttrs()) { -Assert1(Attrs->size() && -Attrs->getParamIndex(Attrs->size()-1)
[llvm-commits] [llvm] r45289 - /llvm/trunk/lib/Target/TargetData.cpp
Author: baldrick Date: Fri Dec 21 14:18:41 2007 New Revision: 45289 URL: http://llvm.org/viewvc/llvm-project?rev=45289&view=rev Log: Fix a brain fart by our beloved leader (the content of this patch is the last line). Modified: llvm/trunk/lib/Target/TargetData.cpp Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=45289&r1=45288&r2=45289&view=diff == --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Fri Dec 21 14:18:41 2007 @@ -268,15 +268,14 @@ return ABIInfo ? Alignments[i].ABIAlign : Alignments[i].PrefAlign; // The best match so far depends on what we're looking for. -if (AlignType == VECTOR_ALIGN) { +if (AlignType == VECTOR_ALIGN && Alignments[i].AlignType == VECTOR_ALIGN) { // If this is a specification for a smaller vector type, we will fall back // to it. This happens because <128 x double> can be implemented in terms // of 64 <2 x double>. - if (Alignments[i].AlignType == VECTOR_ALIGN && - Alignments[i].TypeBitWidth < BitWidth) { + if (Alignments[i].TypeBitWidth < BitWidth) { // Verify that we pick the biggest of the fallbacks. if (BestMatchIdx == -1 || -Alignments[BestMatchIdx].TypeBitWidth < BitWidth) +Alignments[BestMatchIdx].TypeBitWidth < Alignments[i].TypeBitWidth) BestMatchIdx = i; } } else if (AlignType == INTEGER_ALIGN && ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45300 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp
Author: asl Date: Fri Dec 21 17:33:44 2007 New Revision: 45300 URL: http://llvm.org/viewvc/llvm-project?rev=45300&view=rev Log: Fix silly typo in the FP CEP handling. Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=45300&r1=45299&r2=45300&view=diff == --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Fri Dec 21 17:33:44 2007 @@ -851,6 +851,7 @@ if (NeedsClosingParens) Out << "))"; Out << ')'; + return; } default: cerr << "CWriter Error: Unhandled constant expression: " ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm-gcc-4.2] r45303 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Author: johannes Date: Fri Dec 21 18:35:53 2007 New Revision: 45303 URL: http://llvm.org/viewvc/llvm-project?rev=45303&view=rev Log: Comment explaining the data structure gcc uses for virtual base classes. Not what llvm thinks it is. Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=45303&r1=45302&r2=45303&view=diff == --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Dec 21 18:35:53 2007 @@ -1740,6 +1740,27 @@ /// ConvertRECORD - We know that 'type' is a RECORD_TYPE: convert it to an LLVM /// type. +// A note on C++ virtual base class layout. Consider the following example: +// class A { public: int i0; }; +// class B : public virtual A { public: int i1; }; +// class C : public virtual A { public: int i2; }; +// class D : public virtual B, public virtual C { public: int i3; }; +// +// The TYPE nodes gcc builds for classes represent that class as it looks +// standing alone. Thus B is size 12 and looks like { vptr; i2; baseclass A; } +// However, this is not the layout used when that class is a base class for +// some other class, yet the same TYPE node is still used. D in the above has +// both a BINFO list entry and a FIELD that reference type B, but the virtual +// base class A within B is not allocated in that case; B-within-D is only +// size 8. The correct size is in the FIELD node (does not match the size +// in its child TYPE node.) The fields to be omitted from the child TYPE, +// as far as I can tell, are always the last ones; but also, there is a +// TYPE_DECL node sitting in the middle of the FIELD list separating virtual +// base classes from everything else. +// +// For LLVM purposes, we probably need to build a new type for B-within-D that +// has the correct size and layout for that usage. + const Type *TypeConverter::ConvertRECORD(tree type, tree orig_type) { if (const Type *Ty = GET_TYPE_LLVM(type)) { // If we already compiled this type, and if it was not a forward ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45304 - /llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
Author: evancheng Date: Fri Dec 21 19:12:14 2007 New Revision: 45304 URL: http://llvm.org/viewvc/llvm-project?rev=45304&view=rev Log: Allow JIT with non-static relocation model. Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=45304&r1=45303&r2=45304&view=diff == --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Fri Dec 21 19:12:14 2007 @@ -170,7 +170,8 @@ bool X86TargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast, bool DumpAsm, MachineCodeEmitter &MCE) { // FIXME: Move this to TargetJITInfo! - setRelocationModel(Reloc::Static); + if (getRelocationModel() == Reloc::Default) +setRelocationModel(Reloc::Static); Subtarget.setPICStyle(PICStyle::None); // JIT cannot ensure globals are placed in the lower 4G of address. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45305 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2007-12-21-Crash.ll
Author: dpatel Date: Fri Dec 21 19:32:53 2007 New Revision: 45305 URL: http://llvm.org/viewvc/llvm-project?rev=45305&view=rev Log: If succ has succ itself as one of the predecessors then do not merge current bb and succ even if bb's terminator is unconditional branch to succ. Added: llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=45305&r1=45304&r2=45305&view=diff == --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Dec 21 19:32:53 2007 @@ -110,10 +110,10 @@ // update the PHI nodes correctly. if (!isa(BB->begin()) || Succ->getSinglePredecessor()) return true; - // If the predecessors of Succ are only BB and Succ itself, handle it. + // If the predecessors of Succ are only BB, handle it. bool IsSafe = true; for (pred_iterator PI = pred_begin(Succ), E = pred_end(Succ); PI != E; ++PI) -if (*PI != Succ && *PI != BB) { +if (*PI != BB) { IsSafe = false; break; } Added: llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll?rev=45305&view=auto == --- llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll (added) +++ llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll Fri Dec 21 19:32:53 2007 @@ -0,0 +1,60 @@ +; RUN: llvm-as < %s | opt -std-compile-opts -disable-output + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" + +define i32 @bork() { +entry: + %retval = alloca i32; [#uses=2] + %opt = alloca i32 ; [#uses=3] + %undo = alloca i32 ; [#uses=3] + %tmp = alloca i32 ; [#uses=3] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i32 0, i32* %undo, align 4 + br label %bb5 + +bb:; preds = %bb5 + %tmp1 = load i32* %opt, align 4 ; [#uses=1] + switch i32 %tmp1, label %bb4 [ +i32 102, label %bb3 +i32 110, label %bb2 + ] + +bb2: ; preds = %bb + store i32 1, i32* %undo, align 4 + br label %bb3 + +bb3: ; preds = %bb2, %bb + br label %bb5 + +bb4: ; preds = %bb + store i32 258, i32* %tmp, align 4 + br label %bb13 + +bb5: ; preds = %bb3, %entry + %tmp6 = call i32 (...)* @foo( ) nounwind; [#uses=1] + store i32 %tmp6, i32* %opt, align 4 + %tmp7 = load i32* %opt, align 4 ; [#uses=1] + %tmp8 = icmp ne i32 %tmp7, -1 ; [#uses=1] + %tmp89 = zext i1 %tmp8 to i8; [#uses=1] + %toBool = icmp ne i8 %tmp89, 0 ; [#uses=1] + br i1 %toBool, label %bb, label %bb10 + +bb10: ; preds = %bb5 + %tmp11 = load i32* %undo, align 4 ; [#uses=1] + %tmp12 = call i32 (...)* @bar( i32 %tmp11 ) nounwind; [#uses=0] + store i32 1, i32* %tmp, align 4 + br label %bb13 + +bb13: ; preds = %bb10, %bb4 + %tmp14 = load i32* %tmp, align 4; [#uses=1] + store i32 %tmp14, i32* %retval, align 4 + br label %return + +return:; preds = %bb13 + %retval15 = load i32* %retval ; [#uses=1] + ret i32 %retval15 +} + +declare i32 @foo(...) + +declare i32 @bar(...) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45307 - in /llvm/trunk/lib/Target/X86: X86ISelDAGToDAG.cpp X86InstrInfo.td
Author: evancheng Date: Fri Dec 21 20:26:46 2007 New Revision: 45307 URL: http://llvm.org/viewvc/llvm-project?rev=45307&view=rev Log: Fix JIT code emission of X86::MovePCtoStack. Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=45307&r1=45306&r2=45307&view=diff == --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Dec 21 20:26:46 2007 @@ -994,7 +994,9 @@ unsigned PC = RegMap->createVirtualRegister(X86::GR32RegisterClass); const TargetInstrInfo *TII = TM.getInstrInfo(); -BuildMI(FirstMBB, MBBI, TII->get(X86::MovePCtoStack)); +// Operand of MovePCtoStack is completely ignored by asm printer. It's +// only used in JIT code emission as displacement to pc. +BuildMI(FirstMBB, MBBI, TII->get(X86::MovePCtoStack)).addImm(0); BuildMI(FirstMBB, MBBI, TII->get(X86::POP32r), PC); // If we're using vanilla 'GOT' PIC style, we should use relative addressing Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=45307&r1=45306&r2=45307&view=diff == --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Dec 21 20:26:46 2007 @@ -356,8 +356,8 @@ let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS] in { -def CALLpcrel32 : I<0xE8, RawFrm, (outs), (ins i32imm:$dst, variable_ops), -"call\t${dst:call}", []>; +def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm:$dst,variable_ops), + "call\t${dst:call}", []>; def CALL32r : I<0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops), "call\t{*}$dst", [(X86call GR32:$dst)]>; def CALL32m : I<0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops), @@ -408,8 +408,8 @@ let Defs = [ESP], Uses = [ESP, EFLAGS] in def PUSHFD : I<0x9C, RawFrm, (outs), (ins), "pushf", []>; -def MovePCtoStack : I<0, Pseudo, (outs), (ins piclabel:$label), - "call\t$label", []>; +def MovePCtoStack : Ii32<0xE8, RawFrm, (outs), (ins piclabel:$label), + "call\t$label", []>; let isTwoAddress = 1 in // GR32 = bswap GR32 def BSWAP32r : I<0xC8, AddRegFrm, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45308 - /llvm/trunk/test/CodeGen/CellSPU/
Author: gordon Date: Fri Dec 21 22:44:11 2007 New Revision: 45308 URL: http://llvm.org/viewvc/llvm-project?rev=45308&view=rev Log: Ignoring generated files. Modified: llvm/trunk/test/CodeGen/CellSPU/ (props changed) Propchange: llvm/trunk/test/CodeGen/CellSPU/ -- --- svn:ignore (added) +++ svn:ignore Fri Dec 21 22:44:11 2007 @@ -0,0 +1 @@ +Output ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45309 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
Author: resistor Date: Fri Dec 21 22:50:11 2007 New Revision: 45309 URL: http://llvm.org/viewvc/llvm-project?rev=45309&view=rev Log: Remove critical edge breaking. It won't be necessary as long as we are very careful when inserting copies. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=45309&r1=45308&r2=45309&view=diff == --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Fri Dec 21 22:50:11 2007 @@ -21,7 +21,6 @@ #define DEBUG_TYPE "strongphielim" #include "llvm/CodeGen/Passes.h" -#include "llvm/CodeGen/BreakCriticalMachineEdge.h" #include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -101,7 +100,6 @@ std::set& PHIUnion, std::vector& DF, std::vector >& locals); -void breakCriticalEdges(MachineFunction &Fn); }; @@ -501,42 +499,7 @@ } } -/// breakCriticalEdges - Break critical edges coming into blocks with PHI -/// nodes, preserving dominator and livevariable info. -void StrongPHIElimination::breakCriticalEdges(MachineFunction &Fn) { - typedef std::pair MBB_pair; - - MachineDominatorTree& MDT = getAnalysis(); - LiveVariables& LV = getAnalysis(); - - // Find critical edges - std::vector criticals; - for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) -if (!I->empty() && -I->begin()->getOpcode() == TargetInstrInfo::PHI && -I->pred_size() > 1) - for (MachineBasicBlock::pred_iterator PI = I->pred_begin(), - PE = I->pred_end(); PI != PE; ++PI) -if ((*PI)->succ_size() > 1) - criticals.push_back(std::make_pair(*PI, I)); - - for (std::vector::iterator I = criticals.begin(), - E = criticals.end(); I != E; ++I) { -// Split the edge -MachineBasicBlock* new_bb = SplitCriticalMachineEdge(I->first, I->second); - -// Update dominators -MDT.splitBlock(I->first); - -// Update livevariables -for (unsigned var = 1024; var < Fn.getSSARegMap()->getLastVirtReg(); ++var) - if (isLiveOut(LV.getVarInfo(var), I->first)) -LV.getVarInfo(var).AliveBlocks.set(new_bb->getNumber()); - } -} - bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) { - breakCriticalEdges(Fn); computeDFS(Fn); for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] [llvm] r45310 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
Author: resistor Date: Fri Dec 21 22:59:10 2007 New Revision: 45310 URL: http://llvm.org/viewvc/llvm-project?rev=45310&view=rev Log: Note what still needs doing. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=45310&r1=45309&r2=45310&view=diff == --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Fri Dec 21 22:59:10 2007 @@ -397,7 +397,7 @@ std::vector > localInterferences; processPHIUnion(P, PHIUnion, DF, localInterferences); -// FIXME: Check for local interferences +// Check for local interferences for (std::vector >::iterator I = localInterferences.begin(), E = localInterferences.end(); I != E; ++I) { std::pair p = *I; @@ -439,6 +439,8 @@ } } +// FIXME: Cache renaming information + ProcessedNames.insert(PHIUnion.begin(), PHIUnion.end()); ++P; } @@ -507,5 +509,8 @@ I->begin()->getOpcode() == TargetInstrInfo::PHI) processBlock(I); + // FIXME: Insert copies + // FIXME: Perform renaming + return false; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits