mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
random cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54866 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@@ -41,39 +42,39 @@ namespace llvm {
|
|||||||
AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {}
|
AssemblyAnnotationWriter::~AssemblyAnnotationWriter() {}
|
||||||
|
|
||||||
/// This class provides computation of slot numbers for LLVM Assembly writing.
|
/// This class provides computation of slot numbers for LLVM Assembly writing.
|
||||||
/// @brief LLVM Assembly Writing Slot Computation.
|
///
|
||||||
class SlotMachine {
|
class SlotMachine {
|
||||||
|
|
||||||
/// @name Types
|
|
||||||
/// @{
|
|
||||||
public:
|
public:
|
||||||
|
/// ValueMap - A mapping of Values to slot numbers
|
||||||
/// @brief A mapping of Values to slot numbers
|
typedef std::map<const Value*, unsigned> ValueMap;
|
||||||
typedef std::map<const Value*,unsigned> ValueMap;
|
|
||||||
|
private:
|
||||||
/// @}
|
/// TheModule - The module for which we are holding slot numbers
|
||||||
/// @name Constructors
|
const Module* TheModule;
|
||||||
/// @{
|
|
||||||
|
/// TheFunction - The function for which we are holding slot numbers
|
||||||
|
const Function* TheFunction;
|
||||||
|
bool FunctionProcessed;
|
||||||
|
|
||||||
|
/// mMap - The TypePlanes map for the module level data
|
||||||
|
ValueMap mMap;
|
||||||
|
unsigned mNext;
|
||||||
|
|
||||||
|
/// fMap - The TypePlanes map for the function level data
|
||||||
|
ValueMap fMap;
|
||||||
|
unsigned fNext;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// @brief Construct from a module
|
/// Construct from a module
|
||||||
explicit SlotMachine(const Module *M);
|
explicit SlotMachine(const Module *M);
|
||||||
|
/// Construct from a function, starting out in incorp state.
|
||||||
/// @brief Construct from a function, starting out in incorp state.
|
|
||||||
explicit SlotMachine(const Function *F);
|
explicit SlotMachine(const Function *F);
|
||||||
|
|
||||||
/// @}
|
|
||||||
/// @name Accessors
|
|
||||||
/// @{
|
|
||||||
public:
|
|
||||||
/// Return the slot number of the specified value in it's type
|
/// Return the slot number of the specified value in it's type
|
||||||
/// plane. If something is not in the SlotMachine, return -1.
|
/// plane. If something is not in the SlotMachine, return -1.
|
||||||
int getLocalSlot(const Value *V);
|
int getLocalSlot(const Value *V);
|
||||||
int getGlobalSlot(const GlobalValue *V);
|
int getGlobalSlot(const GlobalValue *V);
|
||||||
|
|
||||||
/// @}
|
|
||||||
/// @name Mutators
|
|
||||||
/// @{
|
|
||||||
public:
|
|
||||||
/// If you'd like to deal with a function instead of just a module, use
|
/// If you'd like to deal with a function instead of just a module, use
|
||||||
/// this method to get its data into the SlotMachine.
|
/// this method to get its data into the SlotMachine.
|
||||||
void incorporateFunction(const Function *F) {
|
void incorporateFunction(const Function *F) {
|
||||||
@@ -86,9 +87,7 @@ public:
|
|||||||
/// will reset the state of the machine back to just the module contents.
|
/// will reset the state of the machine back to just the module contents.
|
||||||
void purgeFunction();
|
void purgeFunction();
|
||||||
|
|
||||||
/// @}
|
// Implementation Details
|
||||||
/// @name Implementation Details
|
|
||||||
/// @{
|
|
||||||
private:
|
private:
|
||||||
/// This function does the actual initialization.
|
/// This function does the actual initialization.
|
||||||
inline void initialize();
|
inline void initialize();
|
||||||
@@ -108,29 +107,6 @@ private:
|
|||||||
|
|
||||||
SlotMachine(const SlotMachine &); // DO NOT IMPLEMENT
|
SlotMachine(const SlotMachine &); // DO NOT IMPLEMENT
|
||||||
void operator=(const SlotMachine &); // DO NOT IMPLEMENT
|
void operator=(const SlotMachine &); // DO NOT IMPLEMENT
|
||||||
|
|
||||||
/// @}
|
|
||||||
/// @name Data
|
|
||||||
/// @{
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// @brief The module for which we are holding slot numbers
|
|
||||||
const Module* TheModule;
|
|
||||||
|
|
||||||
/// @brief The function for which we are holding slot numbers
|
|
||||||
const Function* TheFunction;
|
|
||||||
bool FunctionProcessed;
|
|
||||||
|
|
||||||
/// @brief The TypePlanes map for the module level data
|
|
||||||
ValueMap mMap;
|
|
||||||
unsigned mNext;
|
|
||||||
|
|
||||||
/// @brief The TypePlanes map for the function level data
|
|
||||||
ValueMap fMap;
|
|
||||||
unsigned fNext;
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
@@ -461,7 +437,6 @@ static const char *getPredicateText(unsigned predicate) {
|
|||||||
return pred;
|
return pred;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Internal constant writer.
|
|
||||||
static void WriteConstantInt(std::ostream &Out, const Constant *CV,
|
static void WriteConstantInt(std::ostream &Out, const Constant *CV,
|
||||||
std::map<const Type *, std::string> &TypeTable,
|
std::map<const Type *, std::string> &TypeTable,
|
||||||
SlotMachine *Machine) {
|
SlotMachine *Machine) {
|
||||||
@@ -1549,7 +1524,7 @@ SlotMachine::SlotMachine(const Module *M)
|
|||||||
: TheModule(M) ///< Saved for lazy initialization.
|
: TheModule(M) ///< Saved for lazy initialization.
|
||||||
, TheFunction(0)
|
, TheFunction(0)
|
||||||
, FunctionProcessed(false)
|
, FunctionProcessed(false)
|
||||||
, mMap(), mNext(0), fMap(), fNext(0)
|
, mNext(0), fMap(), fNext(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1559,7 +1534,7 @@ SlotMachine::SlotMachine(const Function *F)
|
|||||||
: TheModule(F ? F->getParent() : 0) ///< Saved for lazy initialization
|
: TheModule(F ? F->getParent() : 0) ///< Saved for lazy initialization
|
||||||
, TheFunction(F) ///< Saved for lazy initialization
|
, TheFunction(F) ///< Saved for lazy initialization
|
||||||
, FunctionProcessed(false)
|
, FunctionProcessed(false)
|
||||||
, mMap(), mNext(0), fMap(), fNext(0)
|
, mNext(0), fMap(), fNext(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1672,8 +1647,8 @@ void SlotMachine::CreateModuleSlot(const GlobalValue *V) {
|
|||||||
DestSlot << " [");
|
DestSlot << " [");
|
||||||
// G = Global, F = Function, A = Alias, o = other
|
// G = Global, F = Function, A = Alias, o = other
|
||||||
SC_DEBUG((isa<GlobalVariable>(V) ? 'G' :
|
SC_DEBUG((isa<GlobalVariable>(V) ? 'G' :
|
||||||
(isa<Function> ? 'F' :
|
(isa<Function>(V) ? 'F' :
|
||||||
(isa<GlobalAlias> ? 'A' : 'o'))) << "]\n");
|
(isa<GlobalAlias>(V) ? 'A' : 'o'))) << "]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user