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

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitCodes.h

Issue 154603002: Make pnacl-bccompress add abbreviations for obvious constants. (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Fixs nits associated with Patch Set 4. Created 6 years, 10 months 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
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClBitcodeAbbrevDist.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/llvm/Bitcode/NaCl/NaClBitCodes.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitCodes.h b/include/llvm/Bitcode/NaCl/NaClBitCodes.h
index 8c0eb5e1a2484a95e1d1a13d58ecb5d1d07892a9..8e10ce9a2bae2fccf1931785e65746c8b9aaf497 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitCodes.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitCodes.h
@@ -25,6 +25,8 @@
#include <cassert>
namespace llvm {
+class raw_ostream;
+
namespace naclbitc {
enum StandardWidths {
BlockIDWidth = 8, // We use VBR-8 for block IDs.
@@ -147,6 +149,21 @@ public:
report_fatal_error("Invalid encoding");
}
+ bool isArrayOp() const {
+ return isEncoding() && Enc == Array;
+ }
+
+ /// Returns the number of arguments expected by this abbrevation operator.
+ unsigned NumArguments() const {
+ if (isArrayOp())
+ return 1;
+ else
+ return 0;
+ }
+
+ /// Prints out the abbreviation operator to the given stream.
+ void Print(raw_ostream &Stream) const;
+
/// isChar6 - Return true if this character is legal in the Char6 encoding.
static bool isChar6(char C) {
if (C >= 'a' && C <= 'z') return true;
@@ -263,6 +280,10 @@ public:
OperandList.push_back(OpInfo);
}
+ // Returns a simplified version of the abbreviation. Used
+ // to recognize equivalent abbrevations.
+ NaClBitCodeAbbrev *Simplify() const;
+
int Compare(const NaClBitCodeAbbrev &Abbrev) const {
// First order based on number of operands.
size_t OperandListSize = OperandList.size();
@@ -280,6 +301,8 @@ public:
return 0;
}
+ void Print(raw_ostream &Stream) const;
+
NaClBitCodeAbbrev *Copy() const {
NaClBitCodeAbbrev *AbbrevCopy = new NaClBitCodeAbbrev();
for (unsigned I = 0, IEnd = getNumOperandInfos();
« no previous file with comments | « no previous file | include/llvm/Bitcode/NaCl/NaClBitcodeAbbrevDist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698