[llvm-commits] [vector_llvm] CVS: llvm/include/llvm/Support/CommandLine.h DataTypes.h.in Mangler.h
Robert Bocchino
bocchino at cs.uiuc.edu
Wed Nov 16 10:32:07 PST 2005
Changes in directory llvm/include/llvm/Support:
CommandLine.h updated: 1.49 -> 1.49.2.1
DataTypes.h.in updated: 1.20 -> 1.20.2.1
Mangler.h updated: 1.14 -> 1.14.2.1
---
Log message:
Merged mainline into Vector LLVM branch
---
Diffs of the changes: (+59 -18)
CommandLine.h | 5 ++--
DataTypes.h.in | 7 ++++++
Mangler.h | 65 ++++++++++++++++++++++++++++++++++++++++++---------------
3 files changed, 59 insertions(+), 18 deletions(-)
Index: llvm/include/llvm/Support/CommandLine.h
diff -u llvm/include/llvm/Support/CommandLine.h:1.49 llvm/include/llvm/Support/CommandLine.h:1.49.2.1
--- llvm/include/llvm/Support/CommandLine.h:1.49 Thu Oct 13 19:33:05 2005
+++ llvm/include/llvm/Support/CommandLine.h Wed Nov 16 12:31:56 2005
@@ -21,6 +21,7 @@
#define LLVM_SUPPORT_COMMANDLINE_H
#include "llvm/Support/type_traits.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
#include <vector>
#include <utility>
@@ -334,8 +335,8 @@
};
template<class DataType>
-ValuesClass<DataType> values(const char *Arg, DataType Val, const char *Desc,
- ...) {
+ValuesClass<DataType> END_WITH_NULL values(const char *Arg, DataType Val,
+ const char *Desc, ...) {
va_list ValueArgs;
va_start(ValueArgs, Desc);
ValuesClass<DataType> Vals(Arg, Val, Desc, ValueArgs);
Index: llvm/include/llvm/Support/DataTypes.h.in
diff -u llvm/include/llvm/Support/DataTypes.h.in:1.20 llvm/include/llvm/Support/DataTypes.h.in:1.20.2.1
--- llvm/include/llvm/Support/DataTypes.h.in:1.20 Wed Jul 27 00:53:43 2005
+++ llvm/include/llvm/Support/DataTypes.h.in Wed Nov 16 12:31:56 2005
@@ -67,6 +67,7 @@
// Visual C++ doesn't provide standard integer headers, but it does provide
// built-in data types.
#include <stddef.h>
+#include <sys/types.h>
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef signed int int32_t;
@@ -98,4 +99,10 @@
# define UINT64_MAX 0xffffffffffffffffULL
#endif
+#if __GNUC__ > 3
+#define END_WITH_NULL __attribute__((sentinel))
+#else
+#define END_WITH_NULL
+#endif
+
#endif /* SUPPORT_DATATYPES_H */
Index: llvm/include/llvm/Support/Mangler.h
diff -u llvm/include/llvm/Support/Mangler.h:1.14 llvm/include/llvm/Support/Mangler.h:1.14.2.1
--- llvm/include/llvm/Support/Mangler.h:1.14 Sat Sep 24 03:23:53 2005
+++ llvm/include/llvm/Support/Mangler.h Wed Nov 16 12:31:56 2005
@@ -19,35 +19,65 @@
#include <string>
namespace llvm {
-class Value;
class Type;
class Module;
+class Value;
class GlobalValue;
class Mangler {
- /// This keeps track of which global values have had their names
- /// mangled in the current module.
- ///
- std::set<const Value *> MangledGlobals;
-
- Module &M;
+ /// Prefix - This string is added to each symbol that is emitted, unless the
+ /// symbol is marked as not needing this prefix.
const char *Prefix;
+
+ /// UseQuotes - If this is set, the target accepts global names in quotes,
+ /// e.g. "foo bar" is a legal name. This syntax is used instead of escaping
+ /// the space character. By default, this is false.
+ bool UseQuotes;
+
+ /// Memo - This is used to remember the name that we assign a value.
+ ///
+ std::map<const Value*, std::string> Memo;
- unsigned TypeCounter;
- std::map<const Type*, unsigned> TypeMap;
-
- typedef std::map<const Value *, std::string> ValueMap;
- ValueMap Memo;
-
+ /// Count - This simple counter is used to unique value names.
+ ///
unsigned Count;
+
+ /// TypeMap - If the client wants us to unique types, this keeps track of the
+ /// current assignments and TypeCounter keeps track of the next id to assign.
+ std::map<const Type*, unsigned> TypeMap;
+ unsigned TypeCounter;
- void InsertName(GlobalValue *GV, std::map<std::string, GlobalValue*> &Names);
+ /// This keeps track of which global values have had their names
+ /// mangled in the current module.
+ ///
+ std::set<const GlobalValue*> MangledGlobals;
+
+ /// AcceptableChars - This bitfield contains a one for each character that is
+ /// allowed to be part of an unmangled name.
+ unsigned AcceptableChars[256/32];
public:
// Mangler ctor - if a prefix is specified, it will be prepended onto all
// symbols.
Mangler(Module &M, const char *Prefix = "");
+ /// setUseQuotes - If UseQuotes is set to true, this target accepts quoted
+ /// strings for assembler labels.
+ void setUseQuotes(bool Val) { UseQuotes = Val; }
+
+ /// Acceptable Characters - This allows the target to specify which characters
+ /// are acceptable to the assembler without being mangled. By default we
+ /// allow letters, numbers, '_', '$', and '.', which is what GAS accepts.
+ void markCharAcceptable(unsigned char X) {
+ AcceptableChars[X/32] |= 1 << (X&31);
+ }
+ void markCharUnacceptable(unsigned char X) {
+ AcceptableChars[X/32] &= ~(1 << (X&31));
+ }
+ bool isCharAcceptable(unsigned char X) const {
+ return (AcceptableChars[X/32] & (1 << (X&31))) != 0;
+ }
+
/// getTypeID - Return a unique ID for the specified LLVM type.
///
unsigned getTypeID(const Type *Ty);
@@ -55,6 +85,7 @@
/// getValueName - Returns the mangled name of V, an LLVM Value,
/// in the current module.
///
+ std::string getValueName(const GlobalValue *V);
std::string getValueName(const Value *V);
/// makeNameProper - We don't want identifier names with ., space, or
@@ -64,8 +95,10 @@
/// does this for you, so there's no point calling it on the result
/// from getValueName.
///
- static std::string makeNameProper(const std::string &x,
- const char *Prefix = "");
+ std::string makeNameProper(const std::string &x, const char *Prefix = "");
+
+private:
+ void InsertName(GlobalValue *GV, std::map<std::string, GlobalValue*> &Names);
};
} // End llvm namespace
More information about the llvm-commits
mailing list