aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMCommon.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-01-19 07:51:42 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-01-19 07:51:42 +0000
commita8e2989ece6dc46df59b0768184028257f913843 (patch)
treec0e782730e267b35f0d15668d0689e6c322fe246 /lib/Target/ARM/ARMCommon.cpp
parentbd92d81d22c90433e968077aa0a4157d631d6365 (diff)
ARM backend contribution from Apple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMCommon.cpp')
-rw-r--r--lib/Target/ARM/ARMCommon.cpp84
1 files changed, 0 insertions, 84 deletions
diff --git a/lib/Target/ARM/ARMCommon.cpp b/lib/Target/ARM/ARMCommon.cpp
deleted file mode 100644
index fd3757303b..0000000000
--- a/lib/Target/ARM/ARMCommon.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-//===-- ARMCommon.cpp - Define support functions for ARM --------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file was developed by the "Instituto Nokia de Tecnologia" and
-// is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//
-//
-//===----------------------------------------------------------------------===//
-#include "ARMCommon.h"
-
-static inline unsigned rotateL(unsigned x, unsigned n){
- return ((x << n) | (x >> (32 - n)));
-}
-
-static inline unsigned rotateR(unsigned x, unsigned n){
- return ((x >> n) | (x << (32 - n)));
-}
-
-// finds the end position of largest sequence of zeros in binary representation
-// of 'immediate'.
-static int findLargestZeroSequence(unsigned immediate){
- int max_zero_pos = 0;
- int max_zero_length = 0;
- int zero_pos;
- int zero_length;
- int pos = 0;
- int end_pos;
-
- while ((immediate & 0x3) == 0) {
- immediate = rotateR(immediate, 2);
- pos+=2;
- }
- end_pos = pos+32;
-
- while (pos<end_pos){
- while (((immediate & 0x3) != 0)&&(pos<end_pos)) {
- immediate = rotateR(immediate, 2);
- pos+=2;
- }
- zero_pos = pos;
- while (((immediate & 0x3) == 0)&&(pos<end_pos)) {
- immediate = rotateR(immediate, 2);
- pos+=2;
- }
- zero_length = pos - zero_pos;
- if (zero_length > max_zero_length){
- max_zero_length = zero_length;
- max_zero_pos = zero_pos % 32;
- }
-
- }
-
- return (max_zero_pos + max_zero_length) % 32;
-}
-
-std::vector<unsigned> splitImmediate(unsigned immediate){
- std::vector<unsigned> immediatePieces;
-
- if (immediate == 0){
- immediatePieces.push_back(0);
- } else {
- int start_pos = findLargestZeroSequence(immediate);
- unsigned immediate_tmp = rotateR(immediate, start_pos);
- int pos = 0;
- while (pos < 32){
- while(((immediate_tmp&0x3) == 0)&&(pos<32)){
- immediate_tmp = rotateR(immediate_tmp,2);
- pos+=2;
- }
- if (pos < 32){
- immediatePieces.push_back(rotateL(immediate_tmp&0xFF,
- (start_pos + pos) % 32 ));
- immediate_tmp = rotateR(immediate_tmp,8);
- pos+=8;
- }
- }
- }
- return immediatePieces;
-}