Includes module header first.
This "include module header first" is part of the llvm style guide.
This change exposes "broken" headers that were accessing undefined types, or
even using types without forward declaring them.
BUG=
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/1202253002.
diff --git a/src/IceAssembler.cpp b/src/IceAssembler.cpp
index 757c3ea..94cb5a1 100644
--- a/src/IceAssembler.cpp
+++ b/src/IceAssembler.cpp
@@ -23,6 +23,7 @@
//===----------------------------------------------------------------------===//
#include "IceAssembler.h"
+
#include "IceGlobalContext.h"
#include "IceOperand.h"
diff --git a/src/IceAssemblerX8632.cpp b/src/IceAssemblerX8632.cpp
index a864b17..7d217cf 100644
--- a/src/IceAssemblerX8632.cpp
+++ b/src/IceAssemblerX8632.cpp
@@ -19,6 +19,7 @@
//===----------------------------------------------------------------------===//
#include "IceAssemblerX8632.h"
+
#include "IceCfg.h"
#include "IceOperand.h"
diff --git a/src/IceBrowserCompileServer.cpp b/src/IceBrowserCompileServer.cpp
index 3a879ee..d2654e3 100644
--- a/src/IceBrowserCompileServer.cpp
+++ b/src/IceBrowserCompileServer.cpp
@@ -15,16 +15,15 @@
// unsandboxed LLVM build using the trusted compiler does not have irt.h).
#if PNACL_BROWSER_TRANSLATOR
+#include "IceBrowserCompileServer.h"
+#include "llvm/Support/QueueStreamer.h"
+
#include <cstring>
#include <irt.h>
#include <irt_dev.h>
#include <pthread.h>
#include <thread>
-#include "llvm/Support/QueueStreamer.h"
-
-#include "IceBrowserCompileServer.h"
-
namespace Ice {
// Create C wrappers around callback handlers for the IRT interface.
diff --git a/src/IceBrowserCompileServer.h b/src/IceBrowserCompileServer.h
index 473889d..f15ddaf 100644
--- a/src/IceBrowserCompileServer.h
+++ b/src/IceBrowserCompileServer.h
@@ -14,19 +14,19 @@
#ifndef SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H
#define SUBZERO_SRC_ICEBROWSERCOMPILESERVER_H
-#include <atomic>
-#include <thread>
-
#include "IceClFlags.h"
#include "IceClFlagsExtra.h"
#include "IceCompileServer.h"
#include "IceDefs.h"
#include "IceELFStreamer.h"
+#include <atomic>
+#include <thread>
+
namespace llvm {
class QueueStreamer;
class raw_fd_ostream;
-}
+} // end of namespace llvm
namespace Ice {
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 659f460..d3b0973 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -12,8 +12,9 @@
//
//===----------------------------------------------------------------------===//
-#include "IceAssembler.h"
#include "IceCfg.h"
+
+#include "IceAssembler.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
#include "IceDefs.h"
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index bdb105a..5ff6936 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -12,9 +12,10 @@
//
//===----------------------------------------------------------------------===//
+#include "IceCfgNode.h"
+
#include "IceAssembler.h"
#include "IceCfg.h"
-#include "IceCfgNode.h"
#include "IceGlobalInits.h"
#include "IceInst.h"
#include "IceLiveness.h"
diff --git a/src/IceClFlags.cpp b/src/IceClFlags.cpp
index 7a6eaef..cefd17b 100644
--- a/src/IceClFlags.cpp
+++ b/src/IceClFlags.cpp
@@ -13,10 +13,10 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/CommandLine.h"
-
#include "IceClFlags.h"
+
#include "IceClFlagsExtra.h"
+#include "llvm/Support/CommandLine.h"
namespace cl = llvm::cl;
diff --git a/src/IceClFlagsExtra.h b/src/IceClFlagsExtra.h
index 6f39336..37f87de 100644
--- a/src/IceClFlagsExtra.h
+++ b/src/IceClFlagsExtra.h
@@ -14,9 +14,8 @@
#ifndef SUBZERO_SRC_ICECLFLAGSEXTRA_H
#define SUBZERO_SRC_ICECLFLAGSEXTRA_H
-#include "llvm/IRReader/IRReader.h"
-
#include "IceDefs.h"
+#include "llvm/IRReader/IRReader.h"
namespace Ice {
diff --git a/src/IceCompileServer.cpp b/src/IceCompileServer.cpp
index 406d064..3b828cc 100644
--- a/src/IceCompileServer.cpp
+++ b/src/IceCompileServer.cpp
@@ -11,25 +11,24 @@
//
//===----------------------------------------------------------------------===//
-#include <fstream>
-#include <iostream>
-#include <thread>
+#include "IceCompileServer.h"
+#include "IceClFlags.h"
+#include "IceClFlagsExtra.h"
+#include "IceELFStreamer.h"
+#include "IceGlobalContext.h"
// Include code to handle converting textual bitcode records to binary (for
// INPUT_IS_TEXTUAL_BITCODE).
#include "llvm/Bitcode/NaCl/NaClBitcodeMungeUtils.h"
-
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_os_ostream.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/StreamingMemoryObject.h"
-#include "IceClFlags.h"
-#include "IceClFlagsExtra.h"
-#include "IceCompileServer.h"
-#include "IceELFStreamer.h"
-#include "IceGlobalContext.h"
+#include <fstream>
+#include <iostream>
+#include <thread>
namespace Ice {
diff --git a/src/IceCompiler.cpp b/src/IceCompiler.cpp
index fb116e6..ff17d84 100644
--- a/src/IceCompiler.cpp
+++ b/src/IceCompiler.cpp
@@ -15,6 +15,14 @@
//
//===----------------------------------------------------------------------===//
+#include "IceCompiler.h"
+
+#include "IceCfg.h"
+#include "IceClFlags.h"
+#include "IceClFlagsExtra.h"
+#include "IceConverter.h"
+#include "IceELFObjectWriter.h"
+#include "PNaClTranslator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
@@ -22,13 +30,6 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/StreamingMemoryObject.h"
-#include "IceCfg.h"
-#include "IceClFlags.h"
-#include "IceClFlagsExtra.h"
-#include "IceCompiler.h"
-#include "IceConverter.h"
-#include "IceELFObjectWriter.h"
-#include "PNaClTranslator.h"
namespace Ice {
namespace {
diff --git a/src/IceConverter.cpp b/src/IceConverter.cpp
index afffb99..0a88522 100644
--- a/src/IceConverter.cpp
+++ b/src/IceConverter.cpp
@@ -11,20 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include <iostream>
-
-#include "llvm/IR/Constant.h"
-#include "llvm/IR/Constants.h"
-#include "llvm/IR/DataLayout.h"
-#include "llvm/IR/Instruction.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/IR/LLVMContext.h"
-#include "llvm/IR/Module.h"
+#include "IceConverter.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
-#include "IceConverter.h"
#include "IceDefs.h"
#include "IceGlobalContext.h"
#include "IceGlobalInits.h"
@@ -33,6 +24,14 @@
#include "IceTargetLowering.h"
#include "IceTypes.h"
#include "IceTypeConverter.h"
+#include "llvm/IR/Constant.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Module.h"
+
// TODO(kschimpf): Remove two namespaces being visible at once.
using namespace llvm;
diff --git a/src/IceDefs.h b/src/IceDefs.h
index 583b34e..2ee41a7 100644
--- a/src/IceDefs.h
+++ b/src/IceDefs.h
@@ -15,18 +15,9 @@
#ifndef SUBZERO_SRC_ICEDEFS_H
#define SUBZERO_SRC_ICEDEFS_H
-#include <cassert>
-#include <cstdint>
-#include <cstdio> // snprintf
-#include <functional> // std::less
-#include <limits>
-#include <list>
-#include <map>
-#include <memory>
-#include <mutex>
-#include <string>
-#include <system_error>
-#include <vector>
+#include "IceBuildDefs.h" // TODO(stichnot): move into individual files
+#include "IceTLS.h"
+
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/ilist.h"
@@ -40,8 +31,18 @@
#include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"
-#include "IceBuildDefs.h" // TODO(stichnot): move into individual files
-#include "IceTLS.h"
+#include <cassert>
+#include <cstdint>
+#include <cstdio> // snprintf
+#include <functional> // std::less
+#include <limits>
+#include <list>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <system_error>
+#include <vector>
namespace Ice {
diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp
index 2a86a17..dd20dbc 100644
--- a/src/IceELFObjectWriter.cpp
+++ b/src/IceELFObjectWriter.cpp
@@ -11,16 +11,16 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/MathExtras.h"
+#include "IceELFObjectWriter.h"
#include "IceAssembler.h"
#include "IceDefs.h"
-#include "IceELFObjectWriter.h"
#include "IceELFSection.h"
#include "IceELFStreamer.h"
#include "IceGlobalContext.h"
#include "IceGlobalInits.h"
#include "IceOperand.h"
+#include "llvm/Support/MathExtras.h"
using namespace llvm::ELF;
diff --git a/src/IceELFSection.cpp b/src/IceELFSection.cpp
index 4ca2de4..8ca5b2d 100644
--- a/src/IceELFSection.cpp
+++ b/src/IceELFSection.cpp
@@ -11,11 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/MathExtras.h"
+#include "IceELFSection.h"
#include "IceDefs.h"
-#include "IceELFSection.h"
#include "IceELFStreamer.h"
+#include "llvm/Support/MathExtras.h"
using namespace llvm::ELF;
diff --git a/src/IceFixups.cpp b/src/IceFixups.cpp
index 0e884da..9301910 100644
--- a/src/IceFixups.cpp
+++ b/src/IceFixups.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "IceFixups.h"
+
#include "IceOperand.h"
namespace Ice {
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 2f04535..8742f69 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -12,23 +12,24 @@
//
//===----------------------------------------------------------------------===//
-#include <ctype.h> // isdigit(), isupper()
-#include <locale> // locale
-#include <unordered_map>
-
-#include "llvm/Support/Timer.h"
+#include "IceGlobalContext.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceELFObjectWriter.h"
-#include "IceGlobalContext.h"
#include "IceGlobalInits.h"
#include "IceOperand.h"
#include "IceTargetLowering.h"
#include "IceTimerTree.h"
#include "IceTypes.h"
+#include "llvm/Support/Timer.h"
+
+#include <ctype.h> // isdigit(), isupper()
+#include <locale> // locale
+#include <unordered_map>
+
namespace std {
template <> struct hash<Ice::RelocatableTuple> {
diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h
index 88ee731..1e23a36 100644
--- a/src/IceGlobalContext.h
+++ b/src/IceGlobalContext.h
@@ -15,13 +15,6 @@
#ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H
#define SUBZERO_SRC_ICEGLOBALCONTEXT_H
-#include <array>
-#include <functional>
-#include <mutex>
-#include <thread>
-#include <type_traits>
-#include <vector>
-
#include "IceDefs.h"
#include "IceClFlags.h"
#include "IceIntrinsics.h"
@@ -31,6 +24,13 @@
#include "IceTypes.h"
#include "IceUtils.h"
+#include <array>
+#include <functional>
+#include <mutex>
+#include <thread>
+#include <type_traits>
+#include <vector>
+
namespace Ice {
class ClFlags;
diff --git a/src/IceGlobalInits.cpp b/src/IceGlobalInits.cpp
index f9c57639..249331a 100644
--- a/src/IceGlobalInits.cpp
+++ b/src/IceGlobalInits.cpp
@@ -13,14 +13,15 @@
//
//===----------------------------------------------------------------------===//
+#include "IceGlobalInits.h"
+
+#include "IceDefs.h"
+#include "IceGlobalContext.h"
+#include "IceTypes.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Value.h"
-#include "IceDefs.h"
-#include "IceGlobalContext.h"
-#include "IceGlobalInits.h"
-#include "IceTypes.h"
namespace {
char hexdigit(unsigned X) { return X < 10 ? '0' + X : 'A' + X - 10; }
diff --git a/src/IceGlobalInits.h b/src/IceGlobalInits.h
index 387c0e3..48658e1 100644
--- a/src/IceGlobalInits.h
+++ b/src/IceGlobalInits.h
@@ -17,15 +17,15 @@
#ifndef SUBZERO_SRC_ICEGLOBALINITS_H
#define SUBZERO_SRC_ICEGLOBALINITS_H
-#include <memory>
-#include <utility>
-
+#include "IceDefs.h"
+#include "IceGlobalContext.h"
+#include "IceTypes.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeParser.h" // for NaClBitcodeRecord.
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/GlobalValue.h" // for GlobalValue::LinkageTypes.
-#include "IceDefs.h"
-#include "IceTypes.h"
+#include <memory>
+#include <utility>
// TODO(kschimpf): Remove ourselves from using LLVM representation for calling
// conventions and linkage types.
diff --git a/src/IceInst.cpp b/src/IceInst.cpp
index 3547e07..e685754 100644
--- a/src/IceInst.cpp
+++ b/src/IceInst.cpp
@@ -12,9 +12,10 @@
//
//===----------------------------------------------------------------------===//
+#include "IceInst.h"
+
#include "IceCfg.h"
#include "IceCfgNode.h"
-#include "IceInst.h"
#include "IceLiveness.h"
#include "IceOperand.h"
diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp
index 9c0cc0d..2620b29 100644
--- a/src/IceInstARM32.cpp
+++ b/src/IceInstARM32.cpp
@@ -12,11 +12,12 @@
//
//===----------------------------------------------------------------------===//
+#include "IceInstARM32.h"
+
#include "IceAssemblerARM32.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceInst.h"
-#include "IceInstARM32.h"
#include "IceOperand.h"
#include "IceRegistersARM32.h"
#include "IceTargetLoweringARM32.h"
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp
index 60a58c4..ca62d79 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -12,12 +12,13 @@
//
//===----------------------------------------------------------------------===//
+#include "IceInstX8632.h"
+
#include "IceAssemblerX8632.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceConditionCodesX8632.h"
#include "IceInst.h"
-#include "IceInstX8632.h"
#include "IceRegistersX8632.h"
#include "IceTargetLoweringX8632.h"
#include "IceOperand.h"
diff --git a/src/IceIntrinsics.cpp b/src/IceIntrinsics.cpp
index 354120b..307745e 100644
--- a/src/IceIntrinsics.cpp
+++ b/src/IceIntrinsics.cpp
@@ -12,10 +12,11 @@
//
//===----------------------------------------------------------------------===//
+#include "IceIntrinsics.h"
+
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceInst.h"
-#include "IceIntrinsics.h"
#include "IceLiveness.h"
#include "IceOperand.h"
diff --git a/src/IceLiveness.cpp b/src/IceLiveness.cpp
index 0da611e..f3c4516 100644
--- a/src/IceLiveness.cpp
+++ b/src/IceLiveness.cpp
@@ -19,11 +19,12 @@
//
//===----------------------------------------------------------------------===//
+#include "IceLiveness.h"
+
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceDefs.h"
#include "IceInst.h"
-#include "IceLiveness.h"
#include "IceOperand.h"
namespace Ice {
diff --git a/src/IceLiveness.h b/src/IceLiveness.h
index 333a904..03c63ad 100644
--- a/src/IceLiveness.h
+++ b/src/IceLiveness.h
@@ -20,6 +20,7 @@
#ifndef SUBZERO_SRC_ICELIVENESS_H
#define SUBZERO_SRC_ICELIVENESS_H
+#include "IceCfgNode.h"
#include "IceDefs.h"
#include "IceTypes.h"
diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp
index db530db..60a73d9 100644
--- a/src/IceOperand.cpp
+++ b/src/IceOperand.cpp
@@ -12,10 +12,11 @@
//
//===----------------------------------------------------------------------===//
+#include "IceOperand.h"
+
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceInst.h"
-#include "IceOperand.h"
#include "IceTargetLowering.h" // dumping stack/frame pointer register
namespace Ice {
diff --git a/src/IceRNG.cpp b/src/IceRNG.cpp
index 43c7f07..e3fa8c5 100644
--- a/src/IceRNG.cpp
+++ b/src/IceRNG.cpp
@@ -11,14 +11,14 @@
//
//===----------------------------------------------------------------------===//
-#include <time.h>
-
#include "IceRNG.h"
+#include <time.h>
+
namespace Ice {
namespace {
-const unsigned MAX = 2147483647;
+constexpr unsigned MAX = 2147483647;
} // end of anonymous namespace
// TODO(wala,stichnot): Switch to RNG implementation from LLVM or C++11.
diff --git a/src/IceRNG.h b/src/IceRNG.h
index a2d8e96..83001ad 100644
--- a/src/IceRNG.h
+++ b/src/IceRNG.h
@@ -14,10 +14,9 @@
#ifndef SUBZERO_SRC_ICERNG_H
#define SUBZERO_SRC_ICERNG_H
-#include <cstdint>
-
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
+#include <cstdint>
namespace Ice {
diff --git a/src/IceRegAlloc.cpp b/src/IceRegAlloc.cpp
index c9a50dc..1478b0f 100644
--- a/src/IceRegAlloc.cpp
+++ b/src/IceRegAlloc.cpp
@@ -13,11 +13,12 @@
//
//===----------------------------------------------------------------------===//
+#include "IceRegAlloc.h"
+
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceInst.h"
#include "IceOperand.h"
-#include "IceRegAlloc.h"
#include "IceTargetLowering.h"
namespace Ice {
@@ -26,7 +27,7 @@
// TODO(stichnot): Statically choose the size based on the target
// being compiled.
-const size_t REGS_SIZE = 32;
+constexpr size_t REGS_SIZE = 32;
// Returns true if Var has any definitions within Item's live range.
// TODO(stichnot): Consider trimming the Definitions list similar to
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 64b00db..74ce567 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -15,6 +15,8 @@
//
//===----------------------------------------------------------------------===//
+#include "IceTargetLowering.h"
+
#include "IceAssemblerARM32.h"
#include "IceAssemblerX8632.h"
#include "IceAssemblerX8664.h"
@@ -24,7 +26,6 @@
#include "IceGlobalInits.h"
#include "IceOperand.h"
#include "IceRegAlloc.h"
-#include "IceTargetLowering.h"
#include "IceTargetLoweringARM32.h"
#include "IceTargetLoweringMIPS32.h"
#include "IceTargetLoweringX8632.h"
diff --git a/src/IceTargetLoweringARM32.cpp b/src/IceTargetLoweringARM32.cpp
index 6fca4a9..4797683 100644
--- a/src/IceTargetLoweringARM32.cpp
+++ b/src/IceTargetLoweringARM32.cpp
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/MathExtras.h"
+#include "IceTargetLoweringARM32.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
@@ -25,8 +25,8 @@
#include "IceOperand.h"
#include "IceRegistersARM32.h"
#include "IceTargetLoweringARM32.def"
-#include "IceTargetLoweringARM32.h"
#include "IceUtils.h"
+#include "llvm/Support/MathExtras.h"
namespace Ice {
diff --git a/src/IceTargetLoweringMIPS32.cpp b/src/IceTargetLoweringMIPS32.cpp
index 2cf5953..0adff03 100644
--- a/src/IceTargetLoweringMIPS32.cpp
+++ b/src/IceTargetLoweringMIPS32.cpp
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/MathExtras.h"
+#include "IceTargetLoweringMIPS32.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
@@ -25,8 +25,8 @@
#include "IceOperand.h"
#include "IceRegistersMIPS32.h"
#include "IceTargetLoweringMIPS32.def"
-#include "IceTargetLoweringMIPS32.h"
#include "IceUtils.h"
+#include "llvm/Support/MathExtras.h"
namespace Ice {
diff --git a/src/IceTargetLoweringX86Base.h b/src/IceTargetLoweringX86Base.h
index 495a010..6c32f26 100644
--- a/src/IceTargetLoweringX86Base.h
+++ b/src/IceTargetLoweringX86Base.h
@@ -16,13 +16,13 @@
#ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
#define SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
-#include <type_traits>
-#include <unordered_map>
-
#include "IceDefs.h"
#include "IceInst.h"
#include "IceTargetLowering.h"
+#include <type_traits>
+#include <unordered_map>
+
namespace Ice {
namespace X86Internal {
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index 6b3a30f..6e7cdea 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -16,8 +16,6 @@
#ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
#define SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
-#include "llvm/Support/MathExtras.h"
-
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
@@ -31,6 +29,7 @@
#include "IceTargetLoweringX8632.def"
#include "IceTargetLoweringX8632.h"
#include "IceUtils.h"
+#include "llvm/Support/MathExtras.h"
namespace Ice {
namespace X86Internal {
diff --git a/src/IceThreading.cpp b/src/IceThreading.cpp
index 5cdaaa8..9720f77 100644
--- a/src/IceThreading.cpp
+++ b/src/IceThreading.cpp
@@ -11,9 +11,10 @@
//
//===----------------------------------------------------------------------===//
+#include "IceThreading.h"
+
#include "IceCfg.h"
#include "IceDefs.h"
-#include "IceThreading.h"
namespace Ice {
diff --git a/src/IceThreading.h b/src/IceThreading.h
index 12b085d..4f04935 100644
--- a/src/IceThreading.h
+++ b/src/IceThreading.h
@@ -14,11 +14,11 @@
#ifndef SUBZERO_SRC_ICETHREADING_H
#define SUBZERO_SRC_ICETHREADING_H
+#include "IceDefs.h"
+
#include <condition_variable>
#include <mutex>
-#include "IceDefs.h"
-
namespace Ice {
// BoundedProducerConsumerQueue is a work queue that allows multiple
diff --git a/src/IceTimerTree.cpp b/src/IceTimerTree.cpp
index c5603fd..de84ea5 100644
--- a/src/IceTimerTree.cpp
+++ b/src/IceTimerTree.cpp
@@ -12,10 +12,10 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/Timer.h"
+#include "IceTimerTree.h"
#include "IceDefs.h"
-#include "IceTimerTree.h"
+#include "llvm/Support/Timer.h"
namespace Ice {
diff --git a/src/IceTimerTree.h b/src/IceTimerTree.h
index 17be997..dd8dcf1 100644
--- a/src/IceTimerTree.h
+++ b/src/IceTimerTree.h
@@ -15,6 +15,8 @@
#ifndef SUBZERO_SRC_ICETIMERTREE_H
#define SUBZERO_SRC_ICETIMERTREE_H
+// TODO(jpp): Refactor IceDefs.
+#include "IceDefs.h"
#include "IceTimerTree.def"
namespace Ice {
diff --git a/src/IceTranslator.cpp b/src/IceTranslator.cpp
index c5919f3..a00fd6b 100644
--- a/src/IceTranslator.cpp
+++ b/src/IceTranslator.cpp
@@ -12,12 +12,13 @@
//
//===----------------------------------------------------------------------===//
+#include "IceTranslator.h"
+
#include "IceCfg.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceGlobalInits.h"
#include "IceTargetLowering.h"
-#include "IceTranslator.h"
using namespace Ice;
diff --git a/src/IceTranslator.h b/src/IceTranslator.h
index 0f7f9d7..29b2d77 100644
--- a/src/IceTranslator.h
+++ b/src/IceTranslator.h
@@ -15,9 +15,12 @@
#ifndef SUBZERO_SRC_ICETRANSLATOR_H
#define SUBZERO_SRC_ICETRANSLATOR_H
+#include "IceDefs.h"
+#include "IceGlobalContext.h"
+
namespace llvm {
class Module;
-}
+} // end of namespace llvm
namespace Ice {
diff --git a/src/IceTypeConverter.cpp b/src/IceTypeConverter.cpp
index ddb6cc7..4341dcb 100644
--- a/src/IceTypeConverter.cpp
+++ b/src/IceTypeConverter.cpp
@@ -12,10 +12,10 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/raw_ostream.h"
-
#include "IceTypeConverter.h"
+#include "llvm/Support/raw_ostream.h"
+
namespace Ice {
TypeConverter::TypeConverter(llvm::LLVMContext &Context) {
diff --git a/src/IceTypeConverter.h b/src/IceTypeConverter.h
index 74e9671..18e3e00 100644
--- a/src/IceTypeConverter.h
+++ b/src/IceTypeConverter.h
@@ -15,14 +15,13 @@
#ifndef SUBZERO_SRC_ICETYPECONVERTER_H
#define SUBZERO_SRC_ICETYPECONVERTER_H
-#include "llvm/IR/DerivedTypes.h"
-
#include "IceDefs.h"
#include "IceTypes.h"
+#include "llvm/IR/DerivedTypes.h"
namespace llvm {
class LLVMContext;
-} // end of llvm namespace.
+} // end of namespace llvm
namespace Ice {
@@ -56,6 +55,6 @@
Type convertToIceTypeOther(llvm::Type *LLVMTy) const;
};
-} // end of Ice namespace.
+} // end of namespace Ice
#endif // SUBZERO_SRC_ICETYPECONVERTER_H
diff --git a/src/IceTypes.cpp b/src/IceTypes.cpp
index f12f330..1b0ffb3 100644
--- a/src/IceTypes.cpp
+++ b/src/IceTypes.cpp
@@ -11,9 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#include "IceDefs.h"
#include "IceTypes.h"
+#include "IceDefs.h"
+
namespace Ice {
namespace {
diff --git a/src/IceTypes.h b/src/IceTypes.h
index a881fb4..7daa8a7 100644
--- a/src/IceTypes.h
+++ b/src/IceTypes.h
@@ -16,6 +16,7 @@
#ifndef SUBZERO_SRC_ICETYPES_H
#define SUBZERO_SRC_ICETYPES_H
+#include "IceDefs.h"
#include "IceTypes.def"
namespace Ice {
diff --git a/src/IceUtils.h b/src/IceUtils.h
index a3b5462..6b0d729 100644
--- a/src/IceUtils.h
+++ b/src/IceUtils.h
@@ -13,6 +13,7 @@
#ifndef SUBZERO_SRC_ICEUTILS_H
#define SUBZERO_SRC_ICEUTILS_H
+
#include <climits>
namespace Ice {
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index dfc3fb7..06b3bee 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -12,15 +12,7 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
-#include "llvm/Bitcode/NaCl/NaClBitcodeDefs.h"
-#include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
-#include "llvm/Bitcode/NaCl/NaClBitcodeParser.h"
-#include "llvm/Bitcode/NaCl/NaClReaderWriter.h"
-#include "llvm/Support/Format.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/raw_ostream.h"
+#include "PNaClTranslator.h"
#include "IceAPInt.h"
#include "IceAPFloat.h"
@@ -31,7 +23,15 @@
#include "IceGlobalInits.h"
#include "IceInst.h"
#include "IceOperand.h"
-#include "PNaClTranslator.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
+#include "llvm/Bitcode/NaCl/NaClBitcodeDefs.h"
+#include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
+#include "llvm/Bitcode/NaCl/NaClBitcodeParser.h"
+#include "llvm/Bitcode/NaCl/NaClReaderWriter.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
namespace {
using namespace llvm;
diff --git a/src/PNaClTranslator.h b/src/PNaClTranslator.h
index e2d423a..b8764a6 100644
--- a/src/PNaClTranslator.h
+++ b/src/PNaClTranslator.h
@@ -15,10 +15,10 @@
#ifndef SUBZERO_SRC_PNACLTRANSLATOR_H
#define SUBZERO_SRC_PNACLTRANSLATOR_H
-#include <string>
-
#include "IceTranslator.h"
+#include <string>
+
namespace llvm {
class MemoryBuffer;
class MemoryObject;