Lines Matching full:random
1 //===- llvm-stress.cpp - Generate random LL files to stress-test LLVM -----===//
9 // This program is a utility that generates random .ll files to stress-test
82 /// A utility class to provide a pseudo-random number generator which is
86 class Random {
89 Random(unsigned _seed):Seed(_seed) {}
91 /// Return a random integer, up to a
96 // Only lowest 19 bits are random-ish.
100 /// Return a random 64 bit integer.
114 /// Make this like a C++11 random device
122 assert(Val <= max() && "Random value out of range");
152 /// modifying and adding new random instructions.
159 Modifier(BasicBlock *Block, PieceTable *PT, Random *R)
204 /// Return a random integer.
209 /// Return a random value from the list of known values.
228 /// Return a random value with a known type.
259 /// Return a random value of any pointer type.
270 /// Return a random value of any vector type.
281 /// Pick a random type.
286 /// Pick a random vector type.
298 // Pick a random vector width in the range 2**0 to 2**4.
305 /// Pick a random scalar type.
316 /// Random number generator
317 Random *Ran;
326 LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R)
339 StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R)
358 BinModifier(BasicBlock *BB, PieceTable *PT, Random *R)
403 ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R)
420 // Generate 128 random bits, the size of the (currently)
454 AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R)
466 ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R)
479 ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R)
511 InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R)
526 CastModifier(BasicBlock *BB, PieceTable *PT, Random *R)
607 SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R)
631 CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R)
661 static void FillFunction(Function *F, Random &R) {
673 // List of modifiers which add new random instructions.
686 // Generate the random instructions
697 static void IntroduceControlFlow(Function *F, Random &R) {
733 Random R(SeedCL);
734 // Generate lots of random instructions inside a single basic block.