Lines Matching full:constant

1 //==- AArch64PromoteConstant.cpp - Promote constant to global for AArch64 --==//
11 // types related to constant vector (i.e., constant vector, array of constant
12 // vectors, constant structure with a constant vector field, etc.) are promoted
13 // to global variables. Constant vectors are likely to be lowered in target
14 // constant pool during instruction selection already; therefore, the access
16 // into different constant pool accesses for each field. A bonus side effect is
27 #include "llvm/IR/Constant.h"
68 /// Promotes interesting constant into global variables.
100 using PromotionCacheTy = SmallDenseMap<Constant *, PromotedConstant, 16>;
103 Constant *C;
107 UpdateRecord(Constant *C, Instruction *User, unsigned Op) in UpdateRecord()
117 StringRef getPassName() const override { return "AArch64 Promote Constant"; } in getPassName()
159 /// \param User the user of the constant
173 /// \param User the user of the constant
188 /// \param User the user of the constant
189 /// \param OpNo the operand number of the constant
200 /// Do the constant promotion indicated by the Updates records, keeping track
230 "AArch64 Promote Constant Pass", false, false)
233 "AArch64 Promote Constant Pass", false, false) in INITIALIZE_PASS_DEPENDENCY()
254 // block addresses or constant expressions. Traverses ConstantAggregates.
255 static bool containsOnlyConstantData(const Constant *C) { in containsOnlyConstantData()
263 return containsOnlyConstantData(cast<Constant>(&U)); in containsOnlyConstantData()
272 static bool shouldConvertUse(const Constant *Cst, const Instruction *Instr, in shouldConvertUse()
290 // Alignment argument must be constant. in shouldConvertUse()
294 // Alignment argument must be constant. in shouldConvertUse()
298 // Index must be constant. in shouldConvertUse()
302 // Personality function and filters must be constant. in shouldConvertUse()
311 // Expected address must be a constant. in shouldConvertUse()
326 /// A constant should be converted if it is likely that the materialization of
327 /// the constant will be tricky. Thus, we give up on zero or undef values.
333 /// constant via global merge and the fact that the same constant is stored
334 /// only once with this method (versus, as many function that uses the constant
337 /// constant and rematerialize them when they are actually cheap to create.
338 static bool shouldConvertImpl(const Constant *Cst) { in shouldConvertImpl()
343 // a zero initialized constant. in shouldConvertImpl()
347 // Ideally, we could promote this into a global and rematerialize the constant in shouldConvertImpl()
362 shouldConvert(Constant &C, in shouldConvert()
483 static void ensurePromotedGV(Function &F, Constant &C, in ensurePromotedGV()
543 Constant *C = First->C; in promoteConstants()
557 // Look for instructions using constant vector. Promote that constant to a in runOnFunction()
562 // Traverse the operand, looking for constant vectors. Replace them by a in runOnFunction()
563 // load of a global variable of constant vector type. in runOnFunction()
565 Constant *Cst = dyn_cast<Constant>(U); in runOnFunction()
567 // global. Do not promote constants containing constant expression, global in runOnFunction()
573 // Check if this constant is worth promoting. in runOnFunction()