mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
[weak vtables] Place class definitions into anonymous namespaces to prevent weak vtables.
This patch places class definitions in implementation files into anonymous namespaces to prevent weak vtables. This eliminates the need of providing an out-of-line definition to pin the vtable explicitly to the file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195092 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
36c7806f4e
commit
ba0f991a78
@ -1562,7 +1562,7 @@ llvm::Function *createUnwindExceptionTest(llvm::Module &module,
|
|||||||
return(outerCatchFunct);
|
return(outerCatchFunct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
/// Represents our foreign exceptions
|
/// Represents our foreign exceptions
|
||||||
class OurCppRunException : public std::runtime_error {
|
class OurCppRunException : public std::runtime_error {
|
||||||
public:
|
public:
|
||||||
@ -1577,11 +1577,9 @@ public:
|
|||||||
std::runtime_error::operator=(toCopy)));
|
std::runtime_error::operator=(toCopy)));
|
||||||
}
|
}
|
||||||
|
|
||||||
~OurCppRunException (void) throw ();
|
virtual ~OurCppRunException (void) throw () {}
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
OurCppRunException::~OurCppRunException() throw () {}
|
|
||||||
|
|
||||||
/// Throws foreign C++ exception.
|
/// Throws foreign C++ exception.
|
||||||
/// @param ignoreIt unused parameter that allows function to match implied
|
/// @param ignoreIt unused parameter that allows function to match implied
|
||||||
|
@ -75,18 +75,17 @@ static int gettok() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Abstract Syntax Tree (aka Parse Tree)
|
// Abstract Syntax Tree (aka Parse Tree)
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
namespace {
|
||||||
/// ExprAST - Base class for all expression nodes.
|
/// ExprAST - Base class for all expression nodes.
|
||||||
class ExprAST {
|
class ExprAST {
|
||||||
public:
|
public:
|
||||||
virtual ~ExprAST();
|
virtual ~ExprAST() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
||||||
class NumberExprAST : public ExprAST {
|
class NumberExprAST : public ExprAST {
|
||||||
public:
|
public:
|
||||||
NumberExprAST(double val) {}
|
NumberExprAST(double val) {}
|
||||||
virtual ~NumberExprAST();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// VariableExprAST - Expression class for referencing a variable, like "a".
|
/// VariableExprAST - Expression class for referencing a variable, like "a".
|
||||||
@ -94,14 +93,12 @@ class VariableExprAST : public ExprAST {
|
|||||||
std::string Name;
|
std::string Name;
|
||||||
public:
|
public:
|
||||||
VariableExprAST(const std::string &name) : Name(name) {}
|
VariableExprAST(const std::string &name) : Name(name) {}
|
||||||
virtual ~VariableExprAST();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// BinaryExprAST - Expression class for a binary operator.
|
/// BinaryExprAST - Expression class for a binary operator.
|
||||||
class BinaryExprAST : public ExprAST {
|
class BinaryExprAST : public ExprAST {
|
||||||
public:
|
public:
|
||||||
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) {}
|
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) {}
|
||||||
virtual ~BinaryExprAST();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// CallExprAST - Expression class for function calls.
|
/// CallExprAST - Expression class for function calls.
|
||||||
@ -111,16 +108,8 @@ class CallExprAST : public ExprAST {
|
|||||||
public:
|
public:
|
||||||
CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
|
CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
|
||||||
: Callee(callee), Args(args) {}
|
: Callee(callee), Args(args) {}
|
||||||
virtual ~CallExprAST();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provide out-of-line definitions to prevent weak vtables.
|
|
||||||
ExprAST::~ExprAST() {}
|
|
||||||
NumberExprAST::~NumberExprAST() {}
|
|
||||||
VariableExprAST::~VariableExprAST() {}
|
|
||||||
BinaryExprAST::~BinaryExprAST() {}
|
|
||||||
CallExprAST::~CallExprAST() {}
|
|
||||||
|
|
||||||
/// PrototypeAST - This class represents the "prototype" for a function,
|
/// PrototypeAST - This class represents the "prototype" for a function,
|
||||||
/// which captures its name, and its argument names (thus implicitly the number
|
/// which captures its name, and its argument names (thus implicitly the number
|
||||||
/// of arguments the function takes).
|
/// of arguments the function takes).
|
||||||
@ -138,6 +127,7 @@ class FunctionAST {
|
|||||||
public:
|
public:
|
||||||
FunctionAST(PrototypeAST *proto, ExprAST *body) {}
|
FunctionAST(PrototypeAST *proto, ExprAST *body) {}
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Parser
|
// Parser
|
||||||
@ -169,7 +159,6 @@ static int GetTokPrecedence() {
|
|||||||
/// Error* - These are little helper functions for error handling.
|
/// Error* - These are little helper functions for error handling.
|
||||||
ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
|
ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
|
||||||
PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
|
PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
|
||||||
FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
|
|
||||||
|
|
||||||
static ExprAST *ParseExpression();
|
static ExprAST *ParseExpression();
|
||||||
|
|
||||||
|
@ -80,17 +80,14 @@ static int gettok() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Abstract Syntax Tree (aka Parse Tree)
|
// Abstract Syntax Tree (aka Parse Tree)
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
namespace {
|
||||||
/// ExprAST - Base class for all expression nodes.
|
/// ExprAST - Base class for all expression nodes.
|
||||||
class ExprAST {
|
class ExprAST {
|
||||||
public:
|
public:
|
||||||
virtual ~ExprAST();
|
virtual ~ExprAST() {}
|
||||||
virtual Value *Codegen() = 0;
|
virtual Value *Codegen() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
ExprAST::~ExprAST() {}
|
|
||||||
|
|
||||||
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
||||||
class NumberExprAST : public ExprAST {
|
class NumberExprAST : public ExprAST {
|
||||||
double Val;
|
double Val;
|
||||||
@ -150,6 +147,7 @@ public:
|
|||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Parser
|
// Parser
|
||||||
|
@ -87,17 +87,14 @@ static int gettok() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Abstract Syntax Tree (aka Parse Tree)
|
// Abstract Syntax Tree (aka Parse Tree)
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
namespace {
|
||||||
/// ExprAST - Base class for all expression nodes.
|
/// ExprAST - Base class for all expression nodes.
|
||||||
class ExprAST {
|
class ExprAST {
|
||||||
public:
|
public:
|
||||||
virtual ~ExprAST();
|
virtual ~ExprAST() {}
|
||||||
virtual Value *Codegen() = 0;
|
virtual Value *Codegen() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
ExprAST::~ExprAST() {}
|
|
||||||
|
|
||||||
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
||||||
class NumberExprAST : public ExprAST {
|
class NumberExprAST : public ExprAST {
|
||||||
double Val;
|
double Val;
|
||||||
@ -157,6 +154,7 @@ public:
|
|||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Parser
|
// Parser
|
||||||
|
@ -96,17 +96,14 @@ static int gettok() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Abstract Syntax Tree (aka Parse Tree)
|
// Abstract Syntax Tree (aka Parse Tree)
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
namespace {
|
||||||
/// ExprAST - Base class for all expression nodes.
|
/// ExprAST - Base class for all expression nodes.
|
||||||
class ExprAST {
|
class ExprAST {
|
||||||
public:
|
public:
|
||||||
virtual ~ExprAST();
|
virtual ~ExprAST() {}
|
||||||
virtual Value *Codegen() = 0;
|
virtual Value *Codegen() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
ExprAST::~ExprAST() {}
|
|
||||||
|
|
||||||
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
||||||
class NumberExprAST : public ExprAST {
|
class NumberExprAST : public ExprAST {
|
||||||
double Val;
|
double Val;
|
||||||
@ -186,6 +183,7 @@ public:
|
|||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Parser
|
// Parser
|
||||||
|
@ -101,17 +101,14 @@ static int gettok() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Abstract Syntax Tree (aka Parse Tree)
|
// Abstract Syntax Tree (aka Parse Tree)
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
namespace {
|
||||||
/// ExprAST - Base class for all expression nodes.
|
/// ExprAST - Base class for all expression nodes.
|
||||||
class ExprAST {
|
class ExprAST {
|
||||||
public:
|
public:
|
||||||
virtual ~ExprAST();
|
virtual ~ExprAST() {}
|
||||||
virtual Value *Codegen() = 0;
|
virtual Value *Codegen() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
ExprAST::~ExprAST() {}
|
|
||||||
|
|
||||||
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
||||||
class NumberExprAST : public ExprAST {
|
class NumberExprAST : public ExprAST {
|
||||||
double Val;
|
double Val;
|
||||||
@ -214,6 +211,7 @@ public:
|
|||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Parser
|
// Parser
|
||||||
|
@ -105,17 +105,14 @@ static int gettok() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Abstract Syntax Tree (aka Parse Tree)
|
// Abstract Syntax Tree (aka Parse Tree)
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
namespace {
|
||||||
/// ExprAST - Base class for all expression nodes.
|
/// ExprAST - Base class for all expression nodes.
|
||||||
class ExprAST {
|
class ExprAST {
|
||||||
public:
|
public:
|
||||||
virtual ~ExprAST();
|
virtual ~ExprAST() {}
|
||||||
virtual Value *Codegen() = 0;
|
virtual Value *Codegen() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
ExprAST::~ExprAST() {}
|
|
||||||
|
|
||||||
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
/// NumberExprAST - Expression class for numeric literals like "1.0".
|
||||||
class NumberExprAST : public ExprAST {
|
class NumberExprAST : public ExprAST {
|
||||||
double Val;
|
double Val;
|
||||||
@ -232,6 +229,7 @@ public:
|
|||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Parser
|
// Parser
|
||||||
|
@ -52,6 +52,7 @@ static cl::opt<bool> GenPPCFP128("generate-ppc-fp128",
|
|||||||
static cl::opt<bool> GenX86MMX("generate-x86-mmx",
|
static cl::opt<bool> GenX86MMX("generate-x86-mmx",
|
||||||
cl::desc("Generate X86 MMX floating-point values"), cl::init(false));
|
cl::desc("Generate X86 MMX floating-point values"), cl::init(false));
|
||||||
|
|
||||||
|
namespace {
|
||||||
/// A utility class to provide a pseudo-random number generator which is
|
/// A utility class to provide a pseudo-random number generator which is
|
||||||
/// the same across all platforms. This is somewhat close to the libc
|
/// the same across all platforms. This is somewhat close to the libc
|
||||||
/// implementation. Note: This is not a cryptographically secure pseudorandom
|
/// implementation. Note: This is not a cryptographically secure pseudorandom
|
||||||
@ -128,7 +129,7 @@ public:
|
|||||||
BB(Block),PT(PT),Ran(R),Context(BB->getContext()) {}
|
BB(Block),PT(PT),Ran(R),Context(BB->getContext()) {}
|
||||||
|
|
||||||
/// virtual D'tor to silence warnings.
|
/// virtual D'tor to silence warnings.
|
||||||
virtual ~Modifier();
|
virtual ~Modifier() {}
|
||||||
|
|
||||||
/// Add a new instruction.
|
/// Add a new instruction.
|
||||||
virtual void Act() = 0;
|
virtual void Act() = 0;
|
||||||
@ -287,7 +288,6 @@ protected:
|
|||||||
|
|
||||||
struct LoadModifier: public Modifier {
|
struct LoadModifier: public Modifier {
|
||||||
LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
||||||
virtual ~LoadModifier();
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
// Try to use predefined pointers. If non exist, use undef pointer value;
|
// Try to use predefined pointers. If non exist, use undef pointer value;
|
||||||
Value *Ptr = getRandomPointerValue();
|
Value *Ptr = getRandomPointerValue();
|
||||||
@ -298,7 +298,6 @@ struct LoadModifier: public Modifier {
|
|||||||
|
|
||||||
struct StoreModifier: public Modifier {
|
struct StoreModifier: public Modifier {
|
||||||
StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
||||||
virtual ~StoreModifier();
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
// Try to use predefined pointers. If non exist, use undef pointer value;
|
// Try to use predefined pointers. If non exist, use undef pointer value;
|
||||||
Value *Ptr = getRandomPointerValue();
|
Value *Ptr = getRandomPointerValue();
|
||||||
@ -317,7 +316,6 @@ struct StoreModifier: public Modifier {
|
|||||||
|
|
||||||
struct BinModifier: public Modifier {
|
struct BinModifier: public Modifier {
|
||||||
BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
||||||
virtual ~BinModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
Value *Val0 = getRandomVal();
|
Value *Val0 = getRandomVal();
|
||||||
@ -362,8 +360,6 @@ struct BinModifier: public Modifier {
|
|||||||
/// Generate constant values.
|
/// Generate constant values.
|
||||||
struct ConstModifier: public Modifier {
|
struct ConstModifier: public Modifier {
|
||||||
ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
||||||
virtual ~ConstModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
Type *Ty = pickType();
|
Type *Ty = pickType();
|
||||||
|
|
||||||
@ -410,7 +406,6 @@ struct ConstModifier: public Modifier {
|
|||||||
|
|
||||||
struct AllocaModifier: public Modifier {
|
struct AllocaModifier: public Modifier {
|
||||||
AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
|
AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
|
||||||
virtual ~AllocaModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
Type *Tp = pickType();
|
Type *Tp = pickType();
|
||||||
@ -421,7 +416,6 @@ struct AllocaModifier: public Modifier {
|
|||||||
struct ExtractElementModifier: public Modifier {
|
struct ExtractElementModifier: public Modifier {
|
||||||
ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
|
ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
|
||||||
Modifier(BB, PT, R) {}
|
Modifier(BB, PT, R) {}
|
||||||
virtual ~ExtractElementModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
Value *Val0 = getRandomVectorValue();
|
Value *Val0 = getRandomVectorValue();
|
||||||
@ -435,8 +429,6 @@ struct ExtractElementModifier: public Modifier {
|
|||||||
|
|
||||||
struct ShuffModifier: public Modifier {
|
struct ShuffModifier: public Modifier {
|
||||||
ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
||||||
virtual ~ShuffModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
|
|
||||||
Value *Val0 = getRandomVectorValue();
|
Value *Val0 = getRandomVectorValue();
|
||||||
@ -465,7 +457,6 @@ struct ShuffModifier: public Modifier {
|
|||||||
struct InsertElementModifier: public Modifier {
|
struct InsertElementModifier: public Modifier {
|
||||||
InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
|
InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
|
||||||
Modifier(BB, PT, R) {}
|
Modifier(BB, PT, R) {}
|
||||||
virtual ~InsertElementModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
Value *Val0 = getRandomVectorValue();
|
Value *Val0 = getRandomVectorValue();
|
||||||
@ -482,8 +473,6 @@ struct InsertElementModifier: public Modifier {
|
|||||||
|
|
||||||
struct CastModifier: public Modifier {
|
struct CastModifier: public Modifier {
|
||||||
CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
||||||
virtual ~CastModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
|
|
||||||
Value *V = getRandomVal();
|
Value *V = getRandomVal();
|
||||||
@ -570,7 +559,6 @@ struct CastModifier: public Modifier {
|
|||||||
struct SelectModifier: public Modifier {
|
struct SelectModifier: public Modifier {
|
||||||
SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
|
SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
|
||||||
Modifier(BB, PT, R) {}
|
Modifier(BB, PT, R) {}
|
||||||
virtual ~SelectModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
// Try a bunch of different select configuration until a valid one is found.
|
// Try a bunch of different select configuration until a valid one is found.
|
||||||
@ -595,8 +583,6 @@ struct SelectModifier: public Modifier {
|
|||||||
|
|
||||||
struct CmpModifier: public Modifier {
|
struct CmpModifier: public Modifier {
|
||||||
CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
|
||||||
virtual ~CmpModifier();
|
|
||||||
|
|
||||||
virtual void Act() {
|
virtual void Act() {
|
||||||
|
|
||||||
Value *Val0 = getRandomVal();
|
Value *Val0 = getRandomVal();
|
||||||
@ -622,21 +608,9 @@ struct CmpModifier: public Modifier {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use out-of-line definitions to prevent weak vtables.
|
} // end anonymous namespace
|
||||||
Modifier::~Modifier() {}
|
|
||||||
LoadModifier::~LoadModifier() {}
|
|
||||||
StoreModifier::~StoreModifier() {}
|
|
||||||
BinModifier::~BinModifier() {}
|
|
||||||
ConstModifier::~ConstModifier() {}
|
|
||||||
AllocaModifier::~AllocaModifier() {}
|
|
||||||
ExtractElementModifier::~ExtractElementModifier() {}
|
|
||||||
ShuffModifier::~ShuffModifier() {}
|
|
||||||
InsertElementModifier::~InsertElementModifier() {}
|
|
||||||
CastModifier::~CastModifier() {}
|
|
||||||
SelectModifier::~SelectModifier() {}
|
|
||||||
CmpModifier::~CmpModifier() {}
|
|
||||||
|
|
||||||
void FillFunction(Function *F, Random &R) {
|
static void FillFunction(Function *F, Random &R) {
|
||||||
// Create a legal entry block.
|
// Create a legal entry block.
|
||||||
BasicBlock *BB = BasicBlock::Create(F->getContext(), "BB", F);
|
BasicBlock *BB = BasicBlock::Create(F->getContext(), "BB", F);
|
||||||
ReturnInst::Create(F->getContext(), BB);
|
ReturnInst::Create(F->getContext(), BB);
|
||||||
@ -683,7 +657,7 @@ void FillFunction(Function *F, Random &R) {
|
|||||||
SM->ActN(5); // Throw in a few stores.
|
SM->ActN(5); // Throw in a few stores.
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntroduceControlFlow(Function *F, Random &R) {
|
static void IntroduceControlFlow(Function *F, Random &R) {
|
||||||
std::vector<Instruction*> BoolInst;
|
std::vector<Instruction*> BoolInst;
|
||||||
for (BasicBlock::iterator it = F->begin()->begin(),
|
for (BasicBlock::iterator it = F->begin()->begin(),
|
||||||
e = F->begin()->end(); it != e; ++it) {
|
e = F->begin()->end(); it != e; ++it) {
|
||||||
|
@ -10,14 +10,13 @@
|
|||||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace {
|
||||||
|
struct VirtualRefCounted : public llvm::RefCountedBaseVPTR {
|
||||||
struct VirtualRefCounted : public RefCountedBaseVPTR {
|
virtual void f() {}
|
||||||
virtual void f();
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
namespace llvm {
|
||||||
void VirtualRefCounted::f() {}
|
|
||||||
|
|
||||||
// Run this test with valgrind to detect memory leaks.
|
// Run this test with valgrind to detect memory leaks.
|
||||||
TEST(IntrusiveRefCntPtr, RefCountedBaseVPTRCopyDoesNotLeak) {
|
TEST(IntrusiveRefCntPtr, RefCountedBaseVPTRCopyDoesNotLeak) {
|
||||||
|
@ -59,6 +59,7 @@ static void roundTripDestroy(void *object) {
|
|||||||
delete static_cast<SectionMemoryManager*>(object);
|
delete static_cast<SectionMemoryManager*>(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
class MCJITCAPITest : public testing::Test, public MCJITTestAPICommon {
|
class MCJITCAPITest : public testing::Test, public MCJITTestAPICommon {
|
||||||
protected:
|
protected:
|
||||||
MCJITCAPITest() {
|
MCJITCAPITest() {
|
||||||
@ -83,8 +84,14 @@ protected:
|
|||||||
UnsupportedOSs.push_back(Triple::Cygwin);
|
UnsupportedOSs.push_back(Triple::Cygwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetUp();
|
virtual void SetUp() {
|
||||||
|
didCallAllocateCodeSection = false;
|
||||||
|
Module = 0;
|
||||||
|
Function = 0;
|
||||||
|
Engine = 0;
|
||||||
|
Error = 0;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
virtual void TearDown() {
|
||||||
if (Engine)
|
if (Engine)
|
||||||
LLVMDisposeExecutionEngine(Engine);
|
LLVMDisposeExecutionEngine(Engine);
|
||||||
@ -150,15 +157,7 @@ protected:
|
|||||||
LLVMExecutionEngineRef Engine;
|
LLVMExecutionEngineRef Engine;
|
||||||
char *Error;
|
char *Error;
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
void MCJITCAPITest::SetUp() {
|
|
||||||
didCallAllocateCodeSection = false;
|
|
||||||
Module = 0;
|
|
||||||
Function = 0;
|
|
||||||
Engine = 0;
|
|
||||||
Error = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(MCJITCAPITest, simple_function) {
|
TEST_F(MCJITCAPITest, simple_function) {
|
||||||
SKIP_UNSUPPORTED_PLATFORM;
|
SKIP_UNSUPPORTED_PLATFORM;
|
||||||
|
@ -18,16 +18,10 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {
|
|
||||||
public:
|
|
||||||
virtual ~MCJITMultipleModuleTest();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
MCJITMultipleModuleTest::~MCJITMultipleModuleTest() {}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
class MCJITMultipleModuleTest : public testing::Test, public MCJITTestBase {};
|
||||||
|
|
||||||
// FIXME: ExecutionEngine has no support empty modules
|
// FIXME: ExecutionEngine has no support empty modules
|
||||||
/*
|
/*
|
||||||
TEST_F(MCJITMultipleModuleTest, multiple_empty_modules) {
|
TEST_F(MCJITMultipleModuleTest, multiple_empty_modules) {
|
||||||
|
@ -18,19 +18,13 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
class MCJITTest : public testing::Test, public MCJITTestBase {
|
class MCJITTest : public testing::Test, public MCJITTestBase {
|
||||||
protected:
|
protected:
|
||||||
|
virtual void SetUp() { M.reset(createEmptyModule("<main>")); }
|
||||||
virtual void SetUp();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
void MCJITTest::SetUp() {
|
|
||||||
M.reset(createEmptyModule("<main>"));
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// FIXME: Ensure creating an execution engine does not crash when constructed
|
// FIXME: Ensure creating an execution engine does not crash when constructed
|
||||||
// with a null module.
|
// with a null module.
|
||||||
/*
|
/*
|
||||||
|
@ -36,17 +36,14 @@ static void dumpIdxVec(const SmallVectorImpl<unsigned> &V) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace {
|
||||||
// (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp.
|
// (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp.
|
||||||
struct InstrsOp : public SetTheory::Operator {
|
struct InstrsOp : public SetTheory::Operator {
|
||||||
virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
|
virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
|
||||||
ArrayRef<SMLoc> Loc);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
void InstrsOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
|
|
||||||
ArrayRef<SMLoc> Loc) {
|
ArrayRef<SMLoc> Loc) {
|
||||||
ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
|
ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// (instregex "OpcPat",...) Find all instructions matching an opcode pattern.
|
// (instregex "OpcPat",...) Find all instructions matching an opcode pattern.
|
||||||
//
|
//
|
||||||
@ -60,38 +57,35 @@ struct InstRegexOp : public SetTheory::Operator {
|
|||||||
const CodeGenTarget &Target;
|
const CodeGenTarget &Target;
|
||||||
InstRegexOp(const CodeGenTarget &t): Target(t) {}
|
InstRegexOp(const CodeGenTarget &t): Target(t) {}
|
||||||
|
|
||||||
virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
|
void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
|
||||||
ArrayRef<SMLoc> Loc);
|
ArrayRef<SMLoc> Loc) {
|
||||||
|
SmallVector<Regex*, 4> RegexList;
|
||||||
|
for (DagInit::const_arg_iterator
|
||||||
|
AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
|
||||||
|
StringInit *SI = dyn_cast<StringInit>(*AI);
|
||||||
|
if (!SI)
|
||||||
|
PrintFatalError(Loc, "instregex requires pattern string: "
|
||||||
|
+ Expr->getAsString());
|
||||||
|
std::string pat = SI->getValue();
|
||||||
|
// Implement a python-style prefix match.
|
||||||
|
if (pat[0] != '^') {
|
||||||
|
pat.insert(0, "^(");
|
||||||
|
pat.insert(pat.end(), ')');
|
||||||
|
}
|
||||||
|
RegexList.push_back(new Regex(pat));
|
||||||
|
}
|
||||||
|
for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
|
||||||
|
E = Target.inst_end(); I != E; ++I) {
|
||||||
|
for (SmallVectorImpl<Regex*>::iterator
|
||||||
|
RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
|
||||||
|
if ((*RI)->match((*I)->TheDef->getName()))
|
||||||
|
Elts.insert((*I)->TheDef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DeleteContainerPointers(RegexList);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
void InstRegexOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
|
|
||||||
ArrayRef<SMLoc> Loc) {
|
|
||||||
SmallVector<Regex*, 4> RegexList;
|
|
||||||
for (DagInit::const_arg_iterator
|
|
||||||
AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
|
|
||||||
StringInit *SI = dyn_cast<StringInit>(*AI);
|
|
||||||
if (!SI)
|
|
||||||
PrintFatalError(Loc, "instregex requires pattern string: "
|
|
||||||
+ Expr->getAsString());
|
|
||||||
std::string pat = SI->getValue();
|
|
||||||
// Implement a python-style prefix match.
|
|
||||||
if (pat[0] != '^') {
|
|
||||||
pat.insert(0, "^(");
|
|
||||||
pat.insert(pat.end(), ')');
|
|
||||||
}
|
|
||||||
RegexList.push_back(new Regex(pat));
|
|
||||||
}
|
|
||||||
for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
|
|
||||||
E = Target.inst_end(); I != E; ++I) {
|
|
||||||
for (SmallVectorImpl<Regex*>::iterator
|
|
||||||
RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
|
|
||||||
if ((*RI)->match((*I)->TheDef->getName()))
|
|
||||||
Elts.insert((*I)->TheDef);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DeleteContainerPointers(RegexList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// CodeGenModels ctor interprets machine model records and populates maps.
|
/// CodeGenModels ctor interprets machine model records and populates maps.
|
||||||
CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK,
|
CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK,
|
||||||
|
@ -43,12 +43,12 @@ Type::~Type() {}
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
class ExtendedIntegerType : public Type {
|
class ExtendedIntegerType : public Type {
|
||||||
unsigned BitWidth;
|
unsigned BitWidth;
|
||||||
public:
|
public:
|
||||||
explicit ExtendedIntegerType(unsigned bits)
|
explicit ExtendedIntegerType(unsigned bits)
|
||||||
: Type(TK_ExtendedIntegerType), BitWidth(bits) {}
|
: Type(TK_ExtendedIntegerType), BitWidth(bits) {}
|
||||||
virtual ~ExtendedIntegerType();
|
|
||||||
static bool classof(const Type *T) {
|
static bool classof(const Type *T) {
|
||||||
return T->getKind() == TK_ExtendedIntegerType;
|
return T->getKind() == TK_ExtendedIntegerType;
|
||||||
}
|
}
|
||||||
@ -60,16 +60,12 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
ExtendedIntegerType::~ExtendedIntegerType() {}
|
|
||||||
|
|
||||||
class ExtendedVectorType : public Type {
|
class ExtendedVectorType : public Type {
|
||||||
EVT ElementType;
|
EVT ElementType;
|
||||||
unsigned NumElements;
|
unsigned NumElements;
|
||||||
public:
|
public:
|
||||||
ExtendedVectorType(EVT elty, unsigned num)
|
ExtendedVectorType(EVT elty, unsigned num)
|
||||||
: Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
|
: Type(TK_ExtendedVectorType), ElementType(elty), NumElements(num) {}
|
||||||
virtual ~ExtendedVectorType();
|
|
||||||
static bool classof(const Type *T) {
|
static bool classof(const Type *T) {
|
||||||
return T->getKind() == TK_ExtendedVectorType;
|
return T->getKind() == TK_ExtendedVectorType;
|
||||||
}
|
}
|
||||||
@ -83,9 +79,7 @@ public:
|
|||||||
return NumElements;
|
return NumElements;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} // end anonymous namespace
|
||||||
// Provide out-of-line definition to prevent weak vtable.
|
|
||||||
ExtendedVectorType::~ExtendedVectorType() {}
|
|
||||||
|
|
||||||
static std::map<unsigned, const Type *>
|
static std::map<unsigned, const Type *>
|
||||||
ExtendedIntegerTypeMap;
|
ExtendedIntegerTypeMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user