[PATCH] Adding skeleton for unit testing Hexagon Code Emission
Chad Rosier
mcrosier at codeaurora.org
Mon Sep 29 11:35:25 PDT 2014
================
Comment at: lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp:34
@@ +33,3 @@
+namespace {
+/// \brief Returns the packet bits based on instruction position
+unsigned getPacketBits(HexagonMCInst const &HMI) {
----------------
Please add a period.
================
Comment at: lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp:37
@@ +36,3 @@
+ unsigned PacketBits;
+ if (HMI.isPacketEnd()) {
+ PacketBits = 3 << 14;
----------------
No need for curly brackets, if the body is a single statement.
================
Comment at: lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp:38
@@ +37,3 @@
+ if (HMI.isPacketEnd()) {
+ PacketBits = 3 << 14;
+ } else {
----------------
Where are these magic numbers coming from?
================
Comment at: lib/Target/Hexagon/MCTargetDesc/HexagonMCCodeEmitter.cpp:73
@@ +72,3 @@
+ MCSubtargetInfo const &STI) const {
+ if (MO.isReg()) {
+ unsigned RegNo = MCT.getRegisterInfo()->getEncodingValue(MO.getReg());
----------------
Reduce indent and remove curly brackets.
if (MO.isReg())
return MCT.getRegisterInfo()->getEncodingValue(MO.getReg());
if (MO.isImm())
return static_cast<unsigned>(MO.getImm());
================
Comment at: unittests/Target/CMakeLists.txt:6
@@ +5,1 @@
+endforeach()
\ No newline at end of file
----------------
Please add newline.
================
Comment at: unittests/Target/Hexagon/CMakeLists.txt:11
@@ +10,1 @@
+ )
\ No newline at end of file
----------------
Please add newline.
================
Comment at: unittests/Target/Hexagon/HexagonMCCodeEmitterTest.cpp:54
@@ +53,1 @@
+}
\ No newline at end of file
----------------
Please add newline.
http://reviews.llvm.org/D5523
More information about the llvm-commits
mailing list