llvm.org GIT mirror llvm / af7b183
Remove trailing space sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338293 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 1 year, 1 month ago
255 changed file(s) with 974 addition(s) and 974 deletion(s). Raw diff Collapse all Expand all
1616 #include "llvm/ADT/DenseMap.h"
1717 #include "llvm/ADT/DenseMapInfo.h"
1818 #include "llvm/Support/type_traits.h"
19 #include
19 #include
2020 #include
2121 #include
2222 #include
681681 SmallVectorImpl &SortedIndices);
682682
683683 /// Returns true if the memory operations \p A and \p B are consecutive.
684 /// This is a simple API that does not depend on the analysis pass.
684 /// This is a simple API that does not depend on the analysis pass.
685685 bool isConsecutiveAccess(Value *A, Value *B, const DataLayout &DL,
686686 ScalarEvolution &SE, bool CheckType = true);
687687
733733 /// accesses of a loop.
734734 ///
735735 /// It runs the analysis for a loop on demand. This can be initiated by
736 /// querying the loop access info via AM.getResult.
736 /// querying the loop access info via AM.getResult.
737737 /// getResult return a LoopAccessInfo object. See this class for the
738738 /// specifics of what information is provided.
739739 class LoopAccessAnalysis
99 /// Contains a collection of routines for determining if a given instruction is
1010 /// guaranteed to execute if a given point in control flow is reached. The most
1111 /// common example is an instruction within a loop being provably executed if we
12 /// branch to the header of it's containing loop.
12 /// branch to the header of it's containing loop.
1313 ///
1414 //===----------------------------------------------------------------------===//
1515
5757 bool isGuaranteedToExecute(const Instruction &Inst, const DominatorTree *DT,
5858 const Loop *CurLoop,
5959 const LoopSafetyInfo *SafetyInfo);
60
60
6161 }
6262
6363 #endif
325325 bool haveFastSqrt(Type *Ty) { return false; }
326326
327327 bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) { return true; }
328
328
329329 unsigned getFPOpCost(Type *Ty) { return TargetTransformInfo::TCC_Basic; }
330330
331331 int getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx, const APInt &Imm,
463463 /// This is equivelent to saying that all instructions within the basic block
464464 /// are guaranteed to transfer execution to their successor within the basic
465465 /// block. This has the same assumptions w.r.t. undefined behavior as the
466 /// instruction variant of this function.
466 /// instruction variant of this function.
467467 bool isGuaranteedToTransferExecutionToSuccessor(const BasicBlock *BB);
468468
469469 /// Return true if this function can prove that the instruction I
103103 const std::string &getName() const { return Name; }
104104
105105 /// By default, write barriers are replaced with simple store
106 /// instructions. If true, you must provide a custom pass to lower
106 /// instructions. If true, you must provide a custom pass to lower
107107 /// calls to \@llvm.gcwrite.
108108 bool customWriteBarrier() const { return CustomWriteBarriers; }
109109
110110 /// By default, read barriers are replaced with simple load
111 /// instructions. If true, you must provide a custom pass to lower
111 /// instructions. If true, you must provide a custom pass to lower
112112 /// calls to \@llvm.gcread.
113113 bool customReadBarrier() const { return CustomReadBarriers; }
114114
145145 }
146146
147147 /// By default, roots are left for the code generator so it can generate a
148 /// stack map. If true, you must provide a custom pass to lower
148 /// stack map. If true, you must provide a custom pass to lower
149149 /// calls to \@llvm.gcroot.
150150 bool customRoots() const { return CustomRoots; }
151151
785785 /// setAction ({G_ADD, 0, LLT::scalar(32)}, Legal);
786786 /// setLegalizeScalarToDifferentSizeStrategy(
787787 /// G_ADD, 0, widenToLargerTypesAndNarrowToLargest);
788 /// will end up defining getAction({G_ADD, 0, T}) to return the following
788 /// will end up defining getAction({G_ADD, 0, T}) to return the following
789789 /// actions for different scalar types T:
790790 /// LLT::scalar(1)..LLT::scalar(31): {WidenScalar, 0, LLT::scalar(32)}
791791 /// LLT::scalar(32): {Legal, 0, LLT::scalar(32)}
813813 VectorElementSizeChangeStrategies[OpcodeIdx][TypeIdx] = S;
814814 }
815815
816 /// A SizeChangeStrategy for the common case where legalization for a
816 /// A SizeChangeStrategy for the common case where legalization for a
817817 /// particular operation consists of only supporting a specific set of type
818818 /// sizes. E.g.
819819 /// setAction ({G_DIV, 0, LLT::scalar(32)}, Legal);
2626 uint32_t r_symbolnum; // symbol index if r_extern == 1 else section index
2727 bool r_pcrel; // was relocated pc-relative already
2828 uint8_t r_length; // length = 2 ^ r_length
29 bool r_extern; //
29 bool r_extern; //
3030 uint8_t r_type; // if not 0, machine-specific relocation type.
3131 bool r_scattered; // 1 = scattered, 0 = non-scattered
3232 int32_t r_value; // the value the item to be relocated is referring
3333 // to.
34 public:
34 public:
3535 uint32_t getPackedFields() const {
3636 if (r_scattered)
37 return (1 << 31) | (r_pcrel << 30) | ((r_length & 3) << 28) |
37 return (1 << 31) | (r_pcrel << 30) | ((r_length & 3) << 28) |
3838 ((r_type & 15) << 24) | (r_address & 0x00FFFFFF);
3939 else
4040 return (r_symbolnum << 8) | (r_pcrel << 7) | ((r_length & 3) << 5) |
4444 uint32_t getRawAddress() const { return r_address; }
4545
4646 MachORelocation(uint32_t addr, uint32_t index, bool pcrel, uint8_t len,
47 bool ext, uint8_t type, bool scattered = false,
48 int32_t value = 0) :
47 bool ext, uint8_t type, bool scattered = false,
48 int32_t value = 0) :
4949 r_address(addr), r_symbolnum(index), r_pcrel(pcrel), r_length(len),
5050 r_extern(ext), r_type(type), r_scattered(scattered), r_value(value) {}
5151 };
104104 /// basic block's address of label.
105105 MMIAddrLabelMap *AddrLabelSymbols;
106106
107 // TODO: Ideally, what we'd like is to have a switch that allows emitting
107 // TODO: Ideally, what we'd like is to have a switch that allows emitting
108108 // synchronous (precise at call-sites only) CFA into .eh_frame. However,
109109 // even under this switch, we'd like .debug_frame to be precise when using
110110 // -g. At this moment, there's no way to specify that some CFI directives
251251 MachineInstr *Instr = nullptr; ///< Alternatively, a MachineInstr.
252252
253253 public:
254 SUnit *OrigNode = nullptr; ///< If not this, the node from which this node
254 SUnit *OrigNode = nullptr; ///< If not this, the node from which this node
255255 /// was cloned. (SD scheduling only)
256256
257257 const MCSchedClassDesc *SchedClass =
155155 // TODO:: we should change the STATEPOINT representation so that CC and
156156 // Flags should be part of meta operands, with args and deopt operands, and
157157 // gc operands all prefixed by their length and a type code. This would be
158 // much more consistent.
158 // much more consistent.
159159 public:
160160 // These values are aboolute offsets into the operands of the statepoint
161161 // instruction.
1515
1616 #include "llvm/Pass.h"
1717 #include "llvm/Support/CodeGen.h"
18 #include
18 #include
1919 #include
2020
2121 namespace llvm {
455455 /// stack frame offset. The first register is closest to the incoming stack
456456 /// pointer if stack grows down, and vice versa.
457457 /// Notice: This function does not take into account disabled CSRs.
458 /// In most cases you will want to use instead the function
458 /// In most cases you will want to use instead the function
459459 /// getCalleeSavedRegs that is implemented in MachineRegisterInfo.
460460 virtual const MCPhysReg*
461461 getCalleeSavedRegs(const MachineFunction *MF) const = 0;
517517 /// guaranteed to be restored before any uses. This is useful for targets that
518518 /// have call sequences where a GOT register may be updated by the caller
519519 /// prior to a call and is guaranteed to be restored (also by the caller)
520 /// after the call.
520 /// after the call.
521521 virtual bool isCallerPreservedPhysReg(unsigned PhysReg,
522522 const MachineFunction &MF) const {
523523 return false;
546546 /// may have side effects cannot be removed without semantically changing the
547547 /// generated program.
548548 bool isSafeToRemove() const;
549
549
550550 /// Return true if the instruction is a variety of EH-block.
551551 bool isEHPad() const {
552552 switch (getOpcode()) {
40154015 void setDoesNotThrow() {
40164016 addAttribute(AttributeList::FunctionIndex, Attribute::NoUnwind);
40174017 }
4018
4018
40194019 /// Return the function called, or null if this is an
40204020 /// indirect function invocation.
40214021 ///
540540 [ LLVMMatchType<0>,
541541 llvm_metadata_ty,
542542 llvm_metadata_ty ]>;
543 def int_experimental_constrained_exp : Intrinsic<[ llvm_anyfloat_ty ],
543 def int_experimental_constrained_exp : Intrinsic<[ llvm_anyfloat_ty ],
544544 [ LLVMMatchType<0>,
545545 llvm_metadata_ty,
546546 llvm_metadata_ty ]>;
274274 Intrinsic<[], [llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty], []>;
275275 def int_arm_stcl : GCCBuiltin<"__builtin_arm_stcl">,
276276 Intrinsic<[], [llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty], []>;
277 def int_arm_stc2 : GCCBuiltin<"__builtin_arm_stc2">,
277 def int_arm_stc2 : GCCBuiltin<"__builtin_arm_stc2">,
278278 Intrinsic<[], [llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty], []>;
279279 def int_arm_stc2l : GCCBuiltin<"__builtin_arm_stc2l">,
280280 Intrinsic<[], [llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty], []>;
0 //===- IntrinsicsPowerPC.td - Defines PowerPC intrinsics ---*- tablegen -*-===//
1 //
1 //
22 // The LLVM Compiler Infrastructure
33 //
44 // This file is distributed under the University of Illinois Open Source
55 // License. See LICENSE.TXT for details.
6 //
6 //
77 //===----------------------------------------------------------------------===//
88 //
99 // This file defines all of the PowerPC-specific intrinsics.
121121
122122 /// PowerPC_Vec_BBB_Intrinsic - A PowerPC intrinsic that takes two v16i8
123123 /// vectors and returns one. These intrinsics have no side effects.
124 class PowerPC_Vec_BBB_Intrinsic
124 class PowerPC_Vec_BBB_Intrinsic
125125 : PowerPC_Vec_Intrinsic
126126 [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
127127 [IntrNoMem]>;
128128
129129 /// PowerPC_Vec_HHH_Intrinsic - A PowerPC intrinsic that takes two v8i16
130130 /// vectors and returns one. These intrinsics have no side effects.
131 class PowerPC_Vec_HHH_Intrinsic
131 class PowerPC_Vec_HHH_Intrinsic
132132 : PowerPC_Vec_Intrinsic
133133 [llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
134134 [IntrNoMem]>;
135135
136136 /// PowerPC_Vec_WWW_Intrinsic - A PowerPC intrinsic that takes two v4i32
137137 /// vectors and returns one. These intrinsics have no side effects.
138 class PowerPC_Vec_WWW_Intrinsic
138 class PowerPC_Vec_WWW_Intrinsic
139139 : PowerPC_Vec_Intrinsic
140140 [llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
141141 [IntrNoMem]>;
266266 def int_ppc_altivec_vcmpgtud : GCCBuiltin<"__builtin_altivec_vcmpgtud">,
267267 Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
268268 [IntrNoMem]>;
269
269
270270 def int_ppc_altivec_vcmpequw : GCCBuiltin<"__builtin_altivec_vcmpequw">,
271271 Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
272272 [IntrNoMem]>;
282282 def int_ppc_altivec_vcmpnezw : GCCBuiltin<"__builtin_altivec_vcmpnezw">,
283283 Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
284284 [IntrNoMem]>;
285
285
286286 def int_ppc_altivec_vcmpequh : GCCBuiltin<"__builtin_altivec_vcmpequh">,
287287 Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
288288 [IntrNoMem]>;
354354 def int_ppc_altivec_vcmpnezw_p : GCCBuiltin<"__builtin_altivec_vcmpnezw_p">,
355355 Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
356356 [IntrNoMem]>;
357
357
358358 def int_ppc_altivec_vcmpequh_p : GCCBuiltin<"__builtin_altivec_vcmpequh_p">,
359359 Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
360360 [IntrNoMem]>;
473473 Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
474474 llvm_v4i32_ty], [IntrNoMem]>;
475475 def int_ppc_altivec_vmsumshs : GCCBuiltin<"__builtin_altivec_vmsumshs">,
476 Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
476 Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
477477 llvm_v4i32_ty], [IntrNoMem]>;
478478 def int_ppc_altivec_vmsumubm : GCCBuiltin<"__builtin_altivec_vmsumubm">,
479 Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
479 Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
480480 llvm_v4i32_ty], [IntrNoMem]>;
481481 def int_ppc_altivec_vmsumuhm : GCCBuiltin<"__builtin_altivec_vmsumuhm">,
482482 Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
543543
544544 // Other multiplies.
545545 def int_ppc_altivec_vmladduhm : GCCBuiltin<"__builtin_altivec_vmladduhm">,
546 Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
546 Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
547547 llvm_v8i16_ty], [IntrNoMem]>;
548548
549549 // Packs.
625625
626626 // Add Extended Quadword
627627 def int_ppc_altivec_vaddeuqm : GCCBuiltin<"__builtin_altivec_vaddeuqm">,
628 Intrinsic<[llvm_v1i128_ty],
628 Intrinsic<[llvm_v1i128_ty],
629629 [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
630630 [IntrNoMem]>;
631631 def int_ppc_altivec_vaddecuq : GCCBuiltin<"__builtin_altivec_vaddecuq">,
632 Intrinsic<[llvm_v1i128_ty],
632 Intrinsic<[llvm_v1i128_ty],
633633 [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
634634 [IntrNoMem]>;
635635
636636 // Sub Extended Quadword
637637 def int_ppc_altivec_vsubeuqm : GCCBuiltin<"__builtin_altivec_vsubeuqm">,
638 Intrinsic<[llvm_v1i128_ty],
638 Intrinsic<[llvm_v1i128_ty],
639639 [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
640640 [IntrNoMem]>;
641641 def int_ppc_altivec_vsubecuq : GCCBuiltin<"__builtin_altivec_vsubecuq">,
642 Intrinsic<[llvm_v1i128_ty],
642 Intrinsic<[llvm_v1i128_ty],
643643 [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
644644 [IntrNoMem]>;
645645 }
656656 // Right Shifts.
657657 def int_ppc_altivec_vsr : PowerPC_Vec_WWW_Intrinsic<"vsr">;
658658 def int_ppc_altivec_vsro : PowerPC_Vec_WWW_Intrinsic<"vsro">;
659
659
660660 def int_ppc_altivec_vsrb : PowerPC_Vec_BBB_Intrinsic<"vsrb">;
661661 def int_ppc_altivec_vsrh : PowerPC_Vec_HHH_Intrinsic<"vsrh">;
662662 def int_ppc_altivec_vsrw : PowerPC_Vec_WWW_Intrinsic<"vsrw">;
678678 Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
679679
680680 def int_ppc_altivec_vperm : GCCBuiltin<"__builtin_altivec_vperm_4si">,
681 Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
681 Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
682682 llvm_v4i32_ty, llvm_v16i8_ty], [IntrNoMem]>;
683683 def int_ppc_altivec_vsel : GCCBuiltin<"__builtin_altivec_vsel_4si">,
684 Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
684 Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
685685 llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
686686 def int_ppc_altivec_vgbbd : GCCBuiltin<"__builtin_altivec_vgbbd">,
687687 Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
284284 SpecificBumpPtrAllocator AUFoldingSetNodeAllocator;
285285
286286 // Maps from a pass to it's associated entry in UniqueAnalysisUsages. Does
287 // not own the storage associated with either key or value..
287 // not own the storage associated with either key or value..
288288 DenseMap AnUsageMap;
289289
290290 /// Collection of PassInfo objects found via analysis IDs and in this top
324324 explicit Statepoint(CallSite CS) : Base(CS) {}
325325 };
326326
327 /// Common base class for representing values projected from a statepoint.
327 /// Common base class for representing values projected from a statepoint.
328328 /// Currently, the only projections available are gc.result and gc.relocate.
329329 class GCProjectionInst : public IntrinsicInst {
330330 public:
100100 void operator delete(void *Usr);
101101 /// Placement delete - required by std, called if the ctor throws.
102102 void operator delete(void *Usr, unsigned) {
103 // Note: If a subclass manipulates the information which is required to calculate the
104 // Usr memory pointer, e.g. NumUserOperands, the operator delete of that subclass has
103 // Note: If a subclass manipulates the information which is required to calculate the
104 // Usr memory pointer, e.g. NumUserOperands, the operator delete of that subclass has
105105 // to restore the changed information to the original value, since the dtor of that class
106 // is not called if the ctor fails.
106 // is not called if the ctor fails.
107107 User::operator delete(Usr);
108108
109109 #ifndef LLVM_ENABLE_EXCEPTIONS
112112 }
113113 /// Placement delete - required by std, called if the ctor throws.
114114 void operator delete(void *Usr, unsigned, bool) {
115 // Note: If a subclass manipulates the information which is required to calculate the
116 // Usr memory pointer, e.g. NumUserOperands, the operator delete of that subclass has
115 // Note: If a subclass manipulates the information which is required to calculate the
116 // Usr memory pointer, e.g. NumUserOperands, the operator delete of that subclass has
117117 // to restore the changed information to the original value, since the dtor of that class
118 // is not called if the ctor fails.
118 // is not called if the ctor fails.
119119 User::operator delete(Usr);
120120
121121 #ifndef LLVM_ENABLE_EXCEPTIONS
4343 llvm::LLVMContext Context;
4444 (void)new llvm::Module("", Context);
4545 (void)new llvm::UnreachableInst(Context);
46 (void) llvm::createVerifierPass();
46 (void) llvm::createVerifierPass();
4747 }
4848 } ForceVMCoreLinking;
4949 }
6363
6464 /// Returns true if at least one of the register writes performed by
6565 /// \param Inst implicitly clears the upper portion of all super-registers.
66 ///
66 ///
6767 /// Example: on X86-64, a write to EAX implicitly clears the upper half of
6868 /// RAX. Also (still on x86) an XMM write perfomed by an AVX 128-bit
6969 /// instruction implicitly clears the upper portion of the correspondent
1414 /// AsmCond - Class to support conditional assembly
1515 ///
1616 /// The conditional assembly feature (.if, .else, .elseif and .endif) is
17 /// implemented with AsmCond that tells us what we are in the middle of
17 /// implemented with AsmCond that tells us what we are in the middle of
1818 /// processing. Ignore can be either true or false. When true we are ignoring
1919 /// the block of code in the middle of a conditional.
2020
296296 /// If the comment includes embedded \n's, they will each get the comment
297297 /// prefix as appropriate. The added comment should not end with a \n.
298298 /// By default, each comment is terminated with an end of line, i.e. the
299 /// EOL param is set to true by default. If one prefers not to end the
300 /// comment with a new line then the EOL param should be passed
299 /// EOL param is set to true by default. If one prefers not to end the
300 /// comment with a new line then the EOL param should be passed
301301 /// with a false value.
302302 virtual void AddComment(const Twine &T, bool EOL = true) {}
303303
332332
333333 relocation_iterator locrel_begin() const;
334334 relocation_iterator locrel_end() const;
335
335
336336 void moveRelocationNext(DataRefImpl &Rel) const override;
337337 uint64_t getRelocationOffset(DataRefImpl Rel) const override;
338338 symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
230230 // should be a small number, we just do a linear search over a (dense)
231231 // vector.
232232 Pass *ResultPass = Resolver->findImplPass(PI);
233 assert(ResultPass &&
233 assert(ResultPass &&
234234 "getAnalysis*() called on an analysis that was not "
235235 "'required' by pass!");
236236
88 //
99 // This file defines PassRegistry, a class that is used in the initialization
1010 // and registration of passes. At application startup, passes are registered
11 // with the PassRegistry, which is later provided to the PassManager for
11 // with the PassRegistry, which is later provided to the PassManager for
1212 // dependency resolution and similar tasks.
1313 //
1414 //===----------------------------------------------------------------------===//
206206 /// A CodeRegion associates some code with a counter
207207 CodeRegion,
208208
209 /// An ExpansionRegion represents a file expansion region that associates
209 /// An ExpansionRegion represents a file expansion region that associates
210210 /// a source range with the expansion of a virtual source file, such as
211211 /// for a macro instantiation or #include file.
212212 ExpansionRegion,
1414
1515 namespace llvm {
1616
17 /// An auxiliary type to facilitate extraction of 3-byte entities.
17 /// An auxiliary type to facilitate extraction of 3-byte entities.
1818 struct Uint24 {
1919 uint8_t Bytes[3];
2020 Uint24(uint8_t U) {
0 //===- TargetCallingConv.td - Target Calling Conventions ---*- tablegen -*-===//
1 //
1 //
22 // The LLVM Compiler Infrastructure
33 //
44 // This file is distributed under the University of Illinois Open Source
55 // License. See LICENSE.TXT for details.
6 //
6 //
77 //===----------------------------------------------------------------------===//
88 //
99 // This file defines the target-independent interfaces with which targets
1212 // an instruction. Each MCInstPredicate class has a well-known semantic, and it
1313 // is used by a PredicateExpander to generate code for MachineInstr and/or
1414 // MCInst.
15 //
15 //
1616 // MCInstPredicate definitions can be used to construct MCSchedPredicate
1717 // definitions. An MCSchedPredicate can be used in place of a SchedPredicate
1818 // when defining SchedReadVariant and SchedWriteVariant used by a processor
6262 //
6363 // New MCInstPredicate classes must be added to this file. For each new class
6464 // XYZ, an "expandXYZ" method must be added to the PredicateExpander.
65 //
65 //
6666 //===----------------------------------------------------------------------===//
6767
6868 // Forward declarations.
8181 bool considerHoistingFromTo(BasicBlock &FromBlock, BasicBlock &ToBlock);
8282
8383 // If true, this pass is a nop unless the target architecture has branch
84 // divergence.
84 // divergence.
8585 const bool OnlyIfDivergentTarget = false;
8686
8787 TargetTransformInfo *TTI = nullptr;
7373 /// vararg functions can be extracted. This is safe, if all vararg handling
7474 /// code is extracted, including vastart. If AllowAlloca is true, then
7575 /// extraction of blocks containing alloca instructions would be possible,
76 /// however code extractor won't validate whether extraction is legal.
76 /// however code extractor won't validate whether extraction is legal.
7777 CodeExtractor(ArrayRef BBs, DominatorTree *DT = nullptr,
7878 bool AggregateArgs = false, BlockFrequencyInfo *BFI = nullptr,
7979 BranchProbabilityInfo *BPI = nullptr,
1717 #include "llvm/ADT/DenseMap.h"
1818 #include "llvm/ADT/StringRef.h"
1919 #include "llvm/IR/Attributes.h"
20 #include "llvm/IR/Instructions.h"
20 #include "llvm/IR/Instructions.h"
2121 #include "llvm/IR/Operator.h"
2222 #include "llvm/IR/ValueMap.h"
2323 #include "llvm/Support/AtomicOrdering.h"
133133 private:
134134 void loadAndParseMapFiles();
135135
136 SymbolRewriter::RewriteDescriptorList Descriptors;
136 SymbolRewriter::RewriteDescriptorList Descriptors;
137137 };
138138
139139 } // end namespace llvm
141141 Alias = SetMayAlias;
142142 AST.TotalMayAliasSetSize += size();
143143 } else {
144 // First entry of must alias must have maximum size!
144 // First entry of must alias must have maximum size!
145145 P->updateSizeAndAAInfo(Size, AAInfo);
146146 }
147147 assert(Result != NoAlias && "Cannot be part of must set!");
250250 for (PointerMapType::iterator I = PointerMap.begin(), E = PointerMap.end();
251251 I != E; ++I)
252252 I->second->eraseFromList();
253
253
254254 PointerMap.clear();
255
255
256256 // The alias sets should all be clear now.
257257 AliasSets.clear();
258258 }
268268 for (iterator I = begin(), E = end(); I != E;) {
269269 iterator Cur = I++;
270270 if (Cur->Forward || !Cur->aliasesPointer(Ptr, Size, AAInfo, AA)) continue;
271
271
272272 if (!FoundSet) { // If this is the first alias set ptr can go into.
273273 FoundSet = &*Cur; // Remember it.
274274 } else { // Otherwise, we must merge the sets.
335335 // Return the set!
336336 return *Entry.getAliasSet(*this)->getForwardedTarget(*this);
337337 }
338
338
339339 if (AliasSet *AS = mergeAliasSetsForPointer(Pointer, Size, AAInfo)) {
340340 // Add it to the alias set it aliases.
341341 AS->addPointer(*this, Entry, Size, AAInfo);
342342 return *AS;
343343 }
344
344
345345 // Otherwise create a new alias set to hold the loaded pointer.
346346 AliasSets.push_back(new AliasSet());
347347 AliasSets.back().addPointer(*this, Entry, Size, AAInfo);
525525 AS->SetSize--;
526526 TotalMayAliasSetSize--;
527527 }
528
528
529529 // Stop using the alias set.
530530 AS->dropRef(*this);
531
531
532532 PointerMap.erase(I);
533533 }
534534
123123 }
124124
125125 char CFGPrinterLegacyPass::ID = 0;
126 INITIALIZE_PASS(CFGPrinterLegacyPass, "dot-cfg", "Print CFG of function to 'dot' file",
126 INITIALIZE_PASS(CFGPrinterLegacyPass, "dot-cfg", "Print CFG of function to 'dot' file",
127127 false, true)
128128
129129 PreservedAnalyses CFGPrinterPass::run(Function &F,
165165 OS << "Call graph node for function: '" << F->getName() << "'";
166166 else
167167 OS << "Call graph node <>";
168
168
169169 OS << "<<" << this << ">> #uses=" << getNumReferences() << '\n';
170170
171171 for (const auto &I : *this) {
4040
4141 #define DEBUG_TYPE "cgscc-passmgr"
4242
43 static cl::opt
43 static cl::opt
4444 MaxIterations("max-cg-scc-iterations", cl::ReallyHidden, cl::init(4));
4545
4646 STATISTIC(MaxSCCIterations, "Maximum CGSCCPassMgr iterations on one SCC");
9696 }
9797
9898 PassManagerType getPassManagerType() const override {
99 return PMT_CallGraphPassManager;
100 }
101
99 return PMT_CallGraphPassManager;
100 }
101
102102 private:
103103 bool RunAllPassesOnSCC(CallGraphSCC &CurSCC, CallGraph &CG,
104104 bool &DevirtualizedCall);
105
105
106106 bool RunPassOnSCC(Pass *P, CallGraphSCC &CurSCC,
107107 CallGraph &CG, bool &CallGraphUpToDate,
108108 bool &DevirtualizedCall);
141141 if (EmitICRemark)
142142 emitInstrCountChangedRemark(P, M, InstrCount);
143143 }
144
144
145145 // After the CGSCCPass is done, when assertions are enabled, use
146146 // RefreshCallGraph to verify that the callgraph was correctly updated.
147147 #ifndef NDEBUG
148148 if (Changed)
149149 RefreshCallGraph(CurSCC, CG, true);
150150 #endif
151
151
152152 return Changed;
153153 }
154
154
155155 assert(PM->getPassManagerType() == PMT_FunctionPassManager &&
156156 "Invalid CGPassManager member");
157157 FPPassManager *FPP = (FPPassManager*)P;
158
158
159159 // Run pass P on all functions in the current SCC.
160160 for (CallGraphNode *CGN : CurSCC) {
161161 if (Function *F = CGN->getFunction()) {
167167 F->getContext().yield();
168168 }
169169 }
170
170
171171 // The function pass(es) modified the IR, they may have clobbered the
172172 // callgraph.
173173 if (Changed && CallGraphUpToDate) {
198198
199199 bool MadeChange = false;
200200 bool DevirtualizedCall = false;
201
201
202202 // Scan all functions in the SCC.
203203 unsigned FunctionNo = 0;
204204 for (CallGraphSCC::iterator SCCIdx = CurSCC.begin(), E = CurSCC.end();
206206 CallGraphNode *CGN = *SCCIdx;
207207 Function *F = CGN->getFunction();
208208 if (!F || F->isDeclaration()) continue;
209
209
210210 // Walk the function body looking for call sites. Sync up the call sites in
211211 // CGN with those actually in the function.
212212
213213 // Keep track of the number of direct and indirect calls that were
214214 // invalidated and removed.
215215 unsigned NumDirectRemoved = 0, NumIndirectRemoved = 0;
216
216
217217 // Get the set of call sites currently in the function.
218218 for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ) {
219219 // If this call site is null, then the function pass deleted the call
225225 CallSites.count(I->first) ||
226226
227227 // If the call edge is not from a call or invoke, or it is a
228 // instrinsic call, then the function pass RAUW'd a call with
228 // instrinsic call, then the function pass RAUW'd a call with
229229 // another value. This can happen when constant folding happens
230230 // of well known functions etc.
231231 !CallSite(I->first) ||
235235 CallSite(I->first).getCalledFunction()->getIntrinsicID()))) {
236236 assert(!CheckingMode &&
237237 "CallGraphSCCPass did not update the CallGraph correctly!");
238
238
239239 // If this was an indirect call site, count it.
240240 if (!I->second->getFunction())
241241 ++NumIndirectRemoved;
242 else
242 else
243243 ++NumDirectRemoved;
244
244
245245 // Just remove the edge from the set of callees, keep track of whether
246246 // I points to the last element of the vector.
247247 bool WasLast = I + 1 == E;
248248 CGN->removeCallEdge(I);
249
249
250250 // If I pointed to the last element of the vector, we have to bail out:
251251 // iterator checking rejects comparisons of the resultant pointer with
252252 // end.
255255 E = CGN->end();
256256 continue;
257257 }
258
258
259259 assert(!CallSites.count(I->first) &&
260260 "Call site occurs in node multiple times");
261
261
262262 CallSite CS(I->first);
263263 if (CS) {
264264 Function *Callee = CS.getCalledFunction();
268268 }
269269 ++I;
270270 }
271
271
272272 // Loop over all of the instructions in the function, getting the callsites.
273273 // Keep track of the number of direct/indirect calls added.
274274 unsigned NumDirectAdded = 0, NumIndirectAdded = 0;
279279 if (!CS) continue;
280280 Function *Callee = CS.getCalledFunction();
281281 if (Callee && Callee->isIntrinsic()) continue;
282
282
283283 // If this call site already existed in the callgraph, just verify it
284284 // matches up to expectations and remove it from CallSites.
285285 DenseMap::iterator ExistingIt =
289289
290290 // Remove from CallSites since we have now seen it.
291291 CallSites.erase(ExistingIt);
292
292
293293 // Verify that the callee is right.
294294 if (ExistingNode->getFunction() == CS.getCalledFunction())
295295 continue;
296
296
297297 // If we are in checking mode, we are not allowed to actually mutate
298298 // the callgraph. If this is a case where we can infer that the
299299 // callgraph is less precise than it could be (e.g. an indirect call
302302 if (CheckingMode && CS.getCalledFunction() &&
303303 ExistingNode->getFunction() == nullptr)
304304 continue;
305
305
306306 assert(!CheckingMode &&
307307 "CallGraphSCCPass did not update the CallGraph correctly!");
308
308
309309 // If not, we either went from a direct call to indirect, indirect to
310310 // direct, or direct to different direct.
311311 CallGraphNode *CalleeNode;
327327 MadeChange = true;
328328 continue;
329329 }
330
330
331331 assert(!CheckingMode &&
332332 "CallGraphSCCPass did not update the CallGraph correctly!");
333333
340340 CalleeNode = CG.getCallsExternalNode();
341341 ++NumIndirectAdded;
342342 }
343
343
344344 CGN->addCalledFunction(CS, CalleeNode);
345345 MadeChange = true;
346346 }
347
347
348348 // We scanned the old callgraph node, removing invalidated call sites and
349349 // then added back newly found call sites. One thing that can happen is
350350 // that an old indirect call site was deleted and replaced with a new direct
358358 if (NumIndirectRemoved > NumIndirectAdded &&
359359 NumDirectRemoved < NumDirectAdded)
360360 DevirtualizedCall = true;
361
361
362362 // After scanning this function, if we still have entries in callsites, then
363363 // they are dangling pointers. WeakTrackingVH should save us for this, so
364364 // abort if
365365 // this happens.
366366 assert(CallSites.empty() && "Dangling pointers found in call sites map");
367
367
368368 // Periodically do an explicit clear to remove tombstones when processing
369369 // large scc's.
370370 if ((FunctionNo & 15) == 15)
391391 bool CGPassManager::RunAllPassesOnSCC(CallGraphSCC &CurSCC, CallGraph &CG,
392392 bool &DevirtualizedCall) {
393393 bool Changed = false;
394
394
395395 // Keep track of whether the callgraph is known to be up-to-date or not.
396396 // The CGSSC pass manager runs two types of passes:
397397 // CallGraphSCC Passes and other random function passes. Because other
405405 for (unsigned PassNo = 0, e = getNumContainedPasses();
406406 PassNo != e; ++PassNo) {
407407 Pass *P = getContainedPass(PassNo);
408
408
409409 // If we're in -debug-pass=Executions mode, construct the SCC node list,
410410 // otherwise avoid constructing this string as it is expensive.
411411 if (isPassDebuggingExecutionsOrMore()) {
422422 dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, Functions);
423423 }
424424 dumpRequiredSet(P);
425
425
426426 initializeAnalysisImpl(P);
427
427
428428 // Actually run this pass on the current SCC.
429429 Changed |= RunPassOnSCC(P, CurSCC, CG,
430430 CallGraphUpToDate, DevirtualizedCall);
431
431
432432 if (Changed)
433433 dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, "");
434434 dumpPreservedSet(P);
435
436 verifyPreservedAnalysis(P);
435
436 verifyPreservedAnalysis(P);
437437 removeNotPreservedAnalysis(P);
438438 recordAvailableAnalysis(P);
439439 removeDeadPasses(P, "", ON_CG_MSG);
440440 }
441
441
442442 // If the callgraph was left out of date (because the last pass run was a
443443 // functionpass), refresh it before we move on to the next SCC.
444444 if (!CallGraphUpToDate)
451451 bool CGPassManager::runOnModule(Module &M) {
452452 CallGraph &CG = getAnalysis().getCallGraph();
453453 bool Changed = doInitialization(CG);
454
454
455455 // Walk the callgraph in bottom-up SCC order.
456456 scc_iterator CGI = scc_begin(&CG);
457457
484484 DevirtualizedCall = false;
485485 Changed |= RunAllPassesOnSCC(CurSCC, CG, DevirtualizedCall);
486486 } while (Iteration++ < MaxIterations && DevirtualizedCall);
487
487
488488 if (DevirtualizedCall)
489489 LLVM_DEBUG(dbgs() << " CGSCCPASSMGR: Stopped iteration after "
490490 << Iteration
499499 /// Initialize CG
500500 bool CGPassManager::doInitialization(CallGraph &CG) {
501501 bool Changed = false;
502 for (unsigned i = 0, e = getNumContainedPasses(); i != e; ++i) {
502 for (unsigned i = 0, e = getNumContainedPasses(); i != e; ++i) {
503503 if (PMDataManager *PM = getContainedPass(i)->getAsPMDataManager()) {
504504 assert(PM->getPassManagerType() == PMT_FunctionPassManager &&
505505 "Invalid CGPassManager member");
514514 /// Finalize CG
515515 bool CGPassManager::doFinalization(CallGraph &CG) {
516516 bool Changed = false;
517 for (unsigned i = 0, e = getNumContainedPasses(); i != e; ++i) {
517 for (unsigned i = 0, e = getNumContainedPasses(); i != e; ++i) {
518518 if (PMDataManager *PM = getContainedPass(i)->getAsPMDataManager()) {
519519 assert(PM->getPassManagerType() == PMT_FunctionPassManager &&
520520 "Invalid CGPassManager member");
540540 Nodes[i] = New;
541541 break;
542542 }
543
543
544544 // Update the active scc_iterator so that it doesn't contain dangling
545545 // pointers to the old CallGraphNode.
546546 scc_iterator *CGI = (scc_iterator*)Context;
554554 /// Assign pass manager to manage this pass.
555555 void CallGraphSCCPass::assignPassManager(PMStack &PMS,
556556 PassManagerType PreferredType) {
557 // Find CGPassManager
557 // Find CGPassManager
558558 while (!PMS.empty() &&
559559 PMS.top()->getPassManagerType() > PMT_CallGraphPassManager)
560560 PMS.pop();
561561
562562 assert(!PMS.empty() && "Unable to handle Call Graph Pass");
563563 CGPassManager *CGP;
564
564
565565 if (PMS.top()->getPassManagerType() == PMT_CallGraphPassManager)
566566 CGP = (CGPassManager*)PMS.top();
567567 else {
568 // Create new Call Graph SCC Pass Manager if it does not exist.
568 // Create new Call Graph SCC Pass Manager if it does not exist.
569569 assert(!PMS.empty() && "Unable to create Call Graph Pass Manager");
570570 PMDataManager *PMD = PMS.top();
571571
607607 class PrintCallGraphPass : public CallGraphSCCPass {
608608 std::string Banner;
609609 raw_ostream &OS; // raw_ostream to print on.
610
610
611611 public:
612612 static char ID;
613613
639639 }
640640 return false;
641641 }
642
642
643643 StringRef getPassName() const override { return "Print CallGraph IR"; }
644644 };
645
645
646646 } // end anonymous namespace.
647647
648648 char PrintCallGraphPass::ID = 0;
271271 // Analysis already completed for this function.
272272 return;
273273 Analyzed = true;
274
274
275275 Visited.clear();
276276 AliveBits.clear();
277277
366366
367367 APInt DemandedBits::getDemandedBits(Instruction *I) {
368368 performAnalysis();
369
369
370370 const DataLayout &DL = I->getModule()->getDataLayout();
371371 auto Found = AliveBits.find(I);
372372 if (Found != AliveBits.end())
408408 if (Constant *C = GV->getInitializer())
409409 if (!C->isNullValue())
410410 return false;
411
411
412412 // Walk the user list of the global. If we find anything other than a direct
413413 // load or store, bail out.
414414 for (User *U : GV->users()) {
463463 return true;
464464 }
465465
466 void GlobalsAAResult::CollectSCCMembership(CallGraph &CG) {
466 void GlobalsAAResult::CollectSCCMembership(CallGraph &CG) {
467467 // We do a bottom-up SCC traversal of the call graph. In other words, we
468468 // visit all callees before callers (leaf-first).
469469 unsigned SCCID = 0;
632632 Inputs.push_back(V);
633633 do {
634634 const Value *Input = Inputs.pop_back_val();
635
635
636636 if (isa(Input) || isa(Input) || isa(Input) ||
637637 isa(Input))
638638 // Arguments to functions or returns from functions are inherently
653653 if (auto *LI = dyn_cast(Input)) {
654654 Inputs.push_back(GetUnderlyingObject(LI->getPointerOperand(), DL));
655655 continue;
656 }
656 }
657657 if (auto *SI = dyn_cast(Input)) {
658658 const Value *LHS = GetUnderlyingObject(SI->getTrueValue(), DL);
659659 const Value *RHS = GetUnderlyingObject(SI->getFalseValue(), DL);
671671 }
672672 continue;
673673 }
674
674
675675 return false;
676676 } while (!Inputs.empty());
677677
753753 // non-addr-taken globals.
754754 continue;
755755 }
756
756
757757 // Recurse through a limited number of selects, loads and PHIs. This is an
758758 // arbitrary depth of 4, lower numbers could be used to fix compile time
759759 // issues if needed, but this is generally expected to be only be important
724724 // frequently arranged such that dominating ones come first and we quickly
725725 // find a path to function entry. TODO: We should consider explicitly
726726 // canonicalizing to make this true rather than relying on this happy
727 // accident.
727 // accident.
728728 for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
729729 ValueLatticeElement EdgeResult;
730730 if (!getEdgeValue(Val, *PI, BB, EdgeResult))
175175
176176 /// Calculate Start and End points of memory access.
177177 /// Let's assume A is the first access and B is a memory access on N-th loop
178 /// iteration. Then B is calculated as:
179 /// B = A + Step*N .
178 /// iteration. Then B is calculated as:
179 /// B = A + Step*N .
180180 /// Step value may be positive or negative.
181181 /// N is a calculated back-edge taken count:
182182 /// N = (TripCount > 0) ? RoundDown(TripCount -1 , VF) : 0
13161316 return false;
13171317 }
13181318
1319 /// Given a non-constant (unknown) dependence-distance \p Dist between two
1319 /// Given a non-constant (unknown) dependence-distance \p Dist between two
13201320 /// memory accesses, that have the same stride whose absolute value is given
13211321 /// in \p Stride, and that have the same type size \p TypeByteSize,
13221322 /// in a loop whose takenCount is \p BackedgeTakenCount, check if it is
13351335
13361336 // If we can prove that
13371337 // (**) |Dist| > BackedgeTakenCount * Step
1338 // where Step is the absolute stride of the memory accesses in bytes,
1338 // where Step is the absolute stride of the memory accesses in bytes,
13391339 // then there is no dependence.
13401340 //
1341 // Ratioanle:
1342 // We basically want to check if the absolute distance (|Dist/Step|)
1343 // is >= the loop iteration count (or > BackedgeTakenCount).
1344 // This is equivalent to the Strong SIV Test (Practical Dependence Testing,
1345 // Section 4.2.1); Note, that for vectorization it is sufficient to prove
1341 // Ratioanle:
1342 // We basically want to check if the absolute distance (|Dist/Step|)
1343 // is >= the loop iteration count (or > BackedgeTakenCount).
1344 // This is equivalent to the Strong SIV Test (Practical Dependence Testing,
1345 // Section 4.2.1); Note, that for vectorization it is sufficient to prove
13461346 // that the dependence distance is >= VF; This is checked elsewhere.
1347 // But in some cases we can prune unknown dependence distances early, and
1348 // even before selecting the VF, and without a runtime test, by comparing
1349 // the distance against the loop iteration count. Since the vectorized code
1350 // will be executed only if LoopCount >= VF, proving distance >= LoopCount
1347 // But in some cases we can prune unknown dependence distances early, and
1348 // even before selecting the VF, and without a runtime test, by comparing
1349 // the distance against the loop iteration count. Since the vectorized code
1350 // will be executed only if LoopCount >= VF, proving distance >= LoopCount
13511351 // also guarantees that distance >= VF.
13521352 //
13531353 const uint64_t ByteStride = Stride * TypeByteSize;
13591359 uint64_t DistTypeSize = DL.getTypeAllocSize(Dist.getType());
13601360 uint64_t ProductTypeSize = DL.getTypeAllocSize(Product->getType());
13611361
1362 // The dependence distance can be positive/negative, so we sign extend Dist;
1363 // The multiplication of the absolute stride in bytes and the
1362 // The dependence distance can be positive/negative, so we sign extend Dist;
1363 // The multiplication of the absolute stride in bytes and the
13641364 // backdgeTakenCount is non-negative, so we zero extend Product.
13651365 if (DistTypeSize > ProductTypeSize)
13661366 CastedProduct = SE.getZeroExtendExpr(Product, Dist.getType());
22112211 "versioning:");
22122212 LLVM_DEBUG(dbgs() << " Ptr: " << *Ptr << " Stride: " << *Stride << "\n");
22132213
2214 // Avoid adding the "Stride == 1" predicate when we know that
2214 // Avoid adding the "Stride == 1" predicate when we know that
22152215 // Stride >= Trip-Count. Such a predicate will effectively optimize a single
22162216 // or zero iteration loop, as Trip-Count <= Stride == 1.
2217 //
2217 //
22182218 // TODO: We are currently not making a very informed decision on when it is
22192219 // beneficial to apply stride versioning. It might make more sense that the
2220 // users of this analysis (such as the vectorizer) will trigger it, based on
2221 // their specific cost considerations; For example, in cases where stride
2220 // users of this analysis (such as the vectorizer) will trigger it, based on
2221 // their specific cost considerations; For example, in cases where stride
22222222 // versioning does not help resolving memory accesses/dependences, the
2223 // vectorizer should evaluate the cost of the runtime test, and the benefit
2224 // of various possible stride specializations, considering the alternatives
2225 // of using gather/scatters (if available).
2226
2223 // vectorizer should evaluate the cost of the runtime test, and the benefit
2224 // of various possible stride specializations, considering the alternatives
2225 // of using gather/scatters (if available).
2226
22272227 const SCEV *StrideExpr = PSE->getSCEV(Stride);
2228 const SCEV *BETakenCount = PSE->getBackedgeTakenCount();
2228 const SCEV *BETakenCount = PSE->getBackedgeTakenCount();
22292229
22302230 // Match the types so we can compare the stride and the BETakenCount.
2231 // The Stride can be positive/negative, so we sign extend Stride;
2231 // The Stride can be positive/negative, so we sign extend Stride;
22322232 // The backdgeTakenCount is non-negative, so we zero extend BETakenCount.
22332233 const DataLayout &DL = TheLoop->getHeader()->getModule()->getDataLayout();
22342234 uint64_t StrideTypeSize = DL.getTypeAllocSize(StrideExpr->getType());
22422242 CastedBECount = SE->getZeroExtendExpr(BETakenCount, StrideExpr->getType());
22432243 const SCEV *StrideMinusBETaken = SE->getMinusSCEV(CastedStride, CastedBECount);
22442244 // Since TripCount == BackEdgeTakenCount + 1, checking:
2245 // "Stride >= TripCount" is equivalent to checking:
2245 // "Stride >= TripCount" is equivalent to checking:
22462246 // Stride - BETakenCount > 0
22472247 if (SE->isKnownPositive(StrideMinusBETaken)) {
22482248 LLVM_DEBUG(
117117 } else {
118118 SmallVector NLDI;
119119 assert( (isa(Inst) || isa(Inst) ||
120 isa(Inst)) && "Unknown memory instruction!");
120 isa(Inst)) && "Unknown memory instruction!");
121121 MDA.getNonLocalPointerDependency(Inst, NLDI);
122122
123123 DepSet &InstDeps = Deps[Inst];
234234 }
235235
236236
237 void printInfoComment(const Value &V, formatted_raw_ostream &OS) override {
237 void printInfoComment(const Value &V, formatted_raw_ostream &OS) override {
238238 if (!MustExec.count(&V))
239239 return;
240240
244244 OS << " ; (mustexec in " << NumLoops << " loops: ";
245245 else
246246 OS << " ; (mustexec in: ";
247
247
248248 bool first = true;
249249 for (const Loop *L : Loops) {
250250 if (!first)
263263
264264 MustExecuteAnnotatedWriter Writer(F, DT, LI);
265265 F.print(dbgs(), &Writer);
266
266
267267 return false;
268268 }
48384838
48394839 // Construct the extended SCEV: (Ext ix (Trunc iy (Expr) to ix) to iy)
48404840 // for each of StartVal and Accum
4841 auto getExtendedExpr = [&](const SCEV *Expr,
4841 auto getExtendedExpr = [&](const SCEV *Expr,
48424842 bool CreateSignExtend) -> const SCEV * {
48434843 assert(isLoopInvariant(Expr, L) && "Expr is expected to be invariant");
48444844 const SCEV *TruncatedExpr = getTruncateExpr(Expr, TruncTy);
49344934 return Rewrite;
49354935 }
49364936
4937 // FIXME: This utility is currently required because the Rewriter currently
4938 // does not rewrite this expression:
4939 // {0, +, (sext ix (trunc iy to ix) to iy)}
4937 // FIXME: This utility is currently required because the Rewriter currently
4938 // does not rewrite this expression:
4939 // {0, +, (sext ix (trunc iy to ix) to iy)}
49404940 // into {0, +, %step},
4941 // even when the following Equal predicate exists:
4941 // even when the following Equal predicate exists:
49424942 // "%step == (sext ix (trunc iy to ix) to iy)".
49434943 bool PredicatedScalarEvolution::areAddRecsEqualWithPreds(
49444944 const SCEVAddRecExpr *AR1, const SCEVAddRecExpr *AR2) const {
720720 static Optional getReductionData(Instruction *I) {
721721 Value *L, *R;
722722 if (m_BinOp(m_Value(L), m_Value(R)).match(I))
723 return ReductionData(RK_Arithmetic, I->getOpcode(), L, R);
723 return ReductionData(RK_Arithmetic, I->getOpcode(), L, R);
724724 if (auto *SI = dyn_cast(I)) {
725725 if (m_SMin(m_Value(L), m_Value(R)).match(SI) ||
726726 m_SMax(m_Value(L), m_Value(R)).match(SI) ||
729729 m_UnordFMin(m_Value(L), m_Value(R)).match(SI) ||
730730 m_UnordFMax(m_Value(L), m_Value(R)).match(SI)) {
731731 auto *CI = cast(SI->getCondition());
732 return ReductionData(RK_MinMax, CI->getOpcode(), L, R);
733 }
732 return ReductionData(RK_MinMax, CI->getOpcode(), L, R);
733 }
734734 if (m_UMin(m_Value(L), m_Value(R)).match(SI) ||
735735 m_UMax(m_Value(L), m_Value(R)).match(SI)) {
736736 auto *CI = cast(SI->getCondition());
850850
851851 // We look for a sequence of shuffle,shuffle,add triples like the following
852852 // that builds a pairwise reduction tree.
853 //
853 //
854854 // (X0, X1, X2, X3)
855855 // (X0 + X1, X2 + X3, undef, undef)
856856 // ((X0 + X1) + (X2 + X3), undef, undef, undef)
857 //
857 //
858858 // %rdx.shuf.0.0 = shufflevector <4 x float> %rdx, <4 x float> undef,
859859 // <4 x i32>
860860 // %rdx.shuf.0.1 = shufflevector <4 x float> %rdx, <4 x float> undef,
915915
916916 // We look for a sequence of shuffles and adds like the following matching one
917917 // fadd, shuffle vector pair at a time.
918 //
918 //
919919 // %rdx.shuf = shufflevector <4 x float> %rdx, <4 x float> undef,
920920 // <4 x i32>
921921 // %bin.rdx = fadd <4 x float> %rdx, %rdx.shuf
926926
927927 unsigned MaskStart = 1;
928928 Instruction *RdxOp = RdxStart;
929 SmallVector ShuffleMask(NumVecElems, 0);
929 SmallVector ShuffleMask(NumVecElems, 0);
930930 unsigned NumVecElemsRemain = NumVecElems;
931931 while (NumVecElemsRemain - 1) {
932932 // Check for the right reduction operation.
10921092 case Instruction::InsertElement: {
10931093 const InsertElementInst * IE = cast(I);
10941094 ConstantInt *CI = dyn_cast(IE->getOperand(2));
1095 unsigned Idx = -1;
1095 unsigned Idx = -1;
10961096 if (CI)
10971097 Idx = CI->getZExtValue();
10981098 return getVectorInstrCost(I->getOpcode(),
11031103 // TODO: Identify and add costs for insert/extract subvector, etc.
11041104 if (Shuffle->changesLength())
11051105 return -1;
1106
1106
11071107 if (Shuffle->isIdentity())
11081108 return 0;
11091109
7070 #include
7171 #include
7272 #include
73 #include
73 #include
7474
7575 using namespace llvm;
7676 using namespace llvm::PatternMatch;
38273827
38283828 // If either of the values is known to be non-negative, adding them can only
38293829 // overflow if the second is also non-negative, so we can assume that.
3830 // Two non-negative numbers will only overflow if there is a carry to the
3830 // Two non-negative numbers will only overflow if there is a carry to the
38313831 // sign bit, so we can check if even when the values are as big as possible
38323832 // there is no overflow to the sign bit.
38333833 if (LHSKnown.isNonNegative() || RHSKnown.isNonNegative()) {
38543854 }
38553855
38563856 // If we reached here it means that we know nothing about the sign bits.
3857 // In this case we can't know if there will be an overflow, since by
3857 // In this case we can't know if there will be an overflow, since by
38583858 // changing the sign bits any two values can be made to overflow.
38593859 return false;
38603860 }
39043904 // operands.
39053905 bool LHSOrRHSKnownNonNegative =
39063906 (LHSKnown.isNonNegative() || RHSKnown.isNonNegative());
3907 bool LHSOrRHSKnownNegative =
3907 bool LHSOrRHSKnownNegative =
39083908 (LHSKnown.isNegative() || RHSKnown.isNegative());
39093909 if (LHSOrRHSKnownNonNegative || LHSOrRHSKnownNegative) {
39103910 KnownBits AddKnown = computeKnownBits(Add, DL, /*Depth=*/0, AC, CxtI, DT);
44534453 SPR = matchMinMaxOfMinMax(Pred, CmpLHS, CmpRHS, TrueVal, FalseVal, Depth);
44544454 if (SPR.Flavor != SelectPatternFlavor::SPF_UNKNOWN)
44554455 return SPR;
4456
4456
44574457 if (Pred != CmpInst::ICMP_SGT && Pred != CmpInst::ICMP_SLT)
44584458 return {SPF_UNKNOWN, SPNB_NA, false};
44594459
46294629 case FCmpInst::FCMP_OLE: return {SPF_FMINNUM, NaNBehavior, Ordered};
46304630 }
46314631 }
4632
4632
46334633 if (isKnownNegation(TrueVal, FalseVal)) {
46344634 // Sign-extending LHS does not change its sign, so TrueVal/FalseVal can
46354635 // match against either LHS or sext(LHS).
841841 }
842842
843843 /// parseIndirectSymbol:
844 /// ::= GlobalVar '=' OptionalLinkage OptionalPreemptionSpecifier
844 /// ::= GlobalVar '=' OptionalLinkage OptionalPreemptionSpecifier
845845 /// OptionalVisibility OptionalDLLStorageClass
846846 /// OptionalThreadLocal OptionalUnnamedAddr
847847 // 'alias|ifunc' IndirectSymbol
39343934 Lex.Lex();
39353935 return false;
39363936 }
3937
3937
39383938 template <>
39393939 bool LLParser::ParseMDField(LocTy Loc, StringRef Name,
39403940 DwarfAttEncodingField &Result) {
38083808 continue;
38093809 // The mapping from OriginalId to GUID may return a GUID
38103810 // that corresponds to a static variable. Filter it out here.
3811 // This can happen when
3811 // This can happen when
38123812 // 1) There is a call to a library function which does not have
38133813 // a CallValidId;
38143814 // 2) There is a static variable with the OriginalGUID identical
4545 MachineBasicBlock::iterator End,
4646 unsigned InsertPosIndex,
4747 DbgValueVector &DbgValues) = 0;
48
48
4949 /// Update liveness information to account for the current
5050 /// instruction, which will not be scheduled.
5151 virtual void Observe(MachineInstr &MI, unsigned Count,
111111 uint64_t OffsetInBits = 0;
112112 unsigned DwarfVersion;
113113
114 /// Sometimes we need to add a DW_OP_bit_piece to describe a subregister.
114 /// Sometimes we need to add a DW_OP_bit_piece to describe a subregister.
115115 unsigned SubRegisterSizeInBits = 0;
116116 unsigned SubRegisterOffsetInBits = 0;
117117
9494 }
9595 } else {
9696 ScopeVars.Locals.push_back(Var);
97 }
97 }
9898 return true;
9999 }
11811181 addString(MDie, dwarf::DW_AT_LLVM_include_path, M->getIncludePath());
11821182 if (!M->getISysRoot().empty())
11831183 addString(MDie, dwarf::DW_AT_LLVM_isysroot, M->getISysRoot());
1184
1184
11851185 return &MDie;
11861186 }
11871187
16901690 }
16911691
16921692 void DwarfTypeUnit::emitHeader(bool UseOffsets) {
1693 DwarfUnit::emitCommonHeader(UseOffsets,
1693 DwarfUnit::emitCommonHeader(UseOffsets,
16941694 DD->useSplitDwarf() ? dwarf::DW_UT_split_type
16951695 : dwarf::DW_UT_type);
16961696 Asm->OutStreamer->AddComment("Type Signature");
361361
362362 /// Convert an atomic load of a non-integral type to an integer load of the
363363 /// equivalent bitwidth. See the function comment on
364 /// convertAtomicStoreToIntegerType for background.
364 /// convertAtomicStoreToIntegerType for background.
365365 LoadInst *AtomicExpand::convertAtomicLoadToIntegerType(LoadInst *LI) {
366366 auto *M = LI->getModule();
367367 Type *NewTy = getCorrespondingIntegerType(LI->getType(),
368368 M->getDataLayout());
369369
370370 IRBuilder<> Builder(LI);
371
371
372372 Value *Addr = LI->getPointerOperand();
373373 Type *PT = PointerType::get(NewTy,
374374 Addr->getType()->getPointerAddressSpace());
375375 Value *NewAddr = Builder.CreateBitCast(Addr, PT);
376
376
377377 auto *NewLI = Builder.CreateLoad(NewAddr);
378378 NewLI->setAlignment(LI->getAlignment());
379379 NewLI->setVolatile(LI->isVolatile());
451451 Type *NewTy = getCorrespondingIntegerType(SI->getValueOperand()->getType(),
452452 M->getDataLayout());
453453 Value *NewVal = Builder.CreateBitCast(SI->getValueOperand(), NewTy);
454
454
455455 Value *Addr = SI->getPointerOperand();
456456 Type *PT = PointerType::get(NewTy,
457457 Addr->getType()->getPointerAddressSpace());
919919 /// the equivalent bitwidth. We used to not support pointer cmpxchg in the
920920 /// IR. As a migration step, we convert back to what use to be the standard
921921 /// way to represent a pointer cmpxchg so that we can update backends one by
922 /// one.
922 /// one.
923923 AtomicCmpXchgInst *AtomicExpand::convertCmpXchgToIntegerType(AtomicCmpXchgInst *CI) {
924924 auto *M = CI->getModule();
925925 Type *NewTy = getCorrespondingIntegerType(CI->getCompareOperand()->getType(),
926926 M->getDataLayout());
927927
928928 IRBuilder<> Builder(CI);
929
929
930930 Value *Addr = CI->getPointerOperand();
931931 Type *PT = PointerType::get(NewTy,
932932 Addr->getType()->getPointerAddressSpace());
934934
935935 Value *NewCmp = Builder.CreatePtrToInt(CI->getCompareOperand(), NewTy);
936936 Value *NewNewVal = Builder.CreatePtrToInt(CI->getNewValOperand(), NewTy);
937
938
937
938
939939 auto *NewCI = Builder.CreateAtomicCmpXchg(NewAddr, NewCmp, NewNewVal,
940940 CI->getSuccessOrdering(),
941941 CI->getFailureOrdering(),
77 //===----------------------------------------------------------------------===//
88 //
99 // This file contains the boilerplate required to define our various built in
10 // gc lowering strategies.
10 // gc lowering strategies.
1111 //
1212 //===----------------------------------------------------------------------===//
1313
529529 // Kill instructions can define registers but are really nops, and there
530530 // might be a real definition earlier that needs to be paired with uses
531531 // dominated by this kill.
532
532
533533 // FIXME: It may be possible to remove the isKill() restriction once PR18663
534534 // has been properly fixed. There can be value in processing kills as seen
535535 // in the AggressiveAntiDepBreaker class.
158158 auto NMI = GCStrategyMap.find(Name);
159159 if (NMI != GCStrategyMap.end())
160160 return NMI->getValue();
161
161
162162 for (auto& Entry : GCRegistry::entries()) {
163163 if (Name == Entry.getName()) {
164164 std::unique_ptr S = Entry.instantiate();
170170 }
171171
172172 if (GCRegistry::begin() == GCRegistry::end()) {
173 // In normal operation, the registry should not be empty. There should
173 // In normal operation, the registry should not be empty. There should
174174 // be the builtin GCs if nothing else. The most likely scenario here is
175 // that we got here without running the initializers used by the Registry
175 // that we got here without running the initializers used by the Registry
176176 // itself and it's registration mechanism.
177 const std::string error = ("unsupported GC: " + Name).str() +
177 const std::string error = ("unsupported GC: " + Name).str() +
178178 " (did you remember to link and initialize the CodeGen library?)";
179179 report_fatal_error(error);
180180 } else
5555 // - it makes linker optimizations less useful (order files, LOHs, ...)
5656 // - it forces usage of indexed addressing (which isn't necessarily "free")
5757 // - it can increase register pressure when the uses are disparate enough.
58 //
58 //
5959 // We use heuristics to discover the best global grouping we can (cf cl::opts).
6060 //
6161 // ===---------------------------------------------------------------------===//
112112 case Intrinsic::memcpy:
113113 M.getOrInsertFunction("memcpy",
114114 Type::getInt8PtrTy(Context),
115 Type::getInt8PtrTy(Context),
116 Type::getInt8PtrTy(Context),
115 Type::getInt8PtrTy(Context),
116 Type::getInt8PtrTy(Context),
117117 DL.getIntPtrType(Context));
118118 break;
119119 case Intrinsic::memmove:
120120 M.getOrInsertFunction("memmove",
121121 Type::getInt8PtrTy(Context),
122 Type::getInt8PtrTy(Context),
123 Type::getInt8PtrTy(Context),
122 Type::getInt8PtrTy(Context),
123 Type::getInt8PtrTy(Context),
124124 DL.getIntPtrType(Context));
125125 break;
126126 case Intrinsic::memset:
127127 M.getOrInsertFunction("memset",
128128 Type::getInt8PtrTy(Context),
129 Type::getInt8PtrTy(Context),
130 Type::getInt32Ty(M.getContext()),
129 Type::getInt8PtrTy(Context),
130 Type::getInt32Ty(M.getContext()),
131131 DL.getIntPtrType(Context));
132132 break;
133133 case Intrinsic::sqrt:
209209 "bswap.5");
210210 Value* Tmp4 = Builder.CreateLShr(V, ConstantInt::get(V->getType(), 8),
211211 "bswap.4");
212 Value* Tmp3 = Builder.CreateLShr(V,
212 Value* Tmp3 = Builder.CreateLShr(V,
213213 ConstantInt::get(V->getType(), 24),
214214 "bswap.3");
215 Value* Tmp2 = Builder.CreateLShr(V,
215 Value* Tmp2 = Builder.CreateLShr(V,
216216 ConstantInt::get(V->getType(), 40),
217217 "bswap.2");
218 Value* Tmp1 = Builder.CreateLShr(V,
218 Value* Tmp1 = Builder.CreateLShr(V,
219219 ConstantInt::get(V->getType(), 56),
220220 "bswap.1");
221221 Tmp7 = Builder.CreateAnd(Tmp7,
273273
274274 for (unsigned n = 0; n < WordSize; ++n) {
275275 Value *PartValue = V;
276 for (unsigned i = 1, ct = 0; i < (BitSize>64 ? 64 : BitSize);
276 for (unsigned i = 1, ct = 0; i < (BitSize>64 ? 64 : BitSize);
277277 i <<= 1, ++ct) {
278278 Value *MaskCst = ConstantInt::get(V->getType(), MaskValues[ct]);
279279 Value *LHS = Builder.CreateAnd(PartValue, MaskCst, "cppop.and1");
380380
381381 case Intrinsic::siglongjmp: {
382382 // Insert the call to abort
383 ReplaceCallWith("abort", CI, CS.arg_end(), CS.arg_end(),
383 ReplaceCallWith("abort", CI, CS.arg_end(), CS.arg_end(),
384384 Type::getVoidTy(Context));
385385 break;
386386 }
391391 case Intrinsic::bswap:
392392 CI->replaceAllUsesWith(LowerBSWAP(Context, CI->getArgOperand(0), CI));
393393 break;
394
394
395395 case Intrinsic::ctlz:
396396 CI->replaceAllUsesWith(LowerCTLZ(Context, CI->getArgOperand(0), CI));
397397 break;
419419 CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
420420 break;
421421 }
422
422
423423 case Intrinsic::get_dynamic_area_offset:
424424 errs() << "WARNING: this target does not support the custom llvm.get."
425425 "dynamic.area.offset. It is being lowered to a constant 0\n";
472472 case Intrinsic::assume:
473473 case Intrinsic::var_annotation:
474474 break; // Strip out these intrinsics
475
475
476476 case Intrinsic::memcpy: {
477477 Type *IntPtr = DL.getIntPtrType(Context);
478478 Value *Size = Builder.CreateIntCast(CI->getArgOperand(2), IntPtr,
339339 /// address the spill location in a target independent way.
340340 int LiveDebugValues::extractSpillBaseRegAndOffset(const MachineInstr &MI,
341341 unsigned &Reg) {
342 assert(MI.hasOneMemOperand() &&
342 assert(MI.hasOneMemOperand() &&
343343 "Spill instruction does not have exactly one memory operand?");
344344 auto MMOI = MI.memoperands_begin();
345345 const PseudoSourceValue *PVal = (*MMOI)->getPseudoValue();
471471 int FI;
472472 const MachineMemOperand *MMO;
473473
474 // TODO: Handle multiple stores folded into one.
474 // TODO: Handle multiple stores folded into one.
475475 if (!MI.hasOneMemOperand())
476476 return false;
477477
313313 MMI.deleteMachineFunctionFor(F);
314314 return true;
315315 }
316
316
317317 StringRef getPassName() const override {
318318 return "Free MachineFunction";
319 }
319 }
320320 };
321321
322322 } // end anonymous namespace
944944 // AA (where each "A" is an instruction).
945945 //
946946 // We might have some portion of the module that looks like this:
947 // AAAAAA (6 A's)
947 // AAAAAA (6 A's)
948948 //
949949 // In this case, there are 5 different copies of "AA" in this range, but
950950 // at most 3 can be outlined. If only outlining 3 of these is going to
382382 assert(FromReg != ToReg && "Cannot replace a reg with itself");
383383
384384 const TargetRegisterInfo *TRI = getTargetRegisterInfo();
385
385
386386 // TODO: This could be more efficient by bulk changing the operands.
387387 for (reg_iterator I = reg_begin(FromReg), E = reg_end(); I != E; ) {
388388 MachineOperand &O = *I;
253253 private:
254254 MachineInstr *PHI;
255255 unsigned idx;
256
256
257257 public:
258258 explicit PHI_iterator(MachineInstr *P) // begin iterator
259259 : PHI(P), idx(1) {}
260260 PHI_iterator(MachineInstr *P, bool) // end iterator
261261 : PHI(P), idx(PHI->getNumOperands()) {}
262262
263 PHI_iterator &operator++() { idx += 2; return *this; }
263 PHI_iterator &operator++() { idx += 2; return *this; }
264264 bool operator==(const PHI_iterator& x) const { return idx == x.idx; }
265265 bool operator!=(const PHI_iterator& x) const { return !operator==(x); }
266266
508508 }
509509
510510 ToSplit.insert(std::make_pair(FromBB, ToBB));
511
511
512512 return true;
513513 }
514514
654654 // Debug values should not be included in any calculations.
655655 if (UseMI.isDebugInstr())
656656 return false;
657
657
658658 bool HasPhysRegs = false;
659659 for (MachineInstr::const_mop_iterator I = UseMI.operands_begin(),
660660 E = UseMI.operands_end(); I != E; ++I) {
11661166 computeInstrDepths(MBB);
11671167 if (!TBI.HasValidInstrHeights)
11681168 computeInstrHeights(MBB);
1169
1169
11701170 return Trace(*this, TBI);
11711171 }
11721172
10761076
10771077 auto VerifyStackMapConstant = [&](unsigned Offset) {
10781078 if (!MI->getOperand(Offset).isImm() ||
1079 MI->getOperand(Offset).getImm() != StackMaps::ConstantOp ||
1080 !MI->getOperand(Offset + 1).isImm())
1079 MI->getOperand(Offset).getImm() != StackMaps::ConstantOp ||
1080 !MI->getOperand(Offset + 1).isImm())
10811081 report("stack map constant to STATEPOINT not well formed!", MI);
10821082 };
10831083 const unsigned VarStart = StatepointOpers(MI).getVarIdx();
42024202 // Allow one node which will masked along with any loads found.
42034203 if (NodeToMask)
42044204 return false;
4205
4206 // Also ensure that the node to be masked only produces one data result.
4205
4206 // Also ensure that the node to be masked only produces one data result.
42074207 NodeToMask = Op.getNode();
42084208 if (NodeToMask->getNumValues() > 1) {
42094209 bool HasValue = false;
54785478 return nullptr;
54795479
54805480 // At this point we've matched or extracted a shift op on each side.
5481
5481
54825482 if (LHSShift.getOperand(0) != RHSShift.getOperand(0))
54835483 return nullptr; // Not shifting the same value.
54845484
1039110391 N10.getOperand(0))),
1039210392 DAG.getNode(ISD::FP_EXTEND, SL, VT,
1039310393 N10.getOperand(1)),
10394 N0, Flags);
10394 N0, Flags);
1039510395 }
1039610396 }
1039710397
1045410454 N0.getOperand(2).getOperand(0),
1045510455 N0.getOperand(2).getOperand(1),
1045610456 DAG.getNode(ISD::FNEG, SL, VT,
10457 N1), Flags), Flags);
10457 N1), Flags), Flags);
1045810458 }
1045910459
1046010460 // fold (fsub x, (fma y, z, (fmul u, v)))
1046910469 N1.getOperand(1),
1047010470 DAG.getNode(PreferredFusedOpcode, SL, VT,
1047110471 DAG.getNode(ISD::FNEG, SL, VT, N20),
10472 N21, N0, Flags), Flags);
10472 N21, N0, Flags), Flags);
1047310473 }
1047410474
1047510475
1048910489 DAG.getNode(ISD::FP_EXTEND, SL, VT,
1049010490 N020.getOperand(1)),
1049110491 DAG.getNode(ISD::FNEG, SL, VT,
10492 N1), Flags), Flags);
10492 N1), Flags), Flags);
1049310493 }
1049410494 }
1049510495 }
1051710517 DAG.getNode(ISD::FP_EXTEND, SL, VT,
1051810518 N002.getOperand(1)),
1051910519 DAG.getNode(ISD::FNEG, SL, VT,
10520 N1), Flags), Flags);
10520 N1), Flags), Flags);
1052110521 }
1052210522 }
1052310523 }
1054010540 VT, N1200)),
1054110541 DAG.getNode(ISD::FP_EXTEND, SL, VT,
1054210542 N1201),
10543 N0, Flags), Flags);
10543 N0, Flags), Flags);
1054410544 }
1054510545 }
1054610546
1057110571 VT, N1020)),
1057210572 DAG.getNode(ISD::FP_EXTEND, SL, VT,
1057310573 N1021),
10574 N0, Flags), Flags);
10574 N0, Flags), Flags);
1057510575 }
1057610576 }
1057710577 }
1062710627 Y, Flags);
1062810628 if (XC1 && XC1->isExactlyValue(-1.0))
1062910629 return DAG.getNode(PreferredFusedOpcode, SL, VT, X.getOperand(0), Y,
10630 DAG.getNode(ISD::FNEG, SL, VT, Y), Flags);
10630 DAG.getNode(ISD::FNEG, SL, VT, Y), Flags);
1063110631 }
1063210632 return SDValue();
1063310633 };
1065110651 if (XC0 && XC0->isExactlyValue(-1.0))
1065210652 return DAG.getNode(PreferredFusedOpcode, SL, VT,
1065310653 DAG.getNode(ISD::FNEG, SL, VT, X.getOperand(1)), Y,
10654 DAG.getNode(ISD::FNEG, SL, VT, Y), Flags);
10654 DAG.getNode(ISD::FNEG, SL, VT, Y), Flags);
1065510655
1065610656 auto XC1 = isConstOrConstSplatFP(X.getOperand(1));
1065710657 if (XC1 && XC1->isExactlyValue(+1.0))
1095610956 if (SDValue NewSel = foldBinOpIntoSelect(N))
1095710957 return NewSel;
1095810958
10959 if (Options.UnsafeFPMath ||
10959 if (Options.UnsafeFPMath ||
1096010960 (Flags.hasNoNaNs() && Flags.hasNoSignedZeros())) {
1096110961 // fold (fmul A, 0) -> 0
1096210962 if (N1CFP && N1CFP->isZero())
1096310963 return N1;
10964 }
10964 }
1096510965
1096610966 if (Options.UnsafeFPMath || Flags.hasAllowReassociation()) {
1096710967 // fmul (fmul X, C1), C2 -> fmul X, C1 * C2
1136911369
1137011370 SDValue DAGCombiner::visitFSQRT(SDNode *N) {
1137111371 SDNodeFlags Flags = N->getFlags();
11372 if (!DAG.getTarget().Options.UnsafeFPMath &&
11372 if (!DAG.getTarget().Options.UnsafeFPMath &&
1137311373 !Flags.hasApproximateFuncs())
1137411374 return SDValue();
1137511375
15471547 {
15481548 MachineInstr *CurLastLocalValue = getLastLocalValue();
15491549 if (CurLastLocalValue != SavedLastLocalValue) {
1550 // Find the first local value instruction to be deleted.
1550 // Find the first local value instruction to be deleted.
15511551 // This is the instruction after SavedLastLocalValue if it is non-NULL.
15521552 // Otherwise it's the first instruction in the block.
15531553 MachineBasicBlock::iterator FirstDeadInst(SavedLastLocalValue);
15681568 if (!handlePHINodesInSuccessorBlocks(I->getParent())) {
15691569 // PHI node handling may have generated local value instructions,
15701570 // even though it failed to handle all PHI nodes.
1571 // We remove these instructions because SelectionDAGISel will generate
1571 // We remove these instructions because SelectionDAGISel will generate
15721572 // them again.
15731573 removeDeadLocalValueCode(SavedLastLocalValue);
15741574 return false;
16291629 DbgLoc = DebugLoc();
16301630 // Undo phi node updates, because they will be added again by SelectionDAG.
16311631 if (isa(I)) {
1632 // PHI node handling may have generated local value instructions.
1632 // PHI node handling may have generated local value instructions.
16331633 // We remove them because SelectionDAGISel will generate them again.
16341634 removeDeadLocalValueCode(SavedLastLocalValue);
16351635 FuncInfo.PHINodesToUpdate.resize(FuncInfo.OrigNumPHINodesToUpdate);
152152 // of Endianness. LLVM's APFloat representation is not Endian sensitive,
153153 // and so always converts into a 128-bit APInt in a non-Endian-sensitive
154154 // way. However, APInt's are serialized in an Endian-sensitive fashion,
155 // so on big-Endian targets, the two doubles are output in the wrong
155 // so on big-Endian targets, the two doubles are output in the wrong
156156 // order. Fix this by manually flipping the order of the high 64 bits
157157 // and the low 64 bits here.
158158 if (DAG.getDataLayout().isBigEndian() &&
814814
815815 switch (N->getOpcode()) {
816816 case ISD::ConstantFP: // Leaf node.
817 case ISD::CopyFromReg: // Operand is a register that we know to be left
817 case ISD::CopyFromReg: // Operand is a register that we know to be left
818818 // unchanged by SoftenFloatResult().
819819 case ISD::Register: // Leaf node.
820820 return true;
837837 if (N->getNumOperands() == 3)
838838 return SDValue(DAG.UpdateNodeOperands(N, N->getOperand(0), Op1, Op2), 0);
839839
840 return SDValue(DAG.UpdateNodeOperands(N, N->getOperand(0), Op1, Op2,
840 return SDValue(DAG.UpdateNodeOperands(N, N->getOperand(0), Op1, Op2,
841841 N->getOperand(3)),
842842 0);
843843 }
509509 SDValue SoftenFloatRes_XINT_TO_FP(SDNode *N);
510510
511511 // Return true if we can skip softening the given operand or SDNode because
512 // either it was soften before by SoftenFloatResult and references to the
512 // either it was soften before by SoftenFloatResult and references to the
513513 // operand were replaced by ReplaceValueWith or it's value type is legal in HW
514514 // registers and the operand can be left unchanged.
515515 bool CanSkipSoftenFloatOperand(SDNode *N, unsigned OpNo);
130130 SDValue ExpandCTLZ(SDValue Op);
131131 SDValue ExpandCTTZ_ZERO_UNDEF(SDValue Op);
132132 SDValue ExpandStrictFPOp(SDValue Op);
133
133
134134 /// Implements vector promotion.
135135 ///
136136 /// This is essentially just bitcasting the operands to a different type and
314314 // equivalent. For instance, if ISD::FSQRT is legal then ISD::STRICT_FSQRT
315315 // is also legal, but if ISD::FSQRT requires expansion then so does
316316 // ISD::STRICT_FSQRT.
317 Action = TLI.getStrictFPOperationAction(Node->getOpcode(),
317 Action = TLI.getStrictFPOperationAction(Node->getOpcode(),
318318 Node->getValueType(0));
319319 break;
320320 case ISD::ADD:
396396 Action = TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0));
397397 break;
398398 case ISD::FP_ROUND_INREG:
399 Action = TLI.getOperationAction(Node->getOpcode(),
399 Action = TLI.getOperationAction(Node->getOpcode(),
400400 cast(Node->getOperand(1))->getVT());
401401 break;
402402 case ISD::SINT_TO_FP:
403403 case ISD::UINT_TO_FP:
404 Action = TLI.getOperationAction(Node->getOpcode(),
404 Action = TLI.getOperationAction(Node->getOpcode(),
405405 Node->getOperand(0).getValueType());
406406 break;
407407 case ISD::MSCATTER:
735735 case ISD::CTTZ_ZERO_UNDEF:
736736 return ExpandCTTZ_ZERO_UNDEF(Op);
737737 case ISD::STRICT_FADD:
738 case ISD::STRICT_FSUB:
738 case ISD::STRICT_FSUB:
739739 case ISD::STRICT_FMUL:
740740 case ISD::STRICT_FDIV:
741741 case ISD::STRICT_FSQRT:
11521152 SmallVector OpChains;
11531153 for (unsigned i = 0; i < NumElems; ++i) {
11541154 SmallVector Opers;
1155 SDValue Idx = DAG.getConstant(i, dl,
1155 SDValue Idx = DAG.getConstant(i, dl,
11561156 TLI.getVectorIdxTy(DAG.getDataLayout()));
11571157
11581158 // The Chain is the first operand.
11591159 Opers.push_back(Chain);
11601160
1161 // Now process the remaining operands.
1161 // Now process the remaining operands.
11621162 for (unsigned j = 1; j < NumOpers; ++j) {
11631163 SDValue Oper = Op.getOperand(j);
11641164 EVT OperVT = Oper.getValueType();
11651165
11661166 if (OperVT.isVector())
1167 Oper = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl,
1167 Oper = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl,
11681168 EltVT, Oper, Idx);
11691169
11701170 Opers.push_back(Oper);
11711171 }
1172
1172
11731173 SDValue ScalarOp = DAG.getNode(Op->getOpcode(), dl, ValueVTs, Opers);
11741174
11751175 OpValues.push_back(ScalarOp.getValue(0));
10671067 OpsLo.push_back(Chain);
10681068 OpsHi.push_back(Chain);
10691069
1070 // Now process the remaining operands.
1070 // Now process the remaining operands.
10711071 for (unsigned i = 1; i < NumOps; ++i) {
1072 SDValue Op = N->getOperand(i);
1073 SDValue OpLo = Op;
1074 SDValue OpHi = Op;
1072 SDValue Op = N->getOperand(i);
1073 SDValue OpLo = Op;
1074 SDValue OpHi = Op;
10751075
10761076 EVT InVT = Op.getValueType();
1077 if (InVT.isVector()) {
1077 if (InVT.isVector()) {
10781078 // If the input also splits, handle it directly for a
10791079 // compile time speedup. Otherwise split it by hand.
10801080 if (getTypeAction(InVT) == TargetLowering::TypeSplitVector)
10911091 EVT HiValueVTs[] = {HiVT, MVT::Other};
10921092 Lo = DAG.getNode(N->getOpcode(), dl, LoValueVTs, OpsLo);
10931093 Hi = DAG.getNode(N->getOpcode(), dl, HiValueVTs, OpsHi);
1094
1094
10951095 // Build a factor node to remember that this Op is independent of the
10961096 // other one.
1097 Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
1097 Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
10981098 Lo.getValue(1), Hi.getValue(1));
10991099
11001100 // Legalize the chain result - switch anything that used the old chain to
49864986 unsigned DbgSDNodeOrder) {
49874987 if (auto *FISDN = dyn_cast(N.getNode())) {
49884988 // Construct a FrameIndexDbgValue for FrameIndexSDNodes so we can describe
4989 // stack slot locations.
4989 // stack slot locations.
49904990 //
49914991 // Consider "int x = 0; int *px = &x;". There are two kinds of interesting
49924992 // debug values here after optimization:
418418 Builder.getFrameIndexTy()));
419419 } else if (LiveInOnly) {
420420 // If this value is live in (not live-on-return, or live-through), we can
421 // treat it the same way patchpoint treats it's "live in" values. We'll
422 // end up folding some of these into stack references, but they'll be
421 // treat it the same way patchpoint treats it's "live in" values. We'll
422 // end up folding some of these into stack references, but they'll be
423423 // handled by the register allocator. Note that we do not have the notion
424 // of a late use so these values might be placed in registers which are
424 // of a late use so these values might be placed in registers which are
425425 // clobbered by the call. This is fine for live-in.
426426 Ops.push_back(Incoming);
427427 } else {
497497 auto isGCValue =[&](const Value *V) {
498498 return is_contained(SI.Ptrs, V) || is_contained(SI.Bases, V);
499499 };
500
500
501501 // Before we actually start lowering (and allocating spill slots for values),
502502 // reserve any stack slots which we judge to be profitable to reuse for a
503503 // particular value. This is purely an optimization over the code below and
174174 }
175175 if (!Active)
176176 return false;
177
177
178178 // struct FrameMap {
179179 // int32_t NumRoots; // Number of roots in stack frame.
180180 // int32_t NumMeta; // Number of metadata descriptors. May be < NumRoots.
285285 if (!F.hasGC() ||
286286 F.getGC() != std::string("shadow-stack"))
287287 return false;
288
288
289289 LLVMContext &Context = F.getContext();
290290
291291 // Find calls to llvm.gcroot.
232232 /// - Create a SplitEditor from a SplitAnalysis.
233233 /// - Start a new live interval with openIntv.
234234 /// - Mark the places where the new interval is entered using enterIntv*
235 /// - Mark the ranges where the new interval is used with useIntv*
235 /// - Mark the ranges where the new interval is used with useIntv*
236236 /// - Mark the places where the interval is exited with exitIntv*.
237237 /// - Finish the current interval with closeIntv and repeat from 2.
238238 /// - Rewrite instructions with finish().
631631 setOperationAction(ISD::CTTZ_ZERO_UNDEF, VT, Expand);
632632
633633 setOperationAction(ISD::BITREVERSE, VT, Expand);
634
634
635635 // These library functions default to expand.
636636 setOperationAction(ISD::FROUND, VT, Expand);
637637 setOperationAction(ISD::FPOWI, VT, Expand);
923923 // STATEPOINT Deopt Spill - live-through, read only, indirect
924924 // STATEPOINT Deopt Alloca - live-through, read only, direct
925925 // (We're currently conservative and mark the deopt slots read/write in
926 // practice.)
926 // practice.)
927927 // STATEPOINT GC Spill - live-through, read/write, indirect
928928 // STATEPOINT GC Alloca - live-through, read/write, direct
929929 // The live-in vs live-through is handled already (the live through ones are
14101410 *Fast = true;
14111411 return true;
14121412 }
1413
1413
14141414 // This is a misaligned access.
14151415 return allowsMisalignedMemoryAccesses(VT, AddrSpace, Alignment, Fast);
14161416 }
165165 "Enable unification-based CFL-AA"),
166166 clEnumValN(CFLAAType::Andersen, "anders",
167167 "Enable inclusion-based CFL-AA"),
168 clEnumValN(CFLAAType::Both, "both",
168 clEnumValN(CFLAAType::Both, "both",
169169 "Enable both variants of CFL-AA")));
170170
171171 /// Option names for limiting the codegen pipeline.
5353 cl::desc("Demote catchswitch BBs only (for wasm EH)"), cl::init(false));
5454
5555 namespace {
56
56
5757 class WinEHPrepare : public FunctionPass {
5858 public:
5959 static char ID; // Pass identification, replacement for typeid.
3737 }
3838
3939 bool
40 DWARFAbbreviationDeclaration::extract(DataExtractor Data,
40 DWARFAbbreviationDeclaration::extract(DataExtractor Data,
4141 uint32_t* OffsetPtr) {
4242 clear();
4343 const uint32_t Offset = *OffsetPtr;
473473 while (rangesData.isValidOffset(offset)) {
474474 if (Error E = rangeList.extract(rangesData, &offset)) {
475475 WithColor::error() << toString(std::move(E)) << '\n';
476 break;
476 break;
477477 }
478478 rangeList.dump(OS);
479479 }
154154 // of the function's code, not the descriptor.
155155 uint64_t OpdOffset = SymbolAddress - OpdAddress;
156156 uint32_t OpdOffset32 = OpdOffset;
157 if (OpdOffset == OpdOffset32 &&
157 if (OpdOffset == OpdOffset32 &&
158158 OpdExtractor->isValidOffsetForAddress(OpdOffset32))
159159 SymbolAddress = OpdExtractor->getAddress(&OpdOffset32);
160160 }
152152 LLVMMCJITCompilerOptions options;
153153 memset(&options, 0, sizeof(options)); // Most fields are zero by default.
154154 options.CodeModel = LLVMCodeModelJITDefault;
155
155
156156 memcpy(PassedOptions, &options,
157157 std::min(sizeof(options), SizeOfPassedOptions));
158158 }
170170 "LLVM library mismatch.");
171171 return 1;
172172 }
173
173
174174 // Defend against the user having an old version of the API by ensuring that
175175 // any fields they didn't see are cleared. We must defend against fields being
176176 // set to the bitwise equivalent of zero, and assume that this means "do the
177177 // default" as if that option hadn't been available.
178178 LLVMInitializeMCJITCompilerOptions(&options, sizeof(options));
179179 memcpy(&options, PassedOptions, SizeOfPassedOptions);
180
180
181181 TargetOptions targetOptions;
182182 targetOptions.EnableFastISel = options.EnableFastISel;
183183 std::unique_ptr Mod(unwrap(M));
240240 unsigned NumArgs,
241241 LLVMGenericValueRef *Args) {
242242 unwrap(EE)->finalizeObject();
243
243
244244 std::vector ArgVec;
245245 ArgVec.reserve(NumArgs);
246246 for (unsigned I = 0; I != NumArgs; ++I)
247247 ArgVec.push_back(*unwrap(Args[I]));
248
248
249249 GenericValue *Result = new GenericValue();
250250 *Result = unwrap(EE)->runFunction(unwrap(F), ArgVec);
251251 return wrap(Result);
296296
297297 void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global) {
298298 unwrap(EE)->finalizeObject();
299
299
300300 return unwrap(EE)->getPointerToGlobal(unwrap(Global));
301301 }
302302
394394 LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection,
395395 LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory,
396396 LLVMMemoryManagerDestroyCallback Destroy) {
397
397
398398 if (!AllocateCodeSection || !AllocateDataSection || !FinalizeMemory ||
399399 !Destroy)
400400 return nullptr;
401
401
402402 SimpleBindingMMFunctions functions;
403403 functions.AllocateCodeSection = AllocateCodeSection;
404404 functions.AllocateDataSection = AllocateDataSection;
66 *
77 *===----------------------------------------------------------------------===*
88 *
9 * This file provides Intel(R) Performance Analyzer JIT (Just-In-Time)
9 * This file provides Intel(R) Performance Analyzer JIT (Just-In-Time)
1010 * Profiling API internal config.
1111 *
1212 * NOTE: This file comes in a style different from the rest of LLVM
212212 #define __itt_thread_id() GetCurrentThreadId()
213213 #define __itt_thread_yield() SwitchToThread()
214214 #ifndef ITT_SIMPLE_INIT
215 ITT_INLINE long
215 ITT_INLINE long
216216 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
217217 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
218218 {
272272 }
273273 #endif /* ITT_ARCH==ITT_ARCH_IA64 */
274274 #ifndef ITT_SIMPLE_INIT
275 ITT_INLINE long
275 ITT_INLINE long
276276 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
277277 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
278278 {
66 *
77 *===----------------------------------------------------------------------===*
88 *
9 * This file provides Intel(R) Performance Analyzer JIT (Just-In-Time)
9 * This file provides Intel(R) Performance Analyzer JIT (Just-In-Time)
1010 * Profiling API declaration.
1111 *
1212 * NOTE: This file comes in a style different from the rest of LLVM
2727 {
2828
2929 /* shutdown */
30
31 /*
30
31 /*
3232 * Program exiting EventSpecificData NA
3333 */
34 iJVM_EVENT_TYPE_SHUTDOWN = 2,
34 iJVM_EVENT_TYPE_SHUTDOWN = 2,
3535
3636 /* JIT profiling */
37
38 /*
37
38 /*
3939 * issued after method code jitted into memory but before code is executed
4040 * EventSpecificData is an iJIT_Method_Load
4141 */
42 iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED=13,
43
44 /* issued before unload. Method code will no longer be executed, but code
45 * and info are still in memory. The VTune profiler may capture method
42 iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED=13,
43
44 /* issued before unload. Method code will no longer be executed, but code
45 * and info are still in memory. The VTune profiler may capture method
4646 * code only at this point EventSpecificData is iJIT_Method_Id
4747 */
48 iJVM_EVENT_TYPE_METHOD_UNLOAD_START,
48 iJVM_EVENT_TYPE_METHOD_UNLOAD_START,
4949
5050 /* Method Profiling */
5151
52 /* method name, Id and stack is supplied
53 * issued when a method is about to be entered EventSpecificData is
52 /* method name, Id and stack is supplied
53 * issued when a method is about to be entered EventSpecificData is
5454 * iJIT_Method_NIDS
5555 */
56 iJVM_EVENT_TYPE_ENTER_NIDS = 19,
57
58 /* method name, Id and stack is supplied
59 * issued when a method is about to be left EventSpecificData is
56 iJVM_EVENT_TYPE_ENTER_NIDS = 19,
57
58 /* method name, Id and stack is supplied
59 * issued when a method is about to be left EventSpecificData is
6060 * iJIT_Method_NIDS
6161 */
62 iJVM_EVENT_TYPE_LEAVE_NIDS
62 iJVM_EVENT_TYPE_LEAVE_NIDS
6363 } iJIT_JVM_EVENT;
6464
6565 typedef enum _iJIT_ModeFlags
6666 {
6767 /* No need to Notify VTune, since VTune is not running */
68 iJIT_NO_NOTIFICATIONS = 0x0000,
69
70 /* when turned on the jit must call
68 iJIT_NO_NOTIFICATIONS = 0x0000,
69
70 /* when turned on the jit must call
7171 * iJIT_NotifyEvent
7272 * (
7373 * iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED,
7474 * )
7575 * for all the method already jitted
7676 */
77 iJIT_BE_NOTIFY_ON_LOAD = 0x0001,
77 iJIT_BE_NOTIFY_ON_LOAD = 0x0001,
7878
7979 /* when turned on the jit must call
8080 * iJIT_NotifyEvent
8282 * iJVM_EVENT_TYPE_METHOD_UNLOAD_FINISHED,
8383 * ) for all the method that are unloaded
8484 */
85 iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002,
85 iJIT_BE_NOTIFY_ON_UNLOAD = 0x0002,
8686
8787 /* when turned on the jit must instrument all
8888 * the currently jited code with calls on
8989 * method entries
9090 */
91 iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004,
91 iJIT_BE_NOTIFY_ON_METHOD_ENTRY = 0x0004,
9292
9393 /* when turned on the jit must instrument all
9494 * the currently jited code with calls
9595 * on method exit
9696 */
97 iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008
97 iJIT_BE_NOTIFY_ON_METHOD_EXIT = 0x0008
9898
9999 } iJIT_ModeFlags;
100100
103103 typedef enum _iJIT_IsProfilingActiveFlags
104104 {
105105 /* No profiler is running. Currently not used */
106 iJIT_NOTHING_RUNNING = 0x0000,
106 iJIT_NOTHING_RUNNING = 0x0000,
107107
108108 /* Sampling is running. This is the default value
109109 * returned by iJIT_IsProfilingActive()
110110 */
111 iJIT_SAMPLING_ON = 0x0001,
112
111 iJIT_SAMPLING_ON = 0x0001,
112
113113 /* Call Graph is running */
114114 iJIT_CALLGRAPH_ON = 0x0002
115115
134134 /* Id of the method (same as the one passed in
135135 * the iJIT_Method_Load struct
136136 */
137 unsigned int method_id;
137 unsigned int method_id;
138138
139139 } *piJIT_Method_Id, iJIT_Method_Id;
140140
148148 typedef struct _iJIT_Method_NIDS
149149 {
150150 /* unique method ID */
151 unsigned int method_id;
151 unsigned int method_id;
152152
153153 /* NOTE: no need to fill this field, it's filled by VTune */
154 unsigned int stack_id;
154 unsigned int stack_id;
155155
156156 /* method name (just the method, without the class) */
157 char* method_name;
157 char* method_name;
158158 } *piJIT_Method_NIDS, iJIT_Method_NIDS;
159159
160160 /* structures for the events:
167167 unsigned int Offset;
168168
169169 /* source line number from the beginning of the source file */
170 unsigned int LineNumber;
170 unsigned int LineNumber;
171171
172172 } *pLineNumberInfo, LineNumberInfo;
173173
174174 typedef struct _iJIT_Method_Load
175175 {
176176 /* unique method ID - can be any unique value, (except 0 - 999) */
177 unsigned int method_id;
177 unsigned int method_id;
178178
179179 /* method name (can be with or without the class and signature, in any case
180180 * the class name will be added to it)
181181 */
182 char* method_name;
182 char* method_name;
183183
184184 /* virtual address of that method - This determines the method range for the
185185 * iJVM_EVENT_TYPE_ENTER/LEAVE_METHOD_ADDR events
186186 */
187 void* method_load_address;
187 void* method_load_address;
188188
189189 /* Size in memory - Must be exact */
190 unsigned int method_size;
190 unsigned int method_size;
191191
192192 /* Line Table size in number of entries - Zero if none */
193193 unsigned int line_number_size;
194194
195195 /* Pointer to the beginning of the line numbers info array */
196 pLineNumberInfo line_number_table;
196 pLineNumberInfo line_number_table;
197197
198198 /* unique class ID */
199 unsigned int class_id;
200
199 unsigned int class_id;
200
201201 /* class file name */
202 char* class_file_name;
202 char* class_file_name;
203203
204204 /* source file name */
205 char* source_file_name;
205 char* source_file_name;
206206
207207 /* bits supplied by the user for saving in the JIT file */
208 void* user_data;
208 void* user_data;
209209
210210 /* the size of the user data buffer */
211 unsigned int user_data_size;
211 unsigned int user_data_size;
212212
213213 /* NOTE: no need to fill this field, it's filled by VTune */
214 iJDEnvironmentType env;
214 iJDEnvironmentType env;
215215
216216 } *piJIT_Method_Load, iJIT_Method_Load;
217217
240240 int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData);
241241
242242 /* The new mode call back routine */
243 void JITAPI iJIT_RegisterCallbackEx(void *userdata,
243 void JITAPI iJIT_RegisterCallbackEx(void *userdata,
244244 iJIT_ModeChangedEx NewModeCallBackFuncEx);
245245
246246 iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void);
8484 }
8585 }
8686
87 static void executeFDivInst(GenericValue &Dest, GenericValue Src1,
87 static void executeFDivInst(GenericValue &Dest, GenericValue Src1,
8888 GenericValue Src2, Type *Ty) {
8989 switch (Ty->getTypeID()) {
9090 IMPLEMENT_BINARY_OPERATOR(/, Float);
9595 }
9696 }
9797
98 static void executeFRemInst(GenericValue &Dest, GenericValue Src1,
98 static void executeFRemInst(GenericValue &Dest, GenericValue Src1,
9999 GenericValue Src2, Type *Ty) {
100100 switch (Ty->getTypeID()) {
101101 case Type::FloatTyID:
280280 GenericValue Src1 = getOperandValue(I.getOperand(0), SF);
281281 GenericValue Src2 = getOperandValue(I.getOperand(1), SF);
282282 GenericValue R; // Result
283
283
284284 switch (I.getPredicate()) {
285285 case ICmpInst::ICMP_EQ: R = executeICMP_EQ(Src1, Src2, Ty); break;
286286 case ICmpInst::ICMP_NE: R = executeICMP_NE(Src1, Src2, Ty); break;
296296 dbgs() << "Don't know how to handle this ICmp predicate!\n-->" << I;
297297 llvm_unreachable(nullptr);
298298 }
299
299
300300 SetValue(&I, R, SF);
301301 }
302302
551551 Src2.AggregateVal[_i].DoubleVal)));
552552 }
553553 } else if (Ty->isFloatTy())
554 Dest.IntVal = APInt(1,(Src1.FloatVal == Src1.FloatVal &&
554 Dest.IntVal = APInt(1,(Src1.FloatVal == Src1.FloatVal &&
555555 Src2.FloatVal == Src2.FloatVal));
556556 else {
557 Dest.IntVal = APInt(1,(Src1.DoubleVal == Src1.DoubleVal &&
557 Dest.IntVal = APInt(1,(Src1.DoubleVal == Src1.DoubleVal &&
558558 Src2.DoubleVal == Src2.DoubleVal));
559559 }
560560 return Dest;
582582 Src2.AggregateVal[_i].DoubleVal)));
583583 }
584584 } else if (Ty->isFloatTy())
585 Dest.IntVal = APInt(1,(Src1.FloatVal != Src1.FloatVal ||
585 Dest.IntVal = APInt(1,(Src1.FloatVal != Src1.FloatVal ||
586586 Src2.FloatVal != Src2.FloatVal));
587587 else {
588 Dest.IntVal = APInt(1,(Src1.DoubleVal != Src1.DoubleVal ||
588 Dest.IntVal = APInt(1,(Src1.DoubleVal != Src1.DoubleVal ||
589589 Src2.DoubleVal != Src2.DoubleVal));
590590 }
591591 return Dest;
612612 GenericValue Src1 = getOperandValue(I.getOperand(0), SF);
613613 GenericValue Src2 = getOperandValue(I.getOperand(1), SF);
614614 GenericValue R; // Result
615
615
616616 switch (I.getPredicate()) {
617617 default:
618618 dbgs() << "Don't know how to handle this FCmp predicate!\n-->" << I;
619619 llvm_unreachable(nullptr);
620620 break;
621 case FCmpInst::FCMP_FALSE: R = executeFCMP_BOOL(Src1, Src2, Ty, false);
621 case FCmpInst::FCMP_FALSE: R = executeFCMP_BOOL(Src1, Src2, Ty, false);
622622 break;
623 case FCmpInst::FCMP_TRUE: R = executeFCMP_BOOL(Src1, Src2, Ty, true);
623 case FCmpInst::FCMP_TRUE: R = executeFCMP_BOOL(Src1, Src2, Ty, true);
624624 break;
625625 case FCmpInst::FCMP_ORD: R = executeFCMP_ORD(Src1, Src2, Ty); break;
626626 case FCmpInst::FCMP_UNO: R = executeFCMP_UNO(Src1, Src2, Ty); break;
637637 case FCmpInst::FCMP_UGE: R = executeFCMP_UGE(Src1, Src2, Ty); break;
638638 case FCmpInst::FCMP_OGE: R = executeFCMP_OGE(Src1, Src2, Ty); break;
639639 }
640
640
641641 SetValue(&I, R, SF);
642642 }
643643
644 static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1,
644 static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1,
645645 GenericValue Src2, Type *Ty) {
646646 GenericValue Result;
647647 switch (predicate) {
746746 case Instruction::FRem:
747747 if (cast(Ty)->getElementType()->isFloatTy())
748748 for (unsigned i = 0; i < R.AggregateVal.size(); ++i)
749 R.AggregateVal[i].FloatVal =
749 R.AggregateVal[i].FloatVal =
750750 fmod(Src1.AggregateVal[i].FloatVal, Src2.AggregateVal[i].FloatVal);
751751 else {
752752 if (cast(Ty)->getElementType()->isDoubleTy())
753753 for (unsigned i = 0; i < R.AggregateVal.size(); ++i)
754 R.AggregateVal[i].DoubleVal =
754 R.AggregateVal[i].DoubleVal =
755755 fmod(Src1.AggregateVal[i].DoubleVal, Src2.AggregateVal[i].DoubleVal);
756756 else {
757757 dbgs() << "Unhandled type for Rem instruction: " << *Ty << "\n";
964964 Type *Ty = I.getType()->getElementType(); // Type to be allocated
965965
966966 // Get the number of elements being allocated by the array...
967 unsigned NumElements =
967 unsigned NumElements =
968968 getOperandValue(I.getOperand(0), SF).IntVal.getZExtValue();
969969
970970 unsigned TypeSize = (size_t)getDataLayout().getTypeAllocSize(Ty);
10101010 GenericValue IdxGV = getOperandValue(I.getOperand(), SF);
10111011
10121012 int64_t Idx;
1013 unsigned BitWidth =
1013 unsigned BitWidth =
10141014 cast(I.getOperand()->getType())->getBitWidth();
10151015 if (BitWidth == 32)
10161016 Idx = (int64_t)(int32_t)IdxGV.IntVal.getZExtValue();
20362036 case Instruction::And: Dest.IntVal = Op0.IntVal & Op1.IntVal; break;
20372037 case Instruction::Or: Dest.IntVal = Op0.IntVal | Op1.IntVal; break;
20382038 case Instruction::Xor: Dest.IntVal = Op0.IntVal ^ Op1.IntVal; break;
2039 case Instruction::Shl:
2039 case Instruction::Shl:
20402040 Dest.IntVal = Op0.IntVal.shl(Op1.IntVal.getZExtValue());
20412041 break;
2042 case Instruction::LShr:
2042 case Instruction::LShr:
20432043 Dest.IntVal = Op0.IntVal.lshr(Op1.IntVal.getZExtValue());
20442044 break;
2045 case Instruction::AShr:
2045 case Instruction::AShr:
20462046 Dest.IntVal = Op0.IntVal.ashr(Op1.IntVal.getZExtValue());
20472047 break;
20482048 default:
20992099
21002100 // Handle non-varargs arguments...
21012101 unsigned i = 0;
2102 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
2102 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
21032103 AI != E; ++AI, ++i)
21042104 SetValue(&*AI, ArgVals[i], StackFrame);
21052105
131131 void visitLoadInst(LoadInst &I);
132132 void visitStoreInst(StoreInst &I);
133133 void visitGetElementPtrInst(GetElementPtrInst &I);
134 void visitPHINode(PHINode &PN) {
135 llvm_unreachable("PHI nodes already handled!");
134 void visitPHINode(PHINode &PN) {
135 llvm_unreachable("PHI nodes already handled!");
136136 }
137137 void visitTruncInst(TruncInst &I);
138138 void visitZExtInst(ZExtInst &I);
223223 ExecutionContext &SF);
224224 GenericValue executeBitCastInst(Value *SrcVal, Type *DstTy,
225225 ExecutionContext &SF);
226 GenericValue executeCastOperation(Instruction::CastOps opcode, Value *SrcVal,
226 GenericValue executeCastOperation(Instruction::CastOps opcode, Value *SrcVal,
227227 Type *Ty, ExecutionContext &SF);
228228 void popStackAndReturnValueToCaller(Type *RetTy, GenericValue Result);
229229
118118
119119 void RTDyldMemoryManager::registerEHFramesInProcess(uint8_t *Addr,
120120 size_t Size) {
121 // On Linux __register_frame takes a single argument:
121 // On Linux __register_frame takes a single argument:
122122 // a pointer to the start of the .eh_frame section.
123123
124 // How can it find the end? Because crtendS.o is linked
124 // How can it find the end? Because crtendS.o is linked
125125 // in and it has an .eh_frame section with four zero chars.
126126 __register_frame(Addr);
127127 }
254254 return (uint64_t)&__morestack;
255255 #endif
256256 #endif // __linux__ && __GLIBC__
257
257
258258 // See ARM_MATH_IMPORTS definition for explanation
259259 #if defined(__BIONIC__) && defined(__arm__)
260260 if (Name.compare(0, 8, "__aeabi_") == 0) {
14291429 } else {
14301430 processSimpleRelocation(SectionID, Offset, RelType, Value);
14311431 }
1432
1432
14331433 } else if (Arch == Triple::ppc64 || Arch == Triple::ppc64le) {
14341434 if (RelType == ELF::R_PPC64_REL24) {
14351435 // Determine ABI variant in use for this object.
9292 Args.push_back("-passes=gvn");
9393 } else if (Opt == "sccp") {
9494 Args.push_back("-passes=sccp");
95
95
9696 } else if (Opt == "loop_predication") {
9797 Args.push_back("-passes=loop-predication");
9898 } else if (Opt == "guard_widening") {
113113 Args.push_back("-passes=strength-reduce");
114114 } else if (Opt == "irce") {
115115 Args.push_back("-passes=irce");
116
116
117117 } else if (Triple(Opt).getArch()) {
118118 Args.push_back("-mtriple=" + Opt.str());
119119 } else {
203203 auto M = parseModule(Data, Size, Context);
204204 if (!M || verifyModule(*M, &errs()))
205205 return nullptr;
206
206
207207 return M;
208208 }
9393 Name.startswith("avx512.mask3.vfmsubadd.") || // Added in 7.0
9494 Name.startswith("avx512.mask.shuf.i") || // Added in 6.0
9595 Name.startswith("avx512.mask.shuf.f") || // Added in 6.0
96 Name.startswith("avx512.kunpck") || //added in 6.0
96 Name.startswith("avx512.kunpck") || //added in 6.0
9797 Name.startswith("avx2.pabs.") || // Added in 6.0
9898 Name.startswith("avx512.mask.pabs.") || // Added in 6.0
9999 Name.startswith("avx512.broadcastm") || // Added in 6.0
585585 if (FT->isVarArg())
586586 Result += "vararg";
587587 // Ensure nested function types are distinguishable.
588 Result += "f";
588 Result += "f";
589589 } else if (isa(Ty)) {
590590 Result += "v" + utostr(Ty->getVectorNumElements()) +
591591 getMangledTypeStr(Ty->getVectorElementType());
5656 FunctionType *InlineAsm::getFunctionType() const {
5757 return FTy;
5858 }
59
59
6060 /// Parse - Analyze the specified string (e.g. "==&{eax}") and fill in the
6161 /// fields in this structure. If the constraint string is not understood,
6262 /// return true, otherwise return false.
7979 isCommutative = false;
8080 isIndirect = false;
8181 currentAlternativeIndex = 0;
82
82
8383 // Parse prefixes.
8484 if (*I == '~') {
8585 Type = isClobber;
9999 }
100100
101101 if (I == E) return true; // Just a prefix, like "==" or "~".
102
102
103103 // Parse the modifiers.
104104 bool DoneWithModifiers = false;
105105 while (!DoneWithModifiers) {
123123 case '*': // Register preferencing.
124124 return true; // Not supported.
125125 }
126
126
127127 if (!DoneWithModifiers) {
128128 ++I;
129129 if (I == E) return true; // Just prefixes and modifiers!
130130 }
131131 }
132
132
133133 // Parse the various constraints.
134134 while (I != E) {
135135 if (*I == '{') { // Physical register reference.
149149 if (N >= ConstraintsSoFar.size() || ConstraintsSoFar[N].Type != isOutput||
150150 Type != isInput)
151151 return true; // Invalid constraint number.
152
152
153153 // If Operand N already has a matching input, reject this. An output
154154 // can't be constrained to the same value as multiple inputs.
155155 if (isMultipleAlternative) {
206206 InlineAsm::ConstraintInfoVector
207207 InlineAsm::ParseConstraints(StringRef Constraints) {
208208 ConstraintInfoVector Result;
209
209
210210 // Scan the constraints string.
211211 for (StringRef::iterator I = Constraints.begin(),
212212 E = Constraints.end(); I != E; ) {
222222 }
223223
224224 Result.push_back(Info);
225
225
226226 // ConstraintEnd may be either the next comma or the end of the string. In
227227 // the former case, we skip the comma.
228228 I = ConstraintEnd;
234234 } // don't allow "xyz,"
235235 }
236236 }
237
237
238238 return Result;
239239 }
240240
242242 /// specified function type, and otherwise validate the constraint string.
243243 bool InlineAsm::Verify(FunctionType *Ty, StringRef ConstStr) {
244244 if (Ty->isVarArg()) return false;
245
245
246246 ConstraintInfoVector Constraints = ParseConstraints(ConstStr);
247
247
248248 // Error parsing constraints.
249249 if (Constraints.empty() && !ConstStr.empty()) return false;
250
250
251251 unsigned NumOutputs = 0, NumInputs = 0, NumClobbers = 0;
252252 unsigned NumIndirect = 0;
253
253
254254 for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
255255 switch (Constraints[i].Type) {
256256 case InlineAsm::isOutput:
271271 break;
272272 }
273273 }
274
274
275275 switch (NumOutputs) {
276276 case 0:
277277 if (!Ty->getReturnType()->isVoidTy()) return false;
284284 if (!STy || STy->getNumElements() != NumOutputs)
285285 return false;
286286 break;
287 }
288
287 }
288
289289 if (Ty->getNumParams() != NumInputs) return false;
290290 return true;
291291 }
309309 "Calling a function with bad signature!");
310310
311311 for (unsigned i = 0; i != Args.size(); ++i)
312 assert((i >= FTy->getNumParams() ||
312 assert((i >= FTy->getNumParams() ||
313313 FTy->getParamType(i) == Args[i]->getType()) &&
314314 "Calling a function with a bad signature!");
315315 #endif
408408 assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
409409 "createMalloc needs either InsertBefore or InsertAtEnd");
410410
411 // malloc(type) becomes:
411 // malloc(type) becomes:
412412 // bitcast (i8* malloc(typeSize)) to type*
413413 // malloc(type, arraySize) becomes:
414414 // bitcast (i8* malloc(typeSize*arraySize)) to type*
515515 /// responsibility of the caller.
516516 Instruction *CallInst::CreateMalloc(BasicBlock *InsertAtEnd,
517517 Type *IntPtrTy, Type *AllocTy,
518 Value *AllocSize, Value *ArraySize,
518 Value *AllocSize, Value *ArraySize,
519519 Function *MallocF, const Twine &Name) {
520520 return createMalloc(nullptr, InsertAtEnd, IntPtrTy, AllocTy, AllocSize,
521521 ArraySize, None, MallocF, Name);
611611 "Invoking a function with bad signature");
612612
613613 for (unsigned i = 0, e = Args.size(); i != e; i++)
614 assert((i >= FTy->getNumParams() ||
614 assert((i >= FTy->getNumParams() ||
615615 FTy->getParamType(i) == Args[i]->getType()) &&
616616 "Invoking a function with a bad signature!");
617617 #endif
911911 // UnreachableInst Implementation
912912 //===----------------------------------------------------------------------===//
913913
914 UnreachableInst::UnreachableInst(LLVMContext &Context,
914 UnreachableInst::UnreachableInst(LLVMContext &Context,
915915 Instruction *InsertBefore)
916916 : TerminatorInst(Type::getVoidTy(Context), Instruction::Unreachable,
917917 nullptr, 0, InsertBefore) {
10711071 bool AllocaInst::isStaticAlloca() const {
10721072 // Must be constant size.
10731073 if (!isa(getArraySize())) return false;
1074
1074
10751075 // Must be in the entry block.
10761076 const BasicBlock *Parent = getParent();
10771077 return Parent == &Parent->getParent()->front() && !isUsedWithInAlloca();
11241124 setName(Name);
11251125 }
11261126
1127 LoadInst::LoadInst(Value *Ptr, const Twine &Name, bool isVolatile,
1127 LoadInst::LoadInst(Value *Ptr, const Twine &Name, bool isVolatile,
11281128 unsigned Align, AtomicOrdering Order,
11291129 SyncScope::ID SSID,
11301130 BasicBlock *InsertAE)
13791379 // FenceInst Implementation
13801380 //===----------------------------------------------------------------------===//
13811381
1382 FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
1382 FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
13831383 SyncScope::ID SSID,
13841384 Instruction *InsertBefore)
13851385 : Instruction(Type::getVoidTy(C), Fence, nullptr, 0, InsertBefore) {
13871387 setSyncScopeID(SSID);
13881388 }
13891389
1390 FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
1390 FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
13911391 SyncScope::ID SSID,
13921392 BasicBlock *InsertAtEnd)
13931393 : Instruction(Type::getVoidTy(C), Fence, nullptr, 0, InsertAtEnd) {
15741574 setName(Name);
15751575 }
15761576
1577 bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt,
1577 bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt,
15781578 const Value *Index) {
15791579 if (!Vec->getType()->isVectorTy())
15801580 return false; // First operand of insertelement must be vector type.
1581
1581
15821582 if (Elt->getType() != cast(Vec->getType())->getElementType())
15831583 return false;// Second operand of insertelement must be vector element type.
1584
1584
15851585 if (!Index->getType()->isIntegerTy())
15861586 return false; // Third operand of insertelement must be i32.
15871587 return true;
16311631 // V1 and V2 must be vectors of the same type.
16321632 if (!V1->getType()->isVectorTy() || V1->getType() != V2->getType())
16331633 return false;
1634
1634
16351635 // Mask must be vector of i32.
16361636 auto *MaskTy = dyn_cast(Mask->getType());
16371637 if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32))
16531653 }
16541654 return true;
16551655 }
1656
1656
16571657 if (const auto *CDS = dyn_cast(Mask)) {
16581658 unsigned V1Size = cast(V1->getType())->getNumElements();
16591659 for (unsigned i = 0, e = MaskTy->getNumElements(); i != e; ++i)
16611661 return false;
16621662 return true;
16631663 }
1664
1664
16651665 // The bitcode reader can create a place holder for a forward reference
16661666 // used as the shuffle mask. When this occurs, the shuffle mask will
16671667 // fall into this case and fail. To avoid this error, do this bit of
16861686 void ShuffleVectorInst::getShuffleMask(const Constant *Mask,
16871687 SmallVectorImpl &Result) {
16881688 unsigned NumElts = Mask->getType()->getVectorNumElements();
1689
1689
16901690 if (auto *CDS = dyn_cast(Mask)) {
16911691 for (unsigned i = 0; i != NumElts; ++i)
16921692 Result.push_back(CDS->getElementAsInteger(i));
16931693 return;
1694 }
1694 }
16951695 for (unsigned i = 0; i != NumElts; ++i) {
16961696 Constant *C = Mask->getAggregateElement(i);
16971697 Result.push_back(isa(C) ? -1 :
18051805 // InsertValueInst Class
18061806 //===----------------------------------------------------------------------===//
18071807
1808 void InsertValueInst::init(Value *Agg, Value *Val, ArrayRef Idxs,
1808 void InsertValueInst::init(Value *Agg, Value *Val, ArrayRef Idxs,
18091809 const Twine &Name) {
18101810 assert(getNumOperands() == 2 && "NumOperands not initialized?");
18111811
19021902 AssertOK();
19031903 }
19041904
1905 BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2,
1905 BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2,
19061906 Type *Ty, const Twine &Name,
19071907 BasicBlock *InsertAtEnd)
19081908 : Instruction(Ty, iType,
19371937 "Tried to create a floating-point operation on a "
19381938 "non-floating-point type!");
19391939 break;
1940 case UDiv:
1941 case SDiv:
1940 case UDiv:
1941 case SDiv:
19421942 assert(getType() == LHS->getType() &&
19431943 "Arithmetic operation should return same type as operands!");
19441944 assert(getType()->isIntOrIntVectorTy() &&
19501950 assert(getType()->isFPOrFPVectorTy() &&
19511951 "Incorrect operand type (not floating point) for FDIV");
19521952 break;
1953 case URem:
1954 case SRem:
1953 case URem:
1954 case SRem:
19551955 assert(getType() == LHS->getType() &&
19561956 "Arithmetic operation should return same type as operands!");
19571957 assert(getType()->isIntOrIntVectorTy() &&
21842184 Type *DstTy = getType();
21852185 if (SrcTy == DstTy)
21862186 return true;
2187
2187
21882188 // Pointer to pointer is always lossless.
21892189 if (SrcTy->isPointerTy())
21902190 return DstTy->isPointerTy();
21932193
21942194 /// This function determines if the CastInst does not require any bits to be
21952195 /// changed in order to effect the cast. Essentially, it identifies cases where
2196 /// no code gen is necessary for the cast, hence the name no-op cast. For
2196 /// no code gen is necessary for the cast, hence the name no-op cast. For
21972197 /// example, the following are all no-op casts:
21982198 /// # bitcast i32* %x to i8*
2199 /// # bitcast <2 x i32> %x to <4 x i16>
2199 /// # bitcast <2 x i32> %x to <4 x i16>
22002200 /// # ptrtoint i32* %x to i32 ; on 32-bit plaforms only
22012201 /// Determine if the described cast is a no-op.
22022202 bool CastInst::isNoopCast(Instruction::CastOps Opcode,
22072207 default: llvm_unreachable("Invalid CastOp");
22082208 case Instruction::Trunc:
22092209 case Instruction::ZExt:
2210 case Instruction::SExt:
2210 case Instruction::SExt:
22112211 case Instruction::FPTrunc:
22122212 case Instruction::FPExt:
22132213 case Instruction::UIToFP:
22462246 Type *DstIntPtrTy) {
22472247 // Define the 144 possibilities for these two cast instructions. The values
22482248 // in this matrix determine what to do in a given situation and select the
2249 // case in the switch below. The rows correspond to firstOp, the columns
2249 // case in the switch below. The rows correspond to firstOp, the columns
22502250 // correspond to secondOp. In looking at the table below, keep in mind
22512251 // the following cast properties:
22522252 //
23142314 int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
23152315 [secondOp-Instruction::CastOpsBegin];
23162316 s