llvm.org GIT mirror llvm / 11fdc78
Make library calls sensitive to regparm module flag (Fixes PR3997). Reviewers: mkuper, rnk Subscribers: mehdi_amini, jyknight, aemerson, llvm-commits, rengolin Differential Revision: https://reviews.llvm.org/D27050 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298179 91177308-0d34-0410-b5e6-96231b3b80d8 Nirav Dave 3 years ago
25 changed file(s) with 219 addition(s) and 123 deletion(s). Raw diff Collapse all Expand all
4040 /// quickly.
4141 class FastISel {
4242 public:
43 struct ArgListEntry {
44 Value *Val = nullptr;
45 Type *Ty = nullptr;
46 bool IsSExt : 1;
47 bool IsZExt : 1;
48 bool IsInReg : 1;
49 bool IsSRet : 1;
50 bool IsNest : 1;
51 bool IsByVal : 1;
52 bool IsInAlloca : 1;
53 bool IsReturned : 1;
54 bool IsSwiftSelf : 1;
55 bool IsSwiftError : 1;
56 uint16_t Alignment = 0;
57
58 ArgListEntry()
59 : IsSExt(false), IsZExt(false), IsInReg(false), IsSRet(false),
60 IsNest(false), IsByVal(false), IsInAlloca(false), IsReturned(false),
61 IsSwiftSelf(false), IsSwiftError(false) {}
62
63 /// \brief Set CallLoweringInfo attribute flags based on a call instruction
64 /// and called function attributes.
65 void setAttributes(ImmutableCallSite *CS, unsigned AttrIdx);
66 };
67 typedef std::vector ArgListTy;
68
43 typedef TargetLoweringBase::ArgListEntry ArgListEntry;
44 typedef TargetLoweringBase::ArgListTy ArgListTy;
6945 struct CallLoweringInfo {
7046 Type *RetTy = nullptr;
7147 bool RetSExt : 1;
725725 /// @name Utility functions for querying Debug information.
726726 /// @{
727727
728 /// \brief Returns the Number of Register ParametersDwarf Version by checking
729 /// module flags.
730 unsigned getNumberRegisterParameters() const;
731
728732 /// \brief Returns the Dwarf Version by checking module flags.
729733 unsigned getDwarfVersion() const;
730734
2424
2525 #include "llvm/ADT/ArrayRef.h"
2626 #include "llvm/ADT/DenseMap.h"
27 #include "llvm/ADT/STLExtras.h"
2728 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/STLExtras.h"
2929 #include "llvm/ADT/StringRef.h"
3030 #include "llvm/CodeGen/DAGCombine.h"
3131 #include "llvm/CodeGen/ISDOpcodes.h"
3232 #include "llvm/CodeGen/MachineValueType.h"
3333 #include "llvm/CodeGen/RuntimeLibcalls.h"
34 #include "llvm/CodeGen/SelectionDAG.h"
3435 #include "llvm/CodeGen/SelectionDAGNodes.h"
3536 #include "llvm/CodeGen/ValueTypes.h"
3637 #include "llvm/IR/Attributes.h"
26272628 return *this;
26282629 }
26292630
2631 // setCallee with target/module-specific attributes
2632 CallLoweringInfo &setLibCallee(CallingConv::ID CC, Type *ResultType,
2633 SDValue Target, ArgListTy &&ArgsList) {
2634 RetTy = ResultType;
2635 Callee = Target;
2636 CallConv = CC;
2637 NumFixedArgs = Args.size();
2638 Args = std::move(ArgsList);
2639
2640 DAG.getTargetLoweringInfo().markLibCallAttributes(
2641 &(DAG.getMachineFunction()), CC, Args);
2642 return *this;
2643 }
2644
26302645 CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultType,
26312646 SDValue Target, ArgListTy &&ArgsList) {
26322647 RetTy = ResultType;
118118 "target-specific selector");
119119 STATISTIC(NumFastIselDead, "Number of dead insts removed on failure");
120120
121 void FastISel::ArgListEntry::setAttributes(ImmutableCallSite *CS,
122 unsigned AttrIdx) {
123 IsSExt = CS->paramHasAttr(AttrIdx, Attribute::SExt);
124 IsZExt = CS->paramHasAttr(AttrIdx, Attribute::ZExt);
125 IsInReg = CS->paramHasAttr(AttrIdx, Attribute::InReg);
126 IsSRet = CS->paramHasAttr(AttrIdx, Attribute::StructRet);
127 IsNest = CS->paramHasAttr(AttrIdx, Attribute::Nest);
128 IsByVal = CS->paramHasAttr(AttrIdx, Attribute::ByVal);
129 IsInAlloca = CS->paramHasAttr(AttrIdx, Attribute::InAlloca);
130 IsReturned = CS->paramHasAttr(AttrIdx, Attribute::Returned);
131 IsSwiftSelf = CS->paramHasAttr(AttrIdx, Attribute::SwiftSelf);
132 IsSwiftError = CS->paramHasAttr(AttrIdx, Attribute::SwiftError);
133 Alignment = CS->getParamAlignment(AttrIdx);
134 }
135
136121 /// Set the current block to which generated machine instructions will be
137122 /// appended, and clear the local CSE map.
138123 void FastISel::startNewBlock() {
928913 Entry.setAttributes(&CS, ArgI + 1);
929914 Args.push_back(Entry);
930915 }
916 TLI.markLibCallAttributes(MF, CS.getCallingConv(), Args);
931917
932918 CallLoweringInfo CLI;
933919 CLI.setCallee(RetTy, FTy, Symbol, std::move(Args), CS, NumArgs);
19341934 InChain = TCChain;
19351935
19361936 TargetLowering::CallLoweringInfo CLI(DAG);
1937 CLI.setDebugLoc(SDLoc(Node)).setChain(InChain)
1938 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
1939 .setTailCall(isTailCall).setSExtResult(isSigned).setZExtResult(!isSigned);
1937 CLI.setDebugLoc(SDLoc(Node))
1938 .setChain(InChain)
1939 .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee,
1940 std::move(Args))
1941 .setTailCall(isTailCall)
1942 .setSExtResult(isSigned)
1943 .setZExtResult(!isSigned);
19401944
19411945 std::pair CallInfo = TLI.LowerCallTo(CLI);
19421946
19691973 Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext());
19701974
19711975 TargetLowering::CallLoweringInfo CLI(DAG);
1972 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
1973 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
1974 .setSExtResult(isSigned).setZExtResult(!isSigned);
1976 CLI.setDebugLoc(dl)
1977 .setChain(DAG.getEntryNode())
1978 .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee,
1979 std::move(Args))
1980 .setSExtResult(isSigned)
1981 .setZExtResult(!isSigned);
19751982
19761983 std::pair CallInfo = TLI.LowerCallTo(CLI);
19771984
20032010 Type *RetTy = Node->getValueType(0).getTypeForEVT(*DAG.getContext());
20042011
20052012 TargetLowering::CallLoweringInfo CLI(DAG);
2006 CLI.setDebugLoc(SDLoc(Node)).setChain(InChain)
2007 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
2008 .setSExtResult(isSigned).setZExtResult(!isSigned);
2013 CLI.setDebugLoc(SDLoc(Node))
2014 .setChain(InChain)
2015 .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee,
2016 std::move(Args))
2017 .setSExtResult(isSigned)
2018 .setZExtResult(!isSigned);
20092019
20102020 std::pair CallInfo = TLI.LowerCallTo(CLI);
20112021
20982108
20992109 SDLoc dl(Node);
21002110 TargetLowering::CallLoweringInfo CLI(DAG);
2101 CLI.setDebugLoc(dl).setChain(InChain)
2102 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
2103 .setSExtResult(isSigned).setZExtResult(!isSigned);
2111 CLI.setDebugLoc(dl)
2112 .setChain(InChain)
2113 .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee,
2114 std::move(Args))
2115 .setSExtResult(isSigned)
2116 .setZExtResult(!isSigned);
21042117
21052118 std::pair CallInfo = TLI.LowerCallTo(CLI);
21062119
22092222
22102223 SDLoc dl(Node);
22112224 TargetLowering::CallLoweringInfo CLI(DAG);
2212 CLI.setDebugLoc(dl).setChain(InChain)
2213 .setCallee(TLI.getLibcallCallingConv(LC),
2214 Type::getVoidTy(*DAG.getContext()), Callee, std::move(Args));
2225 CLI.setDebugLoc(dl).setChain(InChain).setLibCallee(
2226 TLI.getLibcallCallingConv(LC), Type::getVoidTy(*DAG.getContext()), Callee,
2227 std::move(Args));
22152228
22162229 std::pair CallInfo = TLI.LowerCallTo(CLI);
22172230
38293842 TargetLowering::CallLoweringInfo CLI(DAG);
38303843 CLI.setDebugLoc(dl)
38313844 .setChain(Node->getOperand(0))
3832 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
3833 DAG.getExternalSymbol("__sync_synchronize",
3834 TLI.getPointerTy(DAG.getDataLayout())),
3835 std::move(Args));
3845 .setLibCallee(
3846 CallingConv::C, Type::getVoidTy(*DAG.getContext()),
3847 DAG.getExternalSymbol("__sync_synchronize",
3848 TLI.getPointerTy(DAG.getDataLayout())),
3849 std::move(Args));
38363850
38373851 std::pair CallResult = TLI.LowerCallTo(CLI);
38383852
38693883 TargetLowering::CallLoweringInfo CLI(DAG);
38703884 CLI.setDebugLoc(dl)
38713885 .setChain(Node->getOperand(0))
3872 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
3873 DAG.getExternalSymbol("abort",
3874 TLI.getPointerTy(DAG.getDataLayout())),
3875 std::move(Args));
3886 .setLibCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
3887 DAG.getExternalSymbol(
3888 "abort", TLI.getPointerTy(DAG.getDataLayout())),
3889 std::move(Args));
38763890 std::pair CallResult = TLI.LowerCallTo(CLI);
38773891
38783892 Results.push_back(CallResult.second);
26062606 TargetLowering::CallLoweringInfo CLI(DAG);
26072607 CLI.setDebugLoc(dl)
26082608 .setChain(Chain)
2609 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Func, std::move(Args))
2609 .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Func, std::move(Args))
26102610 .setSExtResult();
26112611
26122612 std::pair CallInfo = TLI.LowerCallTo(CLI);
10931093 Type *RetTy = Node->getValueType(0).getTypeForEVT(*DAG.getContext());
10941094
10951095 TargetLowering::CallLoweringInfo CLI(DAG);
1096 CLI.setDebugLoc(SDLoc(Node)).setChain(InChain)
1097 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
1098 .setSExtResult(isSigned).setZExtResult(!isSigned);
1096 CLI.setDebugLoc(SDLoc(Node))
1097 .setChain(InChain)
1098 .setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee,
1099 std::move(Args))
1100 .setSExtResult(isSigned)
1101 .setZExtResult(!isSigned);
10991102
11001103 std::pair CallInfo = TLI.LowerCallTo(CLI);
11011104
51745174 TargetLowering::CallLoweringInfo CLI(*this);
51755175 CLI.setDebugLoc(dl)
51765176 .setChain(Chain)
5177 .setCallee(TLI->getLibcallCallingConv(RTLIB::MEMCPY),
5178 Dst.getValueType().getTypeForEVT(*getContext()),
5179 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMCPY),
5180 TLI->getPointerTy(getDataLayout())),
5181 std::move(Args))
5177 .setLibCallee(TLI->getLibcallCallingConv(RTLIB::MEMCPY),
5178 Dst.getValueType().getTypeForEVT(*getContext()),
5179 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMCPY),
5180 TLI->getPointerTy(getDataLayout())),
5181 std::move(Args))
51825182 .setDiscardResult()
51835183 .setTailCall(isTailCall);
51845184
52355235 TargetLowering::CallLoweringInfo CLI(*this);
52365236 CLI.setDebugLoc(dl)
52375237 .setChain(Chain)
5238 .setCallee(TLI->getLibcallCallingConv(RTLIB::MEMMOVE),
5239 Dst.getValueType().getTypeForEVT(*getContext()),
5240 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMMOVE),
5241 TLI->getPointerTy(getDataLayout())),
5242 std::move(Args))
5238 .setLibCallee(TLI->getLibcallCallingConv(RTLIB::MEMMOVE),
5239 Dst.getValueType().getTypeForEVT(*getContext()),
5240 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMMOVE),
5241 TLI->getPointerTy(getDataLayout())),
5242 std::move(Args))
52435243 .setDiscardResult()
52445244 .setTailCall(isTailCall);
52455245
52975297 TargetLowering::CallLoweringInfo CLI(*this);
52985298 CLI.setDebugLoc(dl)
52995299 .setChain(Chain)
5300 .setCallee(TLI->getLibcallCallingConv(RTLIB::MEMSET),
5301 Dst.getValueType().getTypeForEVT(*getContext()),
5302 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMSET),
5303 TLI->getPointerTy(getDataLayout())),
5304 std::move(Args))
5300 .setLibCallee(TLI->getLibcallCallingConv(RTLIB::MEMSET),
5301 Dst.getValueType().getTypeForEVT(*getContext()),
5302 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMSET),
5303 TLI->getPointerTy(getDataLayout())),
5304 std::move(Args))
53055305 .setDiscardResult()
53065306 .setTailCall(isTailCall);
53075307
49114911 report_fatal_error("Unsupported element size");
49124912
49134913 TargetLowering::CallLoweringInfo CLI(DAG);
4914 CLI.setDebugLoc(sdl).setChain(getRoot()).setCallee(
4914 CLI.setDebugLoc(sdl).setChain(getRoot()).setLibCallee(
49154915 TLI.getLibcallCallingConv(LibraryCall),
49164916 Type::getVoidTy(*DAG.getContext()),
49174917 DAG.getExternalSymbol(TLI.getLibcallName(LibraryCall),
55355535 TargetLowering::ArgListTy Args;
55365536
55375537 TargetLowering::CallLoweringInfo CLI(DAG);
5538 CLI.setDebugLoc(sdl).setChain(getRoot()).setCallee(
5538 CLI.setDebugLoc(sdl).setChain(getRoot()).setLibCallee(
55395539 CallingConv::C, I.getType(),
55405540 DAG.getExternalSymbol(TrapFuncName.data(),
55415541 TLI.getPointerTy(DAG.getDataLayout())),
9595
9696 /// \brief Set CallLoweringInfo attribute flags based on a call instruction
9797 /// and called function attributes.
98 void TargetLowering::ArgListEntry::setAttributes(ImmutableCallSite *CS,
99 unsigned AttrIdx) {
98 void TargetLoweringBase::ArgListEntry::setAttributes(ImmutableCallSite *CS,
99 unsigned AttrIdx) {
100100 IsSExt = CS->paramHasAttr(AttrIdx, Attribute::SExt);
101101 IsZExt = CS->paramHasAttr(AttrIdx, Attribute::ZExt);
102102 IsInReg = CS->paramHasAttr(AttrIdx, Attribute::InReg);
137137 Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext());
138138 TargetLowering::CallLoweringInfo CLI(DAG);
139139 bool signExtend = shouldSignExtendTypeInLibCall(RetVT, isSigned);
140 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
141 .setCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
142 .setNoReturn(doesNotReturn).setDiscardResult(!isReturnValueUsed)
143 .setSExtResult(signExtend).setZExtResult(!signExtend);
140 CLI.setDebugLoc(dl)
141 .setChain(DAG.getEntryNode())
142 .setLibCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
143 .setNoReturn(doesNotReturn)
144 .setDiscardResult(!isReturnValueUsed)
145 .setSExtResult(signExtend)
146 .setZExtResult(!signExtend);
144147 return LowerCallTo(CLI);
145148 }
146149
38523855
38533856 TargetLowering::CallLoweringInfo CLI(DAG);
38543857 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode());
3855 CLI.setCallee(CallingConv::C, VoidPtrType, EmuTlsGetAddr, std::move(Args));
3858 CLI.setLibCallee(CallingConv::C, VoidPtrType, EmuTlsGetAddr, std::move(Args));
38563859 std::pair CallResult = LowerCallTo(CLI);
38573860
38583861 // TLSADDR will be codegen'ed as call. Inform MFI that function has calls.
464464 GIF.dropAllReferences();
465465 }
466466
467 unsigned Module::getNumberRegisterParameters() const {
468 auto *Val =
469 cast_or_null(getModuleFlag("NumRegisterParameters"));
470 if (!Val)
471 return 0;
472 return cast(Val->getValue())->getZExtValue();
473 }
474
467475 unsigned Module::getDwarfVersion() const {
468476 auto *Val = cast_or_null(getModuleFlag("Dwarf Version"));
469477 if (!Val)
21222122
21232123 StructType *RetTy = StructType::get(ArgTy, ArgTy, nullptr);
21242124 TargetLowering::CallLoweringInfo CLI(DAG);
2125 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
2126 .setCallee(CallingConv::Fast, RetTy, Callee, std::move(Args));
2125 CLI.setDebugLoc(dl)
2126 .setChain(DAG.getEntryNode())
2127 .setLibCallee(CallingConv::Fast, RetTy, Callee, std::move(Args));
21272128
21282129 std::pair CallResult = LowerCallTo(CLI);
21292130 return CallResult.first;
4343 TargetLowering::CallLoweringInfo CLI(DAG);
4444 CLI.setDebugLoc(dl)
4545 .setChain(Chain)
46 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
47 DAG.getExternalSymbol(bzeroEntry, IntPtr), std::move(Args))
46 .setLibCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
47 DAG.getExternalSymbol(bzeroEntry, IntPtr),
48 std::move(Args))
4849 .setDiscardResult();
4950 std::pair CallResult = TLI.LowerCallTo(CLI);
5051 return CallResult.second;
28722872
28732873 // FIXME: is there useful debug info available here?
28742874 TargetLowering::CallLoweringInfo CLI(DAG);
2875 CLI.setDebugLoc(dl).setChain(Chain).setCallee(
2875 CLI.setDebugLoc(dl).setChain(Chain).setLibCallee(
28762876 CallingConv::C, Type::getInt32Ty(*DAG.getContext()),
28772877 DAG.getExternalSymbol("__tls_get_addr", PtrVT), std::move(Args));
28782878
113113 TargetLowering::CallLoweringInfo CLI(DAG);
114114 CLI.setDebugLoc(dl)
115115 .setChain(Chain)
116 .setCallee(
116 .setLibCallee(
117117 TLI->getLibcallCallingConv(LC), Type::getVoidTy(*DAG.getContext()),
118118 DAG.getExternalSymbol(FunctionNames[AEABILibcall][AlignVariant],
119119 TLI->getPointerTy(DAG.getDataLayout())),
355355 TargetLowering::CallLoweringInfo CLI(DAG);
356356 CLI.setDebugLoc(dl)
357357 .setChain(InChain)
358 .setCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
358 .setLibCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
359359 .setInRegister()
360360 .setSExtResult(isSigned)
361361 .setZExtResult(!isSigned);
19821982 }
19831983
19841984 } // end of namespace llvm
1985
5050 TargetLowering::CallLoweringInfo CLI(DAG);
5151 CLI.setDebugLoc(dl)
5252 .setChain(Chain)
53 .setCallee(
53 .setLibCallee(
5454 TLI.getLibcallCallingConv(RTLIB::MEMCPY),
5555 Type::getVoidTy(*DAG.getContext()),
5656 DAG.getTargetExternalSymbol(
19211921 Args.push_back(Entry);
19221922
19231923 TargetLowering::CallLoweringInfo CLI(DAG);
1924 CLI.setDebugLoc(DL).setChain(DAG.getEntryNode())
1925 .setCallee(CallingConv::C, PtrTy, TlsGetAddr, std::move(Args));
1924 CLI.setDebugLoc(DL)
1925 .setChain(DAG.getEntryNode())
1926 .setLibCallee(CallingConv::C, PtrTy, TlsGetAddr, std::move(Args));
19261927 std::pair CallResult = LowerCallTo(CLI);
19271928
19281929 SDValue Ret = CallResult.first;
26462646
26472647 // Lower to a call to __trampoline_setup(Trmp, TrampSize, FPtr, ctx_reg)
26482648 TargetLowering::CallLoweringInfo CLI(DAG);
2649 CLI.setDebugLoc(dl).setChain(Chain)
2650 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
2651 DAG.getExternalSymbol("__trampoline_setup", PtrVT),
2652 std::move(Args));
2649 CLI.setDebugLoc(dl).setChain(Chain).setLibCallee(
2650 CallingConv::C, Type::getVoidTy(*DAG.getContext()),
2651 DAG.getExternalSymbol("__trampoline_setup", PtrVT), std::move(Args));
26532652
26542653 std::pair CallResult = LowerCallTo(CLI);
26552654 return CallResult.second;
5252 #include "llvm/Support/Debug.h"
5353 #include "llvm/Support/ErrorHandling.h"
5454 #include "llvm/Support/MathExtras.h"
55 #include "llvm/Target/TargetLowering.h"
5556 #include "llvm/Target/TargetOptions.h"
5657 #include
5758 #include
19581959
19591960 bool X86TargetLowering::useSoftFloat() const {
19601961 return Subtarget.useSoftFloat();
1962 }
1963
1964 void X86TargetLowering::markLibCallAttributes(MachineFunction *MF, unsigned CC,
1965 ArgListTy &Args) const {
1966
1967 // Only relabel X86-32 for C / Stdcall CCs.
1968 if (static_cast(MF->getSubtarget()).is64Bit())
1969 return;
1970 if (CC != CallingConv::C && CC != CallingConv::X86_StdCall)
1971 return;
1972 unsigned ParamRegs = 0;
1973 if (auto *M = MF->getFunction()->getParent())
1974 ParamRegs = M->getNumberRegisterParameters();
1975
1976 // Mark the first N int arguments as having reg
1977 for (unsigned Idx = 0; Idx < Args.size(); Idx++) {
1978 Type *T = Args[Idx].Ty;
1979 if (T->isPointerTy() || T->isIntegerTy())
1980 if (MF->getDataLayout().getTypeAllocSize(T) <= 8) {
1981 unsigned numRegs = 1;
1982 if (MF->getDataLayout().getTypeAllocSize(T) > 4)
1983 numRegs = 2;
1984 if (ParamRegs < numRegs)
1985 return;
1986 ParamRegs -= numRegs;
1987 Args[Idx].IsInReg = true;
1988 }
1989 }
19611990 }
19621991
19631992 const MCExpr *
2151621545 getPointerTy(DAG.getDataLayout()));
2151721546
2151821547 TargetLowering::CallLoweringInfo CLI(DAG);
21519 CLI.setDebugLoc(dl).setChain(InChain)
21520 .setCallee(getLibcallCallingConv(LC),
21521 static_cast(MVT::v2i64).getTypeForEVT(*DAG.getContext()),
21522 Callee, std::move(Args))
21523 .setInRegister().setSExtResult(isSigned).setZExtResult(!isSigned);
21548 CLI.setDebugLoc(dl)
21549 .setChain(InChain)
21550 .setLibCallee(
21551 getLibcallCallingConv(LC),
21552 static_cast(MVT::v2i64).getTypeForEVT(*DAG.getContext()), Callee,
21553 std::move(Args))
21554 .setInRegister()
21555 .setSExtResult(isSigned)
21556 .setZExtResult(!isSigned);
2152421557
2152521558 std::pair CallInfo = LowerCallTo(CLI);
2152621559 return DAG.getBitcast(VT, CallInfo.first);
2324423277 : (Type*)VectorType::get(ArgTy, 4);
2324523278
2324623279 TargetLowering::CallLoweringInfo CLI(DAG);
23247 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
23248 .setCallee(CallingConv::C, RetTy, Callee, std::move(Args));
23280 CLI.setDebugLoc(dl)
23281 .setChain(DAG.getEntryNode())
23282 .setLibCallee(CallingConv::C, RetTy, Callee, std::move(Args));
2324923283
2325023284 std::pair CallResult = TLI.LowerCallTo(CLI);
2325123285
686686
687687 unsigned getJumpTableEncoding() const override;
688688 bool useSoftFloat() const override;
689
690 void markLibCallAttributes(MachineFunction *MF, unsigned CC,
691 ArgListTy &Args) const override;
689692
690693 MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override {
691694 return MVT::i8;
8686 TargetLowering::CallLoweringInfo CLI(DAG);
8787 CLI.setDebugLoc(dl)
8888 .setChain(Chain)
89 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
90 DAG.getExternalSymbol(bzeroEntry, IntPtr), std::move(Args))
89 .setLibCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
90 DAG.getExternalSymbol(bzeroEntry, IntPtr),
91 std::move(Args))
9192 .setDiscardResult();
9293
9394 std::pair CallResult = TLI.LowerCallTo(CLI);
482482 Args.push_back(Entry);
483483
484484 TargetLowering::CallLoweringInfo CLI(DAG);
485 CLI.setDebugLoc(DL).setChain(Chain).setCallee(
485 CLI.setDebugLoc(DL).setChain(Chain).setLibCallee(
486486 CallingConv::C, IntPtrTy,
487487 DAG.getExternalSymbol("__misaligned_load",
488488 getPointerTy(DAG.getDataLayout())),
3434 TargetLowering::CallLoweringInfo CLI(DAG);
3535 CLI.setDebugLoc(dl)
3636 .setChain(Chain)
37 .setCallee(TLI.getLibcallCallingConv(RTLIB::MEMCPY),
38 Type::getVoidTy(*DAG.getContext()),
39 DAG.getExternalSymbol("__memcpy_4",
40 TLI.getPointerTy(DAG.getDataLayout())),
41 std::move(Args))
37 .setLibCallee(TLI.getLibcallCallingConv(RTLIB::MEMCPY),
38 Type::getVoidTy(*DAG.getContext()),
39 DAG.getExternalSymbol(
40 "__memcpy_4", TLI.getPointerTy(DAG.getDataLayout())),
41 std::move(Args))
4242 .setDiscardResult();
4343
4444 std::pair CallResult = TLI.LowerCallTo(CLI);
0 ; RUN: llc %s -mtriple=i386-pc-linux -o - | FileCheck -check-prefix=CHECK %s
1 ; RUN: llc %s -mtriple=i386-pc-win32 -o - | FileCheck -check-prefix=WIN %s
2 ; RUN: llc %s -mtriple=i386-pc-linux -fast-isel -o - | FileCheck -check-prefix=FAST %s
3 ; RUN: llc %s -mtriple=i386-pc-win32 -fast-isel -o - | FileCheck -check-prefix=FASTWIN %s
4
5
6
7 target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
8 target triple = "i386-unknown-linux-gnu"
9
10 ; Function Attrs: argmemonly nounwind
11 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i1) #1
12
13 define void @use_memset(i8* inreg nocapture %dest, i8 inreg %c, i32 inreg %n) local_unnamed_addr #0 {
14 entry:
15 ;CHECK-LABEL: @use_memset
16 ;CHECK-NOT: push
17 ;CHECK: jmp memset
18 ;CHECK-NOT: retl
19 ;WIN-LABEL: @use_memset
20 ;WIN-NOT: push
21 ;WIN: jmp _memset
22 ;WIN-NOT: retl
23 ;FAST-LABEL: @use_memset
24 ;FAST: subl $12, %esp
25 ;FAST-NEXT: movzbl %dl, %edx
26 ;FAST-NEXT: calll memset
27 ;FAST-NEXT: addl $12, %esp
28 ;FASTWIN-LABEL: @use_memset
29 ;FASTWIN: movzbl %dl, %edx
30 ;FASTWIN-NEXT: calll _memset
31 ;FASTWIN-NEXT: retl
32 tail call void @llvm.memset.p0i8.i32(i8* %dest, i8 %c, i32 %n, i32 1, i1 false)
33 ret void
34 }
35
36 ; Function Attrs: argmemonly nounwind
37 declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i32, i1) #1
38
39
40 attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
41 attributes #1 = { argmemonly nounwind }
42
43 !llvm.module.flags = !{!0}
44 !llvm.ident = !{!1}
45
46 !0 = !{i32 1, !"NumRegisterParameters", i32 3}
47 !1 = !{!"clang version 4.0.0 (trunk 288025) (llvm/trunk 288033)"}