summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Config/config.h.cmake2
-rw-r--r--include/llvm/MC/MCImm.h55
-rw-r--r--include/llvm/MC/MCInst.h7
-rw-r--r--include/llvm/Support/Timer.h21
-rw-r--r--include/llvm/System/Atomic.h14
-rw-r--r--include/llvm/Target/TargetSelect.h6
-rw-r--r--include/llvm/Type.h8
7 files changed, 86 insertions, 27 deletions
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index c59ed23..4356e7d 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -582,4 +582,4 @@
#cmakedefine strdup ${strdup}
/* Native LLVM architecture */
-#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}
+#cmakedefine LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}Target
diff --git a/include/llvm/MC/MCImm.h b/include/llvm/MC/MCImm.h
new file mode 100644
index 0000000..5b1efd8
--- /dev/null
+++ b/include/llvm/MC/MCImm.h
@@ -0,0 +1,55 @@
+//===-- llvm/MC/MCImm.h - MCImm class ---------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the declaration of the MCInst and MCOperand classes, which
+// is the basic representation used to represent low-level machine code
+// instructions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCIMM_H
+#define LLVM_MC_MCIMM_H
+
+namespace llvm {
+class MCSymbol;
+
+/// MCImm - This represents an "assembler immediate". In its most general form,
+/// this can hold "SymbolA - SymbolB + imm64". Not all targets supports
+/// relocations of this general form, but we need to represent this anyway.
+class MCImm {
+ MCSymbol *SymA, *SymB;
+ int64_t Cst;
+public:
+
+ int64_t getCst() const { return Cst; }
+ MCSymbol *getSymA() const { return SymA; }
+ MCSymbol *getSymB() const { return SymB; }
+
+
+ static MCImm get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) {
+ MCImm R;
+ R.Cst = Val;
+ R.SymA = SymA;
+ R.SymB = SymB;
+ return R;
+ }
+
+ static MCImm get(int64_t Val) {
+ MCImm R;
+ R.Cst = Val;
+ R.SymA = 0;
+ R.SymB = 0;
+ return R;
+ }
+
+};
+
+} // end namespace llvm
+
+#endif
diff --git a/include/llvm/MC/MCInst.h b/include/llvm/MC/MCInst.h
index cadc23a..457c2ae 100644
--- a/include/llvm/MC/MCInst.h
+++ b/include/llvm/MC/MCInst.h
@@ -13,10 +13,10 @@
//
//===----------------------------------------------------------------------===//
-
#ifndef LLVM_MC_MCINST_H
#define LLVM_MC_MCINST_H
+#include "llvm/MC/MCImm.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/DebugLoc.h"
@@ -30,13 +30,15 @@ class MCOperand {
kInvalid, ///< Uninitialized.
kRegister, ///< Register operand.
kImmediate, ///< Immediate operand.
- kMBBLabel ///< Basic block label.
+ kMBBLabel, ///< Basic block label.
+ kMCImm
};
unsigned char Kind;
union {
unsigned RegVal;
int64_t ImmVal;
+ MCImm MCImmVal;
struct {
unsigned FunctionNo;
unsigned BlockNo;
@@ -112,6 +114,7 @@ public:
const MCOperand &getOperand(unsigned i) const { return Operands[i]; }
MCOperand &getOperand(unsigned i) { return Operands[i]; }
+ unsigned getNumOperands() const { return Operands.size(); }
void addOperand(const MCOperand &Op) {
Operands.push_back(Op);
diff --git a/include/llvm/Support/Timer.h b/include/llvm/Support/Timer.h
index 9a82470..f34fc95 100644
--- a/include/llvm/Support/Timer.h
+++ b/include/llvm/Support/Timer.h
@@ -34,12 +34,12 @@ class TimerGroup;
/// if they are never started.
///
class Timer {
- double Elapsed; // Wall clock time elapsed in seconds
- double UserTime; // User time elapsed
- double SystemTime; // System time elapsed
- ssize_t MemUsed; // Memory allocated (in bytes)
- size_t PeakMem; // Peak memory used
- size_t PeakMemBase; // Temporary for peak calculation...
+ int64_t Elapsed; // Wall clock time elapsed in seconds
+ int64_t UserTime; // User time elapsed
+ int64_t SystemTime; // System time elapsed
+ int64_t MemUsed; // Memory allocated (in bytes)
+ int64_t PeakMem; // Peak memory used
+ int64_t PeakMemBase; // Temporary for peak calculation...
std::string Name; // The name of this time variable
bool Started; // Has this time variable ever been started?
TimerGroup *TG; // The TimerGroup this Timer is in.
@@ -49,10 +49,10 @@ public:
Timer(const Timer &T);
~Timer();
- double getProcessTime() const { return UserTime+SystemTime; }
- double getWallTime() const { return Elapsed; }
- ssize_t getMemUsed() const { return MemUsed; }
- size_t getPeakMem() const { return PeakMem; }
+ int64_t getProcessTime() const { return UserTime+SystemTime; }
+ int64_t getWallTime() const { return Elapsed; }
+ int64_t getMemUsed() const { return MemUsed; }
+ int64_t getPeakMem() const { return PeakMem; }
std::string getName() const { return Name; }
const Timer &operator=(const Timer &T) {
@@ -152,7 +152,6 @@ class TimerGroup {
unsigned NumTimers;
std::vector<Timer> TimersToPrint;
public:
- TimerGroup() : Name("Miscellaneous Ungrouped Timers"), NumTimers(0) {}
explicit TimerGroup(const std::string &name) : Name(name), NumTimers(0) {}
~TimerGroup() {
assert(NumTimers == 0 &&
diff --git a/include/llvm/System/Atomic.h b/include/llvm/System/Atomic.h
index adbb975..c0612f9 100644
--- a/include/llvm/System/Atomic.h
+++ b/include/llvm/System/Atomic.h
@@ -20,12 +20,14 @@ namespace llvm {
namespace sys {
void MemoryFence();
- typedef uint32_t cas_flag;
- cas_flag CompareAndSwap(volatile cas_flag* ptr,
- cas_flag new_value,
- cas_flag old_value);
- cas_flag AtomicIncrement(volatile cas_flag* ptr);
- cas_flag AtomicDecrement(volatile cas_flag* ptr);
+ uint32_t CompareAndSwap32(volatile uint32_t* ptr,
+ uint32_t new_value,
+ uint32_t old_value);
+ int32_t AtomicIncrement32(volatile int32_t* ptr);
+ int32_t AtomicDecrement32(volatile int32_t* ptr);
+ int32_t AtomicAdd32(volatile int32_t* ptr, int32_t val);
+
+ int64_t AtomicAdd64(volatile int64_t* ptr, int64_t val);
}
}
diff --git a/include/llvm/Target/TargetSelect.h b/include/llvm/Target/TargetSelect.h
index 8544eed..8aa314a 100644
--- a/include/llvm/Target/TargetSelect.h
+++ b/include/llvm/Target/TargetSelect.h
@@ -50,9 +50,9 @@ namespace llvm {
inline bool InitializeNativeTarget() {
// If we have a native target, initialize it to ensure it is linked in.
#ifdef LLVM_NATIVE_ARCH
-#define DoInit2(TARG, MOD) llvm::Initialize ## TARG ## MOD()
-#define DoInit(T, M) DoInit2(T, M)
- DoInit(LLVM_NATIVE_ARCH, Target);
+#define DoInit2(TARG) llvm::Initialize ## TARG ()
+#define DoInit(T) DoInit2(T)
+ DoInit(LLVM_NATIVE_ARCH);
return false;
#undef DoInit
#undef DoInit2
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index d439233..97d5043 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -103,7 +103,7 @@ private:
/// has no AbstractTypeUsers, the type is deleted. This is only sensical for
/// derived types.
///
- mutable sys::cas_flag RefCount;
+ mutable int32_t RefCount;
const Type *getForwardedTypeInternal() const;
@@ -338,7 +338,7 @@ public:
void addRef() const {
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
- sys::AtomicIncrement(&RefCount);
+ sys::AtomicIncrement32(&RefCount);
}
void dropRef() const {
@@ -347,8 +347,8 @@ public:
// If this is the last PATypeHolder using this object, and there are no
// PATypeHandles using it, the type is dead, delete it now.
- sys::cas_flag OldCount = sys::AtomicDecrement(&RefCount);
- if (OldCount == 0 && AbstractTypeUsers.empty())
+ int32_t Count = sys::AtomicDecrement32(&RefCount);
+ if (Count == 0 && AbstractTypeUsers.empty())
this->destroy();
}
OpenPOWER on IntegriCloud