Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: src/IceAPInt.h

Issue 1484003003: Clean up implementation reading literal constants. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix bad references to llvm::APInt. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceAPInt.h
diff --git a/src/IceAPInt.h b/src/IceAPInt.h
deleted file mode 100644
index 9ef0702186fe6d64ebe437bd5b011b1be5e7d7a2..0000000000000000000000000000000000000000
--- a/src/IceAPInt.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===-- subzero/src/IceAPInt.h - Constant integer conversions --*- C++ -*--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-/// \brief This file implements a class to represent 64 bit integer constant
-/// values, and their conversion to variable bit sized integers.
-///
-/// Note: This is a simplified version of llvm/include/llvm/ADT/APInt.h for use
-/// with Subzero.
-//===----------------------------------------------------------------------===//
-
-#ifndef SUBZERO_SRC_ICEAPINT_H
-#define SUBZERO_SRC_ICEAPINT_H
-
-#include "IceDefs.h"
-
-namespace Ice {
-
-class APInt {
- APInt() = delete;
- APInt(const APInt &) = delete;
- APInt &operator=(const APInt &) = delete;
-
-public:
- /// Bits in an (internal) value.
- static const SizeT APINT_BITS_PER_WORD = sizeof(uint64_t) * CHAR_BIT;
-
- APInt(SizeT Bits, uint64_t Val) : BitWidth(Bits), Val(Val) {
- assert(Bits && "bitwidth too small");
- assert(Bits <= APINT_BITS_PER_WORD && "bitwidth too big");
- clearUnusedBits();
- }
-
- uint32_t getBitWidth() const { return BitWidth; }
-
- int64_t getSExtValue() const {
- return static_cast<int64_t>(Val << (APINT_BITS_PER_WORD - BitWidth)) >>
- (APINT_BITS_PER_WORD - BitWidth);
- }
-
- uint64_t getRawData() const { return Val; }
-
-private:
- uint32_t BitWidth; /// The number of bits in this APInt.
- uint64_t Val; /// The (64-bit) equivalent integer value.
-
- /// Clear unused high order bits.
- void clearUnusedBits() {
- // If all bits are used, we want to leave the value alone.
- if (BitWidth == APINT_BITS_PER_WORD)
- return;
-
- // Mask out the high bits.
- Val &= ~static_cast<uint64_t>(0) >> (APINT_BITS_PER_WORD - BitWidth);
- }
-};
-
-} // end of namespace Ice
-
-#endif // SUBZERO_SRC_ICEAPINT_H
« no previous file with comments | « src/IceAPFloat.h ('k') | src/PNaClTranslator.cpp » ('j') | src/PNaClTranslator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698