-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[NFC][MC][ARM] Fix formatting for ITStatus and VPTStatus
#154815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ITStatus and VPTStatus.ITStatus and VPTStatus
|
LLDB failure is unrealted and a current regression in trunk: FAIL: LLDB (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang-x86_64) :: test_moduleSymbols (TestDAP_moduleSymbols.TestDAP_moduleSymbols.test_moduleSymbols) |
|
@llvm/pr-subscribers-backend-arm Author: Rahul Joshi (jurahul) ChangesFull diff: https://github.com/llvm/llvm-project/pull/154815.diff 1 Files Affected:
diff --git a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
index cbd31beab8299..889873071c4f9 100644
--- a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
+++ b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
@@ -38,94 +38,80 @@ using DecodeStatus = MCDisassembler::DecodeStatus;
namespace {
- // Handles the condition code status of instructions in IT blocks
- class ITStatus
- {
- public:
- // Returns the condition code for instruction in IT block
- unsigned getITCC() {
- unsigned CC = ARMCC::AL;
- if (instrInITBlock())
- CC = ITStates.back();
- return CC;
- }
-
- // Advances the IT block state to the next T or E
- void advanceITState() {
- ITStates.pop_back();
- }
-
- // Returns true if the current instruction is in an IT block
- bool instrInITBlock() {
- return !ITStates.empty();
- }
-
- // Returns true if current instruction is the last instruction in an IT block
- bool instrLastInITBlock() {
- return ITStates.size() == 1;
- }
-
- // Called when decoding an IT instruction. Sets the IT state for
- // the following instructions that for the IT block. Firstcond
- // corresponds to the field in the IT instruction encoding; Mask
- // is in the MCOperand format in which 1 means 'else' and 0 'then'.
- void setITState(char Firstcond, char Mask) {
- // (3 - the number of trailing zeros) is the number of then / else.
- unsigned NumTZ = llvm::countr_zero<uint8_t>(Mask);
- unsigned char CCBits = static_cast<unsigned char>(Firstcond & 0xf);
- assert(NumTZ <= 3 && "Invalid IT mask!");
- // push condition codes onto the stack the correct order for the pops
- for (unsigned Pos = NumTZ+1; Pos <= 3; ++Pos) {
- unsigned Else = (Mask >> Pos) & 1;
- ITStates.push_back(CCBits ^ Else);
- }
- ITStates.push_back(CCBits);
- }
+// Handles the condition code status of instructions in IT blocks
+class ITStatus {
+public:
+ // Returns the condition code for instruction in IT block
+ unsigned getITCC() {
+ unsigned CC = ARMCC::AL;
+ if (instrInITBlock())
+ CC = ITStates.back();
+ return CC;
+ }
+
+ // Advances the IT block state to the next T or E
+ void advanceITState() { ITStates.pop_back(); }
+
+ // Returns true if the current instruction is in an IT block
+ bool instrInITBlock() { return !ITStates.empty(); }
+
+ // Returns true if current instruction is the last instruction in an IT block
+ bool instrLastInITBlock() { return ITStates.size() == 1; }
+
+ // Called when decoding an IT instruction. Sets the IT state for
+ // the following instructions that for the IT block. Firstcond
+ // corresponds to the field in the IT instruction encoding; Mask
+ // is in the MCOperand format in which 1 means 'else' and 0 'then'.
+ void setITState(char Firstcond, char Mask) {
+ // (3 - the number of trailing zeros) is the number of then / else.
+ unsigned NumTZ = llvm::countr_zero<uint8_t>(Mask);
+ unsigned char CCBits = static_cast<unsigned char>(Firstcond & 0xf);
+ assert(NumTZ <= 3 && "Invalid IT mask!");
+ // push condition codes onto the stack the correct order for the pops
+ for (unsigned Pos = NumTZ + 1; Pos <= 3; ++Pos) {
+ unsigned Else = (Mask >> Pos) & 1;
+ ITStates.push_back(CCBits ^ Else);
+ }
+ ITStates.push_back(CCBits);
+ }
- private:
- std::vector<unsigned char> ITStates;
- };
+private:
+ std::vector<unsigned char> ITStates;
+};
- class VPTStatus
- {
- public:
- unsigned getVPTPred() {
- unsigned Pred = ARMVCC::None;
- if (instrInVPTBlock())
- Pred = VPTStates.back();
- return Pred;
- }
+class VPTStatus {
+public:
+ unsigned getVPTPred() {
+ unsigned Pred = ARMVCC::None;
+ if (instrInVPTBlock())
+ Pred = VPTStates.back();
+ return Pred;
+ }
- void advanceVPTState() {
- VPTStates.pop_back();
- }
+ void advanceVPTState() { VPTStates.pop_back(); }
- bool instrInVPTBlock() {
- return !VPTStates.empty();
- }
+ bool instrInVPTBlock() { return !VPTStates.empty(); }
- bool instrLastInVPTBlock() {
- return VPTStates.size() == 1;
- }
+ bool instrLastInVPTBlock() { return VPTStates.size() == 1; }
- void setVPTState(char Mask) {
- // (3 - the number of trailing zeros) is the number of then / else.
- unsigned NumTZ = llvm::countr_zero<uint8_t>(Mask);
- assert(NumTZ <= 3 && "Invalid VPT mask!");
- // push predicates onto the stack the correct order for the pops
- for (unsigned Pos = NumTZ+1; Pos <= 3; ++Pos) {
- bool T = ((Mask >> Pos) & 1) == 0;
- if (T)
- VPTStates.push_back(ARMVCC::Then);
- else
- VPTStates.push_back(ARMVCC::Else);
- }
+ void setVPTState(char Mask) {
+ // (3 - the number of trailing zeros) is the number of then / else.
+ unsigned NumTZ = llvm::countr_zero<uint8_t>(Mask);
+ assert(NumTZ <= 3 && "Invalid VPT mask!");
+ // push predicates onto the stack the correct order for the pops
+ for (unsigned Pos = NumTZ + 1; Pos <= 3; ++Pos) {
+ bool T = ((Mask >> Pos) & 1) == 0;
+ if (T)
VPTStates.push_back(ARMVCC::Then);
- }
+ else
+ VPTStates.push_back(ARMVCC::Else);
+ }
+ VPTStates.push_back(ARMVCC::Then);
+ }
- private:
- SmallVector<unsigned char, 4> VPTStates;
- };
+private:
+ SmallVector<unsigned char, 4> VPTStates;
+};
/// ARM disassembler for all ARM platforms.
class ARMDisassembler : public MCDisassembler {
|
ca06d51 to
a7012dd
Compare
kazutakahirata
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
No description provided.