OpenASIP  2.0
Public Member Functions | List of all members
ImmInfoValue Class Reference

#include <ImmInfo.hh>

Inheritance diagram for ImmInfoValue:
Inheritance graph
Collaboration diagram for ImmInfoValue:
Collaboration graph

Public Member Functions

 ImmInfoValue ()
 
 ImmInfoValue (int immediateWidth, bool signExtending)
 
int64_t lowerBound () const
 
int64_t upperBound () const
 
int width () const
 
bool signExtending () const
 

Detailed Description

The stored immediate result in ImmInfo.

Definition at line 58 of file ImmInfo.hh.

Constructor & Destructor Documentation

◆ ImmInfoValue() [1/2]

ImmInfoValue::ImmInfoValue ( )

Default constructor. Set as zero width and as zero extending.

Definition at line 164 of file ImmInfo.cc.

165  : pair(0, false) {
166 }

◆ ImmInfoValue() [2/2]

ImmInfoValue::ImmInfoValue ( int  immediateWidth,
bool  signExtending 
)

Constructor with the specified immediate width and sign-extension.

Definition at line 172 of file ImmInfo.cc.

173  : pair(immediateWidth, signExtending) {
174 }

Member Function Documentation

◆ lowerBound()

int64_t ImmInfoValue::lowerBound ( ) const

Return largest inclusive value that can be expressed as immediate.

Definition at line 181 of file ImmInfo.cc.

181  {
182  if (second) { // is sign extending?
183  return -(1ll << (first-1));
184  } else { // is then zero extending.
185  return 0;
186  }
187 }

◆ signExtending()

bool ImmInfoValue::signExtending ( ) const
inline

Return true if the immediate is sign extending.

Definition at line 75 of file ImmInfo.hh.

75 { return second; }

Referenced by ImmInfo::canTakeImmediate().

◆ upperBound()

int64_t ImmInfoValue::upperBound ( ) const

Return smallest inclusive value that can be expressed as immediate.

Definition at line 193 of file ImmInfo.cc.

193  {
194  if (second) { // is sign extending?
195  return (1ll << (first-1))-1;
196  } else { // is then zero extending.
197  return (1ll << (first));
198  }
199 }

◆ width()

int ImmInfoValue::width ( ) const
inline

Returns bit width of the immediate.

Definition at line 71 of file ImmInfo.hh.

71 { return first; }

Referenced by ImmInfo::canTakeImmediate(), and ImmInfo::canTakeImmediateByWidth().


The documentation for this class was generated from the following files:
ImmInfoValue::signExtending
bool signExtending() const
Definition: ImmInfo.hh:75