and work better with VC++. Patch contributed by Morten Ofstad!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17281
91177308-0d34-0410-b5e6-
96231b3b80d8
35 files changed:
class DerivedType;
class AbstractTypeUser {
class DerivedType;
class AbstractTypeUser {
class AliasSet {
friend class AliasSetTracker;
class AliasSet {
friend class AliasSetTracker;
typedef std::pair<Value* const, PointerRec> HashNodePair;
class PointerRec {
typedef std::pair<Value* const, PointerRec> HashNodePair;
class PointerRec {
// Volatile - True if this alias set contains volatile loads or stores.
bool Volatile : 1;
// Volatile - True if this alias set contains volatile loads or stores.
bool Volatile : 1;
- friend class ilist_traits<AliasSet>;
+ friend struct ilist_traits<AliasSet>;
AliasSet *getPrev() const { return Prev; }
AliasSet *getNext() const { return Next; }
void setPrev(AliasSet *P) { Prev = P; }
AliasSet *getPrev() const { return Prev; }
AliasSet *getNext() const { return Next; }
void setPrev(AliasSet *P) { Prev = P; }
/// doubly-linked ilist in the DSGraph.
///
DSNode *Next, *Prev;
/// doubly-linked ilist in the DSGraph.
///
DSNode *Next, *Prev;
- friend class ilist_traits<DSNode>;
+ friend struct ilist_traits<DSNode>;
/// Size - The current size of the node. This should be equal to the size of
/// the current type record.
/// Size - The current size of the node. This should be equal to the size of
/// the current type record.
Node *RootNode;
public:
class Node {
Node *RootNode;
public:
class Node {
- friend class DominatorTree;
- friend class PostDominatorTree;
- friend class DominatorTreeBase;
+ friend struct DominatorTree;
+ friend struct PostDominatorTree;
+ friend struct DominatorTreeBase;
BasicBlock *TheBB;
Node *IDom;
std::vector<Node*> Children;
BasicBlock *TheBB;
Node *IDom;
std::vector<Node*> Children;
class LoopInfo;
class PHINode;
class Instruction;
class LoopInfo;
class PHINode;
class Instruction;
static iplist<Instruction> &getList(BasicBlock *BB);
};
static iplist<Instruction> &getList(BasicBlock *BB);
};
-struct BasicBlock : public Value { // Basic blocks are data objects also
+class BasicBlock : public Value { // Basic blocks are data objects also
+public:
typedef iplist<Instruction> InstListType;
private :
InstListType InstList;
typedef iplist<Instruction> InstListType;
private :
InstListType InstList;
// ilist_traits
template <>
// ilist_traits
template <>
-class ilist_traits<MachineInstr> {
+struct ilist_traits<MachineInstr> {
+protected:
// this is only set by the MachineBasicBlock owning the ilist
friend class MachineBasicBlock;
MachineBasicBlock* parent;
// this is only set by the MachineBasicBlock owning the ilist
friend class MachineBasicBlock;
MachineBasicBlock* parent;
int getNumber() const { return Number; }
private: // Methods used to maintain doubly linked list of blocks...
int getNumber() const { return Number; }
private: // Methods used to maintain doubly linked list of blocks...
- friend class ilist_traits<MachineBasicBlock>;
+ friend struct ilist_traits<MachineBasicBlock>;
MachineBasicBlock *getPrev() const { return Prev; }
MachineBasicBlock *getNext() const { return Next; }
MachineBasicBlock *getPrev() const { return Prev; }
MachineBasicBlock *getNext() const { return Next; }
class GlobalValue;
class Function;
class GlobalValue;
class Function;
-struct MachineCodeEmitter {
+class MachineCodeEmitter {
+public:
virtual ~MachineCodeEmitter() {}
/// startFunction - This callback is invoked when the specified function is
virtual ~MachineCodeEmitter() {}
/// startFunction - This callback is invoked when the specified function is
// ilist_traits
template <>
// ilist_traits
template <>
-class ilist_traits<MachineBasicBlock> {
+struct ilist_traits<MachineBasicBlock> {
// this is only set by the MachineFunction owning the ilist
friend class MachineFunction;
MachineFunction* Parent;
// this is only set by the MachineFunction owning the ilist
friend class MachineFunction;
MachineFunction* Parent;
class TargetMachine;
class GlobalValue;
class TargetMachine;
class GlobalValue;
-template <typename T> class ilist_traits;
-template <typename T> class ilist;
+template <typename T> struct ilist_traits;
+template <typename T> struct ilist;
typedef short MachineOpCode;
typedef short MachineOpCode;
// Intrusive list support
//
// Intrusive list support
//
- friend class ilist_traits<MachineInstr>;
+ friend struct ilist_traits<MachineInstr>;
public:
MachineInstr(short Opcode, unsigned numOperands);
public:
MachineInstr(short Opcode, unsigned numOperands);
class PointerType;
//===----------------------------------------------------------------------===//
class PointerType;
//===----------------------------------------------------------------------===//
/// UnwindInst - Immediately exit the current function, unwinding the stack
/// until an invoke instruction is found.
///
/// UnwindInst - Immediately exit the current function, unwinding the stack
/// until an invoke instruction is found.
///
-struct UnwindInst : public TerminatorInst {
+class UnwindInst : public TerminatorInst {
+public:
UnwindInst(Instruction *InsertBefore = 0)
: TerminatorInst(Instruction::Unwind, InsertBefore) {
}
UnwindInst(Instruction *InsertBefore = 0)
: TerminatorInst(Instruction::Unwind, InsertBefore) {
}
/// presence of this instruction indicates some higher level knowledge that the
/// end of the block cannot be reached.
///
/// presence of this instruction indicates some higher level knowledge that the
/// end of the block cannot be reached.
///
-struct UnreachableInst : public TerminatorInst {
+class UnreachableInst : public TerminatorInst {
+public:
UnreachableInst(Instruction *InsertBefore = 0)
: TerminatorInst(Instruction::Unreachable, InsertBefore) {
}
UnreachableInst(Instruction *InsertBefore = 0)
: TerminatorInst(Instruction::Unreachable, InsertBefore) {
}
namespace llvm {
class Value;
namespace llvm {
class Value;
class Function;
class Module;
class AnalysisUsage;
class Function;
class Module;
class AnalysisUsage;
/// constrained passes described below.
///
class Pass {
/// constrained passes described below.
///
class Pass {
- friend class AnalysisResolver;
+ friend struct AnalysisResolver;
AnalysisResolver *Resolver; // AnalysisResolver this pass is owned by...
const PassInfo *PassInfoCache;
AnalysisResolver *Resolver; // AnalysisResolver this pass is owned by...
const PassInfo *PassInfoCache;
/// interprocedural optimizations and analyses. ModulePass's may do anything
/// they want to the program.
///
/// interprocedural optimizations and analyses. ModulePass's may do anything
/// they want to the program.
///
-struct ModulePass : public Pass {
-
+class ModulePass : public Pass {
+public:
/// runOnModule - Virtual method overriden by subclasses to process the module
/// being operated on.
virtual bool runOnModule(Module &M) = 0;
/// runOnModule - Virtual method overriden by subclasses to process the module
/// being operated on.
virtual bool runOnModule(Module &M) = 0;
/// not need to be run. This is useful for things like target information and
/// "basic" versions of AnalysisGroups.
///
/// not need to be run. This is useful for things like target information and
/// "basic" versions of AnalysisGroups.
///
-struct ImmutablePass : public ModulePass {
+class ImmutablePass : public ModulePass {
+public:
/// initializePass - This method may be overriden by immutable passes to allow
/// them to perform various initialization actions they require. This is
/// primarily because an ImmutablePass can "require" another ImmutablePass,
/// initializePass - This method may be overriden by immutable passes to allow
/// them to perform various initialization actions they require. This is
/// primarily because an ImmutablePass can "require" another ImmutablePass,
/// 2. Optimizing a function does not cause the addition or removal of any
/// functions in the module
///
/// 2. Optimizing a function does not cause the addition or removal of any
/// functions in the module
///
-struct FunctionPass : public ModulePass {
+class FunctionPass : public ModulePass {
+public:
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary per-module initialization.
///
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary per-module initialization.
///
class AnnotationID;
class Annotation;
class Annotable;
class AnnotationID;
class Annotation;
class Annotable;
-class AnnotationManager;
+struct AnnotationManager;
//===----------------------------------------------------------------------===//
//
//===----------------------------------------------------------------------===//
//
// freely around and passed byvalue with little or no overhead.
//
class AnnotationID {
// freely around and passed byvalue with little or no overhead.
//
class AnnotationID {
- friend class AnnotationManager;
+ friend struct AnnotationManager;
unsigned ID;
AnnotationID(); // Default ctor is disabled
unsigned ID;
AnnotationID(); // Default ctor is disabled
// parser<bool>
//
template<>
// parser<bool>
//
template<>
-struct parser<bool> : public basic_parser<bool> {
-
+class parser<bool> : public basic_parser<bool> {
+public:
// parse - Return true on error.
bool parse(Option &O, const char *ArgName, const std::string &Arg, bool &Val);
// parse - Return true on error.
bool parse(Option &O, const char *ArgName, const std::string &Arg, bool &Val);
// parser<int>
//
template<>
// parser<int>
//
template<>
-struct parser<int> : public basic_parser<int> {
-
+class parser<int> : public basic_parser<int> {
+public:
// parse - Return true on error.
bool parse(Option &O, const char *ArgName, const std::string &Arg, int &Val);
// parse - Return true on error.
bool parse(Option &O, const char *ArgName, const std::string &Arg, int &Val);
// parser<unsigned>
//
template<>
// parser<unsigned>
//
template<>
-struct parser<unsigned> : public basic_parser<unsigned> {
-
+class parser<unsigned> : public basic_parser<unsigned> {
+public:
// parse - Return true on error.
bool parse(Option &O, const char *AN, const std::string &Arg, unsigned &Val);
// parse - Return true on error.
bool parse(Option &O, const char *AN, const std::string &Arg, unsigned &Val);
// parser<double>
//
template<>
// parser<double>
//
template<>
-struct parser<double> : public basic_parser<double> {
+class parser<double> : public basic_parser<double> {
+public:
// parse - Return true on error.
bool parse(Option &O, const char *AN, const std::string &Arg, double &Val);
// parse - Return true on error.
bool parse(Option &O, const char *AN, const std::string &Arg, double &Val);
// parser<float>
//
template<>
// parser<float>
//
template<>
-struct parser<float> : public basic_parser<float> {
+class parser<float> : public basic_parser<float> {
+public:
// parse - Return true on error.
bool parse(Option &O, const char *AN, const std::string &Arg, float &Val);
// parse - Return true on error.
bool parse(Option &O, const char *AN, const std::string &Arg, float &Val);
// parser<std::string>
//
template<>
// parser<std::string>
//
template<>
-struct parser<std::string> : public basic_parser<std::string> {
+class parser<std::string> : public basic_parser<std::string> {
+public:
// parse - Return true on error.
bool parse(Option &O, const char *AN, const std::string &Arg,
std::string &Value) {
// parse - Return true on error.
bool parse(Option &O, const char *AN, const std::string &Arg,
std::string &Value) {
// object in all cases that it is used.
//
template<class DataType>
// object in all cases that it is used.
//
template<class DataType>
-struct opt_storage<DataType,false,true> : public DataType {
-
+class opt_storage<DataType,false,true> : public DataType {
+public:
template<class T>
void setValue(const T &V) { DataType::operator=(V); }
template<class T>
void setValue(const T &V) { DataType::operator=(V); }
// to get at the value.
//
template<class DataType>
// to get at the value.
//
template<class DataType>
-struct opt_storage<DataType, false, false> {
+class opt_storage<DataType, false, false> {
+public:
DataType Value;
// Make sure we initialize the value with the default constructor for the
DataType Value;
// Make sure we initialize the value with the default constructor for the
// object in all cases that it is used.
//
template<class DataType>
// object in all cases that it is used.
//
template<class DataType>
-struct list_storage<DataType, bool> : public std::vector<DataType> {
-
+class list_storage<DataType, bool> : public std::vector<DataType> {
+public:
template<class T>
void addValue(const T &V) { push_back(V); }
};
template<class T>
void addValue(const T &V) { push_back(V); }
};
/// from DefaultDOTGraphTraits if you don't need to override everything.
///
template <typename Ty>
/// from DefaultDOTGraphTraits if you don't need to override everything.
///
template <typename Ty>
-class DOTGraphTraits : public DefaultDOTGraphTraits {};
+struct DOTGraphTraits : public DefaultDOTGraphTraits {};
/// Forward declare a class used for holding platform specific information
/// that needs to be
/// Forward declare a class used for holding platform specific information
/// that needs to be
/// This class provides an abstraction for a memory mapped file in the
/// operating system's filesystem. It provides platform independent operations
/// This class provides an abstraction for a memory mapped file in the
/// operating system's filesystem. It provides platform independent operations
// This object is used to lazily calculate structure layout information for a
// target machine, based on the TargetData structure.
//
// This object is used to lazily calculate structure layout information for a
// target machine, based on the TargetData structure.
//
+class StructLayout {
+public:
std::vector<uint64_t> MemberOffsets;
uint64_t StructSize;
unsigned StructAlignment;
std::vector<uint64_t> MemberOffsets;
uint64_t StructSize;
unsigned StructAlignment;
/// The offset to the local area is the offset from the stack pointer on
/// function entry to the first location where function data (local variables,
/// spill locations) can be stored.
/// The offset to the local area is the offset from the stack pointer on
/// function entry to the first location where function data (local variables,
/// spill locations) can be stored.
-struct TargetFrameInfo {
+class TargetFrameInfo {
+public:
enum StackDirection {
StackGrowsUp, // Adding to the stack increases the stack address
StackGrowsDown // Adding to the stack decreases the stack address
enum StackDirection {
StackGrowsUp, // Adding to the stack increases the stack address
StackGrowsDown // Adding to the stack decreases the stack address
// before control flow occurs.
const unsigned M_TERMINATOR_FLAG = 1 << 16;
// before control flow occurs.
const unsigned M_TERMINATOR_FLAG = 1 << 16;
-struct TargetInstrDescriptor {
+class TargetInstrDescriptor {
+public:
const char * Name; // Assembly language mnemonic for the opcode.
int numOperands; // Number of args; -1 if variable #args
int resultPos; // Position of the result; -1 if no result
const char * Name; // Assembly language mnemonic for the opcode.
int numOperands; // Number of args; -1 if variable #args
int resultPos; // Position of the result; -1 if no result
/// TargetSchedInfo - Common interface to machine information for
/// instruction scheduling
///
/// TargetSchedInfo - Common interface to machine information for
/// instruction scheduling
///
-struct TargetSchedInfo {
+class TargetSchedInfo {
+public:
const TargetMachine& target;
unsigned maxNumIssueTotal;
const TargetMachine& target;
unsigned maxNumIssueTotal;
namespace llvm {
class BasicBlock;
namespace llvm {
class BasicBlock;
class Function;
class Loop;
class Function;
class Loop;
namespace llvm {
class AllocaInst;
namespace llvm {
class AllocaInst;
-class DominatorTree;
-class DominanceFrontier;
+struct DominatorTree;
+struct DominanceFrontier;
class TargetData;
class AliasSetTracker;
class TargetData;
class AliasSetTracker;
Value *Val;
User *U;
Use *Prev, *Next;
Value *Val;
User *U;
Use *Prev, *Next;
- friend class ilist_traits<Use>;
+ friend struct ilist_traits<Use>;
public:
inline Use(Value *v, User *user);
inline Use(const Use &u);
public:
inline Use(Value *v, User *user);
inline Use(const Use &u);
class Constant;
class Argument;
class Instruction;
class Constant;
class Argument;
class Instruction;
class GlobalValue;
class Function;
class GlobalVariable;
class GlobalValue;
class Function;
class GlobalVariable;
#include "llvm/Instruction.def"
class InstCount : public FunctionPass, public InstVisitor<InstCount> {
#include "llvm/Instruction.def"
class InstCount : public FunctionPass, public InstVisitor<InstCount> {
- friend class InstVisitor<InstCount>;
+ friend struct InstVisitor<InstCount>;
void visitFunction (Function &F) { ++TotalFuncs; }
void visitBasicBlock(BasicBlock &BB) { ++TotalBlocks; }
void visitFunction (Function &F) { ++TotalFuncs; }
void visitBasicBlock(BasicBlock &BB) { ++TotalBlocks; }
- friend class SCEVVisitor<SCEVExpander, Value*>;
+ friend struct SCEVVisitor<SCEVExpander, Value*>;
public:
SCEVExpander(ScalarEvolution &se, LoopInfo &li) : SE(se), LI(li) {}
public:
SCEVExpander(ScalarEvolution &se, LoopInfo &li) : SE(se), LI(li) {}
// The implementation of this class
//
private:
// The implementation of this class
//
private:
- friend class InstVisitor<SCCP>; // Allow callbacks from visitor
+ friend struct InstVisitor<SCCP>; // Allow callbacks from visitor
// markConstant - Make a value be marked as "constant". If the value
// is not already a constant, add it to the instruction work list so that
// markConstant - Make a value be marked as "constant". If the value
// is not already a constant, add it to the instruction work list so that
typedef std::map<const Value*, const Type*> ValueTypeCache;
typedef std::map<const Value*, const Type*> ValueTypeCache;
+class ValueMapCache {
+public:
// Operands mapped - Contains an entry if the first value (the user) has had
// the second value (the operand) mapped already.
//
// Operands mapped - Contains an entry if the first value (the user) has had
// the second value (the operand) mapped already.
//
namespace llvm {
class Value;
class Constant;
namespace llvm {
class Value;
class Constant;
// Constant fold various types of instruction...
Constant *ConstantFoldCastInstruction(const Constant *V, const Type *DestTy);
// Constant fold various types of instruction...
Constant *ConstantFoldCastInstruction(const Constant *V, const Type *DestTy);
namespace llvm {
class Value;
class Constant;
namespace llvm {
class Value;
class Constant;
// Constant fold various types of instruction...
Constant *ConstantFoldCastInstruction(const Constant *V, const Type *DestTy);
// Constant fold various types of instruction...
Constant *ConstantFoldCastInstruction(const Constant *V, const Type *DestTy);
// This pass manager is used to group together all of the BasicBlockPass's
// into a single unit.
//
// This pass manager is used to group together all of the BasicBlockPass's
// into a single unit.
//
-template<> struct PassManagerTraits<BasicBlock> : public BasicBlockPass {
+template<> class PassManagerTraits<BasicBlock> : public BasicBlockPass {
+public:
// PassClass - The type of passes tracked by this PassManager
typedef BasicBlockPass PassClass;
// PassClass - The type of passes tracked by this PassManager
typedef BasicBlockPass PassClass;
// This pass manager is used to group together all of the FunctionPass's
// into a single unit.
//
// This pass manager is used to group together all of the FunctionPass's
// into a single unit.
//
-template<> struct PassManagerTraits<Function> : public FunctionPass {
+template<> class PassManagerTraits<Function> : public FunctionPass {
+public:
// PassClass - The type of passes tracked by this PassManager
typedef FunctionPass PassClass;
// PassClass - The type of passes tracked by this PassManager
typedef FunctionPass PassClass;
//
// This is the top level PassManager implementation that holds generic passes.
//
//
// This is the top level PassManager implementation that holds generic passes.
//
-template<> struct PassManagerTraits<Module> : public ModulePass {
+template<> class PassManagerTraits<Module> : public ModulePass {
+public:
// PassClass - The type of passes tracked by this PassManager
typedef ModulePass PassClass;
// PassClass - The type of passes tracked by this PassManager
typedef ModulePass PassClass;
class Record;
class RecordKeeper;
class Record;
class RecordKeeper;
/// getValueType - Return the MVT::ValueType that the specified TableGen record
/// corresponds to.
/// getValueType - Return the MVT::ValueType that the specified TableGen record
/// corresponds to.
class StringInit;
class IntInit;
class ListInit;
class StringInit;
class IntInit;
class ListInit;
-class CodeGenInstruction;
+struct CodeGenInstruction;
class InstrInfoEmitter : public TableGenBackend {
RecordKeeper &Records;
class InstrInfoEmitter : public TableGenBackend {
RecordKeeper &Records;
namespace llvm {
class DagInit;
namespace llvm {
class DagInit;
class InstrSelectorEmitter;
/// NodeType - Represents Information parsed from the DagNode entries.
class InstrSelectorEmitter;
/// NodeType - Represents Information parsed from the DagNode entries.
class RecordRecTy;
// Init subclasses...
class RecordRecTy;
// Init subclasses...
class UnsetInit;
class BitInit;
class BitsInit;
class UnsetInit;
class BitInit;
class BitsInit;
/// BitRecTy - 'bit' - Represent a single bit
///
/// BitRecTy - 'bit' - Represent a single bit
///
-struct BitRecTy : public RecTy {
+class BitRecTy : public RecTy {
+public:
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue(BitInit *BI) { return (Init*)BI; }
Init *convertValue(BitsInit *BI);
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue(BitInit *BI) { return (Init*)BI; }
Init *convertValue(BitsInit *BI);
/// IntRecTy - 'int' - Represent an integer value of no particular size
///
/// IntRecTy - 'int' - Represent an integer value of no particular size
///
-struct IntRecTy : public RecTy {
+class IntRecTy : public RecTy {
+public:
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue(IntInit *II) { return (Init*)II; }
Init *convertValue(BitInit *BI);
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue(IntInit *II) { return (Init*)II; }
Init *convertValue(BitInit *BI);
/// StringRecTy - 'string' - Represent an string value
///
/// StringRecTy - 'string' - Represent an string value
///
-struct StringRecTy : public RecTy {
+class StringRecTy : public RecTy {
+public:
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue(StringInit *SI) { return (Init*)SI; }
Init *convertValue(TypedInit *TI);
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue(StringInit *SI) { return (Init*)SI; }
Init *convertValue(TypedInit *TI);
/// CodeRecTy - 'code' - Represent an code fragment, function or method.
///
/// CodeRecTy - 'code' - Represent an code fragment, function or method.
///
-struct CodeRecTy : public RecTy {
+class CodeRecTy : public RecTy {
+public:
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue( CodeInit *CI) { return (Init*)CI; }
Init *convertValue(TypedInit *TI);
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue( CodeInit *CI) { return (Init*)CI; }
Init *convertValue(TypedInit *TI);
/// DagRecTy - 'dag' - Represent a dag fragment
///
/// DagRecTy - 'dag' - Represent a dag fragment
///
-struct DagRecTy : public RecTy {
+class DagRecTy : public RecTy {
+public:
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue( DagInit *CI) { return (Init*)CI; }
Init *convertValue(TypedInit *TI);
Init *convertValue(UnsetInit *UI) { return (Init*)UI; }
Init *convertValue( DagInit *CI) { return (Init*)CI; }
Init *convertValue(TypedInit *TI);
/// UnsetInit - ? - Represents an uninitialized value
///
/// UnsetInit - ? - Represents an uninitialized value
///
-struct UnsetInit : public Init {
+class UnsetInit : public Init {
+public:
virtual Init *convertInitializerTo(RecTy *Ty) {
return Ty->convertValue(this);
}
virtual Init *convertInitializerTo(RecTy *Ty) {
return Ty->convertValue(this);
}